diff --git a/.env b/.env index abb463faa0..5325085e90 100644 --- a/.env +++ b/.env @@ -1,11 +1,9 @@ TESTFAIRY_ENABLED=0 ETHEREUM_DEV_CLUSTER=1 -OFFLINE_INBOX_ENABLED=1 RPC_NETWORKS_ONLY=1 LOG_LEVEL=debug LOG_LEVEL_STATUS_GO=info FLEET=eth.beta -QUEUE_MESSAGE_ENABLED=1 RN_BRIDGE_THRESHOLD_WARNINGS=0 POW_TARGET=0.002 POW_TIME=1 @@ -15,6 +13,4 @@ INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=1 INSTABUG_SURVEYS=1 GROUP_CHATS_ENABLED=0 -USE_SYM_KEY=0 -SPAM_BUTTON_DETECTION_ENABLED=1 CACHED_WEBVIEWS_ENABLED=1 diff --git a/.env.e2e b/.env.e2e index 580e5fdebb..ba037eb6a2 100644 --- a/.env.e2e +++ b/.env.e2e @@ -1,18 +1,12 @@ TESTFAIRY_ENABLED=1 ETHEREUM_DEV_CLUSTER=1 -OFFLINE_INBOX_ENABLED=1 LOG_LEVEL=debug LOG_LEVEL_STATUS_GO=info FLEET=eth.beta -JSC_ENABLED=1 -QUEUE_MESSAGE_ENABLED=1 RN_BRIDGE_THRESHOLD_WARNINGS=0 -COMPILE_VIEWS_ENABLED=0 POW_TARGET=0.002 POW_TIME=1 DEFAULT_NETWORK=testnet_rpc INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=1 -INSTABUG_SURVEYS=0 -GROUP_CHATS_ENABLED=1 -USE_SYM_KEY=0 +GROUP_CHATS_ENABLED=1 \ No newline at end of file diff --git a/.env.jenkins b/.env.jenkins index eacb39b85b..2641852ad6 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -1,11 +1,8 @@ TESTFAIRY_ENABLED=1 ETHEREUM_DEV_CLUSTER=1 -OFFLINE_INBOX_ENABLED=1 LOG_LEVEL=debug LOG_LEVEL_STATUS_GO=info FLEET=eth.beta -JSC_ENABLED=1 -QUEUE_MESSAGE_ENABLED=1 RN_BRIDGE_THRESHOLD_WARNINGS=0 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 POW_TARGET=0.002 @@ -13,9 +10,6 @@ POW_TIME=1 DEFAULT_NETWORK=mainnet_rpc INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=1 -INSTABUG_SURVEYS=1 GROUP_CHATS_ENABLED=0 -USE_SYM_KEY=0 -SPAM_BUTTON_DETECTION_ENABLED=1 MAINNET_WARNING_ENABLED=1 CACHED_WEBVIEWS_ENABLED=1 diff --git a/.env.nightly b/.env.nightly index bbbc682902..c06280ab33 100644 --- a/.env.nightly +++ b/.env.nightly @@ -1,11 +1,8 @@ TESTFAIRY_ENABLED=1 ETHEREUM_DEV_CLUSTER=1 -OFFLINE_INBOX_ENABLED=1 LOG_LEVEL=debug LOG_LEVEL_STATUS_GO=info FLEET=eth.beta -JSC_ENABLED=1 -QUEUE_MESSAGE_ENABLED=1 RN_BRIDGE_THRESHOLD_WARNINGS=0 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 POW_TARGET=0.002 @@ -13,7 +10,5 @@ POW_TIME=1 DEFAULT_NETWORK=mainnet_rpc INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=1 -INSTABUG_SURVEYS=1 GROUP_CHATS_ENABLED=0 -SPAM_BUTTON_DETECTION_ENABLED=1 MAINNET_WARNING_ENABLED=1 diff --git a/.env.nightly.staging.fleet b/.env.nightly.staging.fleet index c4b949a406..8c7daf434e 100644 --- a/.env.nightly.staging.fleet +++ b/.env.nightly.staging.fleet @@ -1,11 +1,8 @@ TESTFAIRY_ENABLED=1 ETHEREUM_DEV_CLUSTER=1 -OFFLINE_INBOX_ENABLED=1 LOG_LEVEL=debug LOG_LEVEL_STATUS_GO=info FLEET=eth.staging -JSC_ENABLED=1 -QUEUE_MESSAGE_ENABLED=1 RN_BRIDGE_THRESHOLD_WARNINGS=0 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 POW_TARGET=0.002 @@ -15,5 +12,4 @@ INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=1 INSTABUG_SURVEYS=1 GROUP_CHATS_ENABLED=0 -SPAM_BUTTON_DETECTION_ENABLED=1 MAINNET_WARNING_ENABLED=1 diff --git a/.env.prod b/.env.prod index 4e610020b5..5e5ed82008 100644 --- a/.env.prod +++ b/.env.prod @@ -1,12 +1,10 @@ TESTFAIRY_ENABLED=0 ETHEREUM_DEV_CLUSTER=0 MAINNET_WARNING_ENABLED=1 -OFFLINE_INBOX_ENABLED=1 RPC_NETWORKS_ONLY=1 LOG_LEVEL=info LOG_LEVEL_STATUS_GO= FLEET=eth.beta -QUEUE_MESSAGE_ENABLED=0 RN_BRIDGE_THRESHOLD_WARNINGS=0 POW_TARGET=0.002 POW_TIME=1 @@ -14,8 +12,5 @@ DEFAULT_NETWORK=mainnet_rpc TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c DEBUG_WEBVIEW=0 -INSTABUG_SURVEYS=1 GROUP_CHATS_ENABLED=0 -USE_SYM_KEY=0 -MAINNET_WARNING_ENABLED=1 -SPAM_BUTTON_DETECTION_ENABLED=1 +MAINNET_WARNING_ENABLED=1 \ No newline at end of file diff --git a/src/status_im/chat/models/input.cljs b/src/status_im/chat/models/input.cljs index 4eea74a02b..7daa570382 100644 --- a/src/status_im/chat/models/input.cljs +++ b/src/status_im/chat/models/input.cljs @@ -118,9 +118,7 @@ chat/cooldowns chat/spam-messages-frequency current-chat-id] :as db} :db :as cofx}] - (when (and - config/spam-button-detection-enabled? - (chat-model/public-chat? current-chat-id cofx)) + (when (chat-model/public-chat? current-chat-id cofx) (let [spamming-fast? (< (- (datetime/timestamp) last-outgoing-message-sent-at) (+ const/spam-interval-ms (* 1000 cooldowns))) spamming-frequently? (= const/spam-message-frequency-threshold spam-messages-frequency)] diff --git a/src/status_im/transport/filters.cljs b/src/status_im/transport/filters.cljs index c674f456c7..08afde79d4 100644 --- a/src/status_im/transport/filters.cljs +++ b/src/status_im/transport/filters.cljs @@ -22,9 +22,7 @@ (defn add-filter! [web3 {:keys [topics to] :as options} callback] - (let [options (if config/offline-inbox-enabled? - (assoc options :allowP2P true) - options)] + (let [options (assoc options :allowP2P true)] (log/debug :add-filter options) (add-shh-filter! web3 options callback))) diff --git a/src/status_im/transport/inbox.cljs b/src/status_im/transport/inbox.cljs index 674c7c6f3a..ea63f30fc6 100644 --- a/src/status_im/transport/inbox.cljs +++ b/src/status_im/transport/inbox.cljs @@ -185,25 +185,23 @@ {:keys [address] :as wnode} (models.mailserver/fetch-current cofx) peers-summary (:peers-summary db) connected? (registered-peer? peers-summary address)] - (when config/offline-inbox-enabled? - (if connected? - (handlers-macro/merge-fx cofx - (update-mailserver-status :connected) - (generate-mailserver-symkey wnode)) - (handlers-macro/merge-fx cofx - {::add-peer {:wnode address} - :utils/dispatch-later [{:ms connection-timeout - :dispatch [:inbox/check-connection]}]} - (update-mailserver-status :connecting) - (generate-mailserver-symkey wnode)))))) + (if connected? + (handlers-macro/merge-fx cofx + (update-mailserver-status :connected) + (generate-mailserver-symkey wnode)) + (handlers-macro/merge-fx cofx + {::add-peer {:wnode address} + :utils/dispatch-later [{:ms connection-timeout + :dispatch [:inbox/check-connection]}]} + (update-mailserver-status :connecting) + (generate-mailserver-symkey wnode))))) (defn peers-summary-change-fx "There is only 2 summary changes that require offline inboxing action: - mailserver disconnected: we try to reconnect - mailserver connected: we mark the mailserver as trusted peer" [previous-summary {:keys [db] :as cofx}] - (when (and (:account/account db) - config/offline-inbox-enabled?) + (when (:account/account db) (let [{:keys [peers-summary peers-count]} db wnode (:address (models.mailserver/fetch-current cofx)) mailserver-was-registered? (registered-peer? previous-summary diff --git a/src/status_im/ui/screens/offline_messaging_settings/views.cljs b/src/status_im/ui/screens/offline_messaging_settings/views.cljs index 1c49f6ddc8..d76cefddc7 100644 --- a/src/status_im/ui/screens/offline_messaging_settings/views.cljs +++ b/src/status_im/ui/screens/offline_messaging_settings/views.cljs @@ -48,9 +48,8 @@ [toolbar/toolbar {} toolbar/default-nav-back [toolbar/content-title (i18n/label :t/offline-messaging-settings)] - (when config/add-custom-mailservers-enabled? - [toolbar/actions - [(toolbar.actions/add false (partial navigate-to-add-mailserver nil))]])] + [toolbar/actions + [(toolbar.actions/add false (partial navigate-to-add-mailserver nil))]]] [react/view styles/wrapper [list/flat-list {:data (vals wnodes) :default-separator? false diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 7eaf9dd54f..dd8a554b45 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -151,13 +151,11 @@ :value (get-in networks [network :name]) :action-fn #(re-frame/dispatch [:navigate-to :network-settings]) :accessibility-label :network-button}]) - (when config/offline-inbox-enabled? - [profile.components/settings-item-separator]) - (when config/offline-inbox-enabled? - [profile.components/settings-item - {:label-kw :t/offline-messaging - :action-fn #(re-frame/dispatch [:navigate-to :offline-messaging-settings]) - :accessibility-label :offline-messages-settings-button}]) + [profile.components/settings-item-separator] + [profile.components/settings-item + {:label-kw :t/offline-messaging + :action-fn #(re-frame/dispatch [:navigate-to :offline-messaging-settings]) + :accessibility-label :offline-messages-settings-button}] (when config/bootnodes-settings-enabled? [profile.components/settings-item-separator]) (when config/bootnodes-settings-enabled? diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 9fbe27c277..30b52304bc 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -15,34 +15,28 @@ ;; flags stay up to date and are removed once behavior introduced is stable. ;; ;; TESTFAIRY_ENABLED - indefinite -;; OFFLINE_INBOX_ENABLED - TBD, tenatively until #idea 1 is merged +;; CONFIG FLAGS (def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED))) -(def offline-inbox-enabled? (enabled? (get-config :OFFLINE_INBOX_ENABLED "1"))) + (def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1"))) -(def universal-links-enabled? (enabled? (get-config :UNIVERSAL_LINK_ENABLED "1"))) +(def rpc-networks-only? (enabled? (get-config :RPC_NETWORKS_ONLY "1"))) +(def group-chats-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED))) +(def mainnet-warning-enabled? (enabled? (get-config :MAINNET_WARNING_ENABLED 0))) +(def in-app-notifications-enabled? (enabled? (get-config :IN_APP_NOTIFICATIONS_ENABLED 0))) +(def cached-webviews-enabled? (enabled? (get-config :CACHED_WEBVIEWS_ENABLED 0))) +(def rn-bridge-threshold-warnings-enabled? (enabled? (get-config :RN_BRIDGE_THRESHOLD_WARNINGS 0))) + +;; CONFIG VALUES (def log-level (-> (get-config :LOG_LEVEL "error") string/lower-case keyword)) - (def fleet (get-config :FLEET "eth.beta")) -(def add-custom-mailservers-enabled? (enabled? (get-config :ADD_CUSTOM_MAILSERVERS_ENABLED "1"))) -(def rn-bridge-threshold-warnings-enabled? (enabled? (get-config :RN_BRIDGE_THRESHOLD_WARNINGS 0))) (def default-network (get-config :DEFAULT_NETWORK)) ;; the default value should be a string for `enabled?` to work correctly. -(def rpc-networks-only? (enabled? (get-config :RPC_NETWORKS_ONLY "1"))) (def testfairy-token (get-config :TESTFAIRY_TOKEN)) (def instabug-token (get-config :INSTABUG_TOKEN)) -(def instabug-surveys-enabled? (get-config :INSTABUG_SURVEYS)) -(def force-sr-ratio-tracking (get-config :FORCE_SENT_RECEIVED_TRACKING)) - (def pow-target (js/parseFloat (get-config :POW_TARGET "0.002"))) (def pow-time (js/parseInt (get-config :POW_TIME "1"))) (def use-sym-key (enabled? (get-config :USE_SYM_KEY 0))) - -(def group-chats-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED))) -(def spam-button-detection-enabled? (enabled? (get-config :SPAM_BUTTON_DETECTION_ENABLED "0"))) -(def mainnet-warning-enabled? (enabled? (get-config :MAINNET_WARNING_ENABLED 0))) -(def in-app-notifications-enabled? (enabled? (get-config :IN_APP_NOTIFICATIONS_ENABLED 0))) -(def cached-webviews-enabled? (enabled? (get-config :CACHED_WEBVIEWS_ENABLED 0))) diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index 44a9643e01..be7d44a30a 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -85,10 +85,9 @@ "Store url in the database if the user is not logged in, to be processed on login, otherwise just handle it" [url cofx] - (when config/universal-links-enabled? - (if (models.account/logged-in? cofx) - (route-url url cofx) - (store-url-for-later url cofx)))) + (if (models.account/logged-in? cofx) + (route-url url cofx) + (store-url-for-later url cofx))) (defn process-stored-event "Return an event description for processing a url if in the database" @@ -110,18 +109,16 @@ "Add an event listener for handling background->foreground transition and handles incoming url if the app has been started by clicking on a link" [] - (when config/universal-links-enabled? - (log/debug "universal-links: initializing") - (.. react/linking - (getInitialURL) - (then dispatch-url)) - (.. react/linking - (addEventListener "url" url-event-listener)))) + (log/debug "universal-links: initializing") + (.. react/linking + (getInitialURL) + (then dispatch-url)) + (.. react/linking + (addEventListener "url" url-event-listener))) (defn finalize "Remove event listener for url" [] - (when config/universal-links-enabled? - (log/debug "universal-links: finalizing") - (.. react/linking - (removeEventListener "url" url-event-listener)))) + (log/debug "universal-links: finalizing") + (.. react/linking + (removeEventListener "url" url-event-listener))) diff --git a/src/status_im/utils/universal_links/events.cljs b/src/status_im/utils/universal_links/events.cljs index b34b72fcb4..29649b1c43 100644 --- a/src/status_im/utils/universal_links/events.cljs +++ b/src/status_im/utils/universal_links/events.cljs @@ -10,5 +10,4 @@ :handle-universal-link (fn [cofx [_ url]] (log/debug "universal links: event received for " url) - (when config/universal-links-enabled? - (universal-links/handle-url url cofx)))) + (universal-links/handle-url url cofx))) diff --git a/test/cljs/status_im/test/chat/models/input.cljs b/test/cljs/status_im/test/chat/models/input.cljs index 2e10b0adee..950e2945a8 100644 --- a/test/cljs/status_im/test/chat/models/input.cljs +++ b/test/cljs/status_im/test/chat/models/input.cljs @@ -36,8 +36,7 @@ :chat/cooldowns 0 :chat/spam-messages-frequency 0 :chat/cooldown-enabled? false}] - (with-redefs [datetime/timestamp (constantly 1527675198542) - config/spam-button-detection-enabled? true] + (with-redefs [datetime/timestamp (constantly 1527675198542)] (testing "no spamming detected" (let [expected {:db (assoc db :chat/last-outgoing-message-sent-at 1527675198542)} actual (input/process-cooldown {:db db})]