From ed42199ad807e0de9257dfc3d2901a76a82cc2be Mon Sep 17 00:00:00 2001 From: GOVINDDIXIT Date: Tue, 7 Jul 2020 20:52:42 +0530 Subject: [PATCH] fix stuck screen --- app/notifications/push/index.js | 12 ++++++++---- app/utils/log.js | 6 +++++- package.json | 3 ++- yarn.lock | 5 +++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/notifications/push/index.js b/app/notifications/push/index.js index 865a6ad61..f80c02352 100644 --- a/app/notifications/push/index.js +++ b/app/notifications/push/index.js @@ -3,6 +3,7 @@ import EJSON from 'ejson'; import PushNotification from './push'; import store from '../../lib/createStore'; import { deepLinkingOpen } from '../../actions/deepLinking'; +import RNConfigReader from 'react-native-config-reader'; export const onNotification = (notification) => { if (notification) { @@ -37,8 +38,11 @@ export const onNotification = (notification) => { export const getDeviceToken = () => PushNotification.getDeviceToken(); export const setBadgeCount = count => PushNotification.setBadgeCount(count); export const initializePushNotifications = () => { - setBadgeCount(); - return PushNotification.configure({ - onNotification - }); + const configValue = RNConfigReader.PLAY_BUILD; + if(configValue){ + setBadgeCount(); + return PushNotification.configure({ + onNotification + }); + } }; diff --git a/app/utils/log.js b/app/utils/log.js index f2d0fe2f6..165a3c1a0 100644 --- a/app/utils/log.js +++ b/app/utils/log.js @@ -1,7 +1,9 @@ import { Client } from 'bugsnag-react-native'; import firebase from 'react-native-firebase'; +import RNConfigReader from 'react-native-config-reader'; import config from '../../config'; +const configValue = RNConfigReader.PLAY_BUILD; const bugsnag = new Client(config.BUGSNAG_API_KEY); export const { analytics } = firebase; @@ -17,7 +19,9 @@ export const logServerVersion = (serverVersion) => { }; export const setCurrentScreen = (currentScreen) => { - analytics().setCurrentScreen(currentScreen); + if(configValue){ + analytics().setCurrentScreen(currentScreen); + } leaveBreadcrumb(currentScreen, { type: 'navigation' }); }; diff --git a/package.json b/package.json index a46be95e1..99d92f793 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "generate-source-maps-ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios-release.bundle --sourcemap-output ios-release.bundle.map", "generate-source-maps-android": "bugsnag-sourcemaps", "postinstall": "patch-package && jetify", - "play": "npx react-native run-android --variant=playDebug", + "play": "npx react-native run-android --variant=playDebug", "foss": "npx react-native run-android --variant=fossDebug" }, "husky": { @@ -67,6 +67,7 @@ "react-native-audio": "^4.3.0", "react-native-background-timer": "2.2.0", "react-native-bootsplash": "2.2.4", + "react-native-config-reader": "^4.1.1", "react-native-console-time-polyfill": "^1.2.1", "react-native-device-info": "5.5.7", "react-native-document-picker": "3.3.3", diff --git a/yarn.lock b/yarn.lock index 57deed3da..8f5a51ddf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11770,6 +11770,11 @@ react-native-bootsplash@2.2.4: jimp "0.10.1" prompts "2.3.2" +react-native-config-reader@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/react-native-config-reader/-/react-native-config-reader-4.1.1.tgz#478b69e32adcc2e9a14f6ef5fa2cbbe012b9a27e" + integrity sha512-f+I9DkmJS5UYE++vgSBIFG/TUxxCy9GSpcDFmVj7TDNW9w+Nozc98pdene/VYFzg9QRE7hejRoA6yV1Lv+QbCw== + react-native-console-time-polyfill@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/react-native-console-time-polyfill/-/react-native-console-time-polyfill-1.2.1.tgz#3bf9a1d1d1ce3a05325fe1f2e5c4e5a1c25d910f"