summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/ChatViewController.m2
-rw-r--r--Juick/ViewControllers/LoginViewController.h1
-rw-r--r--Juick/ViewControllers/LoginViewController.m12
3 files changed, 8 insertions, 7 deletions
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m
index 54614b7..a76cc00 100644
--- a/Juick/ViewControllers/ChatViewController.m
+++ b/Juick/ViewControllers/ChatViewController.m
@@ -26,7 +26,7 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
self.tableView.allowsSelection = NO;
- self.me = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"];
+ self.me = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"];
[self reloadChat];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
self.refreshControl = [UIRefreshControl new];
diff --git a/Juick/ViewControllers/LoginViewController.h b/Juick/ViewControllers/LoginViewController.h
index 18ca4a4..12707f5 100644
--- a/Juick/ViewControllers/LoginViewController.h
+++ b/Juick/ViewControllers/LoginViewController.h
@@ -7,7 +7,6 @@
//
#import <UIKit/UIKit.h>
-#import "PDKeychainBindingsController.h"
@interface LoginViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *usernameField;
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