This commit is contained in:
GOVINDDIXIT 2020-07-08 15:35:47 +05:30
parent ed42199ad8
commit 512a7774d0
5 changed files with 22 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import RNUserDefaults from 'rn-user-defaults';
import { KeyCommandsEmitter } from 'react-native-keycommands'; import { KeyCommandsEmitter } from 'react-native-keycommands';
import RNScreens from 'react-native-screens'; import RNScreens from 'react-native-screens';
import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context'; import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context';
import RNConfigReader from 'react-native-config-reader';
import { import {
defaultTheme, defaultTheme,
@ -40,6 +41,8 @@ import debounce from './utils/debounce';
RNScreens.enableScreens(); RNScreens.enableScreens();
const configValue = RNConfigReader.PLAY_BUILD;
const parseDeepLinking = (url) => { const parseDeepLinking = (url) => {
if (url) { if (url) {
url = url.replace(/rocketchat:\/\/|https:\/\/go.rocket.chat\//, ''); url = url.replace(/rocketchat:\/\/|https:\/\/go.rocket.chat\//, '');
@ -160,7 +163,9 @@ export default class Root extends React.Component {
if (!allowCrashReport) { if (!allowCrashReport) {
loggerConfig.autoNotify = false; loggerConfig.autoNotify = false;
loggerConfig.registerBeforeSendCallback(() => false); loggerConfig.registerBeforeSendCallback(() => false);
analytics().setAnalyticsCollectionEnabled(false); if (configValue) {
analytics().setAnalyticsCollectionEnabled(false);
}
} }
}); });
} }

View File

@ -1,9 +1,8 @@
import EJSON from 'ejson'; import EJSON from 'ejson';
import RNConfigReader from 'react-native-config-reader';
import PushNotification from './push'; import PushNotification from './push';
import store from '../../lib/createStore'; import store from '../../lib/createStore';
import { deepLinkingOpen } from '../../actions/deepLinking'; import { deepLinkingOpen } from '../../actions/deepLinking';
import RNConfigReader from 'react-native-config-reader';
export const onNotification = (notification) => { export const onNotification = (notification) => {
if (notification) { if (notification) {
@ -39,7 +38,7 @@ export const getDeviceToken = () => PushNotification.getDeviceToken();
export const setBadgeCount = count => PushNotification.setBadgeCount(count); export const setBadgeCount = count => PushNotification.setBadgeCount(count);
export const initializePushNotifications = () => { export const initializePushNotifications = () => {
const configValue = RNConfigReader.PLAY_BUILD; const configValue = RNConfigReader.PLAY_BUILD;
if(configValue){ if (configValue) {
setBadgeCount(); setBadgeCount();
return PushNotification.configure({ return PushNotification.configure({
onNotification onNotification

View File

@ -6,7 +6,7 @@ import config from '../../config';
const configValue = RNConfigReader.PLAY_BUILD; const configValue = RNConfigReader.PLAY_BUILD;
const bugsnag = new Client(config.BUGSNAG_API_KEY); const bugsnag = new Client(config.BUGSNAG_API_KEY);
export const { analytics } = firebase; export const { analytics } = firebase != null;
export const loggerConfig = bugsnag.config; export const loggerConfig = bugsnag.config;
export const { leaveBreadcrumb } = bugsnag; export const { leaveBreadcrumb } = bugsnag;
@ -19,7 +19,7 @@ export const logServerVersion = (serverVersion) => {
}; };
export const setCurrentScreen = (currentScreen) => { export const setCurrentScreen = (currentScreen) => {
if(configValue){ if (configValue) {
analytics().setCurrentScreen(currentScreen); analytics().setCurrentScreen(currentScreen);
} }
leaveBreadcrumb(currentScreen, { type: 'navigation' }); leaveBreadcrumb(currentScreen, { type: 'navigation' });

View File

@ -5,6 +5,7 @@ import {
} from 'react-native'; } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import equal from 'deep-equal'; import equal from 'deep-equal';
import RNConfigReader from 'react-native-config-reader';
import { analytics } from '../utils/log'; import { analytics } from '../utils/log';
import sharedStyles from './Styles'; import sharedStyles from './Styles';
@ -18,6 +19,8 @@ import TextInput from '../containers/TextInput';
import { loginRequest as loginRequestAction } from '../actions/login'; import { loginRequest as loginRequestAction } from '../actions/login';
import LoginServices from '../containers/LoginServices'; import LoginServices from '../containers/LoginServices';
const configValue = RNConfigReader.PLAY_BUILD;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
registerDisabled: { registerDisabled: {
...sharedStyles.textRegular, ...sharedStyles.textRegular,
@ -121,7 +124,9 @@ class LoginView extends React.Component {
const { loginRequest } = this.props; const { loginRequest } = this.props;
Keyboard.dismiss(); Keyboard.dismiss();
loginRequest({ user, password }); loginRequest({ user, password });
analytics().logEvent('login'); if (configValue) {
analytics().logEvent('login');
}
} }
renderUserForm = () => { renderUserForm = () => {

View File

@ -5,6 +5,7 @@ import {
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import RNConfigReader from 'react-native-config-reader';
import { logout as logoutAction } from '../../actions/login'; import { logout as logoutAction } from '../../actions/login';
import { selectServerRequest as selectServerRequestAction } from '../../actions/server'; import { selectServerRequest as selectServerRequestAction } from '../../actions/server';
@ -36,6 +37,8 @@ import { onReviewPress } from '../../utils/review';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
const configValue = RNConfigReader.PLAY_BUILD;
const SectionSeparator = React.memo(({ theme }) => ( const SectionSeparator = React.memo(({ theme }) => (
<View <View
style={[ style={[
@ -115,7 +118,9 @@ class SettingsView extends React.Component {
const { toggleCrashReport } = this.props; const { toggleCrashReport } = this.props;
toggleCrashReport(value); toggleCrashReport(value);
loggerConfig.autoNotify = value; loggerConfig.autoNotify = value;
analytics().setAnalyticsCollectionEnabled(value); if (configValue) {
analytics().setAnalyticsCollectionEnabled(value);
}
if (value) { if (value) {
loggerConfig.clearBeforeSendCallbacks(); loggerConfig.clearBeforeSendCallbacks();