[#11643] Display profile picture only of users I have added to contacts
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
5c3133adb6
commit
329182fdbe
|
@ -57,6 +57,10 @@
|
|||
(def command-state-transaction-pending 6)
|
||||
(def command-state-transaction-sent 7)
|
||||
|
||||
(def profile-pictures-visibility-contacts-only 1)
|
||||
(def profile-pictures-visibility-everyone 2)
|
||||
(def profile-pictures-visibility-none 3)
|
||||
|
||||
(def min-password-length 6)
|
||||
(def max-group-chat-participants 20)
|
||||
(def default-number-of-messages 20)
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
[status-im.ethereum.core :as ethereum]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im.utils.identicon :as identicon]
|
||||
[status-im.multiaccounts.core :as multiaccounts]))
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.constants :as constants]))
|
||||
|
||||
(defn public-key->new-contact [public-key]
|
||||
(let [alias (gfycat/generate-gfy public-key)]
|
||||
|
@ -54,7 +55,7 @@
|
|||
[members admins contacts {:keys [public-key] :as current-account}]
|
||||
(let [current-contact (some->
|
||||
current-account
|
||||
(select-keys [:name :preferred-name :public-key :identicon])
|
||||
(select-keys [:name :preferred-name :public-key :identicon :images])
|
||||
(clojure.set/rename-keys {:name :alias
|
||||
:preferred-name :name}))
|
||||
all-contacts (cond-> contacts
|
||||
|
@ -130,19 +131,26 @@
|
|||
:added? (contains? system-tags :contact/added)))))
|
||||
|
||||
(defn enrich-contact
|
||||
[{:keys [system-tags] :as contact}]
|
||||
(-> contact
|
||||
(dissoc :ens-verified-at :ens-verification-retries)
|
||||
(assoc :pending? (pending? contact)
|
||||
:blocked? (blocked? contact)
|
||||
:active? (active? contact)
|
||||
:added? (contains? system-tags :contact/added))
|
||||
(multiaccounts/contact-with-names)))
|
||||
([contact] (enrich-contact contact nil nil))
|
||||
([{:keys [system-tags public-key] :as contact} setting own-public-key]
|
||||
(let [added? (contains? system-tags :contact/added)]
|
||||
(cond-> (-> contact
|
||||
(dissoc :ens-verified-at :ens-verification-retries)
|
||||
(assoc :pending? (pending? contact)
|
||||
:blocked? (blocked? contact)
|
||||
:active? (active? contact)
|
||||
:added? added?)
|
||||
(multiaccounts/contact-with-names))
|
||||
(and setting (not= public-key own-public-key)
|
||||
(or (= setting constants/profile-pictures-visibility-none)
|
||||
(and (= setting constants/profile-pictures-visibility-contacts-only)
|
||||
(not added?))))
|
||||
(dissoc :images)))))
|
||||
|
||||
(defn enrich-contacts
|
||||
[contacts]
|
||||
[contacts profile-pictures-visibility own-public-key]
|
||||
(reduce-kv (fn [acc public-key contact]
|
||||
(assoc acc public-key (enrich-contact contact)))
|
||||
(assoc acc public-key (enrich-contact contact profile-pictures-visibility own-public-key)))
|
||||
{}
|
||||
contacts))
|
||||
|
||||
|
|
|
@ -166,6 +166,11 @@
|
|||
{::switch-theme theme}
|
||||
(multiaccounts.update/multiaccount-update :appearance theme {})))
|
||||
|
||||
(fx/defn switch-appearance-profile
|
||||
{:events [:multiaccounts.ui/appearance-profile-switched]}
|
||||
[cofx id]
|
||||
(multiaccounts.update/multiaccount-update cofx :profile-pictures-visibility id {}))
|
||||
|
||||
(defn clean-path [path]
|
||||
(if path
|
||||
(string/replace-first path #"file://" "")
|
||||
|
|
|
@ -910,7 +910,7 @@
|
|||
|
||||
(re-frame/reg-sub
|
||||
:chats/photo-path
|
||||
:<- [::contacts]
|
||||
:<- [:contacts/contacts]
|
||||
:<- [:multiaccount]
|
||||
(fn [[contacts multiaccount] [_ id identicon]]
|
||||
(let [contact (or (get contacts id)
|
||||
|
@ -1801,11 +1801,19 @@
|
|||
(fn [[chat contacts] [_ query-fn]]
|
||||
(contact.db/query-chat-contacts chat contacts query-fn)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::profile-pictures-visibility
|
||||
:<- [:multiaccount]
|
||||
(fn [multiaccount]
|
||||
(get multiaccount :profile-pictures-visibility)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/contacts
|
||||
:<- [::contacts]
|
||||
(fn [contacts]
|
||||
(contact.db/enrich-contacts contacts)))
|
||||
:<- [::profile-pictures-visibility]
|
||||
:<- [:multiaccount/public-key]
|
||||
(fn [[contacts profile-pictures-visibility public-key]]
|
||||
(contact.db/enrich-contacts contacts profile-pictures-visibility public-key)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/active
|
||||
|
@ -2097,7 +2105,7 @@
|
|||
(re-frame/reg-sub
|
||||
:search/filtered-chats
|
||||
:<- [:chats/active-chats]
|
||||
:<- [::contacts]
|
||||
:<- [:contacts/contacts]
|
||||
:<- [:search/home-filter]
|
||||
(fn [[chats contacts search-filter]]
|
||||
;; Short-circuit if search-filter is empty
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
[status-im.react-native.resources :as resources]
|
||||
[quo.core :as quo]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.i18n :as i18n]))
|
||||
[status-im.i18n :as i18n]
|
||||
[status-im.constants :as constants]))
|
||||
|
||||
(def titles {constants/profile-pictures-visibility-contacts-only (i18n/label :t/recent-recipients)
|
||||
constants/profile-pictures-visibility-everyone (i18n/label :t/everyone)
|
||||
constants/profile-pictures-visibility-none (i18n/label :t/none)})
|
||||
|
||||
(defn button [label icon theme selected?]
|
||||
[react/touchable-highlight
|
||||
|
@ -19,12 +24,36 @@
|
|||
(i18n/label label)]]])
|
||||
|
||||
(views/defview appearance []
|
||||
(views/letsubs [{:keys [appearance]} [:multiaccount]]
|
||||
(views/letsubs [{:keys [appearance profile-pictures-visibility]} [:multiaccount]]
|
||||
[react/view {:flex 1}
|
||||
[topbar/topbar {:title (i18n/label :t/appearance)}]
|
||||
[quo/list-header (i18n/label :t/preference)]
|
||||
[react/view {:flex-direction :row :flex 1 :padding-horizontal 8
|
||||
:justify-content :space-between :margin-top 16}
|
||||
[react/view {:flex-direction :row :padding-horizontal 8
|
||||
:justify-content :space-between :margin-vertical 16}
|
||||
[button :t/light :theme-light 1 (= 1 appearance)]
|
||||
[button :t/dark :theme-dark 2 (= 2 appearance)]
|
||||
[button :t/system :theme-system 0 (= 0 appearance)]]]))
|
||||
[button :t/system :theme-system 0 (= 0 appearance)]]
|
||||
[quo/list-header (i18n/label :t/chat)]
|
||||
[quo/list-item
|
||||
{:title (i18n/label :t/show-profile-pictures)
|
||||
:accessibility-label :show-profile-pictures
|
||||
:accessory :text
|
||||
:accessory-text (get titles profile-pictures-visibility)
|
||||
:on-press #(re-frame/dispatch [:navigate-to :appearance-profile-pic])
|
||||
:chevron true}]]))
|
||||
|
||||
(defn radio-item [id value]
|
||||
[quo/list-item
|
||||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:multiaccounts.ui/appearance-profile-switched id])}])
|
||||
|
||||
(views/defview profile-pic []
|
||||
(views/letsubs [{:keys [profile-pictures-visibility]} [:multiaccount]]
|
||||
[react/view {:flex 1}
|
||||
[topbar/topbar {:title (i18n/label :t/show-profile-pictures)}]
|
||||
[react/view {:margin-top 8}
|
||||
[radio-item constants/profile-pictures-visibility-everyone profile-pictures-visibility]
|
||||
[radio-item constants/profile-pictures-visibility-contacts-only profile-pictures-visibility]
|
||||
[radio-item constants/profile-pictures-visibility-none profile-pictures-visibility]]]))
|
|
@ -83,6 +83,8 @@
|
|||
:component privacy-and-security/privacy-and-security}
|
||||
{:name :appearance
|
||||
:component appearance/appearance}
|
||||
{:name :appearance-profile-pic
|
||||
:component appearance/profile-pic}
|
||||
{:name :notifications
|
||||
:component notifications-settings/notifications-settings}
|
||||
{:name :notifications-servers
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
:wallet/visible-tokens {:mainnet #{:SNT}}
|
||||
:currency :usd
|
||||
:appearance 0
|
||||
:profile-pictures-visibility 1
|
||||
:log-level log-level
|
||||
:webview-allow-permission-requests? false
|
||||
:link-previews-enabled-sites #{}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.68.4",
|
||||
"commit-sha1": "79716227db0f4b2a2ddcd8763ce48bab5d487d04",
|
||||
"src-sha256": "11bgn2k93838b1z5mk7parwqkzqydfg51c1cphmfrd33flf1pvkj"
|
||||
"version": "v0.68.5",
|
||||
"commit-sha1": "b5b1e19c2454ae1174915e6cb2fabaaa0955084c",
|
||||
"src-sha256": "0gm2mlcrh1al197yzl2b57p0xvwjbz2jb5cbiq7a3cn43gvvcqy0"
|
||||
}
|
||||
|
|
|
@ -1399,5 +1399,7 @@
|
|||
"seed-key-uid-mismatch-desc-2": "To manage keys for this account verify your seed phrase and try again.",
|
||||
"recover-with-seed-phrase": "Recover with seed phrase",
|
||||
"transfer-ma-unknown-error-desc-1": "It looks like your multiaccount was not deleted. Database may have been reset",
|
||||
"transfer-ma-unknown-error-desc-2": "Please check your account list and try again. If the account is not listed go to Access existing keys to recover with seed phrase"
|
||||
"transfer-ma-unknown-error-desc-2": "Please check your account list and try again. If the account is not listed go to Access existing keys to recover with seed phrase",
|
||||
"everyone": "Everyone",
|
||||
"show-profile-pictures": "Show profile pictures of"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue