Check if push notifications contain roomId or roomToken.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2018-08-06 16:29:22 +02:00
Родитель c938bce476
Коммит b17222f825
3 изменённых файлов: 23 добавлений и 5 удалений

Просмотреть файл

@ -32,7 +32,8 @@ extern NSString * const NCPushNotificationJoinVideoCallAcceptedNotification;
@property (nonatomic, copy) NSString *app;
@property (nonatomic, assign) NCPushNotificationType type;
@property (nonatomic, copy) NSString *subject;
@property (nonatomic, assign) NSInteger pnId;
@property (nonatomic, copy) NSString *roomToken;
@property (nonatomic, assign) NSInteger roomId;
+ (instancetype)pushNotificationFromDecryptedString:(NSString *)decryptedString;
- (NSString *)bodyForRemoteAlerts;

Просмотреть файл

@ -7,6 +7,7 @@
//
#import "NCPushNotification.h"
#import "NCSettingsController.h"
@implementation NCPushNotification
@ -41,7 +42,11 @@ NSString * const NCPushNotificationJoinVideoCallAcceptedNotification = @"NCPu
NCPushNotification *pushNotification = [[NCPushNotification alloc] init];
pushNotification.app = app;
pushNotification.subject = [jsonDict objectForKey:kNCPNSubjectKey];
pushNotification.pnId = [[jsonDict objectForKey:kNCPNIdKey] integerValue];
if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNoPing]) {
pushNotification.roomToken = [jsonDict objectForKey:kNCPNIdKey];
} else {
pushNotification.roomId = [[jsonDict objectForKey:kNCPNIdKey] integerValue];
}
NSString *type = [jsonDict objectForKey:kNCPNTypeKey];
pushNotification.type = NCPushNotificationTypeUnknown;

Просмотреть файл

@ -341,13 +341,21 @@ NSString * const NCRoomsManagerDidReceiveChatMessagesNotification = @"ChatMess
- (void)joinAudioCallAccepted:(NSNotification *)notification
{
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
[self joinCallWithCallId:pushNotification.pnId withVideo:NO];
if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNoPing]) {
[self joinCallWithCallToken:pushNotification.roomToken withVideo:NO];
} else {
[self joinCallWithCallId:pushNotification.roomId withVideo:NO];
}
}
- (void)joinVideoCallAccepted:(NSNotification *)notification
{
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
[self joinCallWithCallId:pushNotification.pnId withVideo:YES];
if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNoPing]) {
[self joinCallWithCallToken:pushNotification.roomToken withVideo:YES];
} else {
[self joinCallWithCallId:pushNotification.roomId withVideo:YES];
}
}
- (void)userSelectedContactForVoiceCall:(NSNotification *)notification
@ -365,7 +373,11 @@ NSString * const NCRoomsManagerDidReceiveChatMessagesNotification = @"ChatMess
- (void)joinChat:(NSNotification *)notification
{
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
[self startChatWithRoomId:pushNotification.pnId];
if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNoPing]) {
[self startChatWithRoomToken:pushNotification.roomToken];
} else {
[self startChatWithRoomId:pushNotification.roomId];
}
}
- (void)userSelectedContactForChat:(NSNotification *)notification