Add datasync,v1messages & disable discovery topic

In preparation for v1 this commits adds a few options so we can get
start debugging the protocol for v1.
This options are:

1) Datasync: If enabled it will send datasync messages
2) V1Messages: If enabled it will send v1 messages (just adding a
signature to the message)
3) Disable discovery topic: If enabled it will stop listening/publishing
on the discovery topic. You will be able to receive messages only from
clients who have this enabled as well.

If any of this option is on, it will only be compatitle with builds >=
this one. A logout is required for any change to take effect.

All this options will be removed before v1, they are there just to make
it easier for us to test and find potential issues.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2019-07-26 10:12:10 +02:00
parent 0b1659fab9
commit 27b77a6dc9
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
7 changed files with 117 additions and 5 deletions

View File

@ -232,6 +232,21 @@
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-device-to-device cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-datasync
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-datasync cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-v1-messages
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-v1-messages cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-disable-discovery-topic
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-disable-discovery-topic cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/web3-opt-in-mode-switched
(fn [cofx [_ opt-in]]

View File

@ -108,6 +108,39 @@
(multiaccounts.update/update-settings (assoc settings :pfs? enabled?)
{}))))
(fx/defn toggle-datasync
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup {:title (i18n/label :t/datasync-warning-title)
:content (i18n/label :t/datasync-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings (assoc settings :datasync? enabled?)
{}))))
(fx/defn toggle-v1-messages
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup {:title (i18n/label :t/v1-messages-warning-title)
:content (i18n/label :t/v1-messages-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings (assoc settings :v1-messages? enabled?)
{}))))
(fx/defn toggle-disable-discovery-topic
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup {:title (i18n/label :t/disable-discovery-topic-warning-title)
:content (i18n/label :t/disable-discovery-topic-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings (assoc settings :disable-discovery-topic? enabled?)
{}))))
(fx/defn switch-web3-opt-in-mode
[{:keys [db] :as cofx} opt-in]
(let [settings (get-in db [:multiaccount :settings])]

View File

@ -100,7 +100,10 @@
:installation-id (get db :multiaccounts/new-installation-id)}
(get multiaccounts address))
use-custom-bootnodes (get-in settings [:bootnodes network])
log-level (get-log-level settings)]
log-level (get-log-level settings)
datasync? (:datasync? settings)
disable-discovery-topic? (:disable-discovery-topic? settings)
v1-messages? (:v1-messages? settings)]
(cond-> (get-in networks [network :config])
:always
(get-base-node-config)
@ -127,6 +130,9 @@
:InstallationID installation-id
:MaxMessageDeliveryAttempts config/max-message-delivery-attempts
:MailServerConfirmations config/mailserver-confirmations-enabled?
:DataSyncEnabled (boolean datasync?)
:DisableGenericDiscoveryTopic (boolean disable-discovery-topic?)
:SendV1Messages (boolean v1-messages?)
:PFSEnabled true}
:RequireTopics (get-topics network))

View File

@ -165,6 +165,9 @@
current-mailserver-id
preferred-mailserver-id)
pfs? (:pfs? settings)
datasync? (:datasync? settings)
v1-messages? (:datasync? settings)
disable-discovery-topic? (:disable-discovery-topic? settings)
connection-message (connection-status peers-count node-status mailserver-state disconnected)]
[react/scroll-view
[react/text {:style styles/advanced-settings-title}
@ -217,7 +220,31 @@
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/device-to-device)]
[react/switch {:track-color #js {:true colors/blue :false nil}
:value pfs?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-device-to-device (not pfs?)])}]]])))
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-device-to-device (not pfs?)])}]]
[react/view {:style styles/title-separator}]
[react/text {:style styles/adv-settings-subtitle} (i18n/label :t/v1-messages)]
[react/view {:style (styles/profile-row false)}
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/v1-messages)]
[react/switch {:track-color #js {:true colors/blue :false nil}
:value pfs?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-v1-messages (not v1-messages?)])}]]
[react/view {:style styles/title-separator}]
[react/text {:style styles/adv-settings-subtitle} (i18n/label :t/datasync)]
[react/view {:style (styles/profile-row false)}
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/datasync)]
[react/switch {:track-color #js {:true colors/blue :false nil}
:value pfs?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-datasync (not datasync?)])}]]
[react/view {:style styles/title-separator}]
[react/text {:style styles/adv-settings-subtitle} (i18n/label :t/disable-discovery-topic)]
[react/view {:style (styles/profile-row false)}
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/disable-discovery-topic)]
[react/switch {:track-color #js {:true colors/blue :false nil}
:value pfs?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-disable-discovery-topic (not disable-discovery-topic?)])}]]])))
(views/defview installations []
(views/letsubs [installations [:pairing/installations]]

View File

@ -224,6 +224,27 @@
{:label-kw :t/device-to-device
:value (:pfs? settings)
:action-fn #(re-frame/dispatch [:multiaccounts.ui/toggle-device-to-device %])}])
(when dev-mode?
[profile.components/settings-item-separator])
(when dev-mode?
[profile.components/settings-switch-item
{:label-kw :t/datasync
:value (:datasync? settings)
:action-fn #(re-frame/dispatch [:multiaccounts.ui/toggle-datasync %])}])
(when dev-mode?
[profile.components/settings-item-separator])
(when dev-mode?
[profile.components/settings-switch-item
{:label-kw :t/v1-messages
:value (:v1-messages? settings)
:action-fn #(re-frame/dispatch [:multiaccounts.ui/toggle-v1-messages %])}])
(when dev-mode?
[profile.components/settings-item-separator])
(when dev-mode?
[profile.components/settings-switch-item
{:label-kw :t/disable-discovery-topic
:value (:disable-discovery-topic? settings)
:action-fn #(re-frame/dispatch [:multiaccounts.ui/toggle-disable-discovery-topic %])}])
[profile.components/settings-item-separator]
[profile.components/settings-switch-item
{:label-kw :t/dev-mode

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.30.1-beta.0",
"commit-sha1": "e93d994460fdbb8c10cb2f417eabe72559a2c517",
"src-sha256": "13y3rwjpqw2mmwc9ngjc2wawnl2myyf3wxm5vk49dgvh14dv6y61"
"version": "release-0.30.1-beta.2",
"commit-sha1": "960b4763a6ef861173f603c858bfa4dc8e2a37ee",
"src-sha256": "1d00gk04l360jr7fi4i161vv6zsj4waxbazrn64k71r32685ig1q"
}

View File

@ -254,6 +254,16 @@
"device-to-device": "Device-to-device Enabled",
"device-to-device-warning-title": "Warning, experimental feature",
"device-to-device-warning-content": "If enabled, only users who are running 0.9.32 and higher will be able to read your direct and public messages.",
"datasync": "DataSync Enabled",
"datasync-warning-title": "Warning, experimental feature",
"datasync-warning-content": "If enabled, only users who are running builds with datasync will be able to read your direct messages. Please logout/login for the changes to take effect",
"v1-messages": "V1 Messages Enabled",
"v1-messages-warning-title": "Warning, experimental feature",
"v1-messages-warning-content": "If enabled, only users who are running builds with v1-messages will be able to read your messages. Please logout/login for the changes to take effect",
"disable-discovery-topic": "Discovery topic Disabled",
"disable-discovery-topic-warning-title": "Warning, experimental feature",
"disable-discovery-topic-warning-content": "If enabled, only users who have this on will be able to read your messages and send you messages. Please logout/login for the changes to take effect",
"open-dapp": "Open ÐApp",
"new-transaction": "New Transaction",
"currency-display-name-bbd": "Barbados Dollar",