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:
parent
b754092710
commit
728831c9c2
4
.env
4
.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
|
||||
|
|
8
.env.e2e
8
.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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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)]
|
||||
|
|
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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})]
|
||||
|
|
Loading…
Reference in New Issue