2015-09-30 20:34:52 -07:00
|
|
|
//
|
|
|
|
|
// TemporaryApp.m
|
|
|
|
|
// Moonlight
|
|
|
|
|
//
|
|
|
|
|
// Created by Cameron Gutman on 9/30/15.
|
|
|
|
|
// Copyright © 2015 Moonlight Stream. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "TemporaryApp.h"
|
|
|
|
|
|
|
|
|
|
@implementation TemporaryApp
|
|
|
|
|
|
2015-12-02 00:25:38 -08:00
|
|
|
- (id) initFromApp:(App*)app withTempHost:(TemporaryHost*)tempHost {
|
|
|
|
|
self = [self init];
|
|
|
|
|
|
|
|
|
|
self.id = app.id;
|
|
|
|
|
self.name = app.name;
|
2018-06-02 12:32:12 -07:00
|
|
|
self.hdrSupported = app.hdrSupported;
|
2015-12-02 00:25:38 -08:00
|
|
|
self.host = tempHost;
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 11:29:17 -05:00
|
|
|
- (void) propagateChangesToParent:(App*)parent withHost:(Host*)host {
|
|
|
|
|
parent.id = self.id;
|
|
|
|
|
parent.name = self.name;
|
2018-06-02 12:32:12 -07:00
|
|
|
parent.hdrSupported = self.hdrSupported;
|
2016-01-21 11:29:17 -05:00
|
|
|
parent.host = host;
|
2015-12-02 00:25:38 -08:00
|
|
|
}
|
|
|
|
|
|
2015-12-01 20:36:08 -08:00
|
|
|
- (NSComparisonResult)compareName:(TemporaryApp *)other {
|
|
|
|
|
return [self.name caseInsensitiveCompare:other.name];
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 13:34:34 -05:00
|
|
|
- (NSUInteger)hash {
|
2016-01-21 15:01:15 -05:00
|
|
|
return [self.host.uuid hash] * 31 + [self.id intValue];
|
2016-01-21 13:34:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL)isEqual:(id)object {
|
|
|
|
|
if (self == object) {
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-18 17:05:36 -07:00
|
|
|
if (![object isKindOfClass:[self class]]) {
|
2016-01-21 13:34:34 -05:00
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 15:01:15 -05:00
|
|
|
return [self.host.uuid isEqualToString:((App*)object).host.uuid] &&
|
|
|
|
|
[self.id isEqualToString:((App*)object).id];
|
2016-01-21 13:34:34 -05:00
|
|
|
}
|
|
|
|
|
|
2015-09-30 20:34:52 -07:00
|
|
|
@end
|