diff --git a/Signal.xcworkspace/xcshareddata/Signal.xccheckout b/Signal.xcworkspace/xcshareddata/Signal.xccheckout deleted file mode 100644 index 711f5d132..000000000 --- a/Signal.xcworkspace/xcshareddata/Signal.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - DA00CCAC-808E-4CDA-A72F-CB8431C155C0 - IDESourceControlProjectName - Signal - IDESourceControlProjectOriginsDictionary - - 5D79A077E31B3FE97A3C6613CBFFDD71C314D14C - https://github.com/WhisperSystems/Signal-iOS - - IDESourceControlProjectPath - Signal.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - 5D79A077E31B3FE97A3C6613CBFFDD71C314D14C - .. - - IDESourceControlProjectURL - https://github.com/WhisperSystems/Signal-iOS - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - 5D79A077E31B3FE97A3C6613CBFFDD71C314D14C - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 5D79A077E31B3FE97A3C6613CBFFDD71C314D14C - IDESourceControlWCCName - Signal-iOS - - - - diff --git a/Signal/src/Storyboard/Storyboard.storyboard b/Signal/src/Storyboard/Storyboard.storyboard index 9a58e3fc6..510e34ec4 100755 --- a/Signal/src/Storyboard/Storyboard.storyboard +++ b/Signal/src/Storyboard/Storyboard.storyboard @@ -35,6 +35,9 @@ + + + @@ -1184,6 +1187,10 @@ Lorem ipsum : Quick explanation of Fingerprints + + + + @@ -1316,11 +1323,47 @@ Lorem ipsum : Quick explanation of Fingerprints + + + + + + @@ -1329,9 +1372,12 @@ Lorem ipsum : Quick explanation of Fingerprints + + + @@ -1349,17 +1395,23 @@ Lorem ipsum : Quick explanation of Fingerprints + + + + + + @@ -1379,17 +1431,23 @@ Lorem ipsum : Quick explanation of Fingerprints + + + + + + @@ -1406,6 +1464,10 @@ Lorem ipsum : Quick explanation of Fingerprints + + + + @@ -1470,7 +1532,7 @@ Lorem ipsum : Quick explanation of Fingerprints - + @@ -2875,7 +2937,8 @@ Licensed under the GPLv3 - + + @@ -2929,6 +2992,9 @@ Licensed under the GPLv3 + + + diff --git a/Signal/src/view controllers/CodeVerificationViewController.h b/Signal/src/view controllers/CodeVerificationViewController.h index 28cf313ba..82704d843 100644 --- a/Signal/src/view controllers/CodeVerificationViewController.h +++ b/Signal/src/view controllers/CodeVerificationViewController.h @@ -5,15 +5,33 @@ // Created by Dylan Bourgeois on 13/11/14. // Copyright (c) 2014 Open Whisper Systems. All rights reserved. // +// This class allows the user to send the server their verification code and request new codes to be sent via SMS or voice. +// #import @interface CodeVerificationViewController : UIViewController +// Where the user enters the verification code they wish to document @property(nonatomic, strong) IBOutlet UITextField* challengeTextField; +// User action buttons @property(nonatomic, strong) IBOutlet UIButton* challengeButton; +@property(nonatomic, strong) IBOutlet UIButton* sendCodeViaSMSAgainButton; +@property(nonatomic, strong) IBOutlet UIButton* sendCodeViaVoiceButton; +// Displays phone number entered in previous step. There is a UI option (segue) which allows the user to go back and edit this. +@property (nonatomic, strong) IBOutlet UILabel* phoneNumberEntered; + + +// User verifies code - (IBAction)verifyChallengeAction:(id)sender; +// User requests new code via SMS +- (IBAction)sendCodeSMSAction:(id)sender; +// User requests new code via voice phone call +- (IBAction)sendCodeVoiceAction:(id)sender; + +// This ensures the user doesn't keep creating server requests before the server has responded for all buttons that result in server requests +-(void)enableServerActions:(BOOL)enabled; @end diff --git a/Signal/src/view controllers/CodeVerificationViewController.m b/Signal/src/view controllers/CodeVerificationViewController.m index 4341aebda..24324f441 100644 --- a/Signal/src/view controllers/CodeVerificationViewController.m +++ b/Signal/src/view controllers/CodeVerificationViewController.m @@ -31,7 +31,8 @@ -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - [_challengeButton setEnabled:YES]; + [self enableServerActions:YES]; + [_phoneNumberEntered setText:[SignalKeyingStorage.localNumber toE164]]; } - (void)didReceiveMemoryWarning { @@ -41,7 +42,7 @@ - (IBAction)verifyChallengeAction:(id)sender { - [_challengeButton setEnabled:NO]; + [self enableServerActions:NO]; [_challengeTextField resignFirstResponder]; [self registerWithSuccess:^{ @@ -49,7 +50,7 @@ [self.navigationController dismissViewControllerAnimated:YES completion:nil]; } failure:^(NSError *error) { [self showAlertForError:error]; - [_challengeButton setEnabled:YES]; + [self enableServerActions:YES]; }]; } @@ -124,6 +125,61 @@ return error; } +#pragma mark - Send codes again +- (IBAction)sendCodeSMSAction:(id)sender { + + [self enableServerActions:NO]; + + + [[RPServerRequestsManager sharedInstance]performRequest:[RPAPICall requestVerificationCode] success:^(NSURLSessionDataTask *task, id responseObject) { + + [self enableServerActions:YES]; + } failure:^(NSURLSessionDataTask *task, NSError *error) { + + DDLogError(@"Registration failed with information %@", error.description); + + UIAlertView *registrationErrorAV = [[UIAlertView alloc]initWithTitle:REGISTER_ERROR_ALERT_VIEW_TITLE + message:REGISTER_ERROR_ALERT_VIEW_BODY + delegate:nil + cancelButtonTitle:REGISTER_ERROR_ALERT_VIEW_DISMISS + otherButtonTitles:nil, nil]; + + [registrationErrorAV show]; + + [self enableServerActions:YES]; + }]; +} + +- (IBAction)sendCodeVoiceAction:(id)sender { + + [self enableServerActions:NO]; + + + [[RPServerRequestsManager sharedInstance]performRequest:[RPAPICall requestVerificationCodeWithVoice] success:^(NSURLSessionDataTask *task, id responseObject) { + + [self enableServerActions:YES]; + } failure:^(NSURLSessionDataTask *task, NSError *error) { + + DDLogError(@"Registration failed with information %@", error.description); + + UIAlertView *registrationErrorAV = [[UIAlertView alloc]initWithTitle:REGISTER_ERROR_ALERT_VIEW_TITLE + message:REGISTER_ERROR_ALERT_VIEW_BODY + delegate:nil + cancelButtonTitle:REGISTER_ERROR_ALERT_VIEW_DISMISS + otherButtonTitles:nil, nil]; + + [registrationErrorAV show]; + + [self enableServerActions:YES]; + }]; +} + +-(void)enableServerActions:(BOOL)enabled { + [_challengeButton setEnabled:enabled]; + [_sendCodeViaSMSAgainButton setEnabled:enabled]; + [_sendCodeViaVoiceButton setEnabled:enabled]; +} + #pragma mark - Keyboard notifications diff --git a/Signal/src/view controllers/SignalTabBarController.m b/Signal/src/view controllers/SignalTabBarController.m index d8fe5e343..1ab85f8a4 100644 --- a/Signal/src/view controllers/SignalTabBarController.m +++ b/Signal/src/view controllers/SignalTabBarController.m @@ -24,10 +24,6 @@ - (void)viewDidLoad { [super viewDidLoad]; - if (![TSAccountManager isRegistered]){ - [self performSegueWithIdentifier:@"showSignupFlow" sender:self]; - } - self.dbConnection = [TSStorageManager sharedManager].newDatabaseConnection; [[NSNotificationCenter defaultCenter] addObserver:self @@ -36,6 +32,12 @@ object:nil]; } +- (void)viewDidAppear:(BOOL)animated{ + if (![TSAccountManager isRegistered]){ + [self performSegueWithIdentifier:@"showSignupFlow" sender:self]; + } +} + - (void)yapDatabaseModified:(NSNotification *)notification { __block NSUInteger numberOfItems; [self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {