|
|
|
@ -3,8 +3,9 @@
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "OWS103EnableVideoCalling.h"
|
|
|
|
|
#import <SignalServiceKit/TSUpdateAttributesRequest.h>
|
|
|
|
|
#import <SignalServiceKit/TSAccountManager.h>
|
|
|
|
|
#import <SignalServiceKit/TSNetworkManager.h>
|
|
|
|
|
#import <SignalServiceKit/TSUpdateAttributesRequest.h>
|
|
|
|
|
|
|
|
|
|
// Increment a similar constant for every future DBMigration
|
|
|
|
|
static NSString *const OWS103EnableVideoCallingMigrationId = @"103";
|
|
|
|
@ -21,15 +22,26 @@ static NSString *const OWS103EnableVideoCallingMigrationId = @"103";
|
|
|
|
|
{
|
|
|
|
|
DDLogWarn(@"%@ running migration...", self.tag);
|
|
|
|
|
|
|
|
|
|
TSUpdateAttributesRequest *request = [[TSUpdateAttributesRequest alloc] initWithUpdatedAttributesWithVoice];
|
|
|
|
|
[[TSNetworkManager sharedManager] makeRequest:request
|
|
|
|
|
success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
|
|
DDLogInfo(@"%@ successfully ran", self.tag);
|
|
|
|
|
[self save];
|
|
|
|
|
}
|
|
|
|
|
failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
|
|
DDLogError(@"%@ failed with error: %@", self.tag, error);
|
|
|
|
|
}];
|
|
|
|
|
// TODO: It'd be nice if TSAccountManager had a
|
|
|
|
|
// [ifRegisteredRunAsync: ifNoRegisteredRunAsync:] method.
|
|
|
|
|
[[TSAccountManager sharedInstance] ifRegistered:YES
|
|
|
|
|
runAsync:^{
|
|
|
|
|
TSUpdateAttributesRequest *request = [[TSUpdateAttributesRequest alloc]
|
|
|
|
|
initWithUpdatedAttributesWithVoice];
|
|
|
|
|
[[TSNetworkManager sharedManager] makeRequest:request
|
|
|
|
|
success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
|
|
DDLogInfo(@"%@ successfully ran", self.tag);
|
|
|
|
|
[self save];
|
|
|
|
|
}
|
|
|
|
|
failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
|
|
DDLogError(@"%@ failed with error: %@", self.tag, error);
|
|
|
|
|
}];
|
|
|
|
|
}];
|
|
|
|
|
[[TSAccountManager sharedInstance] ifRegistered:NO
|
|
|
|
|
runAsync:^{
|
|
|
|
|
DDLogInfo(@"%@ skipping; not registered", self.tag);
|
|
|
|
|
[self save];
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Logging
|
|
|
|
|