Socket Management
This commit is contained in:
parent
9b5379b3e2
commit
6446c6fbe0
|
@ -208,6 +208,7 @@
|
|||
}
|
||||
|
||||
-(void) applicationDidBecomeActive:(UIApplication *)application {
|
||||
[TSSocketManager becomeActive];
|
||||
[AppAudioManager.sharedInstance awake];
|
||||
|
||||
// Hacky way to clear notification center after processed push
|
||||
|
@ -231,8 +232,8 @@
|
|||
completionHandler();
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application{
|
||||
[self protectScreen];
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application{
|
||||
[TSSocketManager resignActivity];
|
||||
}
|
||||
|
||||
- (void)prepareScreenshotProtection{
|
||||
|
|
|
@ -163,8 +163,13 @@ NSString * const SocketConnectingNotification = @"SocketConnectingNotification";
|
|||
[message setResponse:response.build];
|
||||
[message setType:WebSocketMessageTypeResponse];
|
||||
|
||||
@try {
|
||||
[self.websocket send:message.build.data];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
DDLogWarn(@"Caught exception while trying to write on the socket %@", exception.debugDescription);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean {
|
||||
DDLogVerbose(@"WebSocket did close");
|
||||
|
@ -174,8 +179,13 @@ NSString * const SocketConnectingNotification = @"SocketConnectingNotification";
|
|||
}
|
||||
|
||||
- (void)webSocketHeartBeat {
|
||||
@try {
|
||||
[self.websocket sendPing:nil];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
DDLogWarn(@"Caught exception while trying to write on the socket %@", exception.debugDescription);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*)webSocketAuthenticationString{
|
||||
return [NSString stringWithFormat:@"?login=%@&password=%@", [[TSAccountManager registeredNumber] stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"],[TSStorageManager serverAuthToken]];
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
}
|
||||
|
||||
NSData *identityKey = [NSData dataFromBase64String:identityKeyString];
|
||||
NSLog(@"IDentityKey %@", identityKey);
|
||||
|
||||
for (NSDictionary *deviceDict in devicesArray) {
|
||||
NSNumber *registrationIdString = [deviceDict objectForKey:@"registrationId"];
|
||||
|
|
Loading…
Reference in New Issue