Allows unregistering of RedPhone.

pull/1/head
Christine Corbett 11 years ago committed by Frederic Jacobs
parent 349d84c875
commit 478110dc86

@ -5318,8 +5318,7 @@ A0 09 9A FF A8 8A 09 99</string>
<exclude reference="ZIm-Uq-bM8"/> <exclude reference="ZIm-Uq-bM8"/>
</mask> </mask>
</variation> </variation>
<variation key="heightClass=regular-widthClass=compact" misplaced="YES"> <variation key="heightClass=regular-widthClass=compact">
<rect key="frame" x="0.0" y="0.0" width="400" height="100"/>
<mask key="subviews"> <mask key="subviews">
<include reference="gbm-B5-gCc"/> <include reference="gbm-B5-gCc"/>
<include reference="Ul8-NY-i4c"/> <include reference="Ul8-NY-i4c"/>
@ -5373,9 +5372,6 @@ A0 09 9A FF A8 8A 09 99</string>
</tableViewCellContentView> </tableViewCellContentView>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
<rect key="frame" x="0.0" y="108" width="400" height="628"/>
</variation>
<connections> <connections>
<outlet property="dataSource" destination="bDi-2Q-XOC" id="VPO-ms-bH1"/> <outlet property="dataSource" destination="bDi-2Q-XOC" id="VPO-ms-bH1"/>
<outlet property="delegate" destination="bDi-2Q-XOC" id="rKM-jX-C39"/> <outlet property="delegate" destination="bDi-2Q-XOC" id="rKM-jX-C39"/>
@ -5494,7 +5490,7 @@ A0 09 9A FF A8 8A 09 99</string>
<image name="speaker-inactive" width="80" height="80"/> <image name="speaker-inactive" width="80" height="80"/>
</resources> </resources>
<inferredMetricsTieBreakers> <inferredMetricsTieBreakers>
<segue reference="DR8-fx-0PD"/> <segue reference="ZcV-Ck-baL"/>
<segue reference="xo7-5J-BJb"/> <segue reference="xo7-5J-BJb"/>
<segue reference="gZ1-lh-srF"/> <segue reference="gZ1-lh-srF"/>
</inferredMetricsTieBreakers> </inferredMetricsTieBreakers>

@ -55,6 +55,8 @@
* The pushNotification and userNotificationFutureSource are accessed by the App Delegate after requested permissions. * The pushNotification and userNotificationFutureSource are accessed by the App Delegate after requested permissions.
*/ */
-(TOCFuture*)registerPushNotificationFuture;
- (void)registrationForPushWithSuccess:(void (^)(NSData* pushToken))success failure:(void (^)())failure;
@property TOCFutureSource *pushNotificationFutureSource; @property TOCFutureSource *pushNotificationFutureSource;
@property TOCFutureSource *userNotificationFutureSource; @property TOCFutureSource *userNotificationFutureSource;

@ -36,8 +36,7 @@ typedef NS_ENUM(NSInteger, HTTPMethod) {
+ (RPAPICall*)verifyVerificationCode:(NSString*)verificationCode; + (RPAPICall*)verifyVerificationCode:(NSString*)verificationCode;
+ (RPAPICall*)registerPushNotificationWithPushToken:(NSData*)pushToken; + (RPAPICall*)registerPushNotificationWithPushToken:(NSData*)pushToken;
+ (RPAPICall*)requestTextSecureVerificationCode; + (RPAPICall*)requestTextSecureVerificationCode;
+ (RPAPICall*)unregister; + (RPAPICall*)unregisterWithPushToken:(NSData*)pushToken;
+ (RPAPICall*)fetchBloomFilter; + (RPAPICall*)fetchBloomFilter;
//+ (RPAPICall*)requestToOpenPortWithSessionId:(int64_t)sessionId; //+ (RPAPICall*)requestToOpenPortWithSessionId:(int64_t)sessionId;

@ -86,10 +86,12 @@
return apiCall; return apiCall;
} }
+ (RPAPICall*)unregister { + (RPAPICall*)unregisterWithPushToken:(NSData*)pushToken {
RPAPICall *apiCall = [self defaultAPICall]; RPAPICall *apiCall = [self defaultAPICall];
apiCall.method = HTTP_DELETE; apiCall.method = HTTP_DELETE;
apiCall.endPoint = @"/apn"; apiCall.endPoint = [NSString stringWithFormat:@"/apn/%@", pushToken.encodedAsHexString];
apiCall.parameters = nil;
apiCall.requestSerializer = [self basicAuthenticationSerializer];
return apiCall; return apiCall;
} }

@ -65,6 +65,7 @@ MacrosSingletonImplemention
break; break;
case HTTP_DELETE: case HTTP_DELETE:
NSLog(@"endpoint %@, request serializer %@",apiCall.endPoint,apiCall.requestSerializer);
[self.operationManager DELETE:apiCall.endPoint parameters:apiCall.parameters success:success failure:failure]; [self.operationManager DELETE:apiCall.endPoint parameters:apiCall.parameters success:success failure:failure];
break; break;

@ -37,6 +37,7 @@
#import "MediaSettingsTableViewController.h" #import "MediaSettingsTableViewController.h"
#import "AdvancedSettingsTableViewController.h" #import "AdvancedSettingsTableViewController.h"
#import "AboutTableViewController.h" #import "AboutTableViewController.h"
#import "PushManager.h"
#define kProfileCellHeight 87.0f #define kProfileCellHeight 87.0f
#define kStandardCellHeight 44.0f #define kStandardCellHeight 44.0f
@ -175,12 +176,19 @@ typedef enum {
-(IBAction)unregisterUser:(id)sender { -(IBAction)unregisterUser:(id)sender {
[TSAccountManager unregisterTextSecureWithSuccess:^{ [TSAccountManager unregisterTextSecureWithSuccess:^{
[PushManager.sharedManager registrationForPushWithSuccess:^(NSData* pushToken){
[[RPServerRequestsManager sharedInstance]performRequest:[RPAPICall unregisterWithPushToken:pushToken] success:^(NSURLSessionDataTask *task, id responseObject) {
[[TSStorageManager sharedManager] wipe]; [[TSStorageManager sharedManager] wipe];
exit(0); exit(0);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
SignalAlertView(@"Failed to unregister RedPhone component of Signal", @"");
}];
} failure:^{
SignalAlertView(@"Failed to unregister RedPhone component of Signal", @"");
}];
} failure:^(NSError *error) { } failure:^(NSError *error) {
SignalAlertView(@"Failed to unregister", @""); SignalAlertView(@"Failed to unregister TextSecure component of Signal", @"");
}]; }];
} }
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

Loading…
Cancel
Save