diff options
author | 2017-09-21 16:35:27 -0700 | |
---|---|---|
committer | 2017-09-21 16:35:27 -0700 | |
commit | f333bd5c188d553057c2dcc099b5da42edd1d495 (patch) | |
tree | 7f2925d9353c2fc6d267843500aac0077e7b176d /Example/Auth/Sample | |
parent | 93bcf42a0bf3254f57f948fcdf6411b9f4184f1e (diff) |
User meta data (#292)
* Add user metadata
* Small improvements
* Addresses comments
* Fixes broken tests
Adds FIRUserMetadata to unbrella file.
Diffstat (limited to 'Example/Auth/Sample')
-rw-r--r-- | Example/Auth/Sample/UserInfoViewController.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Example/Auth/Sample/UserInfoViewController.m b/Example/Auth/Sample/UserInfoViewController.m index aa5b7fe..e8e15cb 100644 --- a/Example/Auth/Sample/UserInfoViewController.m +++ b/Example/Auth/Sample/UserInfoViewController.m @@ -18,6 +18,7 @@ #import "FIRUser.h" #import "FIRUserInfo.h" +#import "FIRUserMetadata.h" #import "StaticContentTableViewManager.h" /** @fn stringWithBool @@ -29,6 +30,20 @@ static NSString *stringWithBool(BOOL boolValue) { return boolValue ? @"YES" : @"NO"; } +/** @fn stringFromDate + @brief Converts a NSDate va to a string for display. + @param date The NSDate instance. + @return The string form of the NSDate instance. + */ +static NSString *stringFromDate(NSDate *date) { + if (!date) { + return @"nil"; + } + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; + return [dateFormatter stringFromDate:date]; +} + @implementation UserInfoViewController { FIRUser *_user; } @@ -50,6 +65,10 @@ static NSString *stringWithBool(BOOL boolValue) { NSMutableArray<StaticContentTableViewSection *> *sections = [@[ [StaticContentTableViewSection sectionWithTitle:@"User" cells:@[ [StaticContentTableViewCell cellWithTitle:@"anonymous" value:stringWithBool(_user.anonymous)], + [StaticContentTableViewCell cellWithTitle:@"Creation date" + value:stringFromDate(_user.metadata.creationDate)], + [StaticContentTableViewCell cellWithTitle:@"Last sign in date" + value:stringFromDate(_user.metadata.lastSignInDate)], [StaticContentTableViewCell cellWithTitle:@"emailVerified" value:stringWithBool(_user.emailVerified)], [StaticContentTableViewCell cellWithTitle:@"refreshToken" value:_user.refreshToken], |