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 724 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
dpa99c and others added 25 commits March 29, 2021 15:29
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
… latest version of firebase-functions:20.0.0 depends on an older version of it so causes duplicate class conflicts with latest firebase-messaging:22.0.0

https://mvnrepository.com/artifact/com.google.firebase/firebase-functions/20.0.0
…ed in latest Android Firebase SDK major versions
…ing data from Firestore to avoid crashes due to circular references.

Fixes #617.
…data from Firestore to avoid crashes due to circular references.

Fixes #617.
…om Firestore to avoid crashes due to circular references.

Fixes #617.
…pp crashes due to bad access.

Should resolve #616.
pinguluk and others added 30 commits March 14, 2024 11:47
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
…riable to enable specifying a different version of the InappMessaging SDK component from the other Firebase iOS SDK components
…dated related dependencies: GoogleSignIn v7.0.0, GoogleTagManager v8.0.0

Firebase iOS SDK v11 supports iOS 13+ (drops support for iOS 12 which was supported by Firebase iOS SDK v10)
…prevent calling functions on the plugin JS API before Cordova has loaded the plugin JS namespace.

Relates to #888
…lized to prevent calling functions on the plugin JS API before Cordova has loaded the plugin JS namespace.

Resolves #888
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.