Add datasync confirmations, enable device-to-device by default

This commit adds datasync confirmations and enables device-to-device for
all the communications, as that's what we will go with v1.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2019-08-07 18:21:15 +02:00
parent e4c0bcfc3d
commit 370bc207bc
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
8 changed files with 16 additions and 56 deletions

View File

@ -214,11 +214,6 @@
(fn [cofx [_ desktop-notifications?]]
(multiaccounts/enable-notifications cofx desktop-notifications?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-device-to-device
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-device-to-device cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-datasync
(fn [cofx [_ enabled?]]

View File

@ -96,18 +96,6 @@
{:desktop-notifications? desktop-notifications?}
{}))
(fx/defn toggle-device-to-device
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup {:title (i18n/label :t/device-to-device-warning-title)
:content (i18n/label :t/device-to-device-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
;; Set to pfs? for backward compatibility
(multiaccounts.update/update-settings (assoc settings :pfs? enabled?)
{}))))
(fx/defn toggle-datasync
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])

View File

@ -70,8 +70,8 @@
(case type
"node.ready" (status-node-started cofx)
"node.stopped" (status-node-stopped cofx)
"envelope.sent" (transport.message/update-envelope-status cofx (:hash event) :sent)
"envelope.expired" (transport.message/update-envelope-status cofx (:hash event) :not-sent)
"envelope.sent" (transport.message/update-envelopes-status cofx (:ids event) :sent)
"envelope.expired" (transport.message/update-envelopes-status cofx (:ids event) :not-sent)
"bundles.added" (pairing/handle-bundles-added cofx event)
"mailserver.request.completed" (mailserver/handle-request-completed cofx event)
"mailserver.request.expired" (when (multiaccounts.model/logged-in? cofx)

View File

@ -144,6 +144,10 @@
(check-confirmations status chat-id message-id)
(models.message/send-push-notification chat-id message-id fcm-tokens status)))))))
(fx/defn update-envelopes-status
[{:keys [db] :as cofx} envelope-hashes status]
(apply fx/merge cofx (map #(update-envelope-status % status) envelope-hashes)))
(fx/defn set-contact-message-envelope-hash
[{:keys [db] :as cofx} chat-id envelope-hash]
{:db (assoc-in db [:transport/message-envelopes envelope-hash]

View File

@ -71,20 +71,10 @@
"Sends the payload using asymetric key (multiaccount `:public-key` in db) and fixed discovery topic"
[{:keys [db] :as cofx} {:keys [payload chat-id success-event]}]
(let [{:keys [web3]} db]
(let [pfs? (get-in db [:multiaccount :settings :pfs?])]
(if pfs?
(send-direct-message cofx
chat-id
success-event
payload)
(let [topic-hash (discovery-topic-hash)]
{:shh/post [{:web3 web3
:success-event success-event
:message (merge {:sig (multiaccounts.model/current-public-key cofx)
:pubKey chat-id
:payload payload
:topic topic-hash}
whisper-opts)}]})))))
(send-direct-message cofx
chat-id
success-event
payload)))
(defrecord Message [content content-type message-type clock-value timestamp]
StatusMessage

View File

@ -164,7 +164,6 @@
(let [render-fn (offline-messaging.views/render-row
current-mailserver-id
preferred-mailserver-id)
pfs? (:pfs? settings)
datasync? (:datasync? settings)
v1-messages? (:datasync? settings)
disable-discovery-topic? (:disable-discovery-topic? settings)
@ -213,21 +212,12 @@
[react/view {:style styles/title-separator}]
[react/text {:style styles/adv-settings-subtitle} (i18n/label :t/logging)]
[logging-display]
[react/view {:style styles/title-separator}]
[react/text {:style styles/adv-settings-subtitle} (i18n/label :t/device-to-device)]
[react/view {:style (styles/profile-row false)}
[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?)])}]]
[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?
:value v1-messages?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-v1-messages (not v1-messages?)])}]]
[react/view {:style styles/title-separator}]
@ -235,7 +225,7 @@
[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?
:value datasync?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-datasync (not datasync?)])}]]
[react/view {:style styles/title-separator}]
@ -243,7 +233,7 @@
[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?
:value disable-discovery-topic?
:on-value-change #(re-frame/dispatch [:multiaccounts.ui/toggle-disable-discovery-topic (not disable-discovery-topic?)])}]]])))
(views/defview installations []

View File

@ -219,13 +219,6 @@
:accessibility-label :bootnodes-settings-button}])
(when dev-mode?
[profile.components/settings-item-separator])
(when dev-mode?
[profile.components/settings-switch-item
{: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

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": "a3a413b5d98f227ff541ad9527c8d24e9c9ce653",
"commit-sha1": "a3a413b5d98f227ff541ad9527c8d24e9c9ce653",
"src-sha256": "07sgvpmmjiigga73gymbq1ifm047frmrxn3dr26ihw50p0kp0fwh"
"version": "8383feea04004adb967ce879e42adce7cbcd300c",
"commit-sha1": "8383feea04004adb967ce879e42adce7cbcd300c",
"src-sha256": "1sb0irq1h1xzclqfabhhmf680gia3v763kii6avsamv3r1yw0kx1"
}