Skip to content

iOS : In AppDelegate+FirebasePlugin.m add the variable tap in the method didReceiveRemoteNotification()#1104

Open
papattes wants to merge 845 commits intoarnesson:masterfrom
dpa99c:master
Open

iOS : In AppDelegate+FirebasePlugin.m add the variable tap in the method didReceiveRemoteNotification()#1104
papattes wants to merge 845 commits intoarnesson:masterfrom
dpa99c:master

Conversation

@papattes
Copy link
Copy Markdown

TODO

to make the variable tap available when receiving a notification from the background, replace :

//Tells the app that a remote notification arrived that indicates there is data to be fetched.
// Called when a message arrives in the foreground and remote notifications permission has been granted
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

    @try{
        NSDictionary *mutableUserInfo = [userInfo mutableCopy];
        NSDictionary* aps = [mutableUserInfo objectForKey:@"aps"];
        if([aps objectForKey:@"alert"] != nil){
            [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
        }else{
            [mutableUserInfo setValue:@"data" forKey:@"messageType"];
        }

        NSLog(@"didReceiveRemoteNotification: %@", mutableUserInfo);
        
        completionHandler(UIBackgroundFetchResultNewData);
        [self processMessageForForegroundNotification:mutableUserInfo];
        [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
    }@catch (NSException *exception) {
        [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
    }
}

By

//Tells the app that a remote notification arrived that indicates there is data to be fetched.
// Called when a message arrives in the foreground and remote notifications permission has been granted
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

    @try{
        NSDictionary *mutableUserInfo = [userInfo mutableCopy];
        NSDictionary* aps = [mutableUserInfo objectForKey:@"aps"];
        if([aps objectForKey:@"alert"] != nil){
            [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
        }else{
            [mutableUserInfo setValue:@"data" forKey:@"messageType"];
        }

        NSString* tap;
        if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]]){
            tap = @"background";
        }else{
            tap = @"foreground";
        }
        [mutableUserInfo setValue:tap forKey:@"tap"];
        if([mutableUserInfo objectForKey:@"messageType"] == nil){
            [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
        }

        NSLog(@"didReceiveRemoteNotification: %@", mutableUserInfo);
        
        completionHandler(UIBackgroundFetchResultNewData);
        [self processMessageForForegroundNotification:mutableUserInfo];
        [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
    }@catch (NSException *exception) {
        [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
    }
}

dpa99c added a commit to dpa99c/cordova-plugin-firebasex that referenced this pull request Aug 30, 2019
…le app is running in background.

* Based on arnesson#1104
* Resolves #96
@dpa99c dpa99c force-pushed the master branch 2 times, most recently from 21bc600 to ad9ec9d Compare September 30, 2020 12:59
dpa99c and others added 23 commits November 2, 2022 13:04
…AuthFactor).

Update typedef for `verifyPhoneNumber()`
(android) align with iOS implementation
Add IOS_GOOGLE_SIGNIN_VERSION AND IOS_GOOGLE_TAG_MANAGER_VERSION plugin vars to enable overriding default pinned versions at plugin install time.
….0 - November 15, 2022

- See https://firebase.google.com/support/release-notes/ios#version_1020_-_november_15_2022
- BREAKING CHANGE: Minimum supported iOS version is now v11.0 (with Firebase SDK v9 it was iOS v10.0)
  - See https://firebase.google.com/support/release-notes/ios#version_1000_-_october_10_2022
- Update pinned versions of Google Sign In and Google Tag Manager libraries to latest to align with Firebase SDK v10
Add the authorization code to the credential object returned after authentication via Sign in with Apple
(android) Add support for Android push notification localization in foreground notifications
… of building example project to diagnose issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.