diff --git a/src/Account/TSAccountManager.h b/src/Account/TSAccountManager.h index 964f47442..9a7a63def 100644 --- a/src/Account/TSAccountManager.h +++ b/src/Account/TSAccountManager.h @@ -64,7 +64,6 @@ static NSString *const TSRegistrationErrorUserInfoHTTPStatus = @"TSHTTPStatus"; + (void)rerequestVoiceWithSuccess:(void (^)())successBlock failure:(void (^)(NSError *error))failureBlock; - (void)verifyAccountWithCode:(NSString *)verificationCode - isWebRTCEnabled:(BOOL)isWebRTCEnabled success:(void (^)())successBlock failure:(void (^)(NSError *error))failureBlock; diff --git a/src/Account/TSAccountManager.m b/src/Account/TSAccountManager.m index b45a8d863..d7988965a 100644 --- a/src/Account/TSAccountManager.m +++ b/src/Account/TSAccountManager.m @@ -177,7 +177,6 @@ NS_ASSUME_NONNULL_BEGIN } - (void)verifyAccountWithCode:(NSString *)verificationCode - isWebRTCEnabled:(BOOL)isWebRTCEnabled success:(void (^)())successBlock failure:(void (^)(NSError *error))failureBlock { @@ -192,8 +191,7 @@ NS_ASSUME_NONNULL_BEGIN TSVerifyCodeRequest *request = [[TSVerifyCodeRequest alloc] initWithVerificationCode:verificationCode forNumber:phoneNumber signalingKey:signalingKey - authKey:authToken - isWebRTCEnabled:isWebRTCEnabled]; + authKey:authToken]; [self.networkManager makeRequest:request success:^(NSURLSessionDataTask *task, id responseObject) { diff --git a/src/Account/TSAttributes.h b/src/Account/TSAttributes.h index fea637831..0cd1faf1c 100644 --- a/src/Account/TSAttributes.h +++ b/src/Account/TSAttributes.h @@ -10,10 +10,9 @@ @interface TSAttributes : NSObject -+ (NSDictionary *)attributesFromStorage:(BOOL)isWebRTCEnabled; ++ (NSDictionary *)attributesFromStorageWithVoiceSupport; + (NSDictionary *)attributesWithSignalingKey:(NSString *)signalingKey - serverAuthToken:(NSString *)authToken - isWebRTCEnabled:(BOOL)isWebRTCEnabled; + serverAuthToken:(NSString *)authToken; @end diff --git a/src/Account/TSAttributes.m b/src/Account/TSAttributes.m index 340ef8c29..ebad7ca00 100644 --- a/src/Account/TSAttributes.m +++ b/src/Account/TSAttributes.m @@ -1,9 +1,5 @@ // -// TSAttributes.m -// Signal -// -// Created by Frederic Jacobs on 22/08/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // #import "TSAttributes.h" @@ -13,21 +9,19 @@ @implementation TSAttributes -+ (NSDictionary *)attributesFromStorage:(BOOL)isWebRTCEnabled { ++ (NSDictionary *)attributesFromStorageWithVoiceSupport { return [self attributesWithSignalingKey:[TSStorageManager signalingKey] - serverAuthToken:[TSStorageManager serverAuthToken] - isWebRTCEnabled:isWebRTCEnabled]; + serverAuthToken:[TSStorageManager serverAuthToken]]; } + (NSDictionary *)attributesWithSignalingKey:(NSString *)signalingKey serverAuthToken:(NSString *)authToken - isWebRTCEnabled:(BOOL)isWebRTCEnabled { return @{ @"signalingKey" : signalingKey, @"AuthKey" : authToken, @"voice" : @(YES), // all Signal-iOS clients support voice - @"video" : @(isWebRTCEnabled), + @"video" : @(YES), // all Signal-iOS clients support WebRTC-based voice and video calls. @"registrationId" : [NSString stringWithFormat:@"%i", [TSAccountManager getOrGenerateRegistrationId]] }; } diff --git a/src/Network/API/Requests/TSUpdateAttributesRequest.h b/src/Network/API/Requests/TSUpdateAttributesRequest.h index 4398811c6..1347ef864 100644 --- a/src/Network/API/Requests/TSUpdateAttributesRequest.h +++ b/src/Network/API/Requests/TSUpdateAttributesRequest.h @@ -10,6 +10,6 @@ @interface TSUpdateAttributesRequest : TSRequest -- (instancetype)initWithUpdatedAttributes:(BOOL)isWebRTCEnabled; +- (instancetype)initWithUpdatedAttributesWithVoice; @end diff --git a/src/Network/API/Requests/TSUpdateAttributesRequest.m b/src/Network/API/Requests/TSUpdateAttributesRequest.m index f002fcf66..c27b33457 100644 --- a/src/Network/API/Requests/TSUpdateAttributesRequest.m +++ b/src/Network/API/Requests/TSUpdateAttributesRequest.m @@ -12,13 +12,13 @@ @implementation TSUpdateAttributesRequest -- (instancetype)initWithUpdatedAttributes:(BOOL)isWebRTCEnabled { +- (instancetype)initWithUpdatedAttributesWithVoice { NSString *endPoint = [textSecureAccountsAPI stringByAppendingString:textSecureAttributesAPI]; self = [super initWithURL:[NSURL URLWithString:endPoint]]; if (self) { [self setHTTPMethod:@"PUT"]; - [self.parameters addEntriesFromDictionary:[TSAttributes attributesFromStorage:isWebRTCEnabled]]; + [self.parameters addEntriesFromDictionary:[TSAttributes attributesFromStorageWithVoiceSupport]]; } return self; diff --git a/src/Network/API/Requests/TSVerifyCodeRequest.h b/src/Network/API/Requests/TSVerifyCodeRequest.h index 60fd79cc4..496777be9 100644 --- a/src/Network/API/Requests/TSVerifyCodeRequest.h +++ b/src/Network/API/Requests/TSVerifyCodeRequest.h @@ -13,8 +13,7 @@ - (TSRequest *)initWithVerificationCode:(NSString *)verificationCode forNumber:(NSString *)phoneNumber signalingKey:(NSString *)signalingKey - authKey:(NSString *)authKey - isWebRTCEnabled:(BOOL)isWebRTCEnabled; + authKey:(NSString *)authKey; @property (nonatomic, readonly) NSString *numberToValidate; diff --git a/src/Network/API/Requests/TSVerifyCodeRequest.m b/src/Network/API/Requests/TSVerifyCodeRequest.m index e9f791ae7..5c67b2df0 100644 --- a/src/Network/API/Requests/TSVerifyCodeRequest.m +++ b/src/Network/API/Requests/TSVerifyCodeRequest.m @@ -16,16 +16,13 @@ - (TSRequest *)initWithVerificationCode:(NSString *)verificationCode forNumber:(NSString *)phoneNumber signalingKey:(NSString *)signalingKey - authKey:(NSString *)authKey - isWebRTCEnabled:(BOOL)isWebRTCEnabled { + authKey:(NSString *)authKey { self = [super initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/code/%@", textSecureAccountsAPI, verificationCode]]]; NSDictionary *attributes = - [TSAttributes attributesWithSignalingKey:signalingKey - serverAuthToken:authKey - isWebRTCEnabled:isWebRTCEnabled]; + [TSAttributes attributesWithSignalingKey:signalingKey serverAuthToken:authKey]; _numberToValidate = phoneNumber; [self.parameters addEntriesFromDictionary:attributes];