From 5944d2b43f4c055f43308ce83f746b86a93a3885 Mon Sep 17 00:00:00 2001 From: Dmitry Novotochinov Date: Wed, 5 Sep 2018 20:49:31 +0300 Subject: [PATCH] [#5734] Check PN permissions on login Client with versions 0.9.26/27 who recovered their accounts weren't asked for PN permissions so we now check permissions after user signs in. Signed-off-by: Dmitry Novotochinov --- .../data_store/realm/schemas/base/core.cljs | 8 +++-- .../realm/schemas/base/v10/account.cljs | 30 +++++++++++++++++++ .../realm/schemas/base/v10/core.cljs | 12 ++++++++ src/status_im/init/core.cljs | 1 + 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/status_im/data_store/realm/schemas/base/v10/account.cljs create mode 100644 src/status_im/data_store/realm/schemas/base/v10/core.cljs diff --git a/src/status_im/data_store/realm/schemas/base/core.cljs b/src/status_im/data_store/realm/schemas/base/core.cljs index 0b1b6c850d..75c5e88d79 100644 --- a/src/status_im/data_store/realm/schemas/base/core.cljs +++ b/src/status_im/data_store/realm/schemas/base/core.cljs @@ -7,7 +7,8 @@ [status-im.data-store.realm.schemas.base.v6.core :as v6] [status-im.data-store.realm.schemas.base.v7.core :as v7] [status-im.data-store.realm.schemas.base.v8.core :as v8] - [status-im.data-store.realm.schemas.base.v9.core :as v9])) + [status-im.data-store.realm.schemas.base.v9.core :as v9] + [status-im.data-store.realm.schemas.base.v10.core :as v10])) ;; put schemas ordered by version (def schemas [{:schema v1/schema @@ -36,4 +37,7 @@ :migration v8/migration} {:schema v9/schema :schemaVersion 9 - :migration v9/migration}]) + :migration v9/migration} + {:schema v10/schema + :schemaVersion 10 + :migration v10/migration}]) diff --git a/src/status_im/data_store/realm/schemas/base/v10/account.cljs b/src/status_im/data_store/realm/schemas/base/v10/account.cljs new file mode 100644 index 0000000000..64e1932906 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/v10/account.cljs @@ -0,0 +1,30 @@ +(ns status-im.data-store.realm.schemas.base.v10.account) + +(def schema {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :bootnodes {:type :list + :objectType :bootnode} + :last-request {:type :int :optional true} + :settings {:type :string} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false} + :mainnet-warning-shown? {:type :bool + :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v10/core.cljs b/src/status_im/data_store/realm/schemas/base/v10/core.cljs new file mode 100644 index 0000000000..3bddfdb2eb --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/v10/core.cljs @@ -0,0 +1,12 @@ +(ns status-im.data-store.realm.schemas.base.v10.core + (:require [status-im.data-store.realm.schemas.base.v1.network :as network] + [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] + [status-im.data-store.realm.schemas.base.v10.account :as account] + [taoensso.timbre :as log])) + +(def schema [network/schema + bootnode/schema + account/schema]) + +(defn migration [old-realm new-realm] + (log/debug "migrating base database v10: " old-realm new-realm)) diff --git a/src/status_im/init/core.cljs b/src/status_im/init/core.cljs index 607165f77d..bf74e32ee2 100644 --- a/src/status_im/init/core.cljs +++ b/src/status_im/init/core.cljs @@ -170,6 +170,7 @@ (defn login-only-events [address {:keys [db] :as cofx}] (when (not= (:view-id db) :create-account) (handlers-macro/merge-fx cofx + {:notifications/request-notifications nil} (navigation/navigate-to-clean :home) (universal-links/process-stored-event) (notifications/process-stored-event address))))