|
14 | 14 |
|
15 | 15 | #import "GoogleSignIn/Tests/Unit/GIDGoogleUser+Testing.h" |
16 | 16 |
|
| 17 | +#import "GoogleSignIn/Sources/GIDGoogleUser_Private.h" |
| 18 | + |
| 19 | +#import "GoogleSignIn/Sources/GIDAuthentication.h" |
17 | 20 | #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDConfiguration.h" |
18 | 21 | #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDToken.h" |
19 | 22 |
|
20 | 23 | #import "GoogleSignIn/Tests/Unit/GIDConfiguration+Testing.h" |
21 | 24 | #import "GoogleSignIn/Tests/Unit/GIDProfileData+Testing.h" |
22 | 25 |
|
| 26 | +// Key constants used for encode and decode. |
| 27 | +static NSString *const kProfileDataKey = @"profileData"; |
| 28 | +static NSString *const kAuthentication = @"authentication"; |
| 29 | + |
23 | 30 | @implementation GIDGoogleUser (Testing) |
24 | 31 |
|
25 | 32 | - (BOOL)isEqual:(id)object { |
@@ -48,3 +55,27 @@ - (NSUInteger)hash { |
48 | 55 | } |
49 | 56 |
|
50 | 57 | @end |
| 58 | + |
| 59 | +@implementation GIDGoogleUserOldFormat { |
| 60 | + GIDAuthentication *_authentication; |
| 61 | + GIDProfileData *_profile; |
| 62 | +} |
| 63 | + |
| 64 | +- (instancetype)initOldGIDGoogleUserWithAuthState:(OIDAuthState *)authState |
| 65 | + profileData:(GIDProfileData *)profileData { |
| 66 | + self = [super initWithAuthState:authState profileData:profileData]; |
| 67 | + if (self) { |
| 68 | + _authentication = [[GIDAuthentication alloc] initWithAuthState:authState]; |
| 69 | + _profile = profileData; |
| 70 | + } |
| 71 | + return self; |
| 72 | +} |
| 73 | + |
| 74 | +#pragma mark - NSSecureCoding |
| 75 | + |
| 76 | +- (void)encodeWithCoder:(NSCoder *)encoder { |
| 77 | + [encoder encodeObject:_profile forKey:kProfileDataKey]; |
| 78 | + [encoder encodeObject:_authentication forKey:kAuthentication]; |
| 79 | +} |
| 80 | + |
| 81 | +@end |
0 commit comments