diff --git a/.env b/.env index 9567ef53f9..d7182d43f9 100644 --- a/.env +++ b/.env @@ -26,7 +26,6 @@ APN_TOPIC=im.status.ethereum.pr COMMUNITIES_ENABLED=1 DATABASE_MANAGEMENT_ENABLED=1 DELETE_MESSAGE_ENABLED=1 -COLLECTIBLES_ENABLED=1 COMMANDS_ENABLED=1 TWO_MINUTES_SYNCING=1 SWAP_ENABLED=1 diff --git a/.env.release b/.env.release index 1d21278c44..c90b1b69ab 100644 --- a/.env.release +++ b/.env.release @@ -18,6 +18,5 @@ PARTITIONED_TOPIC=0 ENABLE_ROOT_ALERT=1 MAX_IMAGES_BATCH=1 DELETE_MESSAGE_ENABLED=1 -COLLECTIBLES_ENABLED=1 FAST_CREATE_COMMUNITY_ENABLED=0 TEST_NETWORKS_ENABLED=0 diff --git a/src/legacy/status_im/events.cljs b/src/legacy/status_im/events.cljs index b49ad3a071..7346f8a15e 100644 --- a/src/legacy/status_im/events.cljs +++ b/src/legacy/status_im/events.cljs @@ -26,7 +26,6 @@ legacy.status-im.ui.components.invite.events [legacy.status-im.ui.components.react :as react] legacy.status-im.ui.screens.notifications-settings.events - legacy.status-im.ui.screens.privacy-and-security-settings.events [legacy.status-im.utils.dimensions :as dimensions] legacy.status-im.utils.logging.core [legacy.status-im.utils.utils :as utils] diff --git a/src/legacy/status_im/multiaccounts/update/core.cljs b/src/legacy/status_im/multiaccounts/update/core.cljs index aba6e98035..35fdafc035 100644 --- a/src/legacy/status_im/multiaccounts/update/core.cljs +++ b/src/legacy/status_im/multiaccounts/update/core.cljs @@ -120,12 +120,3 @@ {:events [:multiaccounts.ui/switch-backup-enabled]} [cofx enabled?] (multiaccount-update cofx :backup-enabled? enabled? {})) - -(rf/defn toggle-opensea-nfts-visibility - {:events [::toggle-opensea-nfts-visiblity]} - [cofx visible?] - (rf/merge cofx - {:db (assoc-in (:db cofx) [:profile/profile :opensea-enabled?] visible?) - ;; need to add fully qualified namespace to counter circular deps - :dispatch [:legacy.status-im.wallet.core/fetch-collectibles-collection]} - (multiaccount-update :opensea-enabled? visible? {}))) diff --git a/src/legacy/status_im/ui/screens/dapps_permissions/styles.cljs b/src/legacy/status_im/ui/screens/dapps_permissions/styles.cljs deleted file mode 100644 index 4ba6fb54ed..0000000000 --- a/src/legacy/status_im/ui/screens/dapps_permissions/styles.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns legacy.status-im.ui.screens.dapps-permissions.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) - -(def icon-container - {:width 40 - :height 40 - :border-radius 20 - :background-color colors/gray-lighter - :align-items :center - :justify-content :center}) diff --git a/src/legacy/status_im/ui/screens/dapps_permissions/views.cljs b/src/legacy/status_im/ui/screens/dapps_permissions/views.cljs deleted file mode 100644 index 25d0d27d61..0000000000 --- a/src/legacy/status_im/ui/screens/dapps_permissions/views.cljs +++ /dev/null @@ -1,64 +0,0 @@ -(ns legacy.status-im.ui.screens.dapps-permissions.views - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.list.views :as list] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.dapps-permissions.styles :as styles] - [re-frame.core :as re-frame] - [status-im.constants :as constants] - [utils.i18n :as i18n])) - -(defn d-icon - [] - [react/view styles/icon-container - [icons/icon :main-icons/dapp {:color colors/gray}]]) - -(defn prepare-items - [{:keys [dapp permissions]}] - {:title dapp - :chevron true - :on-press #(re-frame/dispatch [:navigate-to :manage-dapps-permissions - {:dapp dapp :permissions permissions}]) - :icon [d-icon]}) - -(defn prepare-items-manage - [name] - (fn [permission] - {:title (cond - (= permission constants/dapp-permission-web3) - name - (= permission constants/dapp-permission-contact-code) - (i18n/label :t/contact-code)) - :size :small - :accessory [icons/icon :main-icons/check {}]})) - -(views/defview dapps-permissions - [] - (views/letsubs [permissions [:dapps/permissions]] - [list/flat-list - {:data (vec (map prepare-items (vals permissions))) - :key-fn (fn [_ i] (str i)) - :render-fn list.item/list-item}])) - -(views/defview manage - [] - (views/letsubs [{:keys [dapp permissions]} [:get-screen-params] - {:keys [name]} [:dapps-account]] - [:<> - [topbar/topbar {:title dapp}] - [list/flat-list - {:data (vec (map (prepare-items-manage name) permissions)) - :key-fn (fn [_ i] (str i)) - :render-fn list.item/list-item}] - [react/view - {:padding-vertical 16 - :padding-horizontal 16} - [quo/button - {:theme :negative - :on-press #(re-frame/dispatch [:dapps/revoke-access dapp])} - (i18n/label :t/revoke-access)]]])) diff --git a/src/legacy/status_im/ui/screens/link_previews_settings/styles.cljs b/src/legacy/status_im/ui/screens/link_previews_settings/styles.cljs deleted file mode 100644 index 18a7ddbd0f..0000000000 --- a/src/legacy/status_im/ui/screens/link_previews_settings/styles.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns legacy.status-im.ui.screens.link-previews-settings.styles) - -(def link-preview-settings-image - {:height 100 - :align-self :center - :margin-top 16}) - -(def whitelist-container - {:flex-direction :row - :justify-content :space-between}) - -(def enable-all - {:align-self :flex-end}) diff --git a/src/legacy/status_im/ui/screens/link_previews_settings/views.cljs b/src/legacy/status_im/ui/screens/link_previews_settings/views.cljs deleted file mode 100644 index beb647a796..0000000000 --- a/src/legacy/status_im/ui/screens/link_previews_settings/views.cljs +++ /dev/null @@ -1,67 +0,0 @@ -(ns legacy.status-im.ui.screens.link-previews-settings.views - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - [legacy.status-im.react-native.resources :as resources] - [legacy.status-im.ui.components.core :as components] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.list.views :as list] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.link-previews-settings.styles :as styles] - [quo.core :as quo] - [re-frame.core :as re-frame] - [status-im.contexts.chat.messenger.messages.link-preview.events] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn prepare-urls-items-data - [link-previews-enabled-sites] - (fn [{:keys [title address]}] - (let [enabled? (contains? link-previews-enabled-sites title)] - {:title title - :subtitle address - :size :small - :accessory :switch - :active (contains? link-previews-enabled-sites title) - :on-press #(re-frame/dispatch - [:chat.ui/enable-link-previews title ((complement boolean) enabled?)])}))) - -(views/defview link-previews-settings - [] - (views/letsubs [link-previews-whitelist [:link-previews-whitelist] - link-previews-enabled-sites [:link-preview/enabled-sites]] - (let [all-enabled (= (count link-previews-whitelist) (count link-previews-enabled-sites))] - [:<> - [quo/page-nav - {:type :title - :title (i18n/label :t/chat-link-previews) - :background :blur - :icon-name :i/close - :on-press #(rf/dispatch [:navigate-back])}] - [react/image - {:source (resources/get-theme-image :unfurl) - :style styles/link-preview-settings-image}] - [components/text {:style {:margin 16}} - (i18n/label :t/you-can-choose-preview-websites)] - [components/separator {:style {:margin-vertical 8}}] - - [react/view styles/whitelist-container - [components/list-header (i18n/label :t/websites)] - - (when (> (count link-previews-whitelist) 1) - [components/button - {:on-press #(re-frame/dispatch [:chat.ui/enable-all-link-previews - link-previews-whitelist - (not all-enabled)]) - :type :secondary - :style styles/enable-all} - (if all-enabled - (i18n/label :t/disable-all) - (i18n/label :t/enable-all))])] - [list/flat-list - {:data (vec (map (prepare-urls-items-data link-previews-enabled-sites) - link-previews-whitelist)) - :key-fn (fn [_ i] (str i)) - :render-fn list.item/list-item - :footer [quo/text - {:color :secondary - :style {:margin 16}} (i18n/label :t/previewing-may-share-metadata)]}]]))) diff --git a/src/legacy/status_im/ui/screens/privacy_and_security_settings/delete_profile.cljs b/src/legacy/status_im/ui/screens/privacy_and_security_settings/delete_profile.cljs deleted file mode 100644 index 953aea10aa..0000000000 --- a/src/legacy/status_im/ui/screens/privacy_and_security_settings/delete_profile.cljs +++ /dev/null @@ -1,81 +0,0 @@ -(ns legacy.status-im.ui.screens.privacy-and-security-settings.delete-profile - (:require - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon.screen] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.privacy-and-security-settings.events :as delete-profile] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.contexts.profile.utils :as profile.utils] - [utils.i18n :as i18n] - [utils.security.core :as security])) - -(defn valid-password? - [password] - (>= (count password) 6)) - -(defn on-delete-profile - [password] - #(do - (re-frame/dispatch - [::delete-profile/delete-profile @password]) - (reset! password nil))) - -(defn delete-profile - [] - (let [password (reagent/atom nil) - text-input-ref (atom nil)] - (fn [] - (let [profile @(re-frame/subscribe [:profile/profile]) - error @(re-frame/subscribe [:delete-profile/error]) - keep-keys-on-keycard? @(re-frame/subscribe - [:delete-profile/keep-keys-on-keycard?])] - (when (and @text-input-ref error (not @password)) - (.clear ^js @text-input-ref)) - [react/keyboard-avoiding-view {:style {:flex 1}} - [react/scroll-view {:style {:flex 1}} - [react/view {:style {:align-items :center}} - [quo/text - {:weight :bold - :size :x-large} - (i18n/label :t/delete-profile)]] - [list.item/list-item - {:title (profile.utils/displayed-name profile) - :icon [chat-icon.screen/contact-icon-contacts-tab profile]}] - [quo/text - {:style {:margin-horizontal 24} - :align :center - :color :negative} - (i18n/label :t/delete-profile-warning)] - [quo/text-input - {:style {:margin-horizontal 36 - :margin-top 36} - :show-cancel false - :secure-text-entry true - :return-key-type :next - :on-submit-editing nil - :auto-focus true - :on-change-text #(reset! password (security/mask-data %)) - :bottom-value 36 - :get-ref #(reset! text-input-ref %) - :error (when (and error (not @password)) - (if (= :wrong-password error) - (i18n/label :t/wrong-password) - (str error)))}]] - [react/view {:style {:align-items :center}} - [quo/separator] - (when (not keep-keys-on-keycard?) - [quo/text - {:style {:margin-horizontal 24 :margin-bottom 16} - :align :center - :color :negative} - (i18n/label :t/delete-profile-warning)]) - [react/view - {:style {:margin-vertical 8}} - [quo/button - {:on-press (on-delete-profile password) - :theme :negative - :accessibility-label :delete-profile-confirm - :disabled ((complement valid-password?) @password)} - (i18n/label :t/delete-profile)]]]])))) diff --git a/src/legacy/status_im/ui/screens/privacy_and_security_settings/events.cljs b/src/legacy/status_im/ui/screens/privacy_and_security_settings/events.cljs deleted file mode 100644 index e166a01329..0000000000 --- a/src/legacy/status_im/ui/screens/privacy_and_security_settings/events.cljs +++ /dev/null @@ -1,73 +0,0 @@ -(ns legacy.status-im.ui.screens.privacy-and-security-settings.events - (:require - [clojure.string :as string] - [legacy.status-im.utils.deprecated-types :as types] - [native-module.core :as native-module] - [re-frame.core :as re-frame] - [taoensso.timbre :as log] - [utils.i18n :as i18n] - [utils.re-frame :as rf] - [utils.security.core :as security])) - -(defn safe-blank? - [s] - (or (not s) - (string/blank? s))) - -(re-frame/reg-fx - ::delete-profile - (fn [{:keys [address key-uid callback masked-password]}] - (let [hashed-password - (-> masked-password - security/safe-unmask-data - native-module/sha3)] - (native-module/verify - address - hashed-password - (fn [result] - (let [{:keys [error]} (types/json->clj result)] - (log/info "[delete-profile] verify-password" result error) - (if-not (safe-blank? error) - (callback :wrong-password nil) - (native-module/delete-multiaccount - key-uid - (fn [result] - (let [{:keys [error]} (types/json->clj result)] - (callback error nil))))))))))) - -(rf/defn delete-profile - {:events [::delete-profile]} - [{:keys [db] :as cofx} masked-password] - (log/info "[delete-profile] delete") - (let [{:keys [key-uid wallet-root-address]} (:profile/profile db)] - {:db (dissoc db :delete-profile/error) - ::delete-profile - {:masked-password masked-password - :key-uid key-uid - :address wallet-root-address - :callback - (fn [error result] - (log/info "[delete-profile] callback" error) - (if (safe-blank? error) - (re-frame/dispatch [::on-delete-profile-success result]) - (re-frame/dispatch [::on-delete-profile-failure error])))}})) - -(rf/defn on-delete-profile-success - {:events [::on-delete-profile-success]} - [cofx] - (log/info "[delete-profile] on-success") - {:effects.utils/show-popup - {:title (i18n/label :t/profile-deleted-title) - :content (i18n/label :t/profile-deleted-content) - :on-dismiss #(re-frame/dispatch [:logout])}}) - -(rf/defn on-delete-profile-failure - {:events [::on-delete-profile-failure]} - [{:keys [db]} error] - (log/info "[delete-profile] on-failure" error) - {:db (assoc db :delete-profile/error error)}) - -(rf/defn keep-keys-on-keycard - {:events [::keep-keys-on-keycard]} - [{:keys [db] :as cofx} checked?] - {:db (assoc-in db [:delete-profile/keep-keys-on-keycard?] checked?)}) diff --git a/src/legacy/status_im/ui/screens/privacy_and_security_settings/messages_from_contacts_only.cljs b/src/legacy/status_im/ui/screens/privacy_and_security_settings/messages_from_contacts_only.cljs deleted file mode 100644 index 59533e8ddf..0000000000 --- a/src/legacy/status_im/ui/screens/privacy_and_security_settings/messages_from_contacts_only.cljs +++ /dev/null @@ -1,34 +0,0 @@ -(ns legacy.status-im.ui.screens.privacy-and-security-settings.messages-from-contacts-only - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - [legacy.status-im.multiaccounts.update.core :as multiaccounts.update] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.react :as react] - [re-frame.core :as re-frame] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(rf/defn handle-messages-from-contacts-only-switched - {:events [::messages-from-contacts-only-switched]} - [cofx value] - (multiaccounts.update/multiaccount-update cofx - :messages-from-contacts-only - value - {})) - -(views/defview messages-from-contacts-only-view - [] - (views/letsubs [{:keys [messages-from-contacts-only]} [:profile/profile]] - [react/view {:margin-top 8} - [list.item/list-item - {:active (not messages-from-contacts-only) - :accessory :radio - :title (i18n/label :t/anyone) - :on-press #(re-frame/dispatch [::messages-from-contacts-only-switched false])}] - [list.item/list-item - {:active messages-from-contacts-only - :accessory :radio - :title (i18n/label :t/contacts) - :subtitle (i18n/label :t/messages-from-contacts-only-subtitle) - :subtitle-max-lines 4 - :on-press #(re-frame/dispatch [::messages-from-contacts-only-switched true])}]])) diff --git a/src/legacy/status_im/ui/screens/privacy_and_security_settings/views.cljs b/src/legacy/status_im/ui/screens/privacy_and_security_settings/views.cljs deleted file mode 100644 index c5b0ac155d..0000000000 --- a/src/legacy/status_im/ui/screens/privacy_and_security_settings/views.cljs +++ /dev/null @@ -1,175 +0,0 @@ -(ns legacy.status-im.ui.screens.privacy-and-security-settings.views - (:require - [legacy.status-im.multiaccounts.reset-password.core :as reset-password] - [legacy.status-im.multiaccounts.update.core :as multiaccounts.update] - [legacy.status-im.ui.components.core :as components] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.react :as react] - [quo.core :as quo] - [re-frame.core :as re-frame] - [react-native.platform :as platform] - [status-im.config :as config] - [status-im.constants :as constants] - [utils.i18n :as i18n] - [utils.re-frame :as rf]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(defn separator - [] - [components/separator {:style {:margin-vertical 8}}]) - -(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) - 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 [preview-privacy? - messages-from-contacts-only - webview-allow-permission-requests? - opensea-enabled? - profile-pictures-visibility]} - [:profile/profile] - has-picture [:profile/has-picture] - profile-pictures-show-to [:multiaccount/profile-pictures-show-to]] - [:<> - [quo/page-nav - {:type :no-title - :background :blur - :icon-name :i/close - :on-press #(rf/dispatch [:navigate-back])}] - [react/scroll-view {:padding-vertical 8} - [components/list-header (i18n/label :t/privacy)] - [list.item/list-item - {:size :small - :title (i18n/label :t/set-dapp-access-permissions) - :on-press #(re-frame/dispatch [:navigate-to :dapps-permissions]) - :accessibility-label :dapps-permissions-button - :chevron true}] - [list.item/list-item - {:size :small - :title (if platform/android? - (i18n/label :t/hide-content-when-switching-apps) - (i18n/label :t/hide-content-when-switching-apps-ios)) - :container-margin-bottom 8 - :active preview-privacy? - :accessory :switch - :on-press #(re-frame/dispatch - [:profile.settings/change-preview-privacy - ((complement boolean) preview-privacy?)])}] - (when config/collectibles-enabled? - [list.item/list-item - {:size :small - :title (i18n/label :t/display-collectibles) - :container-margin-bottom 8 - :active opensea-enabled? - :accessory :switch - :on-press #(re-frame/dispatch - [::multiaccounts.update/toggle-opensea-nfts-visiblity - (not opensea-enabled?)])}]) - [list.item/list-item - {:size :small - :title (i18n/label :t/chat-link-previews) - :chevron true - :on-press #(re-frame/dispatch [:open-modal :legacy-link-previews-settings]) - :accessibility-label :chat-link-previews}] - [list.item/list-item - {:size :small - :title (i18n/label :t/accept-new-chats-from) - :chevron true - :accessory :text - :accessory-text (i18n/label (if messages-from-contacts-only - :t/contacts - :t/anyone)) - :on-press #(re-frame/dispatch [:navigate-to :messages-from-contacts-only]) - :accessibility-label :accept-new-chats-from}] - [list.item/list-item - {:size :small - :title (i18n/label :t/reset-password) - :chevron true - :accessory :text - :on-press #(do - (re-frame/dispatch [::reset-password/clear-form-vals]) - (re-frame/dispatch [:navigate-to :reset-password])) - :accessibility-label :reset-password}] - (when platform/android? - [list.item/list-item - {:size :small - :title (i18n/label :t/webview-camera-permission-requests) - :active webview-allow-permission-requests? - :accessory :switch - :subtitle (i18n/label :t/webview-camera-permission-requests-subtitle) - :subtitle-max-lines 2 - :on-press #(re-frame/dispatch - [:profile.settings/profile-update - :webview-allow-permission-requests? - ((complement boolean) webview-allow-permission-requests?)])}]) - [separator] - [components/list-header (i18n/label :t/privacy-photos)] - [list.item/list-item - {:size :small - :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 :privacy-and-security-profile-pic]) - :chevron true}] - [list.item/list-item - {:size :small - :title (i18n/label :t/show-profile-pictures-to) - :disabled (not has-picture) - :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}] - - [separator] - [list.item/list-item - {:size :small - :theme :negative - :title (i18n/label :t/delete-my-profile) - :on-press #(re-frame/dispatch [:navigate-to :delete-profile]) - :accessibility-label :dapps-permissions-button - :chevron true}]]])) - -(defn ppst-radio-item - [id value] - [list.item/list-item - {:active (= value id) - :accessory :radio - :title (get titles id) - :on-press #(re-frame/dispatch [:profile.settings/change-profile-pictures-show-to id])}]) - -(views/defview profile-pic-show-to - [] - (views/letsubs [{:keys [profile-pictures-show-to]} [:profile/profile]] - [react/view {:margin-top 8} - [ppst-radio-item constants/profile-pictures-show-to-everyone profile-pictures-show-to] - [ppst-radio-item constants/profile-pictures-show-to-contacts-only profile-pictures-show-to] - [ppst-radio-item constants/profile-pictures-show-to-none profile-pictures-show-to] - - [react/view {:style {:margin-horizontal 16}} - [components/text {:color :secondary} - (i18n/label :t/privacy-show-to-warning)]]])) - -(defn ppvf-radio-item - [id value] - [list.item/list-item - {:active (= value id) - :accessory :radio - :title (get titles id) - :on-press #(re-frame/dispatch [:profile.settings/profile-update :profile-pictures-visibility id])}]) - -(views/defview profile-pic - [] - (views/letsubs [{:keys [profile-pictures-visibility]} [:profile/profile]] - [react/view {:margin-top 8} - [ppvf-radio-item constants/profile-pictures-visibility-everyone profile-pictures-visibility] - [ppvf-radio-item constants/profile-pictures-visibility-contacts-only profile-pictures-visibility] - [ppvf-radio-item constants/profile-pictures-visibility-none profile-pictures-visibility]])) diff --git a/src/legacy/status_im/ui/screens/profile/user/views.cljs b/src/legacy/status_im/ui/screens/profile/user/views.cljs index c48e02a0e2..e2fc829ca9 100644 --- a/src/legacy/status_im/ui/screens/profile/user/views.cljs +++ b/src/legacy/status_im/ui/screens/profile/user/views.cljs @@ -13,12 +13,6 @@ [] [rn/scroll-view {:flex 1} [components/list-header "Legacy settings"] - [list.item/list-item - {:icon :main-icons/security - :title (i18n/label :t/privacy-and-security) - :accessibility-label :privacy-and-security-settings-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :legacy-privacy-and-security])}] [list.item/list-item {:icon :main-icons/mobile :title (i18n/label :t/sync-settings) diff --git a/src/legacy/status_im/ui/screens/screens.cljs b/src/legacy/status_im/ui/screens/screens.cljs index a95785c65b..80b8b8d026 100644 --- a/src/legacy/status_im/ui/screens/screens.cljs +++ b/src/legacy/status_im/ui/screens/screens.cljs @@ -8,12 +8,10 @@ [legacy.status-im.ui.screens.bug-report :as bug-report] [legacy.status-im.ui.screens.communities.invite :as communities.invite] [legacy.status-im.ui.screens.communities.members :as members] - [legacy.status-im.ui.screens.dapps-permissions.views :as dapps-permissions] [legacy.status-im.ui.screens.default-sync-period-settings.view :as default-sync-period-settings] [legacy.status-im.ui.screens.fleet-settings.views :as fleet-settings] [legacy.status-im.ui.screens.glossary.view :as glossary] [legacy.status-im.ui.screens.help-center.views :as help-center] - [legacy.status-im.ui.screens.link-previews-settings.views :as link-previews-settings] [legacy.status-im.ui.screens.log-level-settings.views :as log-level-settings] [legacy.status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings] [legacy.status-im.ui.screens.notifications-settings.views :as notifications-settings] @@ -21,10 +19,6 @@ [legacy.status-im.ui.screens.offline-messaging-settings.views :as offline-messaging-settings] [legacy.status-im.ui.screens.pairing.views :as pairing] [legacy.status-im.ui.screens.peers-stats :as peers-stats] - [legacy.status-im.ui.screens.privacy-and-security-settings.delete-profile :as delete-profile] - [legacy.status-im.ui.screens.privacy-and-security-settings.messages-from-contacts-only :as - messages-from-contacts-only] - [legacy.status-im.ui.screens.privacy-and-security-settings.views :as privacy-and-security] [legacy.status-im.ui.screens.profile.seed.views :as profile.seed] [legacy.status-im.ui.screens.profile.user.views :as profile.user] [legacy.status-im.ui.screens.progress.views :as progress] @@ -94,17 +88,6 @@ :insets {:top? platform/android?}} :component profile.user/legacy-settings} - ;; PRIVACY AND SECURITY - {:name :legacy-privacy-and-security - :options {:topBar {:visible false} - :insets {:top? platform/android?}} - :component privacy-and-security/privacy-and-security} - - {:name :legacy-link-previews-settings - :options {:topBar {:visible false} - :insets {:top? platform/android?}} - :component link-previews-settings/link-previews-settings} - ;; SYNC {:name :legacy-sync-settings :options {:topBar {:visible false} @@ -150,25 +133,6 @@ {:name :edit-mailserver :options {:insets {:top? true}} :component edit-mailserver/edit-mailserver} - {:name :dapps-permissions - :options {:topBar (topbar-options :t/dapps-permissions) - :insets {:top? true}} - :component dapps-permissions/dapps-permissions} - {:name :messages-from-contacts-only - :options {:topBar (topbar-options :t/accept-new-chats-from) - :insets {:top? true}} - :component messages-from-contacts-only/messages-from-contacts-only-view} - {:name :privacy-and-security-profile-pic-show-to - :options {:topbar (topbar-options :t/show-profile-pictures-to) - :insets {:top? true}} - :component privacy-and-security/profile-pic-show-to} - {:name :privacy-and-security-profile-pic - :options {:topBar (topbar-options :t/show-profile-pictures) - :insets {:top? true}} - :component privacy-and-security/profile-pic} - {:name :manage-dapps-permissions - :options {:insets {:top? true}} - :component dapps-permissions/manage} {:name :rpc-usage-info :options {:topBar (topbar-options :t/rpc-usage-info) :insets {:top? true}} @@ -196,9 +160,6 @@ :options {:topBar (topbar-options :t/reset-password) :insets {:top? true}} :component reset-password/reset-password} - {:name :delete-profile - :insets {:bottom? true} - :component delete-profile/delete-profile} {:name :default-sync-period-settings :options {:topBar (topbar-options :t/default-sync-period) :insets {:top? true}} diff --git a/src/quo/components/settings/settings_item/style.cljs b/src/quo/components/settings/settings_item/style.cljs index e4ba8c679b..0dc93cdf15 100644 --- a/src/quo/components/settings/settings_item/style.cljs +++ b/src/quo/components/settings/settings_item/style.cljs @@ -51,7 +51,7 @@ (defn color [blur? theme] {:color (if blur? - colors/white-opa-70 + colors/white-opa-40 (colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}) (defn label-dot diff --git a/src/status_im/config.cljs b/src/status_im/config.cljs index 1213040f6f..b85044c90a 100644 --- a/src/status_im/config.cljs +++ b/src/status_im/config.cljs @@ -63,7 +63,6 @@ (def quo-preview-enabled? (enabled? (get-config :ENABLE_QUO_PREVIEW "0"))) (def database-management-enabled? (enabled? (get-config :DATABASE_MANAGEMENT_ENABLED "0"))) (def debug-webview? (enabled? (get-config :DEBUG_WEBVIEW "0"))) -(def collectibles-enabled? (enabled? (get-config :COLLECTIBLES_ENABLED "1"))) (def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0"))) (def two-minutes-syncing? (enabled? (get-config :TWO_MINUTES_SYNCING "0"))) (def swap-enabled? (enabled? (get-config :SWAP_ENABLED "0"))) diff --git a/src/status_im/contexts/profile/events.cljs b/src/status_im/contexts/profile/events.cljs index cb394aa08d..fa74a525fd 100644 --- a/src/status_im/contexts/profile/events.cljs +++ b/src/status_im/contexts/profile/events.cljs @@ -1,6 +1,7 @@ (ns status-im.contexts.profile.events (:require [legacy.status-im.data-store.settings :as data-store.settings] + [legacy.status-im.multiaccounts.update.core :as multiaccounts.update] [native-module.core :as native-module] [status-im.config :as config] [status-im.contexts.profile.edit.accent-colour.events] @@ -73,3 +74,11 @@ :profile/update-profile-from-backup (fn [_ [{{:keys [ensUsernameDetails]} :backedUpProfile}]] {:fx [[:dispatch [:ens/update-usernames ensUsernameDetails]]]})) + +(rf/reg-event-fx :profile/update-messages-from-contacts-only + (fn [{:keys [db] :as cofx}] + (multiaccounts.update/multiaccount-update + cofx + :messages-from-contacts-only + (not (get-in db [:profile/profile :messages-from-contacts-only])) + {}))) diff --git a/src/status_im/contexts/profile/settings/screens/messages/view.cljs b/src/status_im/contexts/profile/settings/screens/messages/view.cljs index 3adbeb24e0..1425ede052 100644 --- a/src/status_im/contexts/profile/settings/screens/messages/view.cljs +++ b/src/status_im/contexts/profile/settings/screens/messages/view.cljs @@ -1,11 +1,10 @@ (ns status-im.contexts.profile.settings.screens.messages.view - (:require [quo.core :as quo] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn- navigate-back - [] - (rf/dispatch [:navigate-back])) + (:require + [quo.core :as quo] + [react-native.core :as rn] + [utils.i18n :as i18n] + [utils.navigation :as navigation] + [utils.re-frame :as rf])) (defn- open-blocked-users [] @@ -13,17 +12,27 @@ (defn view [] - [quo/overlay {:type :shell :top-inset? true} - [quo/page-nav - {:background :blur - :icon-name :i/arrow-left - :on-press navigate-back}] - [quo/page-top {:title (i18n/label :t/messages)}] - [quo/category - {:label (i18n/label :t/contacts) - :data [{:title (i18n/label :t/blocked-users) - :on-press open-blocked-users - :blur? true - :action :arrow}] - :blur? true - :list-type :settings}]]) + (let [allow-new-contact-requests? (rf/sub [:profile/allow-new-contact-requests?]) + toggle-allow-new-contact-requests (rn/use-callback + (fn [] + (rf/dispatch [:profile/update-messages-from-contacts-only])) + [allow-new-contact-requests?])] + [quo/overlay {:type :shell :top-inset? true} + [quo/page-nav + {:background :blur + :icon-name :i/arrow-left + :on-press navigation/navigate-back}] + [quo/page-top {:title (i18n/label :t/messages)}] + [quo/category + {:label (i18n/label :t/contacts) + :data [{:title (i18n/label :t/allow-new-contact-requests) + :blur? true + :action :selector + :action-props {:on-change toggle-allow-new-contact-requests + :checked? allow-new-contact-requests?}} + {:title (i18n/label :t/blocked-users) + :on-press open-blocked-users + :blur? true + :action :arrow}] + :blur? true + :list-type :settings}]])) diff --git a/src/status_im/contexts/settings/privacy_and_security/profile_picture/view.cljs b/src/status_im/contexts/settings/privacy_and_security/profile_picture/view.cljs new file mode 100644 index 0000000000..857ec5e29a --- /dev/null +++ b/src/status_im/contexts/settings/privacy_and_security/profile_picture/view.cljs @@ -0,0 +1,118 @@ +(ns status-im.contexts.settings.privacy-and-security.profile-picture.view + (:require + [quo.core :as quo] + [quo.theme] + [status-im.constants :as constants] + [utils.i18n :as i18n] + [utils.re-frame :as rf])) + +(def pictures-visibility->label + {constants/profile-pictures-visibility-everyone (i18n/label :t/everyone) + constants/profile-pictures-visibility-contacts-only (i18n/label :t/contacts) + constants/profile-pictures-visibility-none (i18n/label :t/no-one)}) + +(def pictures-show-to->label + {constants/profile-pictures-show-to-everyone (i18n/label :t/everyone) + constants/profile-pictures-show-to-contacts-only (i18n/label :t/contacts) + constants/profile-pictures-show-to-none (i18n/label :t/no-one)}) + +(defn- update-profile + [k v] + (rf/dispatch [:profile.settings/profile-update k v]) + (rf/dispatch [:hide-bottom-sheet])) + +(defn- update-pictures-visibility-everyone + [] + (update-profile :profile-pictures-visibility constants/profile-pictures-visibility-everyone)) + +(defn- update-pictures-visibility-contacts-only + [] + (update-profile :profile-pictures-visibility constants/profile-pictures-visibility-contacts-only)) + +(defn- update-pictures-visibility-nobody + [] + (update-profile :profile-pictures-visibility constants/profile-pictures-visibility-none)) + +(defn- update-pictures-show-to-everyone + [] + (update-profile :profile-pictures-show-to constants/profile-pictures-show-to-everyone)) + +(defn- update-pictures-show-to-contacts-only + [] + (update-profile :profile-pictures-show-to constants/profile-pictures-show-to-contacts-only)) + +(defn- update-pictures-show-to-nobody + [] + (update-profile :profile-pictures-show-to constants/profile-pictures-show-to-none)) + +(defn options-for-profile-pictures-visibility + [setting] + (let [customization-color (rf/sub [:profile/customization-color])] + [:<> + [quo/drawer-top {:title (i18n/label :t/show-profile-pictures)}] + [quo/action-drawer + [[{:icon :i/globe + :accessibility-label :see-profile-pictures-from-everyone + :label (i18n/label :t/everyone) + :on-press update-pictures-visibility-everyone + :state (when (= constants/profile-pictures-visibility-everyone setting) + :selected)} + {:icon :i/contact + :icon-color customization-color + :accessibility-label :see-profile-pictures-from-contacts + :label (i18n/label :t/contacts) + :on-press update-pictures-visibility-contacts-only + :state (when (= constants/profile-pictures-visibility-contacts-only setting) + :selected)} + {:icon :i/hide + :accessibility-label :see-profile-pictures-from-nobody + :label (i18n/label :t/no-one) + :add-divider? true + :on-press update-pictures-visibility-nobody + :state (when (= constants/profile-pictures-visibility-none setting) + :selected)}]]]])) + +(defn options-for-profile-pictures-show-to + [setting] + (let [customization-color (rf/sub [:profile/customization-color])] + [:<> + [quo/drawer-top {:title (i18n/label :t/show-profile-pictures-to)}] + [quo/action-drawer + [[{:icon :i/globe + :accessibility-label :show-profile-pictures-to-everyone + :label (i18n/label :t/everyone) + :on-press update-pictures-show-to-everyone + :state (when (= constants/profile-pictures-show-to-everyone setting) + :selected)} + {:icon :i/contact + :icon-color customization-color + :accessibility-label :show-profile-pictures-to-contacts + :label (i18n/label :t/contacts) + :on-press update-pictures-show-to-contacts-only + :state (when (= constants/profile-pictures-show-to-contacts-only setting) + :selected)} + {:icon :i/hide + :accessibility-label :show-profile-pictures-to-nobody + :label (i18n/label :t/no-one) + :on-press update-pictures-show-to-nobody + :state (when (= constants/profile-pictures-show-to-none setting) + :selected) + :add-divider? true}]]]])) + +(defn setting-profile-pictures-visibility + [pictures-visibility on-press] + {:title (i18n/label :t/show-profile-pictures) + :description :text + :description-props {:text (pictures-visibility->label pictures-visibility)} + :blur? true + :action :arrow + :on-press on-press}) + +(defn setting-profile-pictures-show-to + [pictures-show-to on-press] + {:title (i18n/label :t/show-profile-pictures-to) + :description :text + :description-props {:text (pictures-show-to->label pictures-show-to)} + :blur? true + :action :arrow + :on-press on-press}) diff --git a/src/status_im/contexts/settings/privacy_and_security/view.cljs b/src/status_im/contexts/settings/privacy_and_security/view.cljs index 1ce7641bb8..909b84ab6a 100644 --- a/src/status_im/contexts/settings/privacy_and_security/view.cljs +++ b/src/status_im/contexts/settings/privacy_and_security/view.cljs @@ -2,20 +2,65 @@ (:require [quo.core :as quo] [quo.theme] + [react-native.core :as rn] + [react-native.platform :as platform] [react-native.safe-area :as safe-area] + [status-im.contexts.settings.privacy-and-security.profile-picture.view :as profile-picture.view] [status-im.contexts.settings.privacy-and-security.style :as style] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] + [utils.navigation :as navigation] [utils.re-frame :as rf])) -(defn navigate-back - [] - (rf/dispatch [:navigate-back])) +(defn- setting-preview-privacy + [preview-privacy? customization-color on-change] + {:title (i18n/label (if platform/android? + :t/hide-content-when-switching-apps + :t/hide-content-when-switching-apps-ios)) + :blur? true + :action :selector + :action-props {:on-change on-change + :checked? preview-privacy? + :id :preview-privacy + :customization-color customization-color}}) (defn view [] - (let [insets (safe-area/get-insets) + (let [insets (safe-area/get-insets) centralized-metrics-enabled? (rf/sub [:centralized-metrics/enabled?]) - customization-color (rf/sub [:profile/customization-color])] + customization-color (rf/sub [:profile/customization-color]) + + preview-privacy? (rf/sub [:profile/preview-privacy?]) + see-profile-pictures-from (rf/sub [:profile/pictures-visibility]) + show-profile-pictures-to (rf/sub [:multiaccount/profile-pictures-show-to]) + + toggle-preview-privacy + (rn/use-callback (fn [] + (rf/dispatch [:profile.settings/change-preview-privacy + (not preview-privacy?)])) + [preview-privacy?]) + + open-see-profile-pictures-from-options + (rn/use-callback (fn [] + (rf/dispatch + [:show-bottom-sheet + {:theme :dark + :blur? true + :content (fn [] + [profile-picture.view/options-for-profile-pictures-visibility + see-profile-pictures-from])}])) + [see-profile-pictures-from]) + + open-show-profile-pictures-to-options + (rn/use-callback (fn [] + (rf/dispatch + [:show-bottom-sheet + {:theme :dark + :blur? true + :content (fn [] + [profile-picture.view/options-for-profile-pictures-show-to + show-profile-pictures-to])}])) + [show-profile-pictures-to])] [quo/overlay {:type :shell :container-style (style/page-wrapper (:top insets))} @@ -23,7 +68,7 @@ {:key :header :background :blur :icon-name :i/arrow-left - :on-press navigate-back}] + :on-press navigation/navigate-back}] [quo/standard-title {:title (i18n/label :t/privacy-and-security) :container-style style/title-container @@ -31,15 +76,22 @@ :customization-color customization-color}] [quo/category {:key :category - :data [{:title (i18n/label :t/share-usage-data) - :image-props :i/placeholder + :data [(when (ff/enabled? ::ff/profile-pictures-visibility) + (profile-picture.view/setting-profile-pictures-visibility + see-profile-pictures-from + open-see-profile-pictures-from-options)) + (when (ff/enabled? ::ff/profile-pictures-visibility) + (profile-picture.view/setting-profile-pictures-show-to + show-profile-pictures-to + open-show-profile-pictures-to-options)) + (setting-preview-privacy preview-privacy? customization-color toggle-preview-privacy) + {:title (i18n/label :t/share-usage-data) :blur? true :action :selector :action-props {:on-change #(rf/dispatch [:centralized-metrics/toggle-centralized-metrics (not centralized-metrics-enabled?)]) :customization-color customization-color - :checked? centralized-metrics-enabled?} - :on-press identity}] + :checked? centralized-metrics-enabled?}}] :blur? true :list-type :settings}]])) diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index f730cc302d..9185031933 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -11,6 +11,12 @@ (def ^:private initial-flags {::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED) + + ;; Feature toggled (off by default) because the desktop app disabled this + ;; feature and we want both clients in sync. We keep the code because it + ;; works and we may re-enable it by default. + ::profile-pictures-visibility (enabled-in-env? :FLAG_PROFILE_PICTURES_VISIBILITY_ENABLED) + ::settings.import-all-keypairs (enabled-in-env? :FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS) ::shell.jump-to (enabled-in-env? :ENABLE_JUMP_TO) diff --git a/src/status_im/subs/profile.cljs b/src/status_im/subs/profile.cljs index d87a720f5e..609a1641d5 100644 --- a/src/status_im/subs/profile.cljs +++ b/src/status_im/subs/profile.cljs @@ -231,6 +231,20 @@ (fn [multiaccount] (pos? (count (get multiaccount :images))))) +(re-frame/reg-sub :profile/pictures-visibility + :<- [:profile/profile] + :-> :profile-pictures-visibility) + +(re-frame/reg-sub :profile/allow-new-contact-requests? + :<- [:profile/profile] + (fn [{:keys [messages-from-contacts-only]}] + (not messages-from-contacts-only))) + +(re-frame/reg-sub :profile/preview-privacy? + :<- [:profile/profile] + (fn [{:keys [preview-privacy?]}] + (boolean preview-privacy?))) + (defn- replace-multiaccount-image-uri [profile ens-names port font-file avatar-opts theme] (let [{:keys [key-uid ens-name? images diff --git a/src/status_im/subs/root.cljs b/src/status_im/subs/root.cljs index c84fdd9dfb..029eb3207d 100644 --- a/src/status_im/subs/root.cljs +++ b/src/status_im/subs/root.cljs @@ -91,9 +91,6 @@ (reg-root-key-sub :multiaccount/reset-password-form-vals :multiaccount/reset-password-form-vals) (reg-root-key-sub :multiaccount/reset-password-errors :multiaccount/reset-password-errors) (reg-root-key-sub :multiaccount/resetting-password? :multiaccount/resetting-password?) -;;delete profile -(reg-root-key-sub :delete-profile/error :delete-profile/error) -(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?) ;;chat (reg-root-key-sub :chats/cooldown-enabled? :chat/cooldown-enabled?) diff --git a/src/utils/navigation.cljs b/src/utils/navigation.cljs new file mode 100644 index 0000000000..0a2d92651e --- /dev/null +++ b/src/utils/navigation.cljs @@ -0,0 +1,8 @@ +(ns utils.navigation + "Prefer to declare in this namespace only reusable navigation functions that + aren't better suited in a particular bounded context." + (:require [utils.re-frame :as rf])) + +(defn navigate-back + [] + (rf/dispatch [:navigate-back])) diff --git a/translations/en.json b/translations/en.json index f35b1e7b19..3e70c031a1 100644 --- a/translations/en.json +++ b/translations/en.json @@ -16,6 +16,7 @@ "added-you-to": "added you to", "address-name": "Address name", "anyone": "Anyone", + "allow-new-contact-requests": "Allow new contact requests", "messages-from-contacts-only-subtitle": "Only people you added as contacts can start a new chat with you or invite you to a group", "messages-gap-warning": "Some messages might be missing", "accept-new-chats-from": "Accept new chats from", @@ -1093,6 +1094,7 @@ "node-version": "Node version", "nonce": "Nonce", "none": "None", + "no-one": "No one", "not-a-chatkey": "This is not a chatkey", "not-applicable": "Not applicable for unsigned transactions", "not-keycard-text": "The card you used is not a Keycard. You need to purchase a Keycard to use it",