[#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 <dmitry.novot@gmail.com>
This commit is contained in:
Dmitry Novotochinov 2018-09-05 20:49:31 +03:00
parent 1b40ccbe86
commit 5944d2b43f
No known key found for this signature in database
GPG Key ID: 43D1DAF5AD39C927
4 changed files with 49 additions and 2 deletions

View File

@ -7,7 +7,8 @@
[status-im.data-store.realm.schemas.base.v6.core :as v6] [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.v7.core :as v7]
[status-im.data-store.realm.schemas.base.v8.core :as v8] [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 ;; put schemas ordered by version
(def schemas [{:schema v1/schema (def schemas [{:schema v1/schema
@ -36,4 +37,7 @@
:migration v8/migration} :migration v8/migration}
{:schema v9/schema {:schema v9/schema
:schemaVersion 9 :schemaVersion 9
:migration v9/migration}]) :migration v9/migration}
{:schema v10/schema
:schemaVersion 10
:migration v10/migration}])

View File

@ -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}}})

View File

@ -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))

View File

@ -170,6 +170,7 @@
(defn login-only-events [address {:keys [db] :as cofx}] (defn login-only-events [address {:keys [db] :as cofx}]
(when (not= (:view-id db) :create-account) (when (not= (:view-id db) :create-account)
(handlers-macro/merge-fx cofx (handlers-macro/merge-fx cofx
{:notifications/request-notifications nil}
(navigation/navigate-to-clean :home) (navigation/navigate-to-clean :home)
(universal-links/process-stored-event) (universal-links/process-stored-event)
(notifications/process-stored-event address)))) (notifications/process-stored-event address))))