fix #1171
This commit is contained in:
parent
c277260b59
commit
27de707035
|
@ -20,7 +20,8 @@
|
|||
"registered-only":true,
|
||||
"has-handler": false,
|
||||
"fullscreen":true
|
||||
}
|
||||
},
|
||||
"unremovable?": true
|
||||
},
|
||||
"wallet":
|
||||
{
|
||||
|
@ -40,7 +41,8 @@
|
|||
{
|
||||
"en": "https://status.im/dapps/wallet/"
|
||||
},
|
||||
"bot-url": "local://wallet-bot"
|
||||
"bot-url": "local://wallet-bot",
|
||||
"unremovable?": true
|
||||
},
|
||||
|
||||
"mailman":
|
||||
|
|
|
@ -198,5 +198,6 @@
|
|||
:name (s/capitalize console-chat-id)
|
||||
:photo-path console-chat-id
|
||||
:dapp? true
|
||||
:unremovable? true
|
||||
:bot-url "local://console-bot"
|
||||
:dapp-hash 858845357})
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
[view
|
||||
[view st/contact-container
|
||||
[contact-inner-view {:contact contact :info info}]
|
||||
(when extended?
|
||||
(when (and extended? (not (empty? extend-options)))
|
||||
[view st/more-btn-container
|
||||
[context-menu
|
||||
[icon :options_gray]
|
||||
|
|
|
@ -243,7 +243,7 @@
|
|||
:contacts (mapv #(hash-map :identity %) contacts)})
|
||||
default-groups)])
|
||||
(doseq [[id {:keys [name photo-path public-key add-chat? global-command
|
||||
dapp? dapp-url dapp-hash bot-url]}] default-contacts]
|
||||
dapp? dapp-url dapp-hash bot-url unremovable?]}] default-contacts]
|
||||
(let [id' (clojure.core/name id)]
|
||||
(when-not (get contacts id')
|
||||
(when add-chat?
|
||||
|
@ -254,6 +254,7 @@
|
|||
:name (:en name)
|
||||
:photo-path photo-path
|
||||
:public-key public-key
|
||||
:unremovable? (boolean unremovable?)
|
||||
:dapp? dapp?
|
||||
:dapp-url (:en dapp-url)
|
||||
:bot-url bot-url
|
||||
|
|
|
@ -47,10 +47,11 @@
|
|||
:actions [{:image :blank}]
|
||||
:title (label :t/edit-contacts)}])
|
||||
|
||||
(defn contact-options [contact group]
|
||||
(let [options [{:value #(dispatch [:hide-contact contact])
|
||||
:text (label :t/delete-contact)
|
||||
:destructive? true}]]
|
||||
(defn contact-options [{:keys [unremovable?] :as contact} group]
|
||||
(let [delete-contact-opt {:value #(dispatch [:hide-contact contact])
|
||||
:text (label :t/delete-contact)
|
||||
:destructive? true}
|
||||
options (if unremovable? [] [delete-contact-opt])]
|
||||
(if group
|
||||
(conj options
|
||||
{:value #(dispatch [:remove-contact-from-group
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
[status-im.data-store.realm.schemas.account.v3.core :as v3]
|
||||
[status-im.data-store.realm.schemas.account.v4.core :as v4]
|
||||
[status-im.data-store.realm.schemas.account.v5.core :as v5]
|
||||
[status-im.data-store.realm.schemas.account.v6.core :as v6]))
|
||||
[status-im.data-store.realm.schemas.account.v6.core :as v6]
|
||||
[status-im.data-store.realm.schemas.account.v7.core :as v7]))
|
||||
|
||||
; put schemas ordered by version
|
||||
(def schemas [{:schema v1/schema
|
||||
|
@ -24,4 +25,7 @@
|
|||
:migration v5/migration}
|
||||
{:schema v6/schema
|
||||
:schemaVersion 6
|
||||
:migration v6/migration}])
|
||||
:migration v6/migration}
|
||||
{:schema v7/schema
|
||||
:schemaVersion 7
|
||||
:migration v7/migration}])
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
(ns status-im.data-store.realm.schemas.account.v7.contact
|
||||
(:require [taoensso.timbre :as log]))
|
||||
|
||||
(def schema {:name :contact
|
||||
:primaryKey :whisper-identity
|
||||
:properties {:address {:type :string :optional true}
|
||||
:whisper-identity :string
|
||||
:name {:type :string :optional true}
|
||||
:photo-path {:type :string :optional true}
|
||||
:last-updated {:type :int :default 0}
|
||||
:last-online {:type :int :default 0}
|
||||
:pending? {:type :bool :default false}
|
||||
:status {:type :string :optional true}
|
||||
:public-key {:type :string
|
||||
:optional true}
|
||||
:private-key {:type :string
|
||||
:optional true}
|
||||
:unremovable? {:type :bool
|
||||
:default :false}
|
||||
:dapp? {:type :bool
|
||||
:default false}
|
||||
:dapp-url {:type :string
|
||||
:optional true}
|
||||
:bot-url {:type :string
|
||||
:optional true}
|
||||
:global-command {:type :command
|
||||
:optional true}
|
||||
:commands {:type :list
|
||||
:objectType :command}
|
||||
:responses {:type :list
|
||||
:objectType :command}
|
||||
:dapp-hash {:type :int
|
||||
:optional true}
|
||||
:debug? {:type :bool
|
||||
:default false}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating contact schema v7")
|
||||
(let [new-contacts (.objects new-realm "contact")]
|
||||
(dotimes [i (.-length new-contacts)]
|
||||
(let [contact (aget new-contacts i)
|
||||
id (aget contact "whisper-identity")]
|
||||
(when (or (= id "console")
|
||||
(= id "wallet")
|
||||
(= id "browse"))
|
||||
(aset contact "unremovable?" true))))))
|
|
@ -0,0 +1,37 @@
|
|||
(ns status-im.data-store.realm.schemas.account.v7.core
|
||||
(:require [status-im.data-store.realm.schemas.account.v4.chat :as chat]
|
||||
[status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact]
|
||||
[status-im.data-store.realm.schemas.account.v6.command :as command]
|
||||
[status-im.data-store.realm.schemas.account.v6.command-parameter :as command-parameter]
|
||||
[status-im.data-store.realm.schemas.account.v7.contact :as contact]
|
||||
[status-im.data-store.realm.schemas.account.v1.discover :as discover]
|
||||
[status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store]
|
||||
[status-im.data-store.realm.schemas.account.v4.message :as message]
|
||||
[status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message]
|
||||
[status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message]
|
||||
[status-im.data-store.realm.schemas.account.v1.request :as request]
|
||||
[status-im.data-store.realm.schemas.account.v1.tag :as tag]
|
||||
[status-im.data-store.realm.schemas.account.v1.user-status :as user-status]
|
||||
[status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group]
|
||||
[status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def schema [chat/schema
|
||||
chat-contact/schema
|
||||
command/schema
|
||||
command-parameter/schema
|
||||
contact/schema
|
||||
discover/schema
|
||||
kv-store/schema
|
||||
message/schema
|
||||
pending-message/schema
|
||||
processed-message/schema
|
||||
request/schema
|
||||
tag/schema
|
||||
user-status/schema
|
||||
contact-group/schema
|
||||
group-contact/schema])
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating v7 account database: " old-realm new-realm)
|
||||
(contact/migration old-realm new-realm))
|
Loading…
Reference in New Issue