From a228ce07cc5413a6ba164c12042ab1e4028aa5b3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Dec 2017 01:40:51 +0300 Subject: comment --- Juick/ViewControllers/LoginViewController.m | 35 +++++++++-------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'Juick/ViewControllers/LoginViewController.m') diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index 640cd10..a65d180 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -16,10 +16,6 @@ - (void) awakeFromNib { [super awakeFromNib]; - [self initializeForm]; -} - -- (void)initializeForm { self.title = @"Sign in"; [self.view setBackgroundColor:[ColorScheme mainBackground]]; @@ -27,22 +23,8 @@ target:self action:@selector(cancelSignIn)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(doneSignIn)]; - XLFormDescriptor *form = [XLFormDescriptor formDescriptorWithTitle:@"Sign in"]; - form.rowNavigationOptions = XLFormRowNavigationOptionEnabled; - XLFormSectionDescriptor *section = [XLFormSectionDescriptor formSection]; - [form addFormSection:section]; - XLFormRowDescriptor * usernameRow = [XLFormRowDescriptor - formRowDescriptorWithTag:@"com.juick.username" - rowType:XLFormRowDescriptorTypeText title:@"Username"]; - usernameRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"]; - [section addFormRow:usernameRow]; - XLFormRowDescriptor * passwordRow = [XLFormRowDescriptor - formRowDescriptorWithTag:@"com.juick.password" - rowType:XLFormRowDescriptorTypePassword title:@"Password"]; - passwordRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]; - [section addFormRow:passwordRow]; - - self.form = form; + self.usernameField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"]; + self.passwordField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]; } @@ -76,12 +58,15 @@ }]; } - --(void) formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue { - [super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue]; - if ([newValue isKindOfClass:[NSString class]]) { - [[PDKeychainBindings sharedKeychainBindings] setObject:newValue forKey:formRow.tag]; +- (IBAction)passwordChanged:(id)sender { + if ([self.passwordField.text isKindOfClass:[NSString class]]) { + [[PDKeychainBindings sharedKeychainBindings] setObject:self.passwordField.text forKey:@"com.juick.password"]; } } +- (IBAction)usernameChanged:(id)sender { + if ([self.usernameField.text isKindOfClass:[NSString class]]) { + [[PDKeychainBindings sharedKeychainBindings] setObject:self.usernameField.text forKey:@"com.juick.username"]; + } +} @end -- cgit v1.2.3