Add re-registration UI.

pull/1/head
Matthew Chen 7 years ago
parent bc6a4ea8d8
commit 7f346326f6

@ -18,7 +18,10 @@ extern NSString *const kNSNotificationName_LocalNumberDidChange;
@interface TSAccountManager : NSObject @interface TSAccountManager : NSObject
@property (nonatomic, nullable, readonly) NSString *phoneNumberAwaitingVerification; // This property is exposed for testing purposes only.
#ifdef DEBUG
@property (nonatomic, nullable) NSString *phoneNumberAwaitingVerification;
#endif
#pragma mark - Initializers #pragma mark - Initializers
@ -116,8 +119,12 @@ extern NSString *const kNSNotificationName_LocalNumberDidChange;
#pragma mark - De-Registration #pragma mark - De-Registration
// De-registration reflects whether or not the client has received // De-registration reflects whether or not the "last known contact"
// a 403 from the service. // with the service was:
//
// * A 403 from the service, indicating de-registration.
// * A successful auth'd request _or_ websocket connection indicating
// valid registration.
- (BOOL)isDeregistered; - (BOOL)isDeregistered;
- (void)setIsDeregistered:(BOOL)isDeregistered; - (void)setIsDeregistered:(BOOL)isDeregistered;

@ -40,7 +40,10 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
@property (nonatomic, readonly) BOOL isRegistered; @property (nonatomic, readonly) BOOL isRegistered;
// This property is exposed publicly for testing purposes only.
#ifndef DEBUG
@property (nonatomic, nullable) NSString *phoneNumberAwaitingVerification; @property (nonatomic, nullable) NSString *phoneNumberAwaitingVerification;
#endif
@property (nonatomic, nullable) NSString *cachedLocalNumber; @property (nonatomic, nullable) NSString *cachedLocalNumber;
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection; @property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
@ -73,10 +76,6 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
selector:@selector(yapDatabaseModifiedExternally:) selector:@selector(yapDatabaseModifiedExternally:)
name:YapDatabaseModifiedExternallyNotification name:YapDatabaseModifiedExternallyNotification
object:nil]; object:nil];
self.phoneNumberAwaitingVerification =
[self.dbConnection stringForKey:TSAccountManager_ReregisteringPhoneNumberKey
inCollection:TSAccountManager_UserAccountCollection];
} }
return self; return self;
@ -189,6 +188,8 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
inCollection:TSAccountManager_UserAccountCollection]; inCollection:TSAccountManager_UserAccountCollection];
self.phoneNumberAwaitingVerification = nil; self.phoneNumberAwaitingVerification = nil;
self.cachedLocalNumber = localNumber;
} }
} }

@ -88,7 +88,9 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
TSNetworkManagerSuccess success = ^(NSURLSessionDataTask *task, _Nullable id responseObject) { TSNetworkManagerSuccess success = ^(NSURLSessionDataTask *task, _Nullable id responseObject) {
DDLogInfo(@"%@ request succeeded : %@", self.logTag, request); DDLogInfo(@"%@ request succeeded : %@", self.logTag, request);
[TSAccountManager.sharedInstance setIsDeregistered:NO]; if (request.shouldHaveAuthorizationHeaders) {
[TSAccountManager.sharedInstance setIsDeregistered:NO];
}
successBlock(task, responseObject); successBlock(task, responseObject);
}; };

Loading…
Cancel
Save