From ce64d2c4b1c90d9a0e7ea51bae2346b1058bec42 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 18 Feb 2021 16:49:31 +0000 Subject: [PATCH 1/4] Super initial code work I found https://github.com/status-im/status-react/pull/11650/files so I'm using this as a template ... We'll see how I go I don't actually know what most of this code does --- src/status_im/constants.cljs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 1d755eb89e44..750862653de0 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -54,6 +54,10 @@ (def ^:const command-state-transaction-pending 6) (def ^:const command-state-transaction-sent 7) +(def ^:const profile-pictures-show-to-contacts-only 1) +(def ^:const profile-pictures-show-to-everyone 2) +(def ^:const profile-pictures-show-to-none 3) + (def ^:const profile-pictures-visibility-contacts-only 1) (def ^:const profile-pictures-visibility-everyone 2) (def ^:const profile-pictures-visibility-none 3) From fa0868765a848d0e0d5e5a3eee31a3449e7f2277 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Wed, 24 Feb 2021 14:00:46 +0000 Subject: [PATCH 2/4] Implemented more structure --- src/status_im/multiaccounts/core.cljs | 5 +++++ src/status_im/subs.cljs | 6 ++++++ src/status_im/ui/screens/appearance/views.cljs | 5 ++++- src/status_im/utils/config.cljs | 1 + translations/en.json | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/status_im/multiaccounts/core.cljs b/src/status_im/multiaccounts/core.cljs index fb4761e01c4d..9597c0f2045f 100644 --- a/src/status_im/multiaccounts/core.cljs +++ b/src/status_im/multiaccounts/core.cljs @@ -150,6 +150,11 @@ {::switch-theme theme} (multiaccounts.update/multiaccount-update :appearance theme {}))) +(fx/defn switch-profile-picture-show-to + {:events [:multiaccounts.ui/profile-picture-show-to-switched]} + [cofx id] + (multiaccounts.update/multiaccount-update cofx :profile-pictures-show-to id {})) + (fx/defn switch-appearance-profile {:events [:multiaccounts.ui/appearance-profile-switched]} [cofx id] diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 78212941baa9..8472ba833640 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -1791,6 +1791,12 @@ (fn [[chat contacts] [_ query-fn]] (contact.db/query-chat-contacts chat contacts query-fn))) +(re-frame/reg-sub + ::profile-pictures-show-to + :<- [:multiaccount] + (fn [multiaccount] + (get multiaccount :profile-pictures-show-to))) + (re-frame/reg-sub ::profile-pictures-visibility :<- [:multiaccount] diff --git a/src/status_im/ui/screens/appearance/views.cljs b/src/status_im/ui/screens/appearance/views.cljs index 0eb619c3483c..7bf8f0d4d4c6 100644 --- a/src/status_im/ui/screens/appearance/views.cljs +++ b/src/status_im/ui/screens/appearance/views.cljs @@ -9,7 +9,10 @@ [status-im.i18n.i18n :as i18n] [status-im.constants :as constants])) -(def titles {constants/profile-pictures-visibility-contacts-only (i18n/label :t/recent-recipients) +(def titles {constants/profile-pictures-show-to-contacts-only (i18n/label :t/recent-recipients) + constants/profile-pictures-show-to-everyone (i18n/label :t/everyone) + constants/profile-pictures-show-to-none (i18n/label :t/none) + 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)}) diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 44f2cddd6279..9280333944c2 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -78,6 +78,7 @@ :wallet/visible-tokens {:mainnet #{:SNT}} :currency :usd :appearance 0 + :profile-pictures-show-to 1 :profile-pictures-visibility 1 :log-level log-level :webview-allow-permission-requests? false diff --git a/translations/en.json b/translations/en.json index 36c501509d2f..a12bb6477a25 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1407,6 +1407,7 @@ "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", + "show-profile-pictures-to": "Show profile pictures to", "non-archival-node": "RPC endpoint doesn't support archival requests. Your local transfers history might be incomplete.", "custom-node": "You are using custom RPC endpoint. Your local transfers history might be incomplete.", "connection-status": "Connection status", From 67d9698b4969cc139bf52a94d991f1da2a83defa Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 25 Feb 2021 23:37:19 +0000 Subject: [PATCH 3/4] Added view and changed status go version Not working, my list view item shows but the default value isn't set and updating the value doesn't seem to work --- src/status_im/subs.cljs | 2 +- .../ui/screens/appearance/views.cljs | 5 +-- .../privacy_and_security_settings/views.cljs | 34 +++++++++++++++++-- .../ui/screens/routing/profile_stack.cljs | 2 ++ status-go-version.json | 6 ++-- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 8472ba833640..53de9fe87d87 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -1792,7 +1792,7 @@ (contact.db/query-chat-contacts chat contacts query-fn))) (re-frame/reg-sub - ::profile-pictures-show-to + :multiaccount/profile-pictures-show-to :<- [:multiaccount] (fn [multiaccount] (get multiaccount :profile-pictures-show-to))) diff --git a/src/status_im/ui/screens/appearance/views.cljs b/src/status_im/ui/screens/appearance/views.cljs index 7bf8f0d4d4c6..0eb619c3483c 100644 --- a/src/status_im/ui/screens/appearance/views.cljs +++ b/src/status_im/ui/screens/appearance/views.cljs @@ -9,10 +9,7 @@ [status-im.i18n.i18n :as i18n] [status-im.constants :as constants])) -(def titles {constants/profile-pictures-show-to-contacts-only (i18n/label :t/recent-recipients) - constants/profile-pictures-show-to-everyone (i18n/label :t/everyone) - constants/profile-pictures-show-to-none (i18n/label :t/none) - constants/profile-pictures-visibility-contacts-only (i18n/label :t/recent-recipients) +(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)}) diff --git a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs index 13dd317d4437..40fe4d56cf98 100644 --- a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs +++ b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs @@ -7,17 +7,23 @@ [status-im.ui.components.react :as react] [status-im.multiaccounts.biometric.core :as biometric] [status-im.ui.components.topbar :as topbar] - [status-im.utils.platform :as platform]) + [status-im.utils.platform :as platform] + [status-im.constants :as constants]) (:require-macros [status-im.utils.views :as views])) (defn separator [] [quo/separator {:style {:margin-vertical 8}}]) +(def titles {constants/profile-pictures-show-to-contacts-only (i18n/label :t/recent-recipients) + constants/profile-pictures-show-to-everyone (i18n/label :t/everyone) + constants/profile-pictures-show-to-none (i18n/label :t/none)}) + (views/defview privacy-and-security [] (views/letsubs [{:keys [mnemonic preview-privacy? webview-allow-permission-requests?]} [:multiaccount] supported-biometric-auth [:supported-biometric-auth] auth-method [:auth-method] - keycard? [:keycard-multiaccount?]] + keycard? [:keycard-multiaccount?] + profile-pictures-show-to [:multiaccount/profile-pictures-show-to]] [react/view {:flex 1 :background-color colors/white} [topbar/topbar {:title (i18n/label :t/privacy-and-security)}] [react/scroll-view {:padding-vertical 8} @@ -78,6 +84,14 @@ :on-press #(re-frame/dispatch [:multiaccounts.ui/webview-permission-requests-switched ((complement boolean) webview-allow-permission-requests?)])}]) + [quo/list-item + {:size :small + :title (i18n/label :t/show-profile-pictures-to) + :accessibility-label :show-profile-pictures-to + :accessory :text + :accessory-text (get titles profile-pictures-show-to) + :on-press #(re-frame/dispatch [:navigate-to :privacy-and-security-profile-pic-show-to]) + :chevron true}] ;; TODO(rasom): remove this condition when kk support will be added (when-not keycard? [separator]) @@ -89,3 +103,19 @@ :on-press #(re-frame/dispatch [:navigate-to :delete-profile]) :accessibility-label :dapps-permissions-button :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/profile-picture-show-to-switched id])}]) + +(views/defview profile-pic-show-to [] + (views/letsubs [{:keys [profile-pictures-show-to]} [:multiaccount/profile-pictures-show-to]] + [react/view {:flex 1} + [topbar/topbar {:title (i18n/label :t/show-profile-pictures-to)}] + [react/view {:margin-top 8} + [radio-item constants/profile-pictures-show-to-everyone profile-pictures-show-to] + [radio-item constants/profile-pictures-show-to-contacts-only profile-pictures-show-to] + [radio-item constants/profile-pictures-show-to-none profile-pictures-show-to]]])) \ No newline at end of file diff --git a/src/status_im/ui/screens/routing/profile_stack.cljs b/src/status_im/ui/screens/routing/profile_stack.cljs index 4abf7f1fdcf8..1a58e1564aa9 100644 --- a/src/status_im/ui/screens/routing/profile_stack.cljs +++ b/src/status_im/ui/screens/routing/profile_stack.cljs @@ -80,6 +80,8 @@ :component link-previews-settings/link-previews-settings} {:name :privacy-and-security :component privacy-and-security/privacy-and-security} + {:name :privacy-and-security-profile-pic-show-to + :component privacy-and-security/profile-pic-show-to} {:name :appearance :component appearance/appearance} {:name :appearance-profile-pic diff --git a/status-go-version.json b/status-go-version.json index 1456897cf4dd..785fd94f79dc 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.71.4", - "commit-sha1": "2c0383ec2286c644fe4425c04ad692f4fa0243fe", - "src-sha256": "1kvpzmkzarg8l5gq7dz7316f1bph3zh754crhc1mmd334919cn3h" + "version": "feature/private-profile-photos", + "commit-sha1": "ff8d248f4f42e0e9eb1b4a2aa6450ffe817c8672", + "src-sha256": "1g2nrm99dmhbgj0aqik0y1s1m362hkaj8rb3rwi0n0ncdz29lbrq" } From 25e407cee503acd99139e56961b94e17d3f286d0 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Fri, 26 Feb 2021 13:20:49 +0000 Subject: [PATCH 4/4] Subs fix --- .../ui/screens/privacy_and_security_settings/views.cljs | 4 ++-- translations/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs index 40fe4d56cf98..41b961e40719 100644 --- a/src/status_im/ui/screens/privacy_and_security_settings/views.cljs +++ b/src/status_im/ui/screens/privacy_and_security_settings/views.cljs @@ -109,10 +109,10 @@ {:active (= value id) :accessory :radio :title (get titles id) - :on-press #(re-frame/dispatch [:multiaccounts/profile-picture-show-to-switched id])}]) + :on-press #(re-frame/dispatch [:multiaccounts.ui/profile-picture-show-to-switched id])}]) (views/defview profile-pic-show-to [] - (views/letsubs [{:keys [profile-pictures-show-to]} [:multiaccount/profile-pictures-show-to]] + (views/letsubs [profile-pictures-show-to [:multiaccount/profile-pictures-show-to]] [react/view {:flex 1} [topbar/topbar {:title (i18n/label :t/show-profile-pictures-to)}] [react/view {:margin-top 8} diff --git a/translations/en.json b/translations/en.json index a12bb6477a25..328feda80db0 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1406,8 +1406,8 @@ "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", "everyone": "Everyone", - "show-profile-pictures": "Show profile pictures of", - "show-profile-pictures-to": "Show profile pictures to", + "show-profile-pictures": "See profile pictures from", + "show-profile-pictures-to": "Show your profile picture to", "non-archival-node": "RPC endpoint doesn't support archival requests. Your local transfers history might be incomplete.", "custom-node": "You are using custom RPC endpoint. Your local transfers history might be incomplete.", "connection-status": "Connection status",