mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			48 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			48 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Matlab
		
	
| 
											9 years ago
										 | // | ||
|  | //  Copyright (c) 2017 Open Whisper Systems. All rights reserved. | ||
|  | // | ||
|  | 
 | ||
|  | #import "OWS103EnableVideoCalling.h" | ||
| 
											9 years ago
										 | #import <SignalServiceKit/TSAccountManager.h> | ||
| 
											9 years ago
										 | #import <SignalServiceKit/TSNetworkManager.h> | ||
| 
											9 years ago
										 | #import <SignalServiceKit/TSUpdateAttributesRequest.h> | ||
| 
											9 years ago
										 | 
 | ||
|  | // Increment a similar constant for every future DBMigration | ||
|  | static NSString *const OWS103EnableVideoCallingMigrationId = @"103"; | ||
|  | 
 | ||
|  | @implementation OWS103EnableVideoCalling | ||
|  | 
 | ||
|  | + (NSString *)migrationId | ||
|  | { | ||
|  |     return OWS103EnableVideoCallingMigrationId; | ||
|  | } | ||
|  | 
 | ||
|  | // Override parent migration | ||
|  | - (void)runUp | ||
|  | { | ||
| 
											8 years ago
										 |     DDLogWarn(@"%@ running migration...", self.logTag); | ||
| 
											8 years ago
										 |     if ([TSAccountManager isRegistered]) { | ||
|  |         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | ||
| 
											8 years ago
										 |             TSUpdateAttributesRequest *request = [[TSUpdateAttributesRequest alloc] initWithManualMessageFetching:NO]; | ||
| 
											8 years ago
										 |             [[TSNetworkManager sharedManager] makeRequest:request | ||
|  |                 success:^(NSURLSessionDataTask *task, id responseObject) { | ||
| 
											8 years ago
										 |                     DDLogInfo(@"%@ successfully ran", self.logTag); | ||
| 
											8 years ago
										 |                     [self save]; | ||
|  |                 } | ||
|  |                 failure:^(NSURLSessionDataTask *task, NSError *error) { | ||
|  |                     if (!IsNSErrorNetworkFailure(error)) { | ||
|  |                         OWSProdError([OWSAnalyticsEvents errorEnableVideoCallingRequestFailed]); | ||
|  |                     } | ||
| 
											8 years ago
										 |                     DDLogError(@"%@ failed with error: %@", self.logTag, error); | ||
| 
											8 years ago
										 |                 }]; | ||
|  |         }); | ||
|  |     } else { | ||
|  |         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | ||
| 
											8 years ago
										 |             DDLogInfo(@"%@ skipping; not registered", self.logTag); | ||
| 
											8 years ago
										 |             [self save]; | ||
|  |         }); | ||
|  |     } | ||
| 
											9 years ago
										 | } | ||
|  | 
 | ||
|  | @end |