Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 712 commits into
base: master
Choose a base branch
from

Conversation

papattes
Copy link

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
Dave Alden and others added 25 commits March 19, 2021 10:16
…Firebase iOS SDK v7.

Remove deprecated FIRInstanceID as it's replaced by didReceiveRegistrationToken.
…g to ensure notifications are ready when app starts.

Resolves #542.
…e ID token when fetching current user info.

Resolves #566.
Informing that the eventName parameter of the logEvent function does not allow dots in the string. Took me some time debugging to find this out.
- should allow to propagate the token to the web view layer and sign-in within both tiers (native and web)
(feat) iOS: support for AppNotificationSettingsButton
(doc): Adding note for analytics logEvent function
(Android bugfix): Fix sound configuration per channel
…ponse

feat(auth): add idToken on signIn w/ Google response
dpa99c and others added 30 commits January 11, 2024 11:20
…ULT_ALLOW_ANALYTICS_STORAGE, GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE, GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA, GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS preferences to both android & ios
Add Consent Mode v2 (Android & iOS)
Updated iOS sdk to 10.24.0; Bumped up Android sdks versions
Downgraded GoogleSignIn to 6.2.4
Add Consent Mode v2 (Android & iOS)
fix(android): issue w/ trailing comma in SDK 24 & 25's default Chrome WebView
Add information to enable the Analytics debug_mode to the README.md
(ios) docs: Update IOS_NOTIFICATION_SERVICE.md
`cordova-ios` has changed the structure of the pbxproj file since 7.0.0.
This fix will check for if the required shellscript build phase section
is empty and create an empty object to avoid throwing an error.
…scriptphase

fix(ios) handle pbxproj structure change
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.

None yet