Closed abdullahizzuddiin closed 3 years ago
Okay, creating builds with this config
"@react-native-firebase/analytics": "^7.4.1",
"@react-native-firebase/app": "^8.3.0",
"@react-native-firebase/crashlytics": "8.3.0",
"@react-native-firebase/messaging": "^7.6.1",
and
$FirebaseSDKVersion = '6.32.2'
Will report back when I find something out.
@mikehardy Interesting development, I got crash reports in crashlytics instantly with the above configuration.
@Raymond-Cox I wouldn't trust the instantaneousness :-) but I really appreciate the testing. For everyone else following along, there's a config above that gets you the maximum number of bugfixes (read as: most up to date version you can use) while still getting ios crash reports.
And whatever the difference between 8.3.0 and 8.4.4 is, we've got a problem.
There are some people that like changes in a batch so they don't see a lot of versions. I've been trying to release one version per "fix" (or regression, apparently), here is why: each version of crashlytics has one change only:
https://github.com/invertase/react-native-firebase/blob/master/packages/crashlytics/CHANGELOG.md
:detective: which one is it!?! :detective:
I too have issues with crashlytics. After keep updating I am not seeing non-fatal errors at all on dashboard. I want to try @Raymond-Cox config. Can some one please tell how to update specific FirebaseSDKVersion = '6.32.2' I have 6.30.0. I tried updating the package. json but pods still using the 6.30.0.
My package.json: "@react-native-firebase/analytics": "^7.6.1", "@react-native-firebase/app": "^8.4.1", "@react-native-firebase/crashlytics": "^8.4.2", "@react-native-firebase/perf": "^7.4.2",
Pod file:
@sbatikeri I pulled your Podfile from the other issue you opened.
Podfile (Not Podfile.lock)
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$FirebaseSDKVersion = '6.32.2' // <------ Add here
target 'Track' do
I also think in package.json you need to take the carat (^) symbol off for crashlytics to keep it specifically at 8.3.0
Package.json
"@react-native-firebase/crashlytics": "8.3.0",
Afterwards You'll probably need to delete your package.lock file just to be safe, and do a fresh start on node modules, Pods, and such.
People suggest doing so by running this command npx react-native-clean-project
, but it never works for me. I wrote this small script to achieve nearly the same thing for iOS.
rm -rf node_modules && npm install && cd ios && rm -rf Podfile.lock && rm -rf Pods && pod install --repo-update && cd ../
Hope it helps mate.
@Raymond-Cox side note: I'm unaware of npx react-native-clean-project
failures but have success making PR to that repo and obviously love recommending it. If you have any info on what is failing for you and why there, would be best to make it work as it's a standard rec for me
@mikehardy I'll set aside some time in the near future to open an issue on their repo with details on what's failing with it. Honestly it's probably some file misconfigured in this project, I've cleaned up/fixed tons of the react-native standard files since I've joined this organization. Every time I perform some React-Native upgrades I find lines in their files that don't exist in ours whatsoever, and vice-versa :)
That sounds...fun π . I did just (re-)learn that clean-project doesn't run on windows so there is that.
For anyone else following - it does appear the problem is in this library and while crashlytics module 8.3.0 works something in the 5 PRs from that version to current is broken, and the last PR is fine since updated firebase-ios-sdk works, so there's only 4 PRs that could be it.
Of those, 2 are about the manual crash style which may cause issues when testing this library but shouldn't break other crash reports. 1 is for optin/optout (maybe that is it?) and 1 is for including crashlytics without analytics (maybe that is it for project setup where crashlytics thinks you aren't integrated?).
Each is likely testable separately but I'm still otherwise occupied with regards to build test cycles now that Xcode 12 / ios14 is out π
@Raymond-Cox thanks for quick response. I tried what you said. App updated with 6.32.2 but I am getting runtime error. I trying all options even npx react-native-clean-project
error: bundling failed: Error: Unable to resolve module @react-native-community/toolbar-android
from node_modules/react-native-vector-icons/lib/toolbar-android.js
: @react-native-community/toolbar-android could not be found within the project.
@sbatikeri you have an unrelated issue. You need to check the react-native-vector-icons issue tracker for issues related to it. Looks like you need version 7.1.0 over there, or to install @react-native-community/toolbar-android directly
https://github.com/oblador/react-native-vector-icons/issues/1203#issuecomment-692510588
marking these off topic
@sbatikeri you have an unrelated issue. You need to check the react-native-vector-icons issue tracker for issues related to it. Looks like you need version 7.1.0 over there, or to install @react-native-community/toolbar-android directly
oblador/react-native-vector-icons#1203 (comment)
marking these off topic
@react-native-community/toolbar-android
Yes, installing directly fixed runtime issue but still I am not seeing the non-fatals on dashbaord.
@Raymond-Cox I did update but still not seeing ios non-fatal exceptions on dashboard. From: "@react-native-firebase/analytics": "^7.6.1", "@react-native-firebase/app": "^8.4.1", "@react-native-firebase/crashlytics": "^8.4.2",
To: "@react-native-firebase/analytics": "^7.4.1", "@react-native-firebase/app": "^8.3.0", "@react-native-firebase/crashlytics": "8.3.0",
Podfile.lock
@mikehardy do we going to release any fix soon?
@sbatikeri I don't recall you proposing a PR with a fix? There are explicit mentions above about what needs to be tested to find the problem, then we'll need a fix. I look forward to a PR, I have not had time myself
Okay, creating builds with this config
"@react-native-firebase/analytics": "^7.4.1", "@react-native-firebase/app": "^8.3.0", "@react-native-firebase/crashlytics": "8.3.0", "@react-native-firebase/messaging": "^7.6.1",
and
$FirebaseSDKVersion = '6.32.2'
Will report back when I find something out.
I did that and works, but I've felt a little bad downgrading a lot of dependencies, I hope that this works correctly with the latest version soon
@MiguelGrability you don't have to hope! You can do this:
or anyone else following - it does appear the problem is in this library and while crashlytics module 8.3.0 works something in the 5 PRs from that version to current is broken, and the last PR is fine since updated firebase-ios-sdk works, so there's only 4 PRs that could be it.
Of those, 2 are about the manual crash style which may cause issues when testing this library but shouldn't break other crash reports. 1 is for optin/optout (maybe that is it?) and 1 is for including crashlytics without analytics (maybe that is it for project setup where crashlytics thinks you aren't integrated?).
Each is likely testable separately
And advance the issue by discovering the exact change, helping everyone out :pray:
After a large amount of pain and confusion I too can confirm that downgrading from:
"@react-native-firebase/crashlytics": "8.4.5"
to
"@react-native-firebase/crashlytics": "8.3.0"
as well as setting $FirebaseSDKVersion = '6.32.2'
in my Podfile
has allowed me to now see crash reports in the Firebase Crashlytics console. Can provide more information regarding environments etc if necessary.
We don't need more information on environments, we need someone with some time to do the version bisect from 8.3.0 to 8.4.5 - as indicated there are really just 2 or 3 changes to consider, so it should be quick work but it hasn't been taken up yet
Sorry this is continuing to sit out there and cause trouble for other developers but I'm out of time to drive it at the moment between apple-auth, this library, device-info, and my work project. We need help if someone has time :pray:
I did some test with later version, and it stop sending crash report from crashlytics 8.3.2, i've checked the difference between 8.3.0 and 8.3.2. I think this is the issue https://github.com/invertase/react-native-firebase/commit/6b136c3972eb25ad37b4d6230e1d6e139c094f86 , using assert(NO)
i was able to recive crash report in the dashboard. Checking the 8.4.5 version and found the RCT_EXPORT_METHOD(crash) in the RNFBCrashlyticsModule.m now use @throw NSInternalInconsistencyException;
. So this is not what we are looking, i'll continue testing the library 8.3.2 > X < 8.4.5
@babeone it would be interesting to know if general crashes (as opposed to the "test crash" feature) still worked, as that was a specific area of change here. I'm surprised that caused a problem as it was pretty thoroughly researched and tested, but programming is always surprising. Thank you thank you for investigating, the answer should be in there somewhere...
@mikehardy Yes, i've tried with 8.3.3 and it's the same as the 8.3.2, with assert(NO)
i was able to recive the test crash. When i have time i'll try to crash the app without the crash function.
Relevant comment from @JellyLu on the commit that changed crash style and may be the root cause here, pending testing/confirmation
@throw NSInternalInconsistencyException; can crash the app, but firebase console can't get the report. report an issue here.
I try to throw NSInternalInconsistencyException as bellow two ways in AppDelegate.m after the app loading 30 seconds,
way one:
@throw NSInternalInconsistencyException;
way two:
NSException* myException = [NSException
exceptionWithName: NSInternalInconsistencyException
reason:@"V8.4.9 NSInternalInconsistencyException"
userInfo:nil];
@throw myException;
if I use way one, firebase console will NOT collect the crash,
if I use way two, firebase console will collect the crash.
Could you please help to double check with this?
Hey guys, I've been silently tracking this issue and just wondering about the status of it. Looking at master https://github.com/invertase/react-native-firebase/commit/2dcaad59c27b90b1f2b3ef6b31e46d3eac8a5e2e has been merged which appears to fix this issue - is this correct or is there more to it than meets the eye?
@se1exin we can always use more confirmation but it is my understanding that with the correct firebase.json settings and the most recent release, crashes should report on ios in debug and release - in other words, it's supposed to all be working now
Thanks for the update @mikehardy - for what it's worth, I have updated my react-native-firebase/crashlytics
to 8.4.11
and can confirm am now receiving manual crash()
es in the firebase console for both iOS and Android.
Updating all worked for me.
"@react-native-firebase/analytics": "^7.6.9",
"@react-native-firebase/app": "^8.4.7",
"@react-native-firebase/crashlytics": "^8.4.12",
"@react-native-firebase/firestore": "^7.9.1",
"@react-native-firebase/messaging": "^7.9.2",
"@react-native-firebase/perf": "^7.4.10",
react-native-firebase/crashlytics to 8.4.11 solved! Thx you guys!
Should check the peerDependence version of each module.
"@react-native-firebase/analytics": "7.5.1",
"@react-native-firebase/app": "8.4.0",
"@react-native-firebase/crashlytics": "8.4.0",
"@react-native-firebase/firestore": "7.6.1",
@7772 or move to v10+ where we moved to "One.True.Version" and they will no longer be versioned independently, eliminating all confusion
Looks like this is solved; closing.
[EDITED by @mikehardy 20200913]: it appears the pods 6.28 may work fine with our
@react-native-firebase/crashlytics@^8.4.2
, but that pods 6.31 does not. This is an area of active investigation. But you may try overriding pods to 6.28 for now. https://rnfirebase.io/#iosOriginal issue follows:
Issue
I just upgraded
@react-native-firebase/crashlytics
from6.4.0
to8.4.2
. Crash report from iOS didn't displayed on Firebase Console Dashboard.What I've Done
xschme
,project.pbxproj
,podfile
,podfile.lock
firebase.json
crashlytics().setCrashlyticsCollectionEnabled(true);
in app codecrashlytics().crash()
After all things i've done, nothing resulted to displaying error on my Firebase Console.
This log displayed immediately after app builded and ran on my phone.
Sometimes,
1 unsent reports are available. Checking for upload permission.
displayed on console. But, nothing happened after I triggercrashlytics().sendUnsentReports();
I also followed this suggestion. I added
to
Info.plist
and it gave result.we may highlighted
Automatic data collection is enabled.
but no crash appeared on firebase console.On device log, It displayed this error
Project Files
Javascript
Click To Expand
#### `package.json`: ```json "dependencies": { "@react-native-community/async-storage": "^1.8.1", "@react-native-community/cameraroll": "^1.7.2", "@react-native-community/netinfo": "^5.6.2", "@react-native-community/push-notification-ios": "^1.0.7", "@react-native-community/viewpager": "^3.3.0", "@react-native-firebase/analytics": "^7.6.1", "@react-native-firebase/app": "^8.4.1", "@react-native-firebase/crashlytics": "^8.4.2", "@react-native-firebase/dynamic-links": "^7.5.2", "@react-native-firebase/in-app-messaging": "^7.4.2", "@react-native-firebase/messaging": "^7.8.4", "@react-native-firebase/perf": "^7.4.2", "@react-native-firebase/remote-config": "^9.0.3", "appcenter": "^3.0.0", "appcenter-analytics": "^3.0.0", "appcenter-crashes": "^3.0.0", "apsl-react-native-button": "^3.1.1", "assert": "^1.4.1", "babel-plugin-transform-remove-console": "^6.8.5", "crypto-js": "^3.1.9-1", "lodash": "^4.17.15", "lottie-ios": "^3.1.8", "lottie-react-native": "^3.4.0", "memoize-one": "^5.1.1", "moment": "^2.15.0", "moment-timezone": "^0.5.31", "prop-types": "^15.7.2", "react": "16.9.0", "react-native": "^0.61.5", "react-native-appsflyer": "^5.2.0", "react-native-check-box": "^2.1.7", "react-native-code-push": "^6.1.0", "react-native-collapsible": "^1.5.1", "react-native-config": "^0.11.7", "react-native-device-info": "^5.3.1", "react-native-emoji": "git+https://github.com/jorilallo/react-native-emoji.git", "react-native-fbsdk": "^1.1.2", "react-native-freshchat-sdk": "2.6.3", "react-native-gesture-handler": "^1.3.0", "react-native-hyperlink": "0.0.19", "react-native-image-picker": "git+https://github.com/abdullahizzuddiin/react-native-image-picker.git", "react-native-intercom": "^13.2.0", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-linear-gradient": "^2.5.6", "react-native-material-dropdown": "^0.11.1", "react-native-modalbox": "^2.0.0", "react-native-onesignal": "git+https://github.com/abdullahizzuddiin/react-native-onesignal.git", "react-native-photo-view": "git+https://github.com/alwx/react-native-photo-view.git", "react-native-reanimated": "^1.7.0", "react-native-router-flux": "^4.2.0", "react-native-screens": "^2.3.0", "react-native-scrollable-tab-view": "git+https://github.com/abdullahizzuddiin/react-native-scrollable-tab-view.git", "react-native-select-contact": "^1.3.2", "react-native-simple-toast": "^1.0.0", "react-native-spinkit": "^1.5.0", "react-redux": "^7.2.0", "redux": "^4.0.5", "redux-thunk": "^2.3.0", "rn-fetch-blob": "^0.12.0", "stream-browserify": "^2.0.1", "timers-browserify": "^2.0.10", "tty-browserify": "0.0.1", "url": "^0.11.0", "vm-browserify": "1.0.1", "warning": "^3.0.0" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "@react-native-community/eslint-config": "^0.0.5", "@typescript-eslint/eslint-plugin": "^3.8.0", "@typescript-eslint/parser": "^3.8.0", "babel-jest": "^24.9.0", "babel-plugin-module-resolver": "^4.0.0", "eslint": "^6.5.1", "eslint-import-resolver-babel-module": "^5.1.2", "eslint-plugin-import": "^2.22.0", "eslint-plugin-module-resolver": "^1.0.0", "eslint-plugin-react-native": "^3.8.1", "jest": "^24.9.0", "jetifier": "^1.6.3", "metro-react-native-babel-preset": "^0.56.0", "react-devtools": "3.6.2", "react-test-renderer": "16.9.0", "reactotron-react-native": "^2.1.0", "typescript": "^3.9.7" } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_debug_enabled": true, "crashlytics_disable_auto_disabler": true, } } ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # Uncomment the next line to define a global platform for your project platform :ios, '10.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'AppName' do # Pods for your project pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => "../node_modules/react-native/" pod 'React-Core', :path => "../node_modules/react-native/" pod 'React-CoreModules', :path => "../node_modules/react-native/React/CoreModules" pod 'React-Core/DevSupport', :path => "../node_modules/react-native/" pod 'React-RCTActionSheet', :path => "../node_modules/react-native/Libraries/ActionSheetIOS" pod 'React-RCTAnimation', :path => "../node_modules/react-native/Libraries/NativeAnimation" pod 'React-RCTBlob', :path => "../node_modules/react-native/Libraries/Blob" pod 'React-RCTImage', :path => "../node_modules/react-native/Libraries/Image" pod 'React-RCTLinking', :path => "../node_modules/react-native/Libraries/LinkingIOS" pod 'React-RCTNetwork', :path => "../node_modules/react-native/Libraries/Network" pod 'React-RCTSettings', :path => "../node_modules/react-native/Libraries/Settings" pod 'React-RCTText', :path => "../node_modules/react-native/Libraries/Text" pod 'React-RCTVibration', :path => "../node_modules/react-native/Libraries/Vibration" pod 'React-Core/RCTWebSocket', :path => "../node_modules/react-native/" pod 'React-cxxreact', :path => "../node_modules/react-native/ReactCommon/cxxreact" pod 'React-jsi', :path => "../node_modules/react-native/ReactCommon/jsi" pod 'React-jsiexecutor', :path => "../node_modules/react-native/ReactCommon/jsiexecutor" pod 'React-jsinspector', :path => "../node_modules/react-native/ReactCommon/jsinspector" pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => "../node_modules/react-native/ReactCommon/yoga" pod 'DoubleConversion', :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" pod 'glog', :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec" pod 'Folly', :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec" # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for AppName pod 'AppCenter/Crashes' pod 'AppCenter/Analytics' pod 'AppCenterReactNativeShared' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' pod 'Intercom' pod 'ZendeskSupportSDK' pod 'OneSignal', '>= 2.14.2', '< 3.0' pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info' pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios' pod 'RCTSelectContact', :path => '../node_modules/react-native-select-contact' pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll' target 'AppNameTests' do inherit! :search_paths # Pods for testing end use_native_modules! post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'react-native-config' phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) phase.shell_script = "cd ../../"\ " && RNC_ROOT=./node_modules/react-native-config/"\ " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\ " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\ " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby" target.build_phases << phase target.build_phases.move(phase,0) end if target.name == "React" target.remove_from_project end end end end target 'AppName-tvOS' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for AppName-tvOS target 'AppName-tvOSTests' do inherit! :search_paths # Pods for testing end end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.14.2', '< 3.0' end pre_install do |installer| # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289 Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} end ``` #### `AppDelegate.m`: ```objc /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import
#import
#import "Intercom/intercom.h"
#import "FreshchatSDK.h"
#import "AppDelegate.h"
#import
#import
#import
#import
#import
#import
#import
#if __has_include()
#import
#else
#import "AppsFlyerTracker.h"
#endif
#import
#import
@import SupportSDK;
@import ZendeskCoreSDK;
@import Firebase;
@import AppsFlyerLib;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//enable debug on release mode, disable when release to user or in debug mode
//RCTSetLogThreshold(RCTLogLevelInfo - 1);
// Intercom
[Intercom setApiKey:@""];
// Dynamic Links
[FIROptions defaultOptions].deepLinkURLScheme = @"id.AppName.release";
// Firebase init
[FIRApp configure];
// Freshchat init
NSString *FRESHCHAT_APP_ID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"FreshchatAppId"];
NSString *FRESHCHAT_APP_KEY = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"FreshchatAppKey"];
FreshchatConfig *config = [[FreshchatConfig alloc]initWithAppID:FRESHCHAT_APP_ID andAppKey:FRESHCHAT_APP_KEY];
config.gallerySelectionEnabled = YES;
config.cameraCaptureEnabled = YES;
config.teamMemberInfoVisible = YES;
config.showNotificationBanner = YES;
config.responseExpectationVisible = YES;
config.domain = @"msdk.au.freshchat.com";
[[Freshchat sharedInstance] initWithConfig:config];
[ZDKZendesk initializeWithAppId: @""
clientId: @""
zendeskUrl: @""];
[ZDKSupport initializeWithZendesk: [ZDKZendesk instance]];
id userIdentity = [[ZDKObjCAnonymous alloc] initWithName:nil email:nil];
[[ZDKZendesk instance] setIdentity:userIdentity];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing]; // Initialize AppCenter crashes
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; // Initialize AppCenter analytics
[AppCenterReactNative register]; // Initialize AppCenter
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"AppName"
initialProperties:nil];
// Sentry init
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary *)options {
[[AppsFlyerTracker sharedTracker] handleOpenUrl:url options:options];
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
return handled;
}
//Universal Links (iOS 9 +)
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler {
[[AppsFlyerTracker sharedTracker] continueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application{
/* Reset badge app count if so desired */
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
// notify AppsFlyerTracker
[[AppsFlyerTracker sharedTracker] registerUninstall:deviceToken];
// Intercom
[Intercom setDeviceToken:deviceToken];
// Freshchat
[[Freshchat sharedInstance] setPushRegistrationToken:deviceToken];
}
- (void) application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)info{
}
// onesignal background notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
[self processPaymentInfo: userInfo];
if ([[Freshchat sharedInstance]isFreshchatNotification:userInfo]) {
[[Freshchat sharedInstance]handleRemoteNotification:userInfo andAppstate:application.applicationState];
}
}
/* For devices running on ios 10 and above */
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
if ([[Freshchat sharedInstance]isFreshchatNotification:notification.request.content.userInfo]) {
[[Freshchat sharedInstance]handleRemoteNotification:notification.request.content.userInfo andAppstate:[[UIApplication sharedApplication] applicationState]];
completionHandler( UNAuthorizationOptionSound );
} else {
completionHandler( UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge );
}
}
/* For devices running on ios 10 and above */
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
if ([[Freshchat sharedInstance]isFreshchatNotification:response.notification.request.content.userInfo]) {
[[Freshchat sharedInstance]handleRemoteNotification:response.notification.request.content.userInfo andAppstate:[[UIApplication sharedApplication] applicationState]];
}
completionHandler();
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
}
- (void)processPaymentInfo:(NSDictionary *) additionalData
{
NSLog(@"ON NOTIFICATION PROCESSING");
NSLog(@"%@", additionalData);
NSLog(@"Finishing payment transaction");
@try {
int fee = [[additionalData valueForKey:@"biaya"] intValue];
int status = [[additionalData valueForKey:@"statusTransaksi"] intValue];
int transactionId = [[additionalData valueForKey:@"idTransaksi"] intValue];
int transactionType = [[additionalData valueForKey:@"jenis_transaksi"] intValue];
if (fee > 0 && status == 2) {
[self finishPayment:transactionId withFee:fee];
} else if (fee > 0 && status == 6 && transactionType == 6) {
[self refundPayment:transactionId withFee:fee];
}
} @catch (NSException* e) {
NSLog(@"Payment info exception => %@", e);
}
}
- (void)finishPayment:(int) transactionId withFee:(int) fee {
[FIRAnalytics logEventWithName:kFIREventEcommercePurchase parameters:@{
kFIRParameterTransactionID: [NSString stringWithFormat:@"%d", transactionId],
kFIRParameterValue: [NSString stringWithFormat:@"%d", fee],
kFIRParameterCurrency: @"IDR"
}];
}
- (void)refundPayment:(int) transactionId withFee:(int) fee {
[FIRAnalytics logEventWithName:kFIREventPurchaseRefund parameters:@{
kFIRParameterTransactionID: [NSString stringWithFormat:@"%d", transactionId],
kFIRParameterValue: [NSString stringWithFormat:@"%d", fee],
kFIRParameterCurrency: @"IDR"
}];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
@end
```
Android
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 10.15.6 CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz Memory: 18.34 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.5.0 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.5 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman IDEs: Android Studio: 4.0 AI-193.6911.18.40.6626763 Xcode: /undefined - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: ^0.61.5 => 0.61.5 ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** ``` "@react-native-firebase/analytics": "^7.6.1", "@react-native-firebase/app": "^8.4.1", "@react-native-firebase/crashlytics": "^8.4.2", "@react-native-firebase/dynamic-links": "^7.5.2", "@react-native-firebase/in-app-messaging": "^7.4.2", "@react-native-firebase/messaging": "^7.8.4", "@react-native-firebase/perf": "^7.4.2", "@react-native-firebase/remote-config": "^9.0.3", ``` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.