diff --git a/react-native/src/status_im/react_native/js_dependencies.cljs b/react-native/src/status_im/react_native/js_dependencies.cljs index b1ffbe48ff..4b904b0332 100644 --- a/react-native/src/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/status_im/react_native/js_dependencies.cljs @@ -4,6 +4,7 @@ (def android-sms-listener (js/require "react-native-android-sms-listener")) (def autolink (js/require "react-native-autolink")) (def camera (js/require "react-native-camera")) +(def config (js/require "react-native-config")) ;; TODO see https://github.com/rt2zz/react-native-contacts/issues/45 (def contacts (js/require "react-native-contacts")) (def dialogs (js/require "react-native-dialogs")) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index 9a78038f92..745bb8bafb 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -322,4 +322,8 @@ :contract-creation "Contract Creation" ;:webview - :web-view-error "oops, error"}) + :web-view-error "oops, error" + + ;;testfairy warning + :testfairy-title "Warning!" + :testfairy-message "You are using app installed from a nightly build. For testing purposes this build includes session recording if wifi connection is used, so all your interaction with app is saved (as video and log) and might be used by development team to investigate possible issues. Saved video/log do not include your passwords. Recording is done only if app is installed from a nightly build. Nothing is recorded if app is installed from PlayStore or TestFlight."}) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs index 97d73150e8..42010abc1f 100644 --- a/src/status_im/ui/screens/events.cljs +++ b/src/status_im/ui/screens/events.cljs @@ -30,7 +30,10 @@ [status-im.constants :refer [console-chat-id]] [status-im.utils.instabug :as inst] [status-im.utils.platform :as platform] - [status-im.js-dependencies :as dependencies])) + [status-im.js-dependencies :as dependencies] + [status-im.utils.utils :as utils] + [status-im.utils.config :as config] + [status-im.i18n :as i18n])) ;;;; COFX @@ -93,6 +96,14 @@ (fn [[permissions then else]] (permissions/request-permissions permissions then else))) +(reg-fx + ::testfairy-alert + (fn [] + (when config/testfairy-enabled? + (utils/show-popup + (i18n/label :testfairy-title) + (i18n/label :testfairy-message))))) + ;;;; Handlers (register-handler-db @@ -108,12 +119,13 @@ (register-handler-fx :initialize-app (fn [_ _] - {:dispatch-n [[:initialize-db] - [:load-accounts] - [:check-console-chat] - [:listen-to-network-status!] - [:initialize-crypt] - [:initialize-geth]]})) + {::testfairy-alert nil + :dispatch-n [[:initialize-db] + [:load-accounts] + [:check-console-chat] + [:listen-to-network-status!] + [:initialize-crypt] + [:initialize-geth]]})) (register-handler-fx :initialize-db @@ -252,4 +264,4 @@ (register-handler-db :update-geolocation (fn [db [_ geolocation]] - (assoc db :geolocation geolocation))) \ No newline at end of file + (assoc db :geolocation geolocation))) diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs new file mode 100644 index 0000000000..27ac22c0bf --- /dev/null +++ b/src/status_im/utils/config.cljs @@ -0,0 +1,9 @@ +(ns status-im.utils.config + (:require [status-im.react-native.js-dependencies :as rn-dependencies])) + +(def config (js->clj (.-default rn-dependencies/config) :keywordize-keys true)) + +(defn get-config [k] + (get config k)) + +(def testfairy-enabled? (= "1" (get-config :TESTFAIRY_ENABLED))) diff --git a/test/cljs/status_im/react_native/js_dependencies.cljs b/test/cljs/status_im/react_native/js_dependencies.cljs index 817f22b450..79e1a28715 100644 --- a/test/cljs/status_im/react_native/js_dependencies.cljs +++ b/test/cljs/status_im/react_native/js_dependencies.cljs @@ -3,6 +3,7 @@ (def action-button #js {}) (def android-sms-listener #js {}) (def autolink #js {:default #js {}}) +(def config #js {:default #js {}}) (def camera #js {:constants #js {}}) (def circle-checkbox #js {}) (def contacts #js {})