use negation for builds

This commit is contained in:
GOVINDDIXIT 2020-07-27 21:35:26 +05:30
parent 50862b1438
commit 4660822311
8 changed files with 19 additions and 19 deletions

View File

@ -194,11 +194,11 @@ android {
productFlavors {
foss {
dimension = "type"
buildConfigField "boolean", "PLAY_BUILD", "false"
buildConfigField "boolean", "FDROID_BUILD", "true"
}
play {
dimension = "type"
buildConfigField "boolean", "PLAY_BUILD", "true"
buildConfigField "boolean", "FDROID_BUILD", "false"
}
}

View File

@ -49,7 +49,7 @@ public class MainApplication extends Application implements ReactApplication, IN
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
if (BuildConfig.PLAY_BUILD) {
if (!BuildConfig.FDROID_BUILD) {
packages.add(new RNNotificationsPackage(MainApplication.this));
}
packages.add(new KeyboardInputPackage(MainApplication.this));

View File

@ -1,3 +1,3 @@
import RNConfigReader from 'react-native-config-reader';
export const isGooglePlayBuild = RNConfigReader.PLAY_BUILD;
export const isFDroidBuild = RNConfigReader.FDROID_BUILD;

View File

@ -36,7 +36,7 @@ import Toast from './containers/Toast';
import InAppNotification from './containers/InAppNotification';
import { ActionSheetProvider } from './containers/ActionSheet';
import debounce from './utils/debounce';
import { isGooglePlayBuild } from './constants/environment';
import { isFDroidBuild } from './constants/environment';
RNScreens.enableScreens();
@ -59,7 +59,7 @@ export default class Root extends React.Component {
constructor(props) {
super(props);
this.init();
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
this.initCrashReport();
}
const { width, height, scale } = Dimensions.get('window');

View File

@ -2,7 +2,7 @@ import EJSON from 'ejson';
import PushNotification from './push';
import store from '../../lib/createStore';
import { deepLinkingOpen } from '../../actions/deepLinking';
import { isGooglePlayBuild } from '../../constants/environment';
import { isFDroidBuild } from '../../constants/environment';
export const onNotification = (notification) => {
if (notification) {
@ -37,7 +37,7 @@ export const onNotification = (notification) => {
export const getDeviceToken = () => PushNotification.getDeviceToken();
export const setBadgeCount = count => PushNotification.setBadgeCount(count);
export const initializePushNotifications = () => {
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
setBadgeCount();
return PushNotification.configure({
onNotification

View File

@ -1,7 +1,7 @@
import { Client } from 'bugsnag-react-native';
import analytics from '@react-native-firebase/analytics';
import crashlytics from '@react-native-firebase/crashlytics';
import { isGooglePlayBuild } from '../../constants/environment';
import { isFDroidBuild } from '../../constants/environment';
import config from '../../../config';
import events from './events';
@ -21,14 +21,14 @@ export const logServerVersion = (serverVersion) => {
};
export const logEvent = (eventName, payload) => {
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
analytics().logEvent(eventName, payload);
leaveBreadcrumb(eventName, payload);
}
};
export const setCurrentScreen = (currentScreen) => {
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
analytics().setCurrentScreen(currentScreen);
leaveBreadcrumb(currentScreen, { type: 'navigation' });
}
@ -43,7 +43,7 @@ export default (e) => {
}
};
});
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
crashlytics().recordError(e);
}
} else {

View File

@ -5,7 +5,7 @@ import { isIOS } from './deviceInfo';
import I18n from '../i18n';
import { showErrorAlert } from './info';
import { STORE_REVIEW_LINK } from '../constants/links';
import { isGooglePlayBuild } from '../constants/environment';
import { isFDroidBuild } from '../constants/environment';
const store = isIOS ? 'App Store' : 'Play Store';
@ -76,7 +76,7 @@ const tryReview = async() => {
// if ask me later was pressed earlier, we can ask for review only after {{numberOfDays}} days
// if there's no review and it wasn't dismissed by the user
if (daysBetween(lastReviewDate, new Date()) >= numberOfDays && !doneReview && isGooglePlayBuild) {
if (daysBetween(lastReviewDate, new Date()) >= numberOfDays && !doneReview && !isFDroidBuild) {
setTimeout(askReview, reviewDelay);
}
};

View File

@ -38,7 +38,7 @@ import { appStart as appStartAction, ROOT_LOADING } from '../../actions/app';
import { onReviewPress } from '../../utils/review';
import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView';
import { isGooglePlayBuild } from '../../constants/environment';
import { isFDroidBuild } from '../../constants/environment';
const SectionSeparator = React.memo(({ theme }) => (
@ -121,7 +121,7 @@ class SettingsView extends React.Component {
AsyncStorage.setItem(CRASH_REPORT_KEY, JSON.stringify(value));
const { toggleCrashReport } = this.props;
toggleCrashReport(value);
if (isGooglePlayBuild) {
if (!isFDroidBuild) {
loggerConfig.autoNotify = value;
analytics().setAnalyticsCollectionEnabled(value);
if (value) {
@ -161,7 +161,7 @@ class SettingsView extends React.Component {
shareApp = () => {
// eslint-disable-next-line no-nested-ternary
Share.share({ message: isAndroid ? (isGooglePlayBuild ? PLAY_MARKET_LINK : FDROID_MARKET_LINK) : APP_STORE_LINK });
Share.share({ message: isAndroid ? (!isFDroidBuild ? PLAY_MARKET_LINK : FDROID_MARKET_LINK) : APP_STORE_LINK });
}
copyServerVersion = () => {
@ -257,7 +257,7 @@ class SettingsView extends React.Component {
theme={theme}
/>
<Separator theme={theme} />
{isGooglePlayBuild ? (
{!isFDroidBuild ? (
<>
<ListItem
title={I18n.t('Review_this_app')}
@ -347,7 +347,7 @@ class SettingsView extends React.Component {
</>
) : null}
{isGooglePlayBuild ? (
{!isFDroidBuild ? (
<>
<ListItem
title={I18n.t('Send_crash_report')}