зеркало из https://github.com/nextcloud/talk-ios.git
Check if push notifications contain roomId or roomToken.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
c938bce476
Коммит
b17222f825
|
@ -32,7 +32,8 @@ extern NSString * const NCPushNotificationJoinVideoCallAcceptedNotification;
|
||||||
@property (nonatomic, copy) NSString *app;
|
@property (nonatomic, copy) NSString *app;
|
||||||
@property (nonatomic, assign) NCPushNotificationType type;
|
@property (nonatomic, assign) NCPushNotificationType type;
|
||||||
@property (nonatomic, copy) NSString *subject;
|
@property (nonatomic, copy) NSString *subject;
|
||||||
@property (nonatomic, assign) NSInteger pnId;
|
@property (nonatomic, copy) NSString *roomToken;
|
||||||
|
@property (nonatomic, assign) NSInteger roomId;
|
||||||
|
|
||||||
+ (instancetype)pushNotificationFromDecryptedString:(NSString *)decryptedString;
|
+ (instancetype)pushNotificationFromDecryptedString:(NSString *)decryptedString;
|
||||||
- (NSString *)bodyForRemoteAlerts;
|
- (NSString *)bodyForRemoteAlerts;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "NCPushNotification.h"
|
#import "NCPushNotification.h"
|
||||||
|
#import "NCSettingsController.h"
|
||||||
|
|
||||||
@implementation NCPushNotification
|
@implementation NCPushNotification
|
||||||
|
|
||||||
|
@ -41,7 +42,11 @@ NSString * const NCPushNotificationJoinVideoCallAcceptedNotification = @"NCPu
|
||||||
NCPushNotification *pushNotification = [[NCPushNotification alloc] init];
|
NCPushNotification *pushNotification = [[NCPushNotification alloc] init];
|
||||||
pushNotification.app = app;
|
pushNotification.app = app;
|
||||||
pushNotification.subject = [jsonDict objectForKey:kNCPNSubjectKey];
|
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];
|
NSString *type = [jsonDict objectForKey:kNCPNTypeKey];
|
||||||
pushNotification.type = NCPushNotificationTypeUnknown;
|
pushNotification.type = NCPushNotificationTypeUnknown;
|
||||||
|
|
|
@ -341,13 +341,21 @@ NSString * const NCRoomsManagerDidReceiveChatMessagesNotification = @"ChatMess
|
||||||
- (void)joinAudioCallAccepted:(NSNotification *)notification
|
- (void)joinAudioCallAccepted:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
|
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
|
- (void)joinVideoCallAccepted:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
|
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
|
- (void)userSelectedContactForVoiceCall:(NSNotification *)notification
|
||||||
|
@ -365,7 +373,11 @@ NSString * const NCRoomsManagerDidReceiveChatMessagesNotification = @"ChatMess
|
||||||
- (void)joinChat:(NSNotification *)notification
|
- (void)joinChat:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NCPushNotification *pushNotification = [notification.userInfo objectForKey:@"pushNotification"];
|
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
|
- (void)userSelectedContactForChat:(NSNotification *)notification
|
||||||
|
|
Загрузка…
Ссылка в новой задаче