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

@ -55,6 +55,8 @@
* 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 *userNotificationFutureSource;

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

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

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

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

Loading…
Cancel
Save