diff options
author | Vitaly Takmazov | 2020-06-24 22:49:00 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2020-12-10 18:59:38 +0300 |
commit | d7a93cca8289ad997af9ad2c1540877d5bd50879 (patch) | |
tree | 1bb732f35e2d0c8801debf9df374ade0ea24cdbc /Juick/ViewControllers/LoginViewController.m | |
parent | aad20a5cb0a7996d1e83f64fdd973fb7ca290529 (diff) |
WIPsignin
Diffstat (limited to 'Juick/ViewControllers/LoginViewController.m')
-rw-r--r-- | Juick/ViewControllers/LoginViewController.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index a0e9b97..de83fa4 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -28,6 +28,7 @@ NSString * const UserChangedNotificationName = @"UserSignedIn"; target:self action:@selector(doneSignIn)]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; + [self.authorizationField.button addTarget:self action:@selector(signInWithApple) forControlEvents:UIControlEventTouchUpInside]; } - (void)viewWillAppear:(BOOL)animated { @@ -64,6 +65,7 @@ NSString * const UserChangedNotificationName = @"UserSignedIn"; - (void)refreshState { if ([AppDelegate shared].api.currentUser) { self.title = @"Profile"; + [self.authorizationField setHidden:YES]; [self.usernameField setHidden:YES]; [self.passwordField setHidden:YES]; [self.currentUser setHidden:NO]; @@ -82,6 +84,7 @@ NSString * const UserChangedNotificationName = @"UserSignedIn"; } else { self.title = @"Sign in"; self.imageView.image = [UIImage imageNamed:@"Splash"]; + [self.authorizationField setHidden:NO]; [self.usernameField setHidden:NO]; [self.passwordField setHidden:NO]; [self.currentUser setHidden:YES]; @@ -96,4 +99,24 @@ NSString * const UserChangedNotificationName = @"UserSignedIn"; [[NSNotificationCenter defaultCenter] postNotificationName:UserChangedNotificationName object:nil]; }]; } + +- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization { + NSLog(@""); +} + +- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error { + NSLog(@""); +} + +-(void) signInWithApple { + ASAuthorizationAppleIDProvider *appleIDProvider = [ASAuthorizationAppleIDProvider new]; + ASAuthorizationAppleIDRequest *request = [appleIDProvider createRequest]; + request.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail]; + + ASAuthorizationController *authorizationController = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]]; + authorizationController.delegate = self; + authorizationController.presentationContextProvider = self; + [authorizationController performRequests]; +} + @end |