From 88cee34997a30588fa470574c6caf3f32c3f92eb Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 17 May 2017 16:22:10 +0300 Subject: [PATCH] disable Instabug for development env --- .../im/status/ethereum/MainApplication.java | 113 +++++++++--------- ios/StatusIm/AppDelegate.m | 2 + src/status_im/utils/instabug.cljs | 8 +- 3 files changed, 66 insertions(+), 57 deletions(-) diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index 9f6f1ca893..7fb5c50edc 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -1,74 +1,77 @@ package im.status.ethereum; import android.app.Application; - -import com.facebook.react.ReactApplication; -import com.pusherman.networkinfo.RNNetworkInfoPackage; -import me.alwx.HttpServer.HttpServerReactPackage; -import es.tiarg.nfcreactnative.NfcReactNativePackage; -import com.instabug.reactlibrary.RNInstabugReactnativePackage; +import com.BV.LinearGradient.LinearGradientPackage; +import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage; +import com.bitgo.randombytes.RandomBytesPackage; import com.cboy.rn.splashscreen.SplashScreenReactPackage; +import com.centaurwarchief.smslistener.SmsListenerPackage; +import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; - +import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage; +import com.github.yamill.orientation.OrientationPackage; +import com.i18n.reactnativei18n.ReactNativeI18n; +import com.instabug.reactlibrary.RNInstabugReactnativePackage; +import com.lwansbrough.RCTCamera.RCTCameraPackage; +import com.oblador.vectoricons.VectorIconsPackage; +import com.pusherman.networkinfo.RNNetworkInfoPackage; +import com.reactnative.ivpusic.imagepicker.PickerPackage; +import com.rnfs.RNFSPackage; +import com.rt2zz.reactnativecontacts.ReactNativeContacts; +import es.tiarg.nfcreactnative.NfcReactNativePackage; +import fr.bamlab.rnimageresizer.ImageResizerPackage; import im.status.ethereum.module.StatusPackage; import io.realm.react.RealmReactPackage; -import com.oblador.vectoricons.VectorIconsPackage; -import com.rt2zz.reactnativecontacts.ReactNativeContacts; -import com.i18n.reactnativei18n.ReactNativeI18n; -import com.bitgo.randombytes.RandomBytesPackage; -import com.BV.LinearGradient.LinearGradientPackage; -import com.lwansbrough.RCTCamera.*; -import com.centaurwarchief.smslistener.SmsListenerPackage; -import com.github.yamill.orientation.OrientationPackage; -import com.rnfs.RNFSPackage; -import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage; -import fr.bamlab.rnimageresizer.ImageResizerPackage; -import com.reactnative.ivpusic.imagepicker.PickerPackage; -import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage; +import me.alwx.HttpServer.HttpServerReactPackage; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + List packages = Arrays.asList( + new MainReactPackage(), + new RNNetworkInfoPackage(), + new HttpServerReactPackage(), + new NfcReactNativePackage(), + new SplashScreenReactPackage(), + new StatusPackage(BuildConfig.DEBUG), + new RealmReactPackage(), + new VectorIconsPackage(), + new ReactNativeContacts(), + new ReactNativeI18n(), + new RandomBytesPackage(), + new LinearGradientPackage(), + new RCTCameraPackage(), + new SmsListenerPackage(), + new OrientationPackage(), + new RNFSPackage(), + new ReactNativeDialogsPackage(), + new ImageResizerPackage(), + new PickerPackage(), + new WebViewBridgePackage(BuildConfig.DEBUG) + ); + + if (!BuildConfig.DEBUG) { + packages.add(new RNInstabugReactnativePackage("b239f82a9cb00464e4c72cc703e6821e", MainApplication.this, "shake")); + } + + return packages; + } + }; @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new RNNetworkInfoPackage(), - new HttpServerReactPackage(), - new NfcReactNativePackage(), - new RNInstabugReactnativePackage("b239f82a9cb00464e4c72cc703e6821e",MainApplication.this,"shake"), - new SplashScreenReactPackage(), - new StatusPackage(BuildConfig.DEBUG), - new RealmReactPackage(), - new VectorIconsPackage(), - new ReactNativeContacts(), - new ReactNativeI18n(), - new RandomBytesPackage(), - new LinearGradientPackage(), - new RCTCameraPackage(), - new SmsListenerPackage(), - new OrientationPackage(), - new RNFSPackage(), - new ReactNativeDialogsPackage(), - new ImageResizerPackage(), - new PickerPackage(), - new WebViewBridgePackage(BuildConfig.DEBUG) - ); + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } } diff --git a/ios/StatusIm/AppDelegate.m b/ios/StatusIm/AppDelegate.m index 8b7d8aea71..a0b4291fc2 100644 --- a/ios/StatusIm/AppDelegate.m +++ b/ios/StatusIm/AppDelegate.m @@ -34,7 +34,9 @@ rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; +#ifndef DEBUG [Instabug startWithToken:@"5534212f4a44f477c9ab270ab5cd2062" invocationEvent:IBGInvocationEventShake]; +#endif [SplashScreen show]; return YES; } diff --git a/src/status_im/utils/instabug.cljs b/src/status_im/utils/instabug.cljs index 990a866dd8..ff53103ba6 100644 --- a/src/status_im/utils/instabug.cljs +++ b/src/status_im/utils/instabug.cljs @@ -1,5 +1,9 @@ -(ns status-im.utils.instabug) +(ns status-im.utils.instabug + (:require [taoensso.timbre :as log])) (def instabug-rn (js/require "instabug-reactnative")) -(defn log [str] (.IBGLog instabug-rn str)) +(defn log [str] + (if js/goog.DEBUG + (log/debug str) + (.IBGLog instabug-rn str)))