remove unused flags

reorganize config flags
remove offline-inbox-enabled? flag
remove universal-links-enabled flag
remove add-custom-mailservers-enabled? flag
remove spam-button-detection-enabled? flag
remove flags from config files

Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
This commit is contained in:
Eric Dvorsak 2018-08-28 17:35:53 +02:00
parent b754092710
commit 728831c9c2
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
15 changed files with 46 additions and 96 deletions

4
.env
View File

@ -1,11 +1,9 @@
TESTFAIRY_ENABLED=0 TESTFAIRY_ENABLED=0
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
RPC_NETWORKS_ONLY=1 RPC_NETWORKS_ONLY=1
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_LEVEL_STATUS_GO=info LOG_LEVEL_STATUS_GO=info
FLEET=eth.beta FLEET=eth.beta
QUEUE_MESSAGE_ENABLED=1
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
POW_TARGET=0.002 POW_TARGET=0.002
POW_TIME=1 POW_TIME=1
@ -15,6 +13,4 @@ INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=1 DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1 INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0 GROUP_CHATS_ENABLED=0
USE_SYM_KEY=0
SPAM_BUTTON_DETECTION_ENABLED=1
CACHED_WEBVIEWS_ENABLED=1 CACHED_WEBVIEWS_ENABLED=1

View File

@ -1,18 +1,12 @@
TESTFAIRY_ENABLED=1 TESTFAIRY_ENABLED=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_LEVEL_STATUS_GO=info LOG_LEVEL_STATUS_GO=info
FLEET=eth.beta FLEET=eth.beta
JSC_ENABLED=1
QUEUE_MESSAGE_ENABLED=1
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
COMPILE_VIEWS_ENABLED=0
POW_TARGET=0.002 POW_TARGET=0.002
POW_TIME=1 POW_TIME=1
DEFAULT_NETWORK=testnet_rpc DEFAULT_NETWORK=testnet_rpc
INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=1 DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=0 GROUP_CHATS_ENABLED=1
GROUP_CHATS_ENABLED=1
USE_SYM_KEY=0

View File

@ -1,11 +1,8 @@
TESTFAIRY_ENABLED=1 TESTFAIRY_ENABLED=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_LEVEL_STATUS_GO=info LOG_LEVEL_STATUS_GO=info
FLEET=eth.beta FLEET=eth.beta
JSC_ENABLED=1
QUEUE_MESSAGE_ENABLED=1
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55
POW_TARGET=0.002 POW_TARGET=0.002
@ -13,9 +10,6 @@ POW_TIME=1
DEFAULT_NETWORK=mainnet_rpc DEFAULT_NETWORK=mainnet_rpc
INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=1 DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0 GROUP_CHATS_ENABLED=0
USE_SYM_KEY=0
SPAM_BUTTON_DETECTION_ENABLED=1
MAINNET_WARNING_ENABLED=1 MAINNET_WARNING_ENABLED=1
CACHED_WEBVIEWS_ENABLED=1 CACHED_WEBVIEWS_ENABLED=1

View File

@ -1,11 +1,8 @@
TESTFAIRY_ENABLED=1 TESTFAIRY_ENABLED=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_LEVEL_STATUS_GO=info LOG_LEVEL_STATUS_GO=info
FLEET=eth.beta FLEET=eth.beta
JSC_ENABLED=1
QUEUE_MESSAGE_ENABLED=1
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55
POW_TARGET=0.002 POW_TARGET=0.002
@ -13,7 +10,5 @@ POW_TIME=1
DEFAULT_NETWORK=mainnet_rpc DEFAULT_NETWORK=mainnet_rpc
INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=1 DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0 GROUP_CHATS_ENABLED=0
SPAM_BUTTON_DETECTION_ENABLED=1
MAINNET_WARNING_ENABLED=1 MAINNET_WARNING_ENABLED=1

View File

@ -1,11 +1,8 @@
TESTFAIRY_ENABLED=1 TESTFAIRY_ENABLED=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
OFFLINE_INBOX_ENABLED=1
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_LEVEL_STATUS_GO=info LOG_LEVEL_STATUS_GO=info
FLEET=eth.staging FLEET=eth.staging
JSC_ENABLED=1
QUEUE_MESSAGE_ENABLED=1
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55
POW_TARGET=0.002 POW_TARGET=0.002
@ -15,5 +12,4 @@ INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=1 DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1 INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0 GROUP_CHATS_ENABLED=0
SPAM_BUTTON_DETECTION_ENABLED=1
MAINNET_WARNING_ENABLED=1 MAINNET_WARNING_ENABLED=1

View File

@ -1,12 +1,10 @@
TESTFAIRY_ENABLED=0 TESTFAIRY_ENABLED=0
ETHEREUM_DEV_CLUSTER=0 ETHEREUM_DEV_CLUSTER=0
MAINNET_WARNING_ENABLED=1 MAINNET_WARNING_ENABLED=1
OFFLINE_INBOX_ENABLED=1
RPC_NETWORKS_ONLY=1 RPC_NETWORKS_ONLY=1
LOG_LEVEL=info LOG_LEVEL=info
LOG_LEVEL_STATUS_GO= LOG_LEVEL_STATUS_GO=
FLEET=eth.beta FLEET=eth.beta
QUEUE_MESSAGE_ENABLED=0
RN_BRIDGE_THRESHOLD_WARNINGS=0 RN_BRIDGE_THRESHOLD_WARNINGS=0
POW_TARGET=0.002 POW_TARGET=0.002
POW_TIME=1 POW_TIME=1
@ -14,8 +12,5 @@ DEFAULT_NETWORK=mainnet_rpc
TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55 TESTFAIRY_TOKEN=969f6c921cb435cea1d41d1ea3f5b247d6026d55
INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c INSTABUG_TOKEN=758630ed52864cbad9c5eeeac596c60c
DEBUG_WEBVIEW=0 DEBUG_WEBVIEW=0
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0 GROUP_CHATS_ENABLED=0
USE_SYM_KEY=0 MAINNET_WARNING_ENABLED=1
MAINNET_WARNING_ENABLED=1
SPAM_BUTTON_DETECTION_ENABLED=1

View File

@ -118,9 +118,7 @@
chat/cooldowns chat/cooldowns
chat/spam-messages-frequency chat/spam-messages-frequency
current-chat-id] :as db} :db :as cofx}] current-chat-id] :as db} :db :as cofx}]
(when (and (when (chat-model/public-chat? current-chat-id cofx)
config/spam-button-detection-enabled?
(chat-model/public-chat? current-chat-id cofx))
(let [spamming-fast? (< (- (datetime/timestamp) last-outgoing-message-sent-at) (let [spamming-fast? (< (- (datetime/timestamp) last-outgoing-message-sent-at)
(+ const/spam-interval-ms (* 1000 cooldowns))) (+ const/spam-interval-ms (* 1000 cooldowns)))
spamming-frequently? (= const/spam-message-frequency-threshold spam-messages-frequency)] spamming-frequently? (= const/spam-message-frequency-threshold spam-messages-frequency)]

View File

@ -22,9 +22,7 @@
(defn add-filter! (defn add-filter!
[web3 {:keys [topics to] :as options} callback] [web3 {:keys [topics to] :as options} callback]
(let [options (if config/offline-inbox-enabled? (let [options (assoc options :allowP2P true)]
(assoc options :allowP2P true)
options)]
(log/debug :add-filter options) (log/debug :add-filter options)
(add-shh-filter! web3 options callback))) (add-shh-filter! web3 options callback)))

View File

@ -185,25 +185,23 @@
{:keys [address] :as wnode} (models.mailserver/fetch-current cofx) {:keys [address] :as wnode} (models.mailserver/fetch-current cofx)
peers-summary (:peers-summary db) peers-summary (:peers-summary db)
connected? (registered-peer? peers-summary address)] connected? (registered-peer? peers-summary address)]
(when config/offline-inbox-enabled? (if connected?
(if connected? (handlers-macro/merge-fx cofx
(handlers-macro/merge-fx cofx (update-mailserver-status :connected)
(update-mailserver-status :connected) (generate-mailserver-symkey wnode))
(generate-mailserver-symkey wnode)) (handlers-macro/merge-fx cofx
(handlers-macro/merge-fx cofx {::add-peer {:wnode address}
{::add-peer {:wnode address} :utils/dispatch-later [{:ms connection-timeout
:utils/dispatch-later [{:ms connection-timeout :dispatch [:inbox/check-connection]}]}
:dispatch [:inbox/check-connection]}]} (update-mailserver-status :connecting)
(update-mailserver-status :connecting) (generate-mailserver-symkey wnode)))))
(generate-mailserver-symkey wnode))))))
(defn peers-summary-change-fx (defn peers-summary-change-fx
"There is only 2 summary changes that require offline inboxing action: "There is only 2 summary changes that require offline inboxing action:
- mailserver disconnected: we try to reconnect - mailserver disconnected: we try to reconnect
- mailserver connected: we mark the mailserver as trusted peer" - mailserver connected: we mark the mailserver as trusted peer"
[previous-summary {:keys [db] :as cofx}] [previous-summary {:keys [db] :as cofx}]
(when (and (:account/account db) (when (:account/account db)
config/offline-inbox-enabled?)
(let [{:keys [peers-summary peers-count]} db (let [{:keys [peers-summary peers-count]} db
wnode (:address (models.mailserver/fetch-current cofx)) wnode (:address (models.mailserver/fetch-current cofx))
mailserver-was-registered? (registered-peer? previous-summary mailserver-was-registered? (registered-peer? previous-summary

View File

@ -48,9 +48,8 @@
[toolbar/toolbar {} [toolbar/toolbar {}
toolbar/default-nav-back toolbar/default-nav-back
[toolbar/content-title (i18n/label :t/offline-messaging-settings)] [toolbar/content-title (i18n/label :t/offline-messaging-settings)]
(when config/add-custom-mailservers-enabled? [toolbar/actions
[toolbar/actions [(toolbar.actions/add false (partial navigate-to-add-mailserver nil))]]]
[(toolbar.actions/add false (partial navigate-to-add-mailserver nil))]])]
[react/view styles/wrapper [react/view styles/wrapper
[list/flat-list {:data (vals wnodes) [list/flat-list {:data (vals wnodes)
:default-separator? false :default-separator? false

View File

@ -151,13 +151,11 @@
:value (get-in networks [network :name]) :value (get-in networks [network :name])
:action-fn #(re-frame/dispatch [:navigate-to :network-settings]) :action-fn #(re-frame/dispatch [:navigate-to :network-settings])
:accessibility-label :network-button}]) :accessibility-label :network-button}])
(when config/offline-inbox-enabled? [profile.components/settings-item-separator]
[profile.components/settings-item-separator]) [profile.components/settings-item
(when config/offline-inbox-enabled? {:label-kw :t/offline-messaging
[profile.components/settings-item :action-fn #(re-frame/dispatch [:navigate-to :offline-messaging-settings])
{:label-kw :t/offline-messaging :accessibility-label :offline-messages-settings-button}]
:action-fn #(re-frame/dispatch [:navigate-to :offline-messaging-settings])
:accessibility-label :offline-messages-settings-button}])
(when config/bootnodes-settings-enabled? (when config/bootnodes-settings-enabled?
[profile.components/settings-item-separator]) [profile.components/settings-item-separator])
(when config/bootnodes-settings-enabled? (when config/bootnodes-settings-enabled?

View File

@ -15,34 +15,28 @@
;; flags stay up to date and are removed once behavior introduced is stable. ;; flags stay up to date and are removed once behavior introduced is stable.
;; ;;
;; TESTFAIRY_ENABLED - indefinite ;; TESTFAIRY_ENABLED - indefinite
;; OFFLINE_INBOX_ENABLED - TBD, tenatively until #idea 1 is merged
;; CONFIG FLAGS
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED))) (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 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 (def log-level
(-> (get-config :LOG_LEVEL "error") (-> (get-config :LOG_LEVEL "error")
string/lower-case string/lower-case
keyword)) keyword))
(def fleet (get-config :FLEET "eth.beta")) (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)) (def default-network (get-config :DEFAULT_NETWORK))
;; the default value should be a string for `enabled?` to work correctly. ;; 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 testfairy-token (get-config :TESTFAIRY_TOKEN))
(def instabug-token (get-config :INSTABUG_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-target (js/parseFloat (get-config :POW_TARGET "0.002")))
(def pow-time (js/parseInt (get-config :POW_TIME "1"))) (def pow-time (js/parseInt (get-config :POW_TIME "1")))
(def use-sym-key (enabled? (get-config :USE_SYM_KEY 0))) (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)))

View File

@ -85,10 +85,9 @@
"Store url in the database if the user is not logged in, to be processed "Store url in the database if the user is not logged in, to be processed
on login, otherwise just handle it" on login, otherwise just handle it"
[url cofx] [url cofx]
(when config/universal-links-enabled? (if (models.account/logged-in? cofx)
(if (models.account/logged-in? cofx) (route-url url cofx)
(route-url url cofx) (store-url-for-later url cofx)))
(store-url-for-later url cofx))))
(defn process-stored-event (defn process-stored-event
"Return an event description for processing a url if in the database" "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 "Add an event listener for handling background->foreground transition
and handles incoming url if the app has been started by clicking on a link" 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")
(log/debug "universal-links: initializing") (.. react/linking
(.. react/linking (getInitialURL)
(getInitialURL) (then dispatch-url))
(then dispatch-url)) (.. react/linking
(.. react/linking (addEventListener "url" url-event-listener)))
(addEventListener "url" url-event-listener))))
(defn finalize (defn finalize
"Remove event listener for url" "Remove event listener for url"
[] []
(when config/universal-links-enabled? (log/debug "universal-links: finalizing")
(log/debug "universal-links: finalizing") (.. react/linking
(.. react/linking (removeEventListener "url" url-event-listener)))
(removeEventListener "url" url-event-listener))))

View File

@ -10,5 +10,4 @@
:handle-universal-link :handle-universal-link
(fn [cofx [_ url]] (fn [cofx [_ url]]
(log/debug "universal links: event received for " 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))))

View File

@ -36,8 +36,7 @@
:chat/cooldowns 0 :chat/cooldowns 0
:chat/spam-messages-frequency 0 :chat/spam-messages-frequency 0
:chat/cooldown-enabled? false}] :chat/cooldown-enabled? false}]
(with-redefs [datetime/timestamp (constantly 1527675198542) (with-redefs [datetime/timestamp (constantly 1527675198542)]
config/spam-button-detection-enabled? true]
(testing "no spamming detected" (testing "no spamming detected"
(let [expected {:db (assoc db :chat/last-outgoing-message-sent-at 1527675198542)} (let [expected {:db (assoc db :chat/last-outgoing-message-sent-at 1527675198542)}
actual (input/process-cooldown {:db db})] actual (input/process-cooldown {:db db})]