From 112fe367cc373a48f74d3457db96d3484972a761 Mon Sep 17 00:00:00 2001 From: Volodymyr Kozieiev Date: Thu, 20 Dec 2018 12:46:00 +0200 Subject: [PATCH] Fixed desktop release warning messagebox Signed-off-by: Vitaliy Vlasov --- src/status_im/accounts/core.cljs | 11 ----------- src/status_im/accounts/create/core.cljs | 3 +-- src/status_im/events.cljs | 5 ----- src/status_im/init/core.cljs | 3 +-- .../ui/screens/accounts/recover/styles.cljs | 5 +++++ .../ui/screens/accounts/recover/views.cljs | 8 ++++++-- src/status_im/ui/screens/desktop/views.cljs | 17 +++++++++++++++-- translations/en.json | 3 ++- 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/status_im/accounts/core.cljs b/src/status_im/accounts/core.cljs index a818d9e6d6..4e9a909780 100644 --- a/src/status_im/accounts/core.cljs +++ b/src/status_im/accounts/core.cljs @@ -21,17 +21,6 @@ (i18n/label :mainnet-is-default-alert-text) #(re-frame/dispatch [:accounts.ui/mainnet-warning-shown]))))) -(fx/defn show-desktop-alpha-release-warning [{:keys [db]}] - (let [enter-name-screen? (= :enter-name (get-in db [:accounts/create :step])) - shown? (get-in db [:account/account :desktop-alpha-release-warning-shown?])] - (when (and platform/desktop? - (not shown?) - (not enter-name-screen?)) - (utils/show-popup - nil - (i18n/label :desktop-alpha-release-warning) - #(re-frame/dispatch [:accounts.ui/desktop-alpha-release-warning-shown]))))) - (defn- chat-send? [transaction] (and (seq transaction) (not (:in-progress? transaction)) diff --git a/src/status_im/accounts/create/core.cljs b/src/status_im/accounts/create/core.cljs index c311a54313..8de5957914 100644 --- a/src/status_im/accounts/create/core.cljs +++ b/src/status_im/accounts/create/core.cljs @@ -101,8 +101,7 @@ {:db (assoc db :accounts/create {:show-welcome? true}) :notifications/request-notifications-permissions nil :dispatch [:navigate-to :home]} - (accounts.update/account-update {:name (:name create)} {}) - (accounts.core/show-desktop-alpha-release-warning))) + (accounts.update/account-update {:name (:name create)} {}))) (fx/defn next-step [{:keys [db] :as cofx} step password password-confirm] diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 8e2dc094da..169a1158ff 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -142,11 +142,6 @@ (fn [cofx _] (accounts.update/account-update cofx {:mainnet-warning-shown? true} {}))) -(handlers/register-handler-fx - :accounts.ui/desktop-alpha-release-warning-shown - (fn [cofx _] - (accounts.update/account-update cofx {:desktop-alpha-release-warning-shown? true} {}))) - (handlers/register-handler-fx :accounts.ui/dev-mode-switched (fn [cofx [_ dev-mode?]] diff --git a/src/status_im/init/core.cljs b/src/status_im/init/core.cljs index aa05677323..f9bc82e67a 100644 --- a/src/status_im/init/core.cljs +++ b/src/status_im/init/core.cljs @@ -198,8 +198,7 @@ (universal-links/process-stored-event) (notifications/process-stored-event address) (when platform/desktop? - (chat-model/update-dock-badge-label)) - (accounts.core/show-desktop-alpha-release-warning))) + (chat-model/update-dock-badge-label)))) (defn dev-mode? [cofx] (get-in cofx [:db :account/account :dev-mode?])) diff --git a/src/status_im/ui/screens/accounts/recover/styles.cljs b/src/status_im/ui/screens/accounts/recover/styles.cljs index 5257d43664..c352cbcc27 100644 --- a/src/status_im/ui/screens/accounts/recover/styles.cljs +++ b/src/status_im/ui/screens/accounts/recover/styles.cljs @@ -28,6 +28,11 @@ :font-size 13 :color colors/black}) +(def recover-release-warning + {:margin-top 16 + :font-size 12 + :color colors/gray}) + (def recovery-phrase-input {:flex 1 :text-align-vertical :top}) diff --git a/src/status_im/ui/screens/accounts/recover/views.cljs b/src/status_im/ui/screens/accounts/recover/views.cljs index 19a5bda956..eeaa81f6fc 100644 --- a/src/status_im/ui/screens/accounts/recover/views.cljs +++ b/src/status_im/ui/screens/accounts/recover/views.cljs @@ -13,7 +13,8 @@ [status-im.utils.core :as utils.core] [status-im.react-native.js-dependencies :as js-dependencies] [status-im.ui.components.common.common :as components.common] - [status-im.utils.security :as security])) + [status-im.utils.security :as security] + [status-im.utils.platform :as platform])) (defview passphrase-input [passphrase error warning] (letsubs [input-ref (reagent/atom nil)] @@ -61,7 +62,10 @@ [components.common/separator] [react/view styles/inputs-container [passphrase-input (or passphrase "") passphrase-error passphrase-warning] - [password-input (or password "") password-error (when-not disabled? sign-in)]] + [password-input (or password "") password-error (when-not disabled? sign-in)] + (when platform/desktop? + [react/i18n-text {:style styles/recover-release-warning + :key :recover-account-warning}])] [react/view components.styles/flex] (if processing [react/view styles/processing-view diff --git a/src/status_im/ui/screens/desktop/views.cljs b/src/status_im/ui/screens/desktop/views.cljs index 7ef7d83592..df8e90e8e1 100644 --- a/src/status_im/ui/screens/desktop/views.cljs +++ b/src/status_im/ui/screens/desktop/views.cljs @@ -10,12 +10,25 @@ [status-im.ui.screens.accounts.create.views :as create.views] [status-im.ui.screens.accounts.login.views :as login.views] [status-im.ui.screens.accounts.recover.views :as recover.views] - [status-im.ui.screens.accounts.views :as accounts.views])) + [status-im.ui.screens.accounts.views :as accounts.views] + [status-im.utils.platform :as platform] + [status-im.i18n :as i18n] + [status-im.react-native.js-dependencies :as rn-dependencies] + [taoensso.timbre :as log] + [status-im.utils.utils :as utils])) (enable-console-print!) (views/defview main [] - (views/letsubs [view-id [:get :view-id]] + (views/letsubs [view-id [:get :view-id] + version [:get-app-version]] + {:component-did-mount + (fn [] + (.getValue rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" + #(when-not (= %1 version) + (.setValue rn-dependencies/desktop-config "desktop-alpha-warning-shown-for-version" version) + (utils/show-popup nil (i18n/label :desktop-alpha-release-warning)))))} + (let [component (case view-id :intro intro.views/intro :accounts accounts.views/accounts diff --git a/translations/en.json b/translations/en.json index 0663554aaf..528db930d9 100644 --- a/translations/en.json +++ b/translations/en.json @@ -834,5 +834,6 @@ "migrations-failed-content": "{{message}}\nschema version: initial {{initial-version}}, current {{current-version}}, last {{last-version}}\n\nPlease let us know about this problem at #status public chat. If you press \"Cancel\" button, nothing will happen. If you press \"{{erase-accounts-data-button-text}}\" button, account's db will be removed and you will be able to unlock account. All account's data will be lost.", "migrations-erase-accounts-data-button": "Erase account's db", "account-and-db-password-mismatch-title": "The problem occurred!", - "account-and-db-password-mismatch-content": "Account's and realm db passwords do not match." + "account-and-db-password-mismatch-content": "Account's and realm db passwords do not match.", + "recover-account-warning": "Your wallet information will be exposed by importing this account." }