OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." |
| 7 #endif |
| 8 |
| 9 #import "remoting/client/ios/domain/user_info.h" |
| 10 |
| 11 @implementation UserInfo |
| 12 |
| 13 @synthesize userId = _userId; |
| 14 @synthesize userFullName = _userFullName; |
| 15 @synthesize userEmail = _userEmail; |
| 16 |
| 17 // Parse jsonData into Host list. |
| 18 + (UserInfo*)parseListFromJSON:(NSMutableData*)data { |
| 19 NSError* error; |
| 20 |
| 21 NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data |
| 22 options:kNilOptions |
| 23 error:&error]; |
| 24 |
| 25 UserInfo* user = [[UserInfo alloc] init]; |
| 26 user.userId = [json objectForKey:@"userId"]; |
| 27 user.userFullName = [json objectForKey:@"userFullName"]; |
| 28 user.userEmail = [json objectForKey:@"userEmail"]; |
| 29 |
| 30 return user; |
| 31 } |
| 32 |
| 33 - (NSComparisonResult)compare:(UserInfo*)user { |
| 34 return [self.userId compare:user.userId]; |
| 35 } |
| 36 |
| 37 @end |
OLD | NEW |