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 { productFlavors {
foss { foss {
dimension = "type" dimension = "type"
buildConfigField "boolean", "PLAY_BUILD", "false" buildConfigField "boolean", "FDROID_BUILD", "true"
} }
play { play {
dimension = "type" 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() { protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable") @SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages(); List<ReactPackage> packages = new PackageList(this).getPackages();
if (BuildConfig.PLAY_BUILD) { if (!BuildConfig.FDROID_BUILD) {
packages.add(new RNNotificationsPackage(MainApplication.this)); packages.add(new RNNotificationsPackage(MainApplication.this));
} }
packages.add(new KeyboardInputPackage(MainApplication.this)); packages.add(new KeyboardInputPackage(MainApplication.this));

View File

@ -1,3 +1,3 @@
import RNConfigReader from 'react-native-config-reader'; 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 InAppNotification from './containers/InAppNotification';
import { ActionSheetProvider } from './containers/ActionSheet'; import { ActionSheetProvider } from './containers/ActionSheet';
import debounce from './utils/debounce'; import debounce from './utils/debounce';
import { isGooglePlayBuild } from './constants/environment'; import { isFDroidBuild } from './constants/environment';
RNScreens.enableScreens(); RNScreens.enableScreens();
@ -59,7 +59,7 @@ export default class Root extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.init(); this.init();
if (isGooglePlayBuild) { if (!isFDroidBuild) {
this.initCrashReport(); this.initCrashReport();
} }
const { width, height, scale } = Dimensions.get('window'); const { width, height, scale } = Dimensions.get('window');

View File

@ -2,7 +2,7 @@ import EJSON from 'ejson';
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 { isGooglePlayBuild } from '../../constants/environment'; import { isFDroidBuild } from '../../constants/environment';
export const onNotification = (notification) => { export const onNotification = (notification) => {
if (notification) { if (notification) {
@ -37,7 +37,7 @@ export const onNotification = (notification) => {
export const getDeviceToken = () => PushNotification.getDeviceToken(); 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 = () => {
if (isGooglePlayBuild) { if (!isFDroidBuild) {
setBadgeCount(); setBadgeCount();
return PushNotification.configure({ return PushNotification.configure({
onNotification onNotification

View File

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

View File

@ -5,7 +5,7 @@ import { isIOS } from './deviceInfo';
import I18n from '../i18n'; import I18n from '../i18n';
import { showErrorAlert } from './info'; import { showErrorAlert } from './info';
import { STORE_REVIEW_LINK } from '../constants/links'; import { STORE_REVIEW_LINK } from '../constants/links';
import { isGooglePlayBuild } from '../constants/environment'; import { isFDroidBuild } from '../constants/environment';
const store = isIOS ? 'App Store' : 'Play Store'; 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 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 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); setTimeout(askReview, reviewDelay);
} }
}; };

View File

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