mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Don't go to chatListView but notif instead unless view = chatListView or ChatConverstionView of the notif
This commit is contained in:
parent
76da97acfc
commit
3c764fff65
5 changed files with 11 additions and 24 deletions
|
|
@ -128,6 +128,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[_pictureButton setEnabled:fileSharingEnabled];
|
||||
|
||||
[self callUpdateEvent:nil];
|
||||
PhoneMainView.instance.currentRoom = self.chatRoom;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
@ -138,6 +139,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[self setComposingVisible:FALSE withDelay:0]; // will hide the "user is composing.." message
|
||||
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
PhoneMainView.instance.currentRoom = NULL;
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
|
|
|
|||
|
|
@ -201,25 +201,6 @@
|
|||
|
||||
- (void)registerForNotifications:(UIApplication *)app {
|
||||
LinphoneManager *instance = [LinphoneManager instance];
|
||||
/*if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
// Set up for UserNotifications framework
|
||||
UNNotificationAction* act_ans = [UNNotificationAction actionWithIdentifier:@"Answer" title:@"Answer" options:UNNotificationActionOptionNone];
|
||||
UNNotificationAction* act_dec = [UNNotificationAction actionWithIdentifier:@"Decline" title:@"Decline" options:UNNotificationActionOptionNone];
|
||||
UNNotificationCategory* cat_call = [UNNotificationCategory categoryWithIdentifier:@"call_cat" actions:[NSArray arrayWithObjects:act_ans, act_dec, nil] intentIdentifiers:[[NSMutableArray alloc] init] options:UNNotificationCategoryOptionCustomDismissAction];
|
||||
|
||||
//UNUserNotificationCenter* notifCenter = [UNUserNotificationCenter currentNotificationCenter];
|
||||
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
|
||||
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge)
|
||||
completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
||||
// Enable or disable features based on authorization.
|
||||
if (error) {
|
||||
LOGD(error.description);
|
||||
}
|
||||
}];
|
||||
NSSet* categories = [NSSet setWithObjects:cat_call, nil];
|
||||
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];
|
||||
}*/
|
||||
|
||||
if (floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_8_0) {
|
||||
//[app unregisterForRemoteNotifications];
|
||||
// iOS8 and more : PushKit
|
||||
|
|
@ -391,9 +372,7 @@
|
|||
LOGE(@"PushNotification: does not have call-id yet, fix it !");
|
||||
}
|
||||
|
||||
if ([loc_key isEqualToString:@"IM_MSG"] || [loc_key isEqualToString:@"IM_FULLMSG"]) {
|
||||
[PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
|
||||
} else if ([loc_key isEqualToString:@"IC_MSG"]) {
|
||||
if ([loc_key isEqualToString:@"IC_MSG"]) {
|
||||
[self fixRing];
|
||||
}
|
||||
}
|
||||
|
|
@ -553,6 +532,11 @@ didInvalidatePushTokenForType:(NSString *)type {
|
|||
|
||||
#pragma mark - UserNotifications Framework
|
||||
|
||||
- (void) userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
|
||||
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionAlert);
|
||||
}
|
||||
|
||||
|
||||
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
||||
didReceiveNotificationResponse:(UNNotificationResponse *)response
|
||||
withCompletionHandler:(void (^)())completionHandler {
|
||||
|
|
|
|||
|
|
@ -1127,7 +1127,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
|
|||
NSString *remote_uri = [NSString stringWithUTF8String:c_address];
|
||||
ms_free(c_address);
|
||||
|
||||
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
|
||||
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground || ((PhoneMainView.instance.currentView != ChatsListView.compositeViewDescription) && ((PhoneMainView.instance.currentView != ChatConversationView.compositeViewDescription))) || (PhoneMainView.instance.currentView == ChatConversationView.compositeViewDescription && room != PhoneMainView.instance.currentRoom)) {
|
||||
// Create a new notification
|
||||
|
||||
if(floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
|
|
@ -1204,7 +1204,6 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
|
|||
} else {
|
||||
content.body = from;
|
||||
}
|
||||
|
||||
content.sound = [UNNotificationSound soundNamed:@"msg.caf"];
|
||||
content.categoryIdentifier = @"msg_cat";
|
||||
content.userInfo = @{ @"from" : from, @"from_addr" : remote_uri, @"call-id" : callID };
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@
|
|||
|
||||
@property(nonatomic, strong) NSString *name;
|
||||
@property(weak, readonly) UICompositeViewDescription *currentView;
|
||||
@property LinphoneChatRoom* currentRoom;
|
||||
@property(readonly, strong) MPVolumeView *volumeView;
|
||||
|
||||
- (void)changeCurrentView:(UICompositeViewDescription *)view;
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
|
||||
- (void)initPhoneMainView {
|
||||
currentView = nil;
|
||||
_currentRoom = NULL;
|
||||
inhibitedEvents = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue