| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #import "remoting/ios/domain/host_info.h" | 9 #import "remoting/ios/domain/host_info.h" |
| 10 | 10 |
| 11 @implementation HostInfo | 11 @implementation HostInfo |
| 12 | 12 |
| 13 @synthesize createdTime = _createdTime; | 13 @synthesize createdTime = _createdTime; |
| 14 @synthesize hostId = _hostId; | 14 @synthesize hostId = _hostId; |
| 15 @synthesize hostName = _hostName; | 15 @synthesize hostName = _hostName; |
| 16 @synthesize hostOs = _hostOs; |
| 17 @synthesize hostOsVersion = _hostOsVersion; |
| 16 @synthesize hostVersion = _hostVersion; | 18 @synthesize hostVersion = _hostVersion; |
| 17 @synthesize jabberId = _jabberId; | 19 @synthesize jabberId = _jabberId; |
| 18 @synthesize kind = _kind; | 20 @synthesize kind = _kind; |
| 19 @synthesize publicKey = _publicKey; | 21 @synthesize publicKey = _publicKey; |
| 20 @synthesize status = _status; | 22 @synthesize status = _status; |
| 21 @synthesize updatedTime = _updatedTime; | 23 @synthesize updatedTime = _updatedTime; |
| 22 @synthesize isOnline = _isOnline; | 24 @synthesize isOnline = _isOnline; |
| 23 | 25 |
| 24 - (bool)isOnline { | 26 - (bool)isOnline { |
| 25 _isOnline = (self.status && [self.status isEqualToString:@"ONLINE"]); | 27 _isOnline = (self.status && [self.status isEqualToString:@"ONLINE"]); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 NSUInteger idx = 0; | 41 NSUInteger idx = 0; |
| 40 NSDictionary* svr; | 42 NSDictionary* svr; |
| 41 NSUInteger count = [availableHosts count]; | 43 NSUInteger count = [availableHosts count]; |
| 42 | 44 |
| 43 while (idx < count) { | 45 while (idx < count) { |
| 44 svr = [availableHosts objectAtIndex:idx++]; | 46 svr = [availableHosts objectAtIndex:idx++]; |
| 45 HostInfo* host = [[HostInfo alloc] init]; | 47 HostInfo* host = [[HostInfo alloc] init]; |
| 46 host.createdTime = [svr objectForKey:@"createdTime"]; | 48 host.createdTime = [svr objectForKey:@"createdTime"]; |
| 47 host.hostId = [svr objectForKey:@"hostId"]; | 49 host.hostId = [svr objectForKey:@"hostId"]; |
| 48 host.hostName = [svr objectForKey:@"hostName"]; | 50 host.hostName = [svr objectForKey:@"hostName"]; |
| 51 host.hostOs = [svr objectForKey:@"hostOs"]; |
| 49 host.hostVersion = [svr objectForKey:@"hostVersion"]; | 52 host.hostVersion = [svr objectForKey:@"hostVersion"]; |
| 53 host.hostOsVersion = [svr objectForKey:@"hostOsVersion"]; |
| 50 host.jabberId = [svr objectForKey:@"jabberId"]; | 54 host.jabberId = [svr objectForKey:@"jabberId"]; |
| 51 host.kind = [svr objectForKey:@"kind"]; | 55 host.kind = [svr objectForKey:@"kind"]; |
| 52 host.publicKey = [svr objectForKey:@"publicKey"]; | 56 host.publicKey = [svr objectForKey:@"publicKey"]; |
| 53 host.status = [svr objectForKey:@"status"]; | 57 host.status = [svr objectForKey:@"status"]; |
| 54 | 58 |
| 55 NSString* ISO8601DateString = [svr objectForKey:@"updatedTime"]; | 59 NSString* ISO8601DateString = [svr objectForKey:@"updatedTime"]; |
| 56 if (ISO8601DateString != nil) { | 60 if (ISO8601DateString != nil) { |
| 57 NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; | 61 NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; |
| 58 [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSz"]; | 62 [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSz"]; |
| 59 host.updatedTime = [dateFormatter dateFromString:ISO8601DateString]; | 63 host.updatedTime = [dateFormatter dateFromString:ISO8601DateString]; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 } | 77 } |
| 74 } | 78 } |
| 75 | 79 |
| 76 - (NSString*)description { | 80 - (NSString*)description { |
| 77 return | 81 return |
| 78 [NSString stringWithFormat:@"HostInfo: name=%@ status=%@ updatedTime= %@", | 82 [NSString stringWithFormat:@"HostInfo: name=%@ status=%@ updatedTime= %@", |
| 79 _hostName, _status, _updatedTime]; | 83 _hostName, _status, _updatedTime]; |
| 80 } | 84 } |
| 81 | 85 |
| 82 @end | 86 @end |
| OLD | NEW |