From c22688421066a358b1980f4399f421000febdaac Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 25 Dec 2018 10:37:21 +0300 Subject: PDKeychainBindingsController -> SAMKeychain --- Juick/ViewControllers/LoginViewController.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Juick/ViewControllers/LoginViewController.m') diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index 917d563..c0b1a0d 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -28,8 +28,8 @@ target:self action:@selector(cancelSignIn)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(doneSignIn)]; - self.usernameField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"]; - self.passwordField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]; + self.usernameField.text = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; + self.passwordField.text = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"];; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; } @@ -58,7 +58,9 @@ - (void) doneSignIn { [User checkIsValid:^(BOOL success) { if (success) { - [[APIClient sharedClient].manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; + NSString *username = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; + NSString *password = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"]; + [[APIClient sharedClient].manager.requestSerializer setAuthorizationHeaderFieldWithUsername:username password:password]; AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; [app registerForRemoteNotifications]; @@ -77,13 +79,13 @@ } - (IBAction)passwordChanged:(id)sender { if ([self.passwordField.text isKindOfClass:[NSString class]]) { - [[PDKeychainBindings sharedKeychainBindings] setObject:self.passwordField.text forKey:@"com.juick.password"]; + [SAMKeychain setPassword:self.passwordField.text forService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"]; } } - (IBAction)usernameChanged:(id)sender { if ([self.usernameField.text isKindOfClass:[NSString class]]) { - [[PDKeychainBindings sharedKeychainBindings] setObject:self.usernameField.text forKey:@"com.juick.username"]; + [SAMKeychain setPassword:self.usernameField.text forService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; } } @end -- cgit v1.2.3