Implement seed phrase fallback flow (#21090)

Co-authored-by: Parvesh Monu <parvesh.dhullmonu@gmail.com>
Co-authored-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Parvesh Monu 2024-09-19 15:23:23 +05:30 committed by GitHub
parent 2e61f94d84
commit 0eb065bbb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 445 additions and 88 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -62,6 +62,7 @@
:chatId :chat-id :chatId :chat-id
:contactVerificationStatus :contact-verification-status :contactVerificationStatus :contact-verification-status
:communityId :community-id :communityId :community-id
:installationId :installation-id
:membershipStatus :membership-status :membershipStatus :membership-status
:albumMessages :album-messages}) :albumMessages :album-messages})
(update :last-message #(when % (messages/<-rpc %))) (update :last-message #(when % (messages/<-rpc %)))

View File

@ -117,20 +117,24 @@
(deftest parse-notification-counts-response-test (deftest parse-notification-counts-response-test
(is (is
(= {notification-types/one-to-one-chat 15 (= {notification-types/one-to-one-chat 15
notification-types/private-group-chat 16 notification-types/private-group-chat 16
notification-types/mention 17 notification-types/mention 17
notification-types/reply 18 notification-types/reply 18
notification-types/contact-request 19 notification-types/contact-request 19
notification-types/admin 20 notification-types/admin 20
notification-types/contact-verification 21} notification-types/contact-verification 21
notification-types/new-installation-received 22
notification-types/new-installation-created 23}
(store/parse-notification-counts-response (store/parse-notification-counts-response
{(keyword (str notification-types/one-to-one-chat)) 15 {(keyword (str notification-types/one-to-one-chat)) 15
(keyword (str notification-types/private-group-chat)) 16 (keyword (str notification-types/private-group-chat)) 16
(keyword (str notification-types/mention)) 17 (keyword (str notification-types/mention)) 17
(keyword (str notification-types/reply)) 18 (keyword (str notification-types/reply)) 18
(keyword (str notification-types/contact-request)) 19 (keyword (str notification-types/contact-request)) 19
(keyword (str notification-types/admin)) 20 (keyword (str notification-types/admin)) 20
(keyword (str notification-types/contact-verification)) 21 (keyword (str notification-types/contact-verification)) 21
(keyword (str notification-types/new-installation-received)) 22
(keyword (str notification-types/new-installation-created)) 23
;; Unsupported type in the response is ignored ;; Unsupported type in the response is ignored
:999 100})))) :999 100}))))

View File

@ -243,6 +243,23 @@
{} {}
installations))}) installations))})
(rf/defn finish-seed-phrase-fallback-syncing
{:events [:pairing/finish-seed-phrase-fallback-syncing]}
[{:keys [db]}]
{:fx [[:json-rpc/call
[{:method "wakuext_enableInstallationAndPair"
:params [{:installationId (:syncing/installation-id db)}]
:js-response true
:on-success [:sanitize-messages-and-process-response]}]]]})
(rf/defn pair-and-sync
{:events [:pairing/pair-and-sync]}
[cofx installation-id]
{:fx [[:json-rpc/call
[{:method "wakuext_enableInstallationAndSync"
:params [{:installationId installation-id}]
:on-success #(log/debug "successfully synced devices")}]]]})
(rf/defn enable-installation-success (rf/defn enable-installation-success
{:events [:pairing.callback/enable-installation-success]} {:events [:pairing.callback/enable-installation-success]}
[cofx installation-id] [cofx installation-id]

View File

@ -0,0 +1,23 @@
(ns status-im.common.new-device-sheet.style
(:require [quo.foundations.colors :as colors]))
(def heading
{:padding-left 20
:padding-bottom 8})
(def message
{:padding-horizontal 20
:padding-top 4})
(def warning
{:margin-horizontal 20
:margin-top 10})
(def drawer-container
{:padding-horizontal 13
:padding-top 16})
(def settings-subtext
{:color colors/white-opa-70
:align-self :center
:margin-bottom 12})

View File

@ -0,0 +1,75 @@
(ns status-im.common.new-device-sheet.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.events-helper :as events-helper]
[status-im.common.new-device-sheet.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- pair-and-sync
[installation-id]
(rf/dispatch [:pairing/pair-and-sync installation-id])
(events-helper/hide-bottom-sheet))
(defn installation-request-receiver-view
[installation-id]
(rn/use-mount events-helper/dismiss-keyboard)
[:<>
[quo/text
{:weight :semi-bold
:size :heading-2
:accessibility-label :new-device-sheet-heading
:style style/heading}
(i18n/label :t/pair-new-device-and-sync)]
[quo/text
{:weight :regular
:size :paragraph-1
:accessibility-label :new-device-sheet-message
:style style/message}
(i18n/label :t/new-device-detected-recovered-device-message)]
[quo/text
{:weight :semi-bold
:size :heading-2
:accessibility-label :new-device-installation-id
:style style/heading}
installation-id]
[quo/bottom-actions
{:actions :two-actions
:blur? true
:container-style {:margin-top 12}
:button-two-label (i18n/label :t/cancel)
:button-two-props {:type :grey
:on-press events-helper/hide-bottom-sheet}
:button-one-label (i18n/label :t/pair-and-sync)
:button-one-props {:on-press #(pair-and-sync installation-id)}}]])
(defn installation-request-creator-view
[installation-id]
(rn/use-mount events-helper/dismiss-keyboard)
[:<>
[quo/text
{:weight :semi-bold
:size :heading-2
:accessibility-label :new-device-sheet-heading
:style style/heading}
(i18n/label :t/pair-this-device-and-sync)]
[quo/text
{:weight :regular
:size :paragraph-1
:accessibility-label :new-device-sheet-message
:style style/message}
(i18n/label :t/new-device-detected-other-device-message)]
[quo/text
{:weight :semi-bold
:size :heading-2
:accessibility-label :new-device-installation-id
:style style/heading}
installation-id]
[quo/bottom-actions
{:actions :one-action
:blur? true
:container-style {:margin-top 12}
:button-one-label (i18n/label :t/close)
:button-one-props {:type :grey
:on-press events-helper/hide-bottom-sheet}}]])

View File

@ -28,6 +28,7 @@
:notifications (js/require "../resources/images/ui2/notifications.png") :notifications (js/require "../resources/images/ui2/notifications.png")
:nfc-prompt (js/require "../resources/images/ui2/nfc-prompt.png") :nfc-prompt (js/require "../resources/images/ui2/nfc-prompt.png")
:nfc-success (js/require "../resources/images/ui2/nfc-success.png") :nfc-success (js/require "../resources/images/ui2/nfc-success.png")
:preparing-status (js/require "../resources/images/ui2/preparing-status.png")
:syncing-devices (js/require "../resources/images/ui2/syncing_devices.png") :syncing-devices (js/require "../resources/images/ui2/syncing_devices.png")
:syncing-wrong (js/require "../resources/images/ui2/syncing_wrong.png")}) :syncing-wrong (js/require "../resources/images/ui2/syncing_wrong.png")})

View File

@ -37,6 +37,7 @@
:screen/onboarding.enable-biometrics :screen/onboarding.enable-biometrics
:screen/onboarding.generating-keys :screen/onboarding.generating-keys
:screen/onboarding.enable-notifications :screen/onboarding.enable-notifications
:screen/onboarding.preparing-status
:screen/onboarding.sign-in-intro :screen/onboarding.sign-in-intro
:screen/onboarding.sign-in :screen/onboarding.sign-in
:screen/onboarding.syncing-progress :screen/onboarding.syncing-progress

View File

@ -71,17 +71,20 @@
{:events [:onboarding/create-account-and-login]} {:events [:onboarding/create-account-and-login]}
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(let [{:keys [display-name seed-phrase password image-path color] :as profile} (let [{:keys [display-name seed-phrase password image-path color] :as profile}
(:onboarding/profile db)] (:onboarding/profile db)
loading-screen (if (seq (:syncing/key-uid db))
:screen/onboarding.preparing-status
:screen/onboarding.generating-keys)]
(rf/merge cofx (rf/merge cofx
{:dispatch [:navigate-to-within-stack {:dispatch [:navigate-to-within-stack
[:screen/onboarding.generating-keys [loading-screen
(get db (get db
:onboarding/navigated-to-enter-seed-phrase-from-screen :onboarding/navigated-to-enter-seed-phrase-from-screen
:screen/onboarding.new-to-status)]] :screen/onboarding.new-to-status)]]
:dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms :dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
:dispatch [:navigate-to-within-stack :dispatch [:navigate-to-within-stack
[:screen/onboarding.enable-notifications [:screen/onboarding.enable-notifications
:screen/onboarding.generating-keys]]}] loading-screen]]}]
:db (-> db :db (-> db
(dissoc :profile/login) (dissoc :profile/login)
(dissoc :auth-method) (dissoc :auth-method)
@ -134,22 +137,32 @@
(rf/defn seed-phrase-validated (rf/defn seed-phrase-validated
{:events [:onboarding/seed-phrase-validated]} {:events [:onboarding/seed-phrase-validated]}
[{:keys [db]} seed-phrase key-uid] [{:keys [db]} seed-phrase key-uid]
(if (contains? (:profile/profiles-overview db) key-uid) (let [syncing-account-recovered? (and (seq (:syncing/key-uid db))
{:effects.utils/show-confirmation (= (:syncing/key-uid db) key-uid))
{:title (i18n/label :t/multiaccount-exists-title) next-screen (if syncing-account-recovered?
:content (i18n/label :t/multiaccount-exists-content) :screen/onboarding.create-profile-password
:confirm-button-text (i18n/label :t/unlock) :screen/onboarding.create-profile)]
:on-accept (fn [] (if (contains? (:profile/profiles-overview db) key-uid)
(re-frame/dispatch [:pop-to-root :screen/profile.profiles]) {:effects.utils/show-confirmation
(re-frame/dispatch {:title (i18n/label :t/multiaccount-exists-title)
[:profile/profile-selected key-uid])) :content (i18n/label :t/multiaccount-exists-content)
:on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}} :confirm-button-text (i18n/label :t/unlock)
{:db (assoc-in db [:onboarding/profile :seed-phrase] seed-phrase) :on-accept (fn []
:dispatch [:navigate-to-within-stack (re-frame/dispatch [:pop-to-root :screen/profile.profiles])
[:screen/onboarding.create-profile (re-frame/dispatch
(get db [:profile/profile-selected key-uid]))
:onboarding/navigated-to-enter-seed-phrase-from-screen :on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}}
:screen/onboarding.new-to-status)]]})) {:db (-> db
(assoc-in [:onboarding/profile :seed-phrase] seed-phrase)
(assoc-in [:onboarding/profile :color] constants/profile-default-color))
:fx [[:dispatch
[:navigate-to-within-stack
[next-screen
(get db
:onboarding/navigated-to-enter-seed-phrase-from-screen
:screen/onboarding.new-to-status)]]]
(when-not syncing-account-recovered?
[:dispatch [:syncing/clear-syncing-data]])]})))
(rf/defn navigate-to-create-profile (rf/defn navigate-to-create-profile
{:events [:onboarding/navigate-to-create-profile]} {:events [:onboarding/navigate-to-create-profile]}

View File

@ -0,0 +1,11 @@
(ns status-im.contexts.onboarding.preparing-status.style)
(defn page-container
[insets]
{:flex 1
:padding-top (:top insets)})
(defn page-illustration
[width]
{:flex 1
:width width})

View File

@ -0,0 +1,36 @@
(ns status-im.contexts.onboarding.preparing-status.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.generating-keys.style :as style]
[utils.i18n :as i18n]))
(defn title
[]
[rn/view
{:style {:margin-top 56
:height 56
:margin-bottom 10}}
[quo/text-combinations
{:container-style {:margin-horizontal 20
:margin-vertical 12}
:title (i18n/label :t/preparing-app-for-you)
:description (i18n/label :t/hang-in-there)}]])
(defn content
[]
(let [width (:width (rn/get-window))]
[rn/image
{:resize-mode :stretch
:style (style/page-illustration width)
:source (resources/get-image :preparing-status)}]))
(defn view
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[:<>
[title]
[content]]]))

View File

@ -27,7 +27,3 @@
:align-items :center :align-items :center
:align-self :center :align-self :center
:justify-content :center}) :justify-content :center})
(def try-again-button
{:margin-top 20
:padding-horizontal 20})

View File

@ -5,6 +5,7 @@
[status-im.common.resources :as resources] [status-im.common.resources :as resources]
[status-im.contexts.onboarding.common.background.view :as background] [status-im.contexts.onboarding.common.background.view :as background]
[status-im.contexts.onboarding.syncing.progress.style :as style] [status-im.contexts.onboarding.syncing.progress.style :as style]
[utils.debounce :as debounce]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -25,17 +26,40 @@
:title-accessibility-label :progress-screen-title :title-accessibility-label :progress-screen-title
:description-accessibility-label :progress-screen-sub-title}]) :description-accessibility-label :progress-screen-sub-title}])
(defn- navigate-to-enter-seed-phrase
[]
(debounce/debounce-and-dispatch
[:onboarding/navigate-to-sign-in-by-seed-phrase :screen/onboarding.sync-or-recover-profile]
500))
(defn- try-again
[logged-in?]
(rf/dispatch [:syncing/clear-states])
(if logged-in?
(rf/dispatch [:navigate-back])
(rf/dispatch [:navigate-back-to :screen/onboarding.sync-or-recover-profile])))
(defn try-again-button (defn try-again-button
[profile-color] [profile-color logged-in?]
[quo/button [quo/bottom-actions
{:on-press (fn [] {:actions (if logged-in? :one-action :two-actions)
(rf/dispatch [:syncing/clear-states]) :blur? true
(rf/dispatch [:navigate-back])) :button-one-label (i18n/label :t/recovery-phrase)
:accessibility-label :try-again-later-button :button-one-props {:type :primary
:customization-color profile-color :accessibility-label :try-seed-phrase-button
:size 40 :customization-color profile-color
:container-style style/try-again-button} :container-style {:flex 1}
(i18n/label :t/try-again)]) :size 40
:on-press navigate-to-enter-seed-phrase}
(if logged-in? :button-one-label :button-two-label)
(i18n/label :t/try-again)
(if logged-in? :button-one-props :button-two-props)
{:type (if logged-in? :primary :grey)
:accessibility-label :try-again-later-button
:customization-color profile-color
:container-style {:flex 1}
:size 40
:on-press #(try-again logged-in?)}}])
(defn- illustration (defn- illustration
[pairing-progress?] [pairing-progress?]
@ -47,6 +71,7 @@
(defn view (defn view
[in-onboarding?] [in-onboarding?]
(let [pairing-status (rf/sub [:pairing/pairing-status]) (let [pairing-status (rf/sub [:pairing/pairing-status])
logged-in? (rf/sub [:multiaccount/logged-in?])
pairing-progress? (pairing-progress pairing-status) pairing-progress? (pairing-progress pairing-status)
profile-color (or (:color (rf/sub [:onboarding/profile])) profile-color (or (:color (rf/sub [:onboarding/profile]))
(rf/sub [:profile/customization-color]))] (rf/sub [:profile/customization-color]))]
@ -58,7 +83,7 @@
[page-title pairing-progress?] [page-title pairing-progress?]
[illustration pairing-progress?] [illustration pairing-progress?]
(when-not (pairing-progress pairing-status) (when-not (pairing-progress pairing-status)
[try-again-button profile-color])])) [try-again-button profile-color logged-in?])]))
(defn view-onboarding (defn view-onboarding
[] []

View File

@ -142,6 +142,8 @@
(rf/dispatch [:chats-list/load-success result]) (rf/dispatch [:chats-list/load-success result])
(rf/dispatch [:communities/get-user-requests-to-join]) (rf/dispatch [:communities/get-user-requests-to-join])
(rf/dispatch [:profile.login/get-chats-callback]))}] (rf/dispatch [:profile.login/get-chats-callback]))}]
(when (:syncing/installation-id db)
[:dispatch [:pairing/finish-seed-phrase-fallback-syncing]])
(when-not new-account? (when-not new-account?
[:dispatch [:universal-links/process-stored-event]])]}))) [:dispatch [:universal-links/process-stored-event]])]})))

View File

@ -1,6 +1,7 @@
(ns status-im.contexts.profile.recover.events (ns status-im.contexts.profile.recover.events
(:require (:require
[native-module.core :as native-module] [native-module.core :as native-module]
[status-im.constants :as constants]
[status-im.contexts.profile.config :as profile.config] [status-im.contexts.profile.config :as profile.config]
status-im.contexts.profile.recover.effects status-im.contexts.profile.recover.effects
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -16,10 +17,10 @@
(assoc-in [:syncing :login-sha3-password] login-sha3-password)) (assoc-in [:syncing :login-sha3-password] login-sha3-password))
:effects.profile/restore-and-login :effects.profile/restore-and-login
(merge (profile.config/create) (assoc (profile.config/create)
{:displayName display-name :displayName display-name
:mnemonic (security/safe-unmask-data seed-phrase) :mnemonic (security/safe-unmask-data seed-phrase)
:password login-sha3-password :password login-sha3-password
:imagePath (profile.config/strip-file-prefix image-path) :imagePath (profile.config/strip-file-prefix image-path)
:customizationColor color :customizationColor (or color constants/profile-default-color)
:fetchBackup true})})) :fetchBackup true)}))

View File

@ -0,0 +1,78 @@
(ns status-im.contexts.shell.activity-center.notification.syncing.view
(:require
[quo.core :as quo]
quo.theme
[react-native.core :as rn]
[status-im.common.new-device-sheet.view :as new-device-sheet]
[status-im.contexts.shell.activity-center.notification.common.view :as common]
[utils.datetime :as datetime]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- swipeable
[{:keys [extra-fn]} child]
[common/swipeable
{:left-button common/swipe-button-read-or-unread
:left-on-press common/swipe-on-press-toggle-read
:right-button common/swipe-button-delete
:right-on-press common/swipe-on-press-delete
:extra-fn extra-fn}
child])
(defn installation-created-view
[{:keys [notification extra-fn]}]
(let [{:keys [installation-id read timestamp]} notification
customization-color (rf/sub [:profile/customization-color])
theme (quo.theme/use-theme)
more-details (rn/use-callback
(fn []
(rf/dispatch [:show-bottom-sheet
{:content
(fn []
[new-device-sheet/installation-request-creator-view
installation-id])}]))
[installation-id])]
[swipeable {:extra-fn extra-fn}
[quo/activity-log
{:title (i18n/label :t/sync-your-profile)
:customization-color customization-color
:icon :i/mobile
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [(i18n/label :t/check-other-device-for-pairing)]
:items [{:type :button
:subtype :positive
:key :review-pairing-request
:blur? true
:label (i18n/label :t/more-details)
:theme theme
:on-press more-details}]}]]))
(defn installation-received-view
[{:keys [notification extra-fn]}]
(let [{:keys [installation-id read timestamp]} notification
customization-color (rf/sub [:profile/customization-color])
theme (quo.theme/use-theme)
review-pairing-request (rn/use-callback
(fn []
(rf/dispatch [:show-bottom-sheet
{:content
(fn []
[new-device-sheet/installation-request-receiver-view
installation-id])}]))
[installation-id])]
[swipeable {:extra-fn extra-fn}
[quo/activity-log
{:title (i18n/label :t/new-device-detected)
:customization-color customization-color
:icon :i/mobile
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [(i18n/label :t/new-device-detected)]
:items [{:type :button
:subtype :positive
:key :review-pairing-request
:blur? true
:label (i18n/label :t/review-pairing-request)
:theme theme
:on-press review-pairing-request}]}]]))

View File

@ -10,6 +10,8 @@
(def ^:const admin 8) (def ^:const admin 8)
(def ^:const community-kicked 9) (def ^:const community-kicked 9)
(def ^:const contact-verification 10) (def ^:const contact-verification 10)
(def ^:const new-installation-received 23)
(def ^:const new-installation-created 24)
(def ^:const all-supported (def ^:const all-supported
#{one-to-one-chat #{one-to-one-chat
@ -20,7 +22,9 @@
community-request community-request
admin admin
community-kicked community-kicked
contact-verification}) contact-verification
new-installation-received
new-installation-created})
;; TODO: Replace with correct enum values once status-go implements them. ;; TODO: Replace with correct enum values once status-go implements them.
(def ^:const tx 66612) (def ^:const tx 66612)

View File

@ -19,6 +19,7 @@
[status-im.contexts.shell.activity-center.notification.membership.view :as membership] [status-im.contexts.shell.activity-center.notification.membership.view :as membership]
[status-im.contexts.shell.activity-center.notification.mentions.view :as mentions] [status-im.contexts.shell.activity-center.notification.mentions.view :as mentions]
[status-im.contexts.shell.activity-center.notification.reply.view :as reply] [status-im.contexts.shell.activity-center.notification.reply.view :as reply]
[status-im.contexts.shell.activity-center.notification.syncing.view :as syncing]
[status-im.contexts.shell.activity-center.style :as style] [status-im.contexts.shell.activity-center.style :as style]
[status-im.contexts.shell.activity-center.tabs.empty-tab.view :as empty-tab] [status-im.contexts.shell.activity-center.tabs.empty-tab.view :as empty-tab]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -48,6 +49,12 @@
(= notification-type types/admin) (= notification-type types/admin)
[admin/view props] [admin/view props]
(= notification-type types/new-installation-received)
[syncing/installation-received-view props]
(= notification-type types/new-installation-created)
[syncing/installation-created-view props]
(types/membership notification-type) (types/membership notification-type)
(condp = notification-type (condp = notification-type
types/private-group-chat [membership/view props] types/private-group-chat [membership/view props]

View File

@ -2,6 +2,7 @@
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[native-module.core :as native-module] [native-module.core :as native-module]
[re-frame.core :as re-frame]
[react-native.platform :as platform] [react-native.platform :as platform]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.profile.config :as profile.config] [status-im.contexts.profile.config :as profile.config]
@ -21,18 +22,45 @@
{:events [:syncing/clear-states]} {:events [:syncing/clear-states]}
[{:keys [db]} role] [{:keys [db]} role]
{:db (dissoc db :syncing)}) {:db (dissoc db :syncing)})
(defn- input-connection-string-callback (defn- input-connection-string-callback
[res] [res]
(log/info "[local-pairing] input-connection-string-for-bootstrapping callback" (log/info "[local-pairing] input-connection-string-for-bootstrapping callback"
{:response res {:response res
:event :syncing/input-connection-string-for-bootstrapping}) :event :syncing/input-connection-string-for-bootstrapping})
(let [error (when (sync-utils/extract-error res) (let [response (transforms/json->clj res)
(str "generic-error: " res))] installation-id (:installationId response)
(when (some? error) key-uid (:keyUID response)
error (:error response)]
(when (seq installation-id)
(rf/dispatch [:syncing/set-syncing-installation-id installation-id key-uid]))
(when (seq error)
(rf/dispatch [:toasts/upsert (rf/dispatch [:toasts/upsert
{:type :negative {:type :negative
:text error}])))) :text error}]))))
(rf/defn initiate-pairing-process
{:events [:syncing/initiate-pairing-process]}
[{:keys [db]}]
{:db (assoc db :syncing/pairing-process-initiated? true)})
(rf/defn set-syncing-installation-id
{:events [:syncing/set-syncing-installation-id]}
[{:keys [db]} installation-id key-uid]
{:db (assoc db
:syncing/key-uid key-uid
:syncing/installation-id installation-id)})
(defn clear-syncing-data
[{:keys [db]}]
{:db (dissoc
db
:syncing/key-uid
:syncing/installation-id
:syncing/pairing-process-initiated?)})
(re-frame/reg-event-fx :syncing/clear-syncing-data clear-syncing-data)
(rf/defn preflight-outbound-check-for-local-pairing (rf/defn preflight-outbound-check-for-local-pairing
{:events [:syncing/preflight-outbound-check]} {:events [:syncing/preflight-outbound-check]}
[_ set-checks-passed] [_ set-checks-passed]
@ -67,6 +95,7 @@
(when (sync-utils/valid-connection-string? response) (when (sync-utils/valid-connection-string? response)
(on-valid-connection-string response) (on-valid-connection-string response)
(rf/dispatch [:syncing/update-role constants/local-pairing-role-sender]) (rf/dispatch [:syncing/update-role constants/local-pairing-role-sender])
(rf/dispatch [:syncing/initiate-pairing-process])
(rf/dispatch [:hide-bottom-sheet])))] (rf/dispatch [:hide-bottom-sheet])))]
(when-not (and error (string/blank? error)) (when-not (and error (string/blank? error))
(let [key-uid (get-in db [:profile/profile :key-uid]) (let [key-uid (get-in db [:profile/profile :key-uid])

View File

@ -34,6 +34,7 @@
[status-im.contexts.onboarding.generating-keys.view :as generating-keys] [status-im.contexts.onboarding.generating-keys.view :as generating-keys]
[status-im.contexts.onboarding.identifiers.view :as identifiers] [status-im.contexts.onboarding.identifiers.view :as identifiers]
[status-im.contexts.onboarding.intro.view :as intro] [status-im.contexts.onboarding.intro.view :as intro]
[status-im.contexts.onboarding.preparing-status.view :as preparing-status]
[status-im.contexts.onboarding.sign-in.view :as sign-in] [status-im.contexts.onboarding.sign-in.view :as sign-in]
[status-im.contexts.onboarding.syncing.progress.view :as syncing-devices] [status-im.contexts.onboarding.syncing.progress.view :as syncing-devices]
[status-im.contexts.onboarding.syncing.results.view :as syncing-results] [status-im.contexts.onboarding.syncing.results.view :as syncing-results]
@ -345,6 +346,15 @@
:popStackOnPress false}} :popStackOnPress false}}
:component generating-keys/view} :component generating-keys/view}
{:name :screen/onboarding.preparing-status
:options {:theme :dark
:layout options/onboarding-transparent-layout
:animations transitions/push-animations-for-transparent-background
:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}
:component preparing-status/view}
{:name :screen/onboarding.enter-seed-phrase {:name :screen/onboarding.enter-seed-phrase
:options {:theme :dark :options {:theme :dark
:layout options/onboarding-transparent-layout :layout options/onboarding-transparent-layout

View File

@ -22,32 +22,37 @@
(testing "returns an empty set when no types have unread notifications" (testing "returns an empty set when no types have unread notifications"
(swap! rf-db/app-db assoc-in (swap! rf-db/app-db assoc-in
[:activity-center :unread-counts-by-type] [:activity-center :unread-counts-by-type]
{types/one-to-one-chat 0 {types/one-to-one-chat 0
types/private-group-chat 0 types/private-group-chat 0
types/contact-verification 0 types/contact-verification 0
types/contact-request 0 types/contact-request 0
types/mention 0 types/mention 0
types/reply 0 types/reply 0
types/admin 0}) types/admin 0
types/new-installation-received 0
types/new-installation-created 0})
(is (= #{} (rf/sub [sub-name])))) (is (= #{} (rf/sub [sub-name]))))
(testing "returns a set with all types containing positive unread counts" (testing "returns a set with all types containing positive unread counts"
(swap! rf-db/app-db assoc-in (swap! rf-db/app-db assoc-in
[:activity-center :unread-counts-by-type] [:activity-center :unread-counts-by-type]
{types/one-to-one-chat 1 {types/one-to-one-chat 1
types/private-group-chat 0 types/private-group-chat 0
types/contact-verification 1 types/contact-verification 1
types/contact-request 0 types/contact-request 0
types/mention 3 types/mention 3
types/reply 0 types/reply 0
types/admin 2}) types/admin 2
types/new-installation-received 1
types/new-installation-created 0})
(let [actual (rf/sub [sub-name])] (let [actual (rf/sub [sub-name])]
(is (= #{types/one-to-one-chat (is (= #{types/one-to-one-chat
types/contact-verification types/contact-verification
types/mention types/mention
types/admin} types/admin
types/new-installation-received}
actual)) actual))
(is (set? actual))))) (is (set? actual)))))
@ -55,15 +60,17 @@
[sub-name] [sub-name]
(swap! rf-db/app-db assoc-in (swap! rf-db/app-db assoc-in
[:activity-center :unread-counts-by-type] [:activity-center :unread-counts-by-type]
{types/one-to-one-chat 1 {types/one-to-one-chat 1
types/private-group-chat 2 types/private-group-chat 2
types/contact-verification 3 types/contact-verification 3
types/contact-request 4 types/contact-request 4
types/mention 5 types/mention 5
types/reply 6 types/reply 6
types/admin 7}) types/admin 7
types/new-installation-received 8
types/new-installation-created 9})
(is (= 28 (rf/sub [sub-name])))) (is (= 45 (rf/sub [sub-name]))))
(h/deftest-sub :activity-center/unread-indicator (h/deftest-sub :activity-center/unread-indicator
[sub-name] [sub-name]

View File

@ -266,6 +266,11 @@
(fn [{:keys [preview-privacy?]}] (fn [{:keys [preview-privacy?]}]
(boolean preview-privacy?))) (boolean preview-privacy?)))
(re-frame/reg-sub :profile/installation-id
:<- [:profile/profile]
(fn [{:keys [installation-id]}]
installation-id))
(defn- replace-multiaccount-image-uri (defn- replace-multiaccount-image-uri
[profile ens-names port font-file avatar-opts theme] [profile ens-names port font-file avatar-opts theme]
(let [{:keys [key-uid ens-name? images (let [{:keys [key-uid ens-name? images

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "6e5a32c02215f36509b21645a32361fca85b10f7", "version": "v2.0.0",
"commit-sha1": "6e5a32c02215f36509b21645a32361fca85b10f7", "commit-sha1": "50338d01d7e3c08661e1b788b828d35b257c6c5a",
"src-sha256": "0wp0a7xp7vw64kkiyrpkswb37dfabj1al4a4nrb71iyfrcyrzscl" "src-sha256": "18gvq8hb7isn39ggddsxwrn29ah4p6af6azf9cc0kc7sxmdi0awn"
} }

View File

@ -363,6 +363,7 @@
"check-before-syncing-doc-description": "To sync your devices successfully, make sure to check and complete these steps:", "check-before-syncing-doc-description": "To sync your devices successfully, make sure to check and complete these steps:",
"check-on-block-explorer": "Check on block explorer", "check-on-block-explorer": "Check on block explorer",
"check-on-opensea": "Check on opensea", "check-on-opensea": "Check on opensea",
"check-other-device-for-pairing": "Check your other device for a pairing request.",
"check-your-account-balance-and-activity": "Check your account balance and activity", "check-your-account-balance-and-activity": "Check your account balance and activity",
"check-your-recovery-phrase": "Check your seed phrase", "check-your-recovery-phrase": "Check your seed phrase",
"choose-actions": "Choose actions", "choose-actions": "Choose actions",
@ -964,7 +965,6 @@
"enter-puk-code-description": "6-digit passcode has been blocked.\n Please enter PUK code to unblock passcode.", "enter-puk-code-description": "6-digit passcode has been blocked.\n Please enter PUK code to unblock passcode.",
"enter-recipient-address-or-username": "Enter address or username of the recipient", "enter-recipient-address-or-username": "Enter address or username of the recipient",
"enter-recovery-phrase": "Enter recovery phrase", "enter-recovery-phrase": "Enter recovery phrase",
"enter-seed-phrase": "Enter seed phrase",
"enter-sync-code": "Enter sync code", "enter-sync-code": "Enter sync code",
"enter-url": "Enter URL", "enter-url": "Enter URL",
"enter-user-pk": "Enter user public key", "enter-user-pk": "Enter user public key",
@ -1111,6 +1111,7 @@
"group-membership-request": "Group membership request", "group-membership-request": "Group membership request",
"groups": "Groups", "groups": "Groups",
"gwei": "Gwei", "gwei": "Gwei",
"hang-in-there": "Hang in there! Just a few more seconds!",
"has-permissions": "has permission to access", "has-permissions": "has permission to access",
"hash": "Hash", "hash": "Hash",
"have-a-sync-code?": "Have a sync code?", "have-a-sync-code?": "Have a sync code?",
@ -1582,6 +1583,7 @@
"mobile-syncing-sheet-title": "Sync using mobile data?", "mobile-syncing-sheet-title": "Sync using mobile data?",
"mon": "Mon", "mon": "Mon",
"more": "more", "more": "more",
"more-details": "More details",
"more-details-in-privacy-policy-1": "For more details refer to our ", "more-details-in-privacy-policy-1": "For more details refer to our ",
"more-details-in-privacy-policy-2": "Privacy Policy", "more-details-in-privacy-policy-2": "Privacy Policy",
"more-details-in-privacy-policy-settings-1": "For details on this and other potential limited data processing by Status, see our ", "more-details-in-privacy-policy-settings-1": "For details on this and other potential limited data processing by Status, see our ",
@ -1650,6 +1652,9 @@
"new-community-title": "New community", "new-community-title": "New community",
"new-contact": "New contact", "new-contact": "New contact",
"new-contract": "New Contract", "new-contract": "New Contract",
"new-device-detected": "New device detected",
"new-device-detected-other-device-message": "Check your other device for a pairing request. Ensure that the this device ID displayed on your other device. Only proceed with pairing and syncing if the IDs are identical.",
"new-device-detected-recovered-device-message": "A new device has been detected. You can see device ID below and on your other device. Only confirm the request if device ID matches.",
"new-favourite": "New favourite", "new-favourite": "New favourite",
"new-group": "New group", "new-group": "New group",
"new-group-chat": "New group chat", "new-group-chat": "New group chat",
@ -1817,14 +1822,17 @@
"page-camera-request-blocked": "camera requests blocked. To enable camera requests go to Settings", "page-camera-request-blocked": "camera requests blocked. To enable camera requests go to Settings",
"page-would-like-to-use-camera": "would like to use your camera", "page-would-like-to-use-camera": "would like to use your camera",
"pair": "Pair", "pair": "Pair",
"pair-and-sync": "Pair and Sync",
"pair-card": "Pair to this device", "pair-card": "Pair to this device",
"pair-code": "Pair code", "pair-code": "Pair code",
"pair-code-explanation": "Pairs card to a different device (up to 5) to unlock keys and sign transactions with the same Keycard", "pair-code-explanation": "Pairs card to a different device (up to 5) to unlock keys and sign transactions with the same Keycard",
"pair-code-placeholder": "Pair code...", "pair-code-placeholder": "Pair code...",
"pair-device-toast": "Device successfully paired", "pair-device-toast": "Device successfully paired",
"pair-devices": "Pair devices", "pair-devices": "Pair devices",
"pair-new-device-and-sync": "Pair new device and sync profile",
"pair-this-card": "Pair this card", "pair-this-card": "Pair this card",
"pair-this-device": "Advertise device", "pair-this-device": "Advertise device",
"pair-this-device-and-sync": "Pair this device and sync profile",
"pair-this-device-description": "Pair your devices to sync contacts and chats between them", "pair-this-device-description": "Pair your devices to sync contacts and chats between them",
"paired-devices": "Paired devices", "paired-devices": "Paired devices",
"paired-with-this-device": "Paired with this device", "paired-with-this-device": "Paired with this device",
@ -1920,6 +1928,7 @@
"powered-by-paraswap": "Powered by Paraswap", "powered-by-paraswap": "Powered by Paraswap",
"preference": "Preference", "preference": "Preference",
"preferred-by-receiver": "Preferred by receiver", "preferred-by-receiver": "Preferred by receiver",
"preparing-app-for-you": "Preparing app for you...",
"press": "Press", "press": "Press",
"preview-privacy": "Preview privacy mode", "preview-privacy": "Preview privacy mode",
"previewing-may-share-metadata": "Previewing links from these websites may share your metadata with their owners", "previewing-may-share-metadata": "Previewing links from these websites may share your metadata with their owners",
@ -2006,7 +2015,7 @@
"recover-with-seed-phrase": "Recover with seed phrase", "recover-with-seed-phrase": "Recover with seed phrase",
"recovering-key": "Accessing keys...", "recovering-key": "Accessing keys...",
"recovery-confirm-phrase": "Confirm seed phrase", "recovery-confirm-phrase": "Confirm seed phrase",
"recovery-phrase": "Seed phrase", "recovery-phrase": "Recovery phrase",
"recovery-success-text": "You will have to create a new code or password to re-encrypt your keys", "recovery-success-text": "You will have to create a new code or password to re-encrypt your keys",
"recovery-typo-dialog-description": "Please note, your seed phrase must use the exact same words and order as you received it", "recovery-typo-dialog-description": "Please note, your seed phrase must use the exact same words and order as you received it",
"recovery-typo-dialog-title": "Is the seed phrase correct?", "recovery-typo-dialog-title": "Is the seed phrase correct?",
@ -2089,6 +2098,7 @@
"reveal-qr-code": "Reveal QR code", "reveal-qr-code": "Reveal QR code",
"reveal-sync-code": "Reveal sync code", "reveal-sync-code": "Reveal sync code",
"review-bridge": "Review bridge", "review-bridge": "Review bridge",
"review-pairing-request": "Review pairing request",
"review-send": "Review send", "review-send": "Review send",
"review-swap": "Review swap", "review-swap": "Review swap",
"revoke-access": "Revoke access", "revoke-access": "Revoke access",
@ -2400,6 +2410,7 @@
"sync-or-recover-profile": "Sync or recover profile", "sync-or-recover-profile": "Sync or recover profile",
"sync-settings": "Sync settings", "sync-settings": "Sync settings",
"sync-synced": "In sync", "sync-synced": "In sync",
"sync-your-profile": "Sync your profile",
"synced-devices": "Synced Devices", "synced-devices": "Synced Devices",
"synced-with": "Synced with", "synced-with": "Synced with",
"synchronise-your-data-across-your-devices": "Synchronise your data across your devices", "synchronise-your-data-across-your-devices": "Synchronise your data across your devices",