diff --git a/src/legacy/status_im/currency/core.cljs b/src/legacy/status_im/currency/core.cljs deleted file mode 100644 index cf4642ff74..0000000000 --- a/src/legacy/status_im/currency/core.cljs +++ /dev/null @@ -1,18 +0,0 @@ -(ns legacy.status-im.currency.core - (:require - [legacy.status-im.multiaccounts.update.core :as multiaccounts.update] - [utils.re-frame :as rf])) - -(defn get-currency - [db] - (get-in db [:profile/profile :currency] :usd)) - -(rf/defn set-currency - {:events [:wallet-legacy.settings.ui/currency-selected]} - [{:keys [db] :as cofx} currency] - (rf/merge cofx - (multiaccounts.update/multiaccount-update - :currency - currency - ;; on changing currency, we should fetch tokens prices again - {:on-success #(rf/dispatch [:wallet/get-wallet-token])}))) diff --git a/src/legacy/status_im/currency/core_test.cljs b/src/legacy/status_im/currency/core_test.cljs deleted file mode 100644 index 1b58c468f4..0000000000 --- a/src/legacy/status_im/currency/core_test.cljs +++ /dev/null @@ -1,21 +0,0 @@ -(ns legacy.status-im.currency.core-test - (:require - [cljs.test :refer-macros [deftest is]] - [legacy.status-im.currency.core :as models])) - -(deftest get-currency - (is (= :usd (models/get-currency {:profile/profile {:currency :usd}}))) - (is (= :usd (models/get-currency {:profile/profile {:not-empty "would throw an error if was empty"}}))) - (is (= :aud (models/get-currency {:profile/profile {:currency :aud}})))) - -(deftest set-currency - (let [cofx (models/set-currency {:db {:profile/profile {:not-empty - "would throw an error if was empty"}}} - :usd)] - (is (= :usd (get-in cofx [:db :profile/profile :currency])))) - (is - (= :jpy - (get-in (models/set-currency {:db {:profile/profile {:not-empty - "would throw an error if was empty"}}} - :jpy) - [:db :profile/profile :currency])))) diff --git a/src/legacy/status_im/events.cljs b/src/legacy/status_im/events.cljs index b8b030c3a3..ca49261d6f 100644 --- a/src/legacy/status_im/events.cljs +++ b/src/legacy/status_im/events.cljs @@ -5,7 +5,6 @@ legacy.status-im.browser.core legacy.status-im.browser.permissions legacy.status-im.chat.models.loading - legacy.status-im.currency.core legacy.status-im.data-store.chats legacy.status-im.data-store.switcher-cards legacy.status-im.data-store.visibility-status-updates diff --git a/src/legacy/status_im/ui/components/connectivity/view.cljs b/src/legacy/status_im/ui/components/connectivity/view.cljs index 17ece146dc..65ba474704 100644 --- a/src/legacy/status_im/ui/components/connectivity/view.cljs +++ b/src/legacy/status_im/ui/components/connectivity/view.cljs @@ -151,7 +151,7 @@ {:title (i18n/label :t/settings) :accessibility-label "settings" :theme :accent - :on-press #(hide-sheet-and-dispatch [:navigate-to :sync-settings]) + :on-press #(hide-sheet-and-dispatch [:navigate-to :legacy-sync-settings]) :icon :main-icons/settings}] (when mobile [:<> diff --git a/src/legacy/status_im/ui/screens/about_app/views.cljs b/src/legacy/status_im/ui/screens/about_app/views.cljs index cabec2633e..93baa92475 100644 --- a/src/legacy/status_im/ui/screens/about_app/views.cljs +++ b/src/legacy/status_im/ui/screens/about_app/views.cljs @@ -5,11 +5,9 @@ [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.components.list.item :as list.item] [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.webview :refer [webview]] - [re-frame.core :as re-frame] - [status-im.constants :refer - [principles-link privacy-policy-link terms-of-service-link]] - [utils.i18n :as i18n]) + [quo.core :as quo] + [utils.i18n :as i18n] + [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) (views/defview about-app @@ -17,44 +15,38 @@ (views/letsubs [app-version [:get-app-short-version] commit-hash [:get-commit-hash] node-version [:get-app-node-version]] - [react/scroll-view - [list.item/list-item - {:size :small - :title (i18n/label :t/privacy-policy) - :accessibility-label :privacy-policy - :on-press - #(re-frame/dispatch [:navigate-to :privacy-policy]) - :chevron true}] - [list.item/list-item - {:size :small - :title (i18n/label :t/terms-of-service) - :accessibility-label :terms-of-service - :on-press #(re-frame/dispatch [:navigate-to :terms-of-service]) - :chevron true}] - [copyable-text/copyable-text-view - {:copied-text app-version} - [list.item/list-item - {:size :small - :accessibility-label :app-version - :title (i18n/label :t/version) - :accessory :text - :accessory-text app-version}]] - [copyable-text/copyable-text-view - {:copied-text commit-hash} - [list.item/list-item - {:size :small - :accessibility-label :commit-hash - :title (i18n/label :t/app-commit) - :accessory :text - :accessory-text commit-hash}]] - [copyable-text/copyable-text-view - {:copied-text node-version} - [list.item/list-item - {:size :small - :accessibility-label :node-version - :title (i18n/label :t/node-version) - :accessory :text - :accessory-text node-version}]]])) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/about-app) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [react/scroll-view + [copyable-text/copyable-text-view + {:copied-text app-version} + [list.item/list-item + {:size :small + :accessibility-label :app-version + :title (i18n/label :t/version) + :accessory :text + :accessory-text app-version}]] + [copyable-text/copyable-text-view + {:copied-text commit-hash} + [list.item/list-item + {:size :small + :accessibility-label :commit-hash + :title (i18n/label :t/app-commit) + :accessory :text + :accessory-text commit-hash}]] + [copyable-text/copyable-text-view + {:copied-text node-version} + [list.item/list-item + {:size :small + :accessibility-label :node-version + :title (i18n/label :t/node-version) + :accessory :text + :accessory-text node-version}]]]])) (views/defview learn-more-sheet [] @@ -73,21 +65,3 @@ (def learn-more {:content learn-more-sheet}) - -(views/defview privacy-policy - [] - [webview - {:source {:uri privacy-policy-link} - :java-script-enabled true}]) - -(views/defview tos - [] - [webview - {:source {:uri terms-of-service-link} - :java-script-enabled true}]) - -(views/defview principles - [] - [webview - {:source {:uri principles-link} - :java-script-enabled true}]) diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index 85dbf3995e..39b532f304 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -1,10 +1,12 @@ (ns legacy.status-im.ui.screens.advanced-settings.views (:require - [legacy.status-im.ui.components.core :as quo] + [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] + [quo.core :as quo] [re-frame.core :as re-frame] - [utils.i18n :as i18n]) + [utils.i18n :as i18n] + [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) (defn hide-sheet-and-dispatch @@ -27,7 +29,7 @@ :title (i18n/label :t/log-level) :accessibility-label :log-level-settings-button :on-press - #(re-frame/dispatch [:open-modal :log-level-settings]) + #(re-frame/dispatch [:open-modal :legacy-:og-level-settings]) :accessory :text :accessory-text current-log-level :chevron true} @@ -110,13 +112,7 @@ :on-press #(re-frame/dispatch [:profile.settings/toggle-peer-syncing]) :accessory :switch - :active peer-syncing-enabled?} - {:size :small - :title (i18n/label :t/set-currency) - :accessibility-label :wallet-change-currency - :on-press #(hide-sheet-and-dispatch - [:open-modal :currency-settings]) - :chevron true}])) + :active peer-syncing-enabled?}])) (defn- flat-list-data [options] @@ -125,7 +121,7 @@ (defn- render-item [props] (if (= (:type props) :section-header) - [quo/list-header (:title props)] + [components/list-header (:title props)] [list.item/list-item props])) (views/defview advanced-settings @@ -138,16 +134,23 @@ current-log-level [:log-level/current-log-level] current-fleet [:fleets/current-fleet] peer-syncing-enabled? [:profile/peer-syncing-enabled?]] - [list/flat-list - {:data (flat-list-data - {:current-log-level current-log-level - :transactions-management-enabled? transactions-management-enabled? - :light-client-enabled? light-client-enabled? - :current-fleet current-fleet - :dev-mode? false - :webview-debug webview-debug - :test-networks-enabled? test-networks-enabled? - :is-goerli-enabled? is-goerli-enabled? - :peer-syncing-enabled? peer-syncing-enabled?}) - :key-fn (fn [_ i] (str i)) - :render-fn render-item}])) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/advanced) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [list/flat-list + {:data (flat-list-data + {:current-log-level current-log-level + :transactions-management-enabled? transactions-management-enabled? + :light-client-enabled? light-client-enabled? + :current-fleet current-fleet + :dev-mode? false + :webview-debug webview-debug + :test-networks-enabled? test-networks-enabled? + :is-goerli-enabled? is-goerli-enabled? + :peer-syncing-enabled? peer-syncing-enabled?}) + :key-fn (fn [_ i] (str i)) + :render-fn render-item}]])) diff --git a/src/legacy/status_im/ui/screens/appearance/views.cljs b/src/legacy/status_im/ui/screens/appearance/views.cljs index b3a73e0681..02173cf7e3 100644 --- a/src/legacy/status_im/ui/screens/appearance/views.cljs +++ b/src/legacy/status_im/ui/screens/appearance/views.cljs @@ -3,10 +3,12 @@ (:require [legacy.status-im.react-native.resources :as resources] [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] + [legacy.status-im.ui.components.core :as components] [legacy.status-im.ui.components.react :as react] + [quo.core :as quo] [re-frame.core :as re-frame] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (defn button [label icon theme selected?] @@ -24,7 +26,13 @@ [] (views/letsubs [{:keys [appearance]} [:profile/profile]] [:<> - [quo/list-header (i18n/label :t/preference)] + [quo/page-nav + {:type :title + :title (i18n/label :t/appearance) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [components/list-header (i18n/label :t/preference)] [react/view {:flex-direction :row :padding-horizontal 8 diff --git a/src/legacy/status_im/ui/screens/bug_report.cljs b/src/legacy/status_im/ui/screens/bug_report.cljs index 12f765105c..84c7f9d8af 100644 --- a/src/legacy/status_im/ui/screens/bug_report.cljs +++ b/src/legacy/status_im/ui/screens/bug_report.cljs @@ -1,23 +1,27 @@ (ns legacy.status-im.ui.screens.bug-report (:require - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.topbar :as topbar] + [legacy.status-im.ui.components.core :as component] + [quo.core :as quo] [re-frame.core :as re-frame] [react-native.core :as react-native] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (defn bug-report [] (let [{:keys [description steps]} @(re-frame/subscribe [:bug-report/details])] [react-native/view {:style {:flex 1}} - [topbar/topbar - {:title (i18n/label :t/bug-report) - :modal? true}] + [quo/page-nav + {:type :title + :title (i18n/label :t/bug-report) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] [react-native/view {:style {:flex 1 :padding-top 8 :padding-horizontal 16}} - [quo/text-input + [component/text-input {:label (i18n/label :t/bug-report-description) :default-value description :placeholder (i18n/label :t/bug-report-description-placeholder) @@ -26,7 +30,7 @@ :error @(re-frame/subscribe [:bug-report/description-error]) :accessibility-label :bug-report-description :on-change-text #(re-frame/dispatch [:logging/report-details :description %])}] - [quo/text-input + [component/text-input {:label (i18n/label :t/bug-report-steps) :default-value steps :placeholder (i18n/label :t/bug-report-steps-placeholder) @@ -34,7 +38,7 @@ :multiline true :accessibility-label :bug-report-steps :on-change-text #(re-frame/dispatch [:logging/report-details :steps %])}] - [quo/button + [component/button {:type :primary :accessibility-label :bug-report-submit :theme :accent @@ -43,8 +47,8 @@ [react-native/view {:style {:margin-vertical 16 :align-items :center}} - [quo/text (i18n/label :t/or)]] - [quo/button + [component/text (i18n/label :t/or)]] + [component/button {:type :primary :accessibility-label :bug-report-submit-gh-issue :theme :accent diff --git a/src/legacy/status_im/ui/screens/contacts_list/views.cljs b/src/legacy/status_im/ui/screens/contacts_list/views.cljs deleted file mode 100644 index b6ab2814f6..0000000000 --- a/src/legacy/status_im/ui/screens/contacts_list/views.cljs +++ /dev/null @@ -1,76 +0,0 @@ -(ns legacy.status-im.ui.screens.contacts-list.views - (:require - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon.screen] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.invite.views :as invite] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.list.views :as list.views] - [legacy.status-im.ui.components.react :as react] - [re-frame.core :as re-frame] - [status-im.contexts.profile.utils :as profile.utils] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :refer [defview letsubs]])) - -(defn contacts-list-item - [{:keys [public-key] :as contact}] - (let [{:keys [primary-name secondary-name customization-color]} contact] - [list.item/list-item - {:title primary-name - :subtitle secondary-name - :icon [chat-icon.screen/profile-photo-plus-dot-view - {:public-key public-key - :full-name primary-name - :customization-color (or customization-color :primary) - :photo-path (profile.utils/photo contact)}] - :chevron true - :on-press #(re-frame/dispatch [:chat.ui/show-profile public-key])}])) - -(defn add-new-contact - [] - [list.item/list-item - {:icon :main-icons/add - :theme :accent - :title (i18n/label :t/add-new-contact) - :accessibility-label :add-new-contact-button - :on-press #(re-frame/dispatch [:open-modal :new-contact])}]) - -(defview contacts-list - [] - (letsubs [blocked-contacts-count [:contacts/blocked-count] - sorted-contacts [:contacts/sorted-contacts]] - [react/scroll-view {:flex 1} - [add-new-contact] - (when (pos? blocked-contacts-count) - [react/view {:margin-vertical 16} - [list.item/list-item - {:title (i18n/label :t/blocked-users) - :icon :main-icons/cancel - :theme :negative - :accessibility-label :blocked-users-list-button - :chevron true - :accessory :text - :accessory-text blocked-contacts-count - :on-press #(re-frame/dispatch [:navigate-to :blocked-users-list])}]]) - (if (seq sorted-contacts) - [list.views/flat-list - {:data sorted-contacts - :key-fn :address - :render-fn contacts-list-item}] - [react/view - {:align-items :center - :flex 1 - :justify-content :center} - [react/text {:style {:color colors/gray :margin-vertical 24}} - (i18n/label :t/you-dont-have-contacts)] - [invite/button]])])) - -(defview blocked-users-list - [] - (letsubs [blocked-contacts [:contacts/blocked]] - [list.views/flat-list - {:data blocked-contacts - :key-fn :address - :render-fn contacts-list-item - :default-separator? true - :enableEmptySections true - :keyboard-should-persist-taps :always}])) diff --git a/src/legacy/status_im/ui/screens/currency_settings/styles.cljs b/src/legacy/status_im/ui/screens/currency_settings/styles.cljs deleted file mode 100644 index 121ae77fc8..0000000000 --- a/src/legacy/status_im/ui/screens/currency_settings/styles.cljs +++ /dev/null @@ -1,14 +0,0 @@ -(ns legacy.status-im.ui.screens.currency-settings.styles - (:require - [legacy.status-im.utils.styles :as styles])) - -(styles/def currency-item - {:flex-direction :row - :justify-content :space-between - :align-items :center - :padding-horizontal 16 - :ios {:height 64} - :android {:height 56}}) - -(def currency-name-text - {:typography :title}) diff --git a/src/legacy/status_im/ui/screens/currency_settings/views.cljs b/src/legacy/status_im/ui/screens/currency_settings/views.cljs deleted file mode 100644 index 26623ac226..0000000000 --- a/src/legacy/status_im/ui/screens/currency_settings/views.cljs +++ /dev/null @@ -1,54 +0,0 @@ -(ns legacy.status-im.ui.screens.currency-settings.views - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.list.views :as list] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.search-input.view :as search-input] - [legacy.status-im.ui.screens.currency-settings.styles :as styles] - [re-frame.core :as re-frame] - [reagent.core :as reagent])) - -(defonce search-active? (reagent/atom false)) - -(defn render-currency - [{:keys [id code display-name]} _ _ current-currency-id] - (let [selected? (= id current-currency-id)] - [react/touchable-highlight - {:on-press #(re-frame/dispatch [:wallet-legacy.settings.ui/currency-selected id]) - :accessibility-label :currency-item} - [react/view styles/currency-item - [react/text {:style styles/currency-name-text} - (str display-name " (" code ")")] - (when selected? - [icons/icon :main-icons/check {:color :active}])]])) - -(views/defview currency-settings - [] - (views/letsubs [currency-id [:wallet-legacy/settings-currency] - {:keys [currencies search-filter]} [:wallet-legacy/search-filtered-currencies]] - {:component-will-unmount #(do - (re-frame/dispatch [:search/currency-filter-changed nil]) - (reset! search-active? false))} - [:<> - [react/view {:flex 1} - [react/view - {:padding-horizontal 16 - :padding-vertical 10} - [search-input/search-input-old - {:search-active? search-active? - :search-filter search-filter - :on-cancel #(re-frame/dispatch [:search/currency-filter-changed nil]) - :on-focus (fn [search-filter] - (when-not search-filter - (re-frame/dispatch [:search/currency-filter-changed ""]))) - :on-change (fn [text] - (re-frame/dispatch [:search/currency-filter-changed text]))}]] - [list/flat-list - {:data (->> currencies - vals - (sort #(compare (:code %1) (:code %2)))) - :key-fn :code - :render-data currency-id - :render-fn render-currency - :keyboard-should-persist-taps :always}]]])) diff --git a/src/legacy/status_im/ui/screens/ens/views.cljs b/src/legacy/status_im/ui/screens/ens/views.cljs index d8fde3082a..e69de29bb2 100644 --- a/src/legacy/status_im/ui/screens/ens/views.cljs +++ b/src/legacy/status_im/ui/screens/ens/views.cljs @@ -1,770 +0,0 @@ -(ns legacy.status-im.ui.screens.ens.views - (:require - [clojure.string :as string] - [legacy.status-im.ens.core :as ens] - [legacy.status-im.ethereum.tokens :as tokens] - [legacy.status-im.react-native.resources :as resources] - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon] - [legacy.status-im.ui.components.checkbox.view :as checkbox] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.common.common :as components.common] - [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.react :as react] - [legacy.status-im.ui.components.toolbar :as toolbar] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.chat.utils :as chat.utils] - [legacy.status-im.ui.screens.profile.components.views :as profile.components] - [legacy.status-im.utils.utils :as utils] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.config :as config] - [utils.address :as address] - [utils.debounce :as debounce] - [utils.ens.core :as utils.ens] - [utils.ens.stateofus :as stateofus] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(defn- link - [{:keys [on-press]} label] - [react/touchable-opacity - {:on-press on-press - :style {:justify-content :center}} - [react/text {:style {:color colors/blue}} - label]]) - -(defn- section - [{:keys [title content]}] - [react/view - {:style {:margin-horizontal 16 - :align-items :flex-start}} - [react/text {:style {:color colors/gray :font-size 15}} - title] - [react/view - {:margin-top 8 - :padding-horizontal 16 - :padding-vertical 12 - :border-width 1 - :border-radius 12 - :border-color colors/gray-lighter} - [quo/text {:monospace true} - content]]]) - -(defn- domain-label - [custom-domain?] - (if custom-domain? - (i18n/label :t/ens-custom-domain) - (str "." stateofus/domain))) - -(defn- domain-switch-label - [custom-domain?] - (if custom-domain? - (i18n/label :t/ens-want-domain) - (i18n/label :t/ens-want-custom-domain))) - -(defn- big-blue-icon - [state] - [react/view - {:style {:margin-top 68 - :margin-bottom 24 - :width 60 - :height 60 - :border-radius 30 - :background-color colors/blue - :align-items :center - :justify-content :center}} - [icons/icon - (case state - (:available :connected :connected-with-different-key :owned) - :main-icons/check - (:taken :error) - :main-icons/cancel - :main-icons/username) - {:color colors/white-persist}]]) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; SEARCH SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defn- icon-wrapper - [color icon] - [react/view - {:style {:margin-right 16 - :margin-top 11 - :width 32 - :height 32 - :border-radius 25 - :align-items :center - :justify-content :center - :background-color color}} - icon]) - -(defn- input-icon - [state] - (case state - :searching - [icon-wrapper colors/gray - [react/activity-indicator {:color colors/white-persist}]] - - (:available :connected :connected-with-different-key :owned) - [react/touchable-highlight - {:on-press #(debounce/throttle-and-dispatch [::ens/input-submitted] 3000)} - [icon-wrapper colors/blue - [icons/icon :main-icons/arrow-right {:color colors/white-persist}]]] - - [icon-wrapper colors/gray - [icons/icon :main-icons/arrow-right {:color colors/white-persist}]])) - -(defn help-message-text-element - ([label] - [react/text - {:style {:flex 1 - :margin-top 16 - :margin-horizontal 16 - :font-size 14 - :text-align :center}} - (i18n/label label)]) - ([label second-label] - [react/nested-text - {:style {:flex 1 - :margin-top 16 - :margin-horizontal 16 - :font-size 14 - :text-align :center}} - (i18n/label label) " " - [{:style {:font-weight "700"}} - (i18n/label second-label)]])) - -(defn help-message - [state custom-domain?] - (case state - :already-added - [help-message-text-element :t/ens-username-already-added] - :available - [help-message-text-element :t/ens-username-available] - :owned - [help-message-text-element - :t/ens-username-owned - :t/ens-username-owned-continue] - :connected - [help-message-text-element - :t/ens-username-connected - :t/ens-username-connected-continue] - :connected-with-different-key - [help-message-text-element - :t/ens-username-owned - :t/ens-username-connected-with-different-key] - :invalid-ens - [help-message-text-element - :t/ens-username-owned - :t/ens-username-registration-invalid] - (if custom-domain? - (case state - :too-short - [help-message-text-element :t/ens-custom-username-hints] - :invalid - [help-message-text-element :t/ens-custom-username-hints] - :taken - [help-message-text-element :t/ens-custom-username-taken] - [react/text ""]) - (case state - :too-short - [help-message-text-element :t/ens-username-hints] - :invalid - [help-message-text-element :t/ens-username-invalid] - :taken - [help-message-text-element :t/ens-username-taken] - [react/text ""])))) - -(defn- username-input - [_ _ _] - (let [input-ref (atom nil)] - (fn [_ state placeholder] - [react/view {:flex-direction :row :justify-content :center} - ;;NOTE required so that the keyboards shows up when navigating back from checkout screen - ;; TODO: navigation-events were deprecated - ;; [:> navigation/navigation-events - ;; {:on-did-focus - ;; (fn [] - ;; (.focus ^js @input-ref))}] - ;;NOTE setting the key as placeholder forces the component to remount - ;;when the placeholder changes, this prevents the placeholder from - ;;disappearing when switching between stateofus and custom domain - ^{:key placeholder} - [react/text-input - {:ref #(reset! input-ref %) - :on-change-text #(do - (re-frame/dispatch [:set-in [:ens/registration :state] :searching]) - (debounce/debounce-and-dispatch [::ens/set-username-candidate %] - 600)) - :on-submit-editing #(re-frame/dispatch [::ens/input-submitted]) - :auto-capitalize :none - :auto-complete-type "off" - :auto-focus true - :auto-correct false - :default-value "" - :text-align :center - :placeholder placeholder - :placeholder-text-color colors/text-gray - :style {:flex 1 - :font-size 22 - :padding-left 48}}] - [input-icon state]]))) - -(views/defview search - [] - (views/letsubs [{:keys [state custom-domain? username]} - [:ens/search-screen]] - [react/keyboard-avoiding-view {:flex 1} - [react/scroll-view - {:style {:flex 1} - ;;NOTE required so that switching custom-domain works on first tap and persists keyboard - ;;instead of dismissing keyboard and requiring two taps - :keyboard-should-persist-taps :always} - [react/view {:style {:flex 1}} - [react/view - {:style {:flex 1 - :align-items :center - :justify-content :center}} - [big-blue-icon state] - [username-input username state - (if custom-domain? - "vitalik94.domain.eth" - "vitalik94")] - [react/view - {:style {:height 36 - :align-items :center - :justify-content :space-between - :padding-horizontal 12 - :margin-top 24 - :margin-horizontal 16 - :border-color colors/gray-lighter - :border-radius 20 - :border-width 1 - :flex-direction :row}} - [react/text - {:style {:font-size 13 - :typography :main-medium}} - (domain-label custom-domain?)] - [react/view {:flex 1 :min-width 24}] - [react/touchable-highlight {:on-press #(re-frame/dispatch [::ens/switch-domain-type])} - [react/text - {:style {:color colors/blue - :font-size 12 - :typography :main-medium} - :number-of-lines 2} - (domain-switch-label custom-domain?)]]]] - [help-message state custom-domain?]]]])) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; CHECKOUT SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defn- agreement - [checked contract] - [react/view - {:flex-direction :row - :margin-left 26 ;; 10 for checkbox + 16 - :margin-right 16 - :margin-top 14 - :align-items :flex-start - :justify-content :center} - [checkbox/checkbox - {:checked? @checked - :style {:padding 0} - :on-value-change #(reset! checked %)}] - [react/nested-text {:style {:margin-left 10}} - (i18n/label :t/ens-agree-to) - [{:style {:color colors/blue} - :on-press #(re-frame/dispatch [:navigate-to :ens-terms {:contract contract}])} - (i18n/label :t/ens-terms-registration)] - "\n" - (i18n/label :t/ens-understand)]]) - -(defn render-account - [address] - (let [account @(re-frame/subscribe [:account-by-address address])] - [list.item/list-item - {:icon [chat-icon/custom-icon-view-list (:name account) (:color account)] - :title (:name account) - :subtitle (utils/get-shortened-checksum-address (:address account)) - :chevron true - :on-press #(js/alert "funcitonality no longer supported")}])) - -(defn- registration - [checked contract address public-key] - [react/view {:style {:flex 1 :margin-top 24}} - [react/text {:style {:color colors/gray :font-size 15 :margin-horizontal 16}} - (i18n/label :t/wallet)] - [render-account address] - [react/view {:style {:margin-top 14}} - [section - {:title (i18n/label :t/key) - :content public-key}]] - [agreement checked contract]]) - -(defn checkout - [] - (let [checked? (reagent/atom false)] - (fn [] - (let [{:keys [username address custom-domain? public-key - chain amount-label sufficient-funds?]} - @(re-frame/subscribe [:ens/checkout-screen])] - [react/keyboard-avoiding-view {:flex 1} - [react/scroll-view {:style {:flex 1}} - [react/view - {:style {:flex 1 - :align-items :center - :justify-content :center}} - [big-blue-icon nil] - [react/text - {:text-align :center - :style {:flex 1 - :font-size 22 - :padding-horizontal 48}} - username] - [react/view - {:style {:height 36 - :align-items :center - :justify-content :space-between - :padding-horizontal 12 - :margin-top 24 - :margin-horizontal 16 - :border-color colors/gray-lighter - :border-radius 20 - :border-width 1 - :flex-direction :row}} - [react/text - {:style {:font-size 13 - :typography :main-medium}} - (domain-label custom-domain?)] - [react/view {:flex 1 :min-width 24}]]] - [registration - checked? - (when (or (not= chain :goerli) config/test-stateofus?) - (stateofus/get-cached-registrar chain)) - address - public-key]] - [toolbar/toolbar - {:show-border? true - :size :large - :left [react/view {:flex-direction :row :align-items :center} - [react/image - {:source tokens/snt-icon-source - :style {:width 36 :height 36}}] - [react/view {:flex-direction :column :margin 8} - [react/text {:style {:font-size 15}} - amount-label] - [react/text {:style {:color colors/gray :font-size 15}} - (i18n/label :t/ens-deposit)]]] - :right [react/view {:padding-horizontal 8} - [quo/button - {:disabled (or (not @checked?) (not sufficient-funds?)) - :on-press #(debounce/throttle-and-dispatch [::ens/register-name-pressed - address] - 2000)} - (if sufficient-funds? - (i18n/label :t/ens-register) - (i18n/label :t/not-enough-snt))]]}]])))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; CONFIRMATION SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defn- finalized-icon - [state] - (case state - :registration-failed - [react/view - {:style {:width 40 - :height 40 - :border-radius 30 - :background-color colors/red-light - :align-items :center - :justify-content :center}} - [icons/icon :main-icons/warning {:color colors/red}]] - [react/view - {:style {:width 40 - :height 40 - :border-radius 30 - :background-color colors/gray-lighter - :align-items :center - :justify-content :center}} - [icons/icon :main-icons/check {:color colors/blue}]])) - -(defn- final-state-label - [state username] - (case state - :available - (i18n/label :t/ens-username-registration-confirmation - {:username (stateofus/username-with-domain username)}) - :connected-with-different-key - (i18n/label :t/ens-username-connection-confirmation - {:username (stateofus/username-with-domain username)}) - :connected - (i18n/label :t/ens-saved-title) - ;;NOTE: this state can't be reached atm - :registration-failed - (i18n/label :t/ens-registration-failed-title) - nil)) - -(defn- final-state-details - [state username] - (case state - :available - [react/text {:style {:color colors/gray :font-size 15 :text-align :center}} - (i18n/label :t/ens-username-you-can-follow-progress)] - :connected-with-different-key - [react/text {:style {:color colors/gray :font-size 15 :text-align :center}} - (i18n/label :t/ens-username-you-can-follow-progress)] - :connected - [react/nested-text - {:style {:font-size 15 :text-align :center}} - (stateofus/username-with-domain username) - [{:style {:color colors/gray}} - (i18n/label :t/ens-saved)]] - ;;NOTE: this state can't be reached atm - :registration-failed - [react/text {:style {:color colors/gray :font-size 14}} - (i18n/label :t/ens-registration-failed)] - nil)) - -(views/defview confirmation - [] - (views/letsubs [{:keys [state username]} [:ens/confirmation-screen]] - [react/keyboard-avoiding-view {:flex 1} - [react/view - {:style {:flex 1 - :align-items :center - :justify-content :center}} - [finalized-icon state] - [react/text - {:style {:typography :header - :margin-top 32 - :margin-horizontal 32 - :text-align :center}} - (final-state-label state username)] - [react/view - {:align-items :center - :margin-horizontal 32 - :margin-top 12 - :margin-bottom 20 - :justify-content :center} - [final-state-details state username]] - (if (= state :registration-failed) - [react/view - [quo/button {:on-press #(re-frame/dispatch [::ens/retry-pressed])} - (i18n/label :t/retry)] - [quo/button {:on-press #(re-frame/dispatch [::ens/cancel-pressed])} - (i18n/label :t/cancel)]] - [quo/button {:on-press #(re-frame/dispatch [::ens/got-it-pressed])} - (i18n/label :t/ens-got-it)])]])) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; TERMS SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defn- term-point - [content] - [react/view {:style {:flex 1 :margin-top 24 :margin-horizontal 16 :flex-direction :row}} - [react/view {:style {:width 16 :margin-top 8}} - [react/view {:style {:background-color colors/gray :width 4 :height 4 :border-radius 25}}]] - [react/text {:style {:flex 1 :font-size 15}} - content]]) - -(defn- etherscan-url - [address] - (str "https://etherscan.io/address/" address)) - -(views/defview terms - [] - (views/letsubs [{:keys [contract]} [:get-screen-params :ens-terms]] - [react/scroll-view {:style {:flex 1}} - [react/view - {:style {:height 136 - :background-color colors/gray-lighter - :justify-content :center - :align-items :center}} - [react/text {:style {:text-align :center :typography :header :letter-spacing -0.275}} - (i18n/label :t/ens-terms-header)]] - [react/view - [term-point - (i18n/label :t/ens-terms-point-1)] - [term-point - (i18n/label :t/ens-terms-point-2)] - [term-point - (i18n/label :t/ens-terms-point-3)] - [term-point - (i18n/label :t/ens-terms-point-4)] - [term-point - (i18n/label :t/ens-terms-point-5)] - [term-point - (i18n/label :t/ens-terms-point-6)] - [term-point - (i18n/label :t/ens-terms-point-7)]] - [react/view - [react/text {:style {:font-size 15 :margin-top 24 :margin-horizontal 16 :font-weight "700"}} - (i18n/label :t/ens-terms-point-8)] - [term-point - (i18n/label :t/ens-terms-point-9 {:address contract})] - [react/view {:style {:align-items :center :margin-top 16 :margin-bottom 8}} - [link {:on-press #(.openURL ^js react/linking (etherscan-url contract))} - (i18n/label :t/etherscan-lookup)]] - [term-point - (i18n/label :t/ens-terms-point-10)] - [react/view {:style {:align-items :center :margin-top 16 :margin-bottom 8}} - [link - {:on-press #(.openURL ^js react/linking (etherscan-url (:mainnet utils.ens/ens-registries)))} - (i18n/label :t/etherscan-lookup)]]]])) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; NAME DETAILS SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(def release-instructions-link "https://our.status.im/managing-your-ens-name-in-v1/") - -(defn open-release-instructions-link! - [] - (.openURL ^js react/linking release-instructions-link)) - -(views/defview name-details - [] - (views/letsubs [{:keys [name address custom-domain? public-key - expiration-date releasable? pending?]} - [:ens.name/screen]] - [react/view {:style {:flex 1}} - [topbar/topbar {:title name}] - [react/scroll-view {:style {:flex 1}} - (when-not custom-domain? - [react/view {:style {:flex 1 :margin-horizontal 16}} - [react/view {:flex-direction :row :align-items :center :margin-top 20} - [react/view {:style {:margin-right 16}} - [components.common/logo - {:size 40 - :icon-size 16}]] - [react/text {:style {:typography :title}} - (if pending? - (i18n/label :t/ens-transaction-pending) - (str (i18n/label :t/ens-10-SNT) ", deposit unlocked"))]]]) - [react/view {:style {:margin-top 22}} - (when-not pending? - [section - {:title (i18n/label :t/wallet-address) - :content (address/normalized-hex address)}]) - (when-not pending? - [react/view {:style {:margin-top 14}} - [section - {:title (i18n/label :t/key) - :content public-key}]]) - [react/view {:style {:margin-top 16 :margin-bottom 32}} - ;;TODO this is temporary fix for accounts with failed txs we still need this for regular ens - ;;names (not pending) but we need to detach public key in the contract - (when pending? - [list.item/list-item - {:title (i18n/label :t/ens-remove-username) - ;:subtext (i18n/label :t/ens-remove-hints) - :icon :main-icons/close - :theme :negative - :on-press #(re-frame/dispatch [::ens/remove-username name])}]) - (when (and (not custom-domain?) (not pending?)) - [react/view {:style {:margin-top 18}} - [list.item/list-item - {:title (i18n/label :t/ens-release-username) - :theme :accent - :disabled (not releasable?) - :subtitle (when (and expiration-date - (not releasable?)) - (i18n/label :t/ens-locked - {:date expiration-date})) - :icon :main-icons/delete - :on-press #(open-release-instructions-link!)}]])]]]])) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; WELCOME SCREEN -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defn- welcome-item - [{:keys [icon-label title]} content] - [react/view - {:style {:flex 1 - :margin-top 24 - :margin-left 16 - :flex-direction :row}} - [react/view - {:style {:height 40 - :width 40 - :border-radius 25 - :border-width 1 - :border-color colors/gray-lighter - :align-items :center - :justify-content :center}} - [react/text {:style {:typography :title}} - icon-label]] - [react/view - {:style {:flex 1 - :margin-horizontal 16}} - [react/text - {:style {:font-size 15 - :typography :main-semibold}} - title] - content]]) - -(defn- welcome - [] - (let [name (:name @(re-frame/subscribe [:profile/profile]))] - [react/view {:style {:flex 1}} - [react/scroll-view {:content-container-style {:align-items :center}} - [react/image - {:source (resources/get-theme-image :ens-header) - :style {:margin-top 32}}] - [react/text {:style {:margin-top 32 :margin-bottom 8 :typography :header}} - (i18n/label :t/ens-get-name)] - [react/text - {:style {:margin-top 8 - :margin-bottom 24 - :color colors/gray - :font-size 15 - :margin-horizontal 16 - :text-align :center}} - (i18n/label :t/ens-welcome-hints)] - [welcome-item {:icon-label "1" :title (i18n/label :t/ens-welcome-point-customize-title)} - [react/view {:flex-direction :row} - [react/text - {:style {:color colors/gray}} - (i18n/label :t/ens-welcome-point-customize {:name name})]]] - [welcome-item {:icon-label "2" :title (i18n/label :t/ens-welcome-point-simplify-title)} - [react/text {:style {:color colors/gray}} - (i18n/label :t/ens-welcome-point-simplify)]] - [welcome-item {:icon-label "3" :title (i18n/label :t/ens-welcome-point-receive-title)} - [react/text {:style {:color colors/gray}} - (i18n/label :t/ens-welcome-point-receive)]] - [welcome-item {:icon-label "4" :title (i18n/label :t/ens-welcome-point-register-title)} - [react/text {:style {:color colors/gray}} - (i18n/label :t/ens-welcome-point-register)]] - [welcome-item {:icon-label "@" :title (i18n/label :t/ens-welcome-point-verify-title)} - [react/text {:style {:color colors/gray}} - (i18n/label :t/ens-welcome-point-verify)]] - [react/text - {:style - {:margin-top 16 :text-align :center :color colors/gray :typography :caption :padding-bottom 96}} - (i18n/label :t/ens-powered-by)]] - [toolbar/toolbar - {:show-border? true - :right [quo/button - {:on-press #(re-frame/dispatch [::ens/get-started-pressed]) - :type :secondary - :after :main-icons/next} - (i18n/label :t/get-started)]}]])) - -(defn- name-item - [{:keys [name action subtitle]}] - (let [stateofus-username (stateofus/username name) - s (or stateofus-username name)] - [list.item/list-item - (merge {:title s - :subtitle (if subtitle - subtitle - (when stateofus-username stateofus/domain)) - :icon :main-icons/username} - (when action - {:on-press action}))])) - -(defn- name-list - [names preferred-name] - [react/view {:style {:flex 1 :margin-top 16}} - [react/view {:style {:margin-horizontal 16 :align-items :center :justify-content :center}} - [react/nested-text - {:style {:color colors/gray}} - (i18n/label :t/ens-displayed-with) - [{:style {:color colors/black :text-align :center}} - (str "\n@" preferred-name)]]] - [react/view {:style {:flex 1 :margin-top 8}} - (for [name names] - (let [action #(do (re-frame/dispatch [::ens/save-preferred-name name]) - (re-frame/dispatch [:bottom-sheet/hide-old])) - stateofus-username (stateofus/username name) - s (or stateofus-username name)] - ^{:key name} - [list.item/list-item - {:accessibility-label (if (= name preferred-name) - :primary-username - :not-primary-username) - :title s - :subtitle (when stateofus-username stateofus/domain) - :icon :main-icons/username - :on-press action - :accessory :radio - :active (= name preferred-name)}]))]]) - -(views/defview in-progress-registrations - [registrations] - [react/view {:style {:margin-top 8}} - (for [[tx-hash {:keys [state username]}] registrations - :when (or (= state :submitted) (= state :failure))] - ^{:key tx-hash} - [name-item - {:name username - :action (when-not (= state :submitted) - #(re-frame/dispatch [:ens/clear-registration tx-hash])) - :subtitle (case state - :submitted (i18n/label :t/ens-registration-in-progress) - :failure (i18n/label :t/ens-registration-failure) - nil)}])]) - -(views/defview my-name - [] - (views/letsubs [contact-name [:multiaccount/preferred-name]] - (when-not (string/blank? contact-name) - (chat.utils/format-author-old {:primary-name - (str "@" - (or (stateofus/username contact-name) - contact-name))})))) - -(views/defview registered - [names {:keys [preferred-name]} _ registrations] - [react/view {:style {:flex 1}} - [react/scroll-view - [react/view {:style {:margin-top 8}} - [list.item/list-item - {:title (i18n/label :t/ens-add-username) - :theme :accent - :on-press #(re-frame/dispatch [::ens/add-username-pressed]) - :icon :main-icons/add}]] - [react/view {:style {:margin-top 22 :margin-bottom 8}} - [react/text {:style {:color colors/gray :margin-horizontal 16}} - (i18n/label :t/ens-your-usernames)] - (when registrations - [in-progress-registrations registrations]) - (if (seq names) - [react/view {:style {:margin-top 8}} - (for [name names] - ^{:key name} - [name-item - {:name name - :action #(re-frame/dispatch [::ens/navigate-to-name name])}])] - [react/text - {:style {:color colors/gray - :font-size 15 - :margin-horizontal 16}} - (i18n/label :t/ens-no-usernames)])] - [react/view {:style {:padding-vertical 22 :border-color colors/gray-lighter :border-top-width 1}} - (when (> (count names) 1) - [react/view - [react/text {:style {:color colors/gray :margin-horizontal 16}} - (i18n/label :t/ens-chat-settings)] - [profile.components/settings-item - {:label-kw :ens-primary-username - :value preferred-name - :action-fn #(re-frame/dispatch [:show-bottom-sheet - {:content - (fn [] (name-list names preferred-name))}])}]])]]]) - -(views/defview main - [] - (views/letsubs [{:keys [names profile/profile show? registrations]} [:ens.main/screen]] - [react/keyboard-avoiding-view {:style {:flex 1}} - (if (or (seq names) registrations) - [registered names profile show? registrations] - [welcome])])) diff --git a/src/legacy/status_im/ui/screens/glossary/view.cljs b/src/legacy/status_im/ui/screens/glossary/view.cljs index 4226089f8b..2a48abe657 100644 --- a/src/legacy/status_im/ui/screens/glossary/view.cljs +++ b/src/legacy/status_im/ui/screens/glossary/view.cljs @@ -3,7 +3,9 @@ [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.list.views :as list] [legacy.status-im.ui.components.react :as react] - [utils.i18n :as i18n])) + [quo.core :as quo] + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (def messages [{:title :t/account-title @@ -56,10 +58,17 @@ (map (fn [[k v]] {:title k :data v})))] - [list/section-list - {:contentContainerStyle {:padding-horizontal 16 - :padding-bottom 16} - :stickySectionHeadersEnabled true - :sections sections - :render-fn render-element - :render-section-header-fn render-section-header}])) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/glossary) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [list/section-list + {:contentContainerStyle {:padding-horizontal 16 + :padding-bottom 16} + :stickySectionHeadersEnabled true + :sections sections + :render-fn render-element + :render-section-header-fn render-section-header}]])) diff --git a/src/legacy/status_im/ui/screens/group/styles.cljs b/src/legacy/status_im/ui/screens/group/styles.cljs deleted file mode 100644 index 75a5ffdba5..0000000000 --- a/src/legacy/status_im/ui/screens/group/styles.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns legacy.status-im.ui.screens.group.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) - -(def group-container - {:flex 1 - :flex-direction :column}) - -(defn no-contact-text - [] - {:margin-bottom 20 - :margin-horizontal 50 - :text-align :center - :color colors/gray}) - -(def no-contacts - {:flex 1 - :justify-content :center - :align-items :center}) - -(defn search-container - [] - {:border-bottom-color colors/gray-lighter - :border-bottom-width 1 - :padding-horizontal 16 - :padding-vertical 10}) - -(defn members-title - [] - {:color colors/gray - :margin-top 14 - :margin-bottom 4}) diff --git a/src/legacy/status_im/ui/screens/group/views.cljs b/src/legacy/status_im/ui/screens/group/views.cljs deleted file mode 100644 index 7fcfbe083e..0000000000 --- a/src/legacy/status_im/ui/screens/group/views.cljs +++ /dev/null @@ -1,196 +0,0 @@ -(ns legacy.status-im.ui.screens.group.views - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.invite.views :as invite] - [legacy.status-im.ui.components.keyboard-avoid-presentation :as kb-presentation] - [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.search-input.view :as search] - [legacy.status-im.ui.components.toolbar :as toolbar] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.group.styles :as styles] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.constants :as constants] - [utils.debounce :as debounce] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(defn- render-contact - [row] - (let [{:keys [primary-name secondary-name]} row] - [list.item/list-item - {:title primary-name - :subtitle secondary-name - :icon [chat-icon/contact-icon-contacts-tab row]}])) - -(defn- on-toggle-participant - [allow-new-users? checked? public-key] - (cond - - checked? - (re-frame/dispatch [:deselect-participant public-key allow-new-users?]) - - ;; Only allow new users if not reached the maximum - (and (not checked?) - allow-new-users?) - (re-frame/dispatch [:select-participant public-key allow-new-users?]))) - -(defn- toggle-item - [] - (fn [allow-new-users? subs-name {:keys [public-key] :as contact} on-toggle] - (let [contact-selected? @(re-frame/subscribe [subs-name public-key]) - {:keys [primary-name secondary-name]} contact] - [list.item/list-item - {:title primary-name - :subtitle secondary-name - :icon [chat-icon/contact-icon-contacts-tab contact] - :on-press #(on-toggle allow-new-users? contact-selected? public-key) - :active contact-selected? - :accessory :checkbox}]))) - -(defn- group-toggle-participant - [contact _ _ allow-new-users?] - [toggle-item allow-new-users? :is-participant-selected? contact on-toggle-participant]) - -(defn toggle-list - [{:keys [contacts render-fn render-data]}] - [list/flat-list - {:data contacts - :key-fn :public-key - :render-data render-data - :render-fn render-fn - :keyboard-should-persist-taps :always}]) - -(defn no-contacts-view - [{:keys [no-contacts]}] - [react/view {:style styles/no-contacts} - [react/text - {:style (styles/no-contact-text)} - no-contacts] - [invite/button]]) - -(defn filter-contacts - [filter-text contacts] - (let [lower-filter-text (string/lower-case (str filter-text)) - filter-fn (fn [{:keys [name alias nickname]}] - (or - (string/includes? (string/lower-case (str name)) lower-filter-text) - (string/includes? (string/lower-case (str alias)) lower-filter-text) - (when nickname - (string/includes? (string/lower-case (str nickname)) - lower-filter-text))))] - (if filter-text - (filter filter-fn contacts) - contacts))) - -;; Set name of new group-chat -(views/defview new-group - [] - (views/letsubs [contacts [:selected-group-contacts] - group-name [:new-chat-name]] - (let [group-name-empty? (not (and (string? group-name) (not-empty group-name)))] - [react/keyboard-avoiding-view - {:style styles/group-container - :ignore-offset true} - [react/view {:flex 1} - [topbar/topbar - {:use-insets false - :title (i18n/label :t/new-group-chat) - :subtitle (i18n/label :t/group-chat-members-count - {:selected (inc (count contacts)) - :max constants/max-group-chat-participants})}] - [react/view - {:style {:padding-top 16 - :flex 1}} - [react/view {:style {:padding-horizontal 16}} - [quo/text-input - {:auto-focus true - :on-change-text #(re-frame/dispatch [:set :new-chat-name %]) - :default-value group-name - :placeholder (i18n/label :t/set-a-topic) - :accessibility-label :chat-name-input}] - [react/text {:style (styles/members-title)} - (i18n/label :t/members-title)]] - [react/view - {:style {:margin-top 8 - :flex 1}} - [list/flat-list - {:data contacts - :key-fn :address - :render-fn render-contact - :bounces false - :keyboard-should-persist-taps :always - :enable-empty-sections true}]]] - [toolbar/toolbar - {:show-border? true - :left - [quo/button - {:type :secondary - :before :main-icon/back - :accessibility-label :previous-button - :on-press #(re-frame/dispatch [:navigate-back])} - (i18n/label :t/back)] - :right - [quo/button - {:type :secondary - :accessibility-label :create-group-chat-button - :disabled group-name-empty? - :on-press #(debounce/throttle-and-dispatch [:group-chats.ui/create-pressed - group-name] - 300)} - (i18n/label :t/create-group-chat)]}]]]))) - -(defn searchable-contact-list - [] - (let [search-value (reagent/atom nil)] - (fn [{:keys [contacts no-contacts-label toggle-fn allow-new-users?]}] - [react/view {:style {:flex 1}} - [react/view {:style (styles/search-container)} - [search/search-input-old - {:on-cancel #(reset! search-value nil) - :on-change #(reset! search-value %)}]] - [react/view - {:style {:flex 1 - :padding-vertical 8}} - (if (seq contacts) - [toggle-list - {:contacts (filter-contacts @search-value contacts) - :render-data allow-new-users? - :render-fn toggle-fn}] - [no-contacts-view {:no-contacts no-contacts-label}])]]))) - -;; Add participants to existing group chat -(views/defview add-participants-toggle-list - [] - (views/letsubs [contacts [:contacts/all-contacts-not-in-current-chat] - current-chat [:chats/current-chat] - selected-contacts-count [:selected-participants-count]] - (let [current-participants-count (count (:contacts current-chat))] - [kb-presentation/keyboard-avoiding-view {:style styles/group-container} - [topbar/topbar - {:use-insets false - :border-bottom false - :title (i18n/label :t/add-members) - :subtitle (i18n/label :t/group-chat-members-count - {:selected (+ current-participants-count selected-contacts-count) - :max constants/max-group-chat-participants})}] - [searchable-contact-list - {:contacts contacts - :no-contacts-label (i18n/label :t/group-chat-all-contacts-invited) - :toggle-fn group-toggle-participant - :allow-new-users? (< (+ current-participants-count - selected-contacts-count) - constants/max-group-chat-participants)}] - [toolbar/toolbar - {:show-border? true - :center - [quo/button - {:type :secondary - :accessibility-label :next-button - :disabled (zero? selected-contacts-count) - :on-press #(re-frame/dispatch [:group-chats.ui/add-members-pressed])} - (i18n/label :t/add)]}]]))) diff --git a/src/legacy/status_im/ui/screens/help_center/views.cljs b/src/legacy/status_im/ui/screens/help_center/views.cljs index 04b781e460..c170df2ab3 100644 --- a/src/legacy/status_im/ui/screens/help_center/views.cljs +++ b/src/legacy/status_im/ui/screens/help_center/views.cljs @@ -2,34 +2,33 @@ (:require [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] + [quo.core :as quo] [re-frame.core :as re-frame] - [status-im.constants :as constants] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (def data - [{:size :small - :title (i18n/label :t/faq) - :accessibility-label :faq-button - :on-press - #(.openURL ^js react/linking constants/faq) - :chevron true} - {:size :small - :title (i18n/label :t/glossary) + [{:size :small + :title (i18n/label :t/glossary) :accessibility-label :glossary-button - :on-press - #(re-frame/dispatch [:navigate-to :glossary]) - :chevron true} - {:size :small - :title (i18n/label :t/submit-bug) + :on-press #(re-frame/dispatch [:open-modal :glossary]) + :chevron true} + {:size :small + :title (i18n/label :t/submit-bug) :accessibility-label :submit-bug-button - :on-press - #(re-frame/dispatch [:open-modal :bug-report]) - :chevron true}]) + :on-press #(re-frame/dispatch [:open-modal :bug-report]) + :chevron true}]) (defn help-center [] - [list/flat-list - {:data data - :key-fn (fn [_ i] (str i)) - :render-fn list.item/list-item}]) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/need-help) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [list/flat-list + {:data data + :key-fn (fn [_ i] (str i)) + :render-fn list.item/list-item}]]) 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 index ba3961fe6f..beb647a796 100644 --- a/src/legacy/status_im/ui/screens/link_previews_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/link_previews_settings/views.cljs @@ -2,14 +2,16 @@ (: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 quo] + [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.i18n :as i18n] + [utils.re-frame :as rf])) (defn prepare-urls-items-data [link-previews-enabled-sites] @@ -29,18 +31,24 @@ 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}] - [quo/text {:style {:margin 16}} + [components/text {:style {:margin 16}} (i18n/label :t/you-can-choose-preview-websites)] - [quo/separator {:style {:margin-vertical 8}}] + [components/separator {:style {:margin-vertical 8}}] [react/view styles/whitelist-container - [quo/list-header (i18n/label :t/websites)] + [components/list-header (i18n/label :t/websites)] (when (> (count link-previews-whitelist) 1) - [quo/button + [components/button {:on-press #(re-frame/dispatch [:chat.ui/enable-all-link-previews link-previews-whitelist (not all-enabled)]) diff --git a/src/legacy/status_im/ui/screens/log_level_settings/views.cljs b/src/legacy/status_im/ui/screens/log_level_settings/views.cljs index d0d3e6740a..03646d691f 100644 --- a/src/legacy/status_im/ui/screens/log_level_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/log_level_settings/views.cljs @@ -4,7 +4,10 @@ [legacy.status-im.ui.components.list.views :as list] [legacy.status-im.ui.components.react :as react] [legacy.status-im.ui.screens.log-level-settings.styles :as styles] - [re-frame.core :as re-frame]) + [quo.core :as quo] + [re-frame.core :as re-frame] + [utils.i18n :as i18n] + [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) (defn- log-level-icon @@ -46,9 +49,16 @@ (views/defview log-level-settings [] (views/letsubs [current-log-level [:log-level/current-log-level]] - [list/flat-list - {:data log-levels - :default-separator? false - :key-fn :name - :render-data current-log-level - :render-fn render-row}])) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/log-level-settings) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [list/flat-list + {:data log-levels + :default-separator? false + :key-fn :name + :render-data current-log-level + :render-fn render-row}]])) diff --git a/src/legacy/status_im/ui/screens/notifications_settings/views.cljs b/src/legacy/status_im/ui/screens/notifications_settings/views.cljs index 8d7a3a553d..e87b36c38a 100644 --- a/src/legacy/status_im/ui/screens/notifications_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/notifications_settings/views.cljs @@ -1,9 +1,10 @@ (ns legacy.status-im.ui.screens.notifications-settings.views (:require [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] + [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] [react-native.platform :as platform] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -22,10 +23,10 @@ :active notifications-enabled? :on-press #(rf/dispatch [:push-notifications/switch (not notifications-enabled?)]) :accessory :switch}] - [quo/separator + [components/separator {:color (:ui-02 @colors/theme) :style {:margin-vertical 8}}] - [quo/list-header (i18n/label :t/notifications-preferences)] + [components/list-header (i18n/label :t/notifications-preferences)] [list.item/list-item {:size :small :title (i18n/label :t/notifications-non-contacts) @@ -61,9 +62,16 @@ (defn notifications-settings [] - [react/scroll-view - {:style {:flex 1} - :content-container-style {:padding-vertical 8}} - (if platform/ios? - [notifications-settings-ios] - [notifications-settings-android])]) + [:<> + [quo/page-nav + {:type :title + :title (i18n/label :t/notification-settings) + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [react/scroll-view + {:style {:flex 1} + :content-container-style {:padding-vertical 8}} + (if platform/ios? + [notifications-settings-ios] + [notifications-settings-android])]]) diff --git a/src/legacy/status_im/ui/screens/popover/views.cljs b/src/legacy/status_im/ui/screens/popover/views.cljs index 5c23837067..b553d03f1a 100644 --- a/src/legacy/status_im/ui/screens/popover/views.cljs +++ b/src/legacy/status_im/ui/screens/popover/views.cljs @@ -5,7 +5,6 @@ [legacy.status-im.ui.components.animation :as anim] [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.profile.user.views :as profile.user] [legacy.status-im.ui.screens.reset-password.views :as reset-password.views] [re-frame.core :as re-frame] [react-native.platform :as platform] @@ -127,9 +126,6 @@ (vector? view) view - (= :share-chat-key view) - [profile.user/share-chat-key] - (= :password-reset-popover view) [reset-password.views/reset-password-popover] 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 index 619db3fcf7..61bb35d5f5 100644 --- 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 @@ -3,19 +3,21 @@ [legacy.status-im.multiaccounts.reset-password.core :as reset-password] [legacy.status-im.multiaccounts.update.core :as multiaccounts.update] [legacy.status-im.ui.components.common.common :as components.common] - [legacy.status-im.ui.components.core :as quo] + [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.i18n :as i18n] + [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) (defn separator [] - [quo/separator {:style {:margin-vertical 8}}]) + [components/separator {:style {:margin-vertical 8}}]) (def titles {constants/profile-pictures-visibility-contacts-only (i18n/label :t/recent-recipients) @@ -36,110 +38,117 @@ [:profile/profile] has-picture [:profile/has-picture] profile-pictures-show-to [:multiaccount/profile-pictures-show-to]] - [react/scroll-view {:padding-vertical 8} - [quo/list-header (i18n/label :t/security)] - [list.item/list-item - {:size :small - :title (i18n/label :t/back-up-seed-phrase) - :accessibility-label :back-up-recovery-phrase-button - :disabled (not mnemonic) - :chevron (boolean mnemonic) - :accessory (when mnemonic [components.common/counter {:size 22} 1]) - :on-press #(re-frame/dispatch [:navigate-to :backup-seed])}] - [separator] - [quo/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 [:navigate-to :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] - [quo/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}] + [:<> + [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/security)] + [list.item/list-item + {:size :small + :title (i18n/label :t/back-up-seed-phrase) + :accessibility-label :back-up-recovery-phrase-button + :disabled (not mnemonic) + :chevron (boolean mnemonic) + :accessory (when mnemonic [components.common/counter {:size 22} 1]) + :on-press #(re-frame/dispatch [:navigate-to :backup-seed])}] + [separator] + [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}]])) + [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] @@ -158,7 +167,7 @@ [ppst-radio-item constants/profile-pictures-show-to-none profile-pictures-show-to] [react/view {:style {:margin-horizontal 16}} - [quo/text {:color :secondary} + [components/text {:color :secondary} (i18n/label :t/privacy-show-to-warning)]]])) (defn ppvf-radio-item diff --git a/src/legacy/status_im/ui/screens/profile/contact/styles.cljs b/src/legacy/status_im/ui/screens/profile/contact/styles.cljs deleted file mode 100644 index 1c9c990440..0000000000 --- a/src/legacy/status_im/ui/screens/profile/contact/styles.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.contact.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) - -(def block-action-label - {:color colors/red - :margin-top 26 - :margin-bottom 50 - :margin-left 16}) - -(def contact-profile-details-container - {:padding-top 26}) - -(def contact-profile-detail-share-icon - {:color colors/gray-transparent-40}) - -(defn updates-descr-cont - [] - {:border-width 1 - :border-color colors/gray-lighter - :border-top-right-radius 16 - :border-bottom-left-radius 16 - :border-top-left-radius 16 - :border-bottom-right-radius 4 - :padding-horizontal 12 - :padding-vertical 6}) diff --git a/src/legacy/status_im/ui/screens/profile/contact/views.cljs b/src/legacy/status_im/ui/screens/profile/contact/views.cljs index 8d0b10c3da..e69de29bb2 100644 --- a/src/legacy/status_im/ui/screens/profile/contact/views.cljs +++ b/src/legacy/status_im/ui/screens/profile/contact/views.cljs @@ -1,227 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.contact.views - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.keyboard-avoid-presentation :as kb-presentation] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.profile-header.view :as profile-header] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.toolbar :as toolbar] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.profile.components.sheets :as sheets] - [quo.components.avatars.user-avatar.style :as user-avatar.style] - [quo.theme] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.constants :as constants] - [status-im.contexts.profile.utils :as profile.utils] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn actions - [{:keys [public-key added? blocked? ens-name mutual?] :as profile} muted?] - (concat [{:label (i18n/label :t/chat) - :icon :main-icons/message - :disabled (not mutual?) - :action #(re-frame/dispatch [:chat.ui/start-chat - public-key - ens-name]) - :accessibility-label :start-conversation-button}] - (if added? - [{:label (i18n/label :t/remove-from-contacts) - :icon :main-icons/remove-contact - :selected true - :accessibility-label :in-contacts-button - :action #(re-frame/dispatch [:contact.ui/remove-contact-pressed profile])}] - [{:label (i18n/label :t/add-to-contacts) - :icon :main-icons/add-contact - :disabled blocked? - :accessibility-label :add-to-contacts-button - :action (when-not blocked? - (fn [] - (re-frame/dispatch [:contact.ui/send-contact-request - public-key])))}]) - [{:label (i18n/label (if (or muted? blocked?) :t/unmute :t/mute)) - :icon :main-icons/notification - :accessibility-label :mute-chat - :selected muted? - :disabled blocked? - :action (when-not blocked? - #(re-frame/dispatch [:chat.ui/mute public-key (not muted?) - (when-not muted? - constants/mute-till-unmuted)]))}] - [{:label (i18n/label (if blocked? :t/unblock :t/block)) - :negative true - :selected blocked? - :icon :main-icons/cancel - :action (if blocked? - #(re-frame/dispatch [:contact/unblock-contact public-key]) - #(re-frame/dispatch [:show-popover - {:view sheets/block-contact - :prevent-closing? true - :public-key public-key}])) - :accessibility-label (if blocked? - :unblock-contact - :block-contact)}])) - -(defn pin-settings - [public-key pin-count] - [list.item/list-item - {:title (i18n/label :t/pinned-messages) - :size :small - :accessibility-label :pinned-messages-item - :accessory :text - :accessory-text pin-count - :disabled (zero? pin-count) - :on-press #(rf/dispatch [:pin-message/show-pins-bottom-sheet public-key]) - :chevron true}]) - -(defn nickname-settings - [{:keys [nickname]}] - [list.item/list-item - {:title (i18n/label :t/nickname) - :size :small - :accessibility-label :profile-nickname-item - :accessory :text - :accessory-text (or nickname (i18n/label :t/none)) - :on-press #(re-frame/dispatch [:open-modal :nickname]) - :chevron true}]) - -(defn save-nickname - [public-key nickname] - (re-frame/dispatch [:contacts/update-nickname public-key nickname]) - (re-frame/dispatch [:navigate-back])) - -(defn valid-nickname? - [nickname] - (not (string/blank? nickname))) - -(defn- nickname-input - [nickname entered-nickname public-key] - [quo/text-input - {:on-change-text #(reset! entered-nickname %) - :on-submit-editing #(when (valid-nickname? @entered-nickname) - (save-nickname public-key @entered-nickname)) - :auto-capitalize :none - :auto-focus false - :max-length constants/profile-name-max-length - :accessibility-label :nickname-input - :default-value nickname - :placeholder (i18n/label :t/nickname) - :return-key-type :done - :auto-correct false}]) - -(defn nickname-view - [] - (let [{:keys [public-key nickname] :as profile} (rf/sub [:contacts/current-contact]) - entered-nickname (reagent/atom nickname)] - (fn [] - [kb-presentation/keyboard-avoiding-view - {:style {:flex 1} - :ignore-offset true} - [topbar/topbar - {:title (i18n/label :t/nickname) - :subtitle (profile.utils/displayed-name profile) - :modal? true}] - [react/view {:flex 1 :padding 16} - [react/text {:style {:color colors/gray :margin-bottom 16}} - (i18n/label :t/nickname-description)] - [nickname-input nickname entered-nickname public-key] - [react/text - {:style {:align-self :flex-end - :margin-top 16 - :color colors/gray}} - (str (count @entered-nickname) " / " constants/profile-name-max-length)]] - [toolbar/toolbar - {:show-border? true - :center - [quo/button - {:type :secondary - :on-press #(save-nickname public-key @entered-nickname)} - (i18n/label :t/done)]}]]))) - -(defn button-item - [{:keys [icon label action selected disabled negative]}] - [react/touchable-highlight - {:on-press action - :disabled disabled - :style {:flex 1} - :accessibility-label (str label "-item-button")} - [react/view {:flex 1 :align-items :center} - [list.item/icon-column - {:icon icon - :size :small - :icon-bg-color (if disabled - colors/gray-lighter - (if negative - (if selected colors/red colors/red-light) - (if selected colors/blue colors/blue-light))) - :icon-color (if disabled - colors/gray - (if negative - (if selected colors/white colors/red) - (if selected colors/white colors/blue)))}] - [react/text - {:style {:text-align :center - :color (if disabled - colors/gray - (if negative colors/red colors/blue)) - :font-size 12 - :line-height 16 - :margin-top 6} - :number-of-lines 2} - label]]]) - -(defn profile-view - [] - (let [{:keys [public-key - secondary-name - name - ens-verified - customization-color - compressed-key] - :as profile} @(re-frame/subscribe [:contacts/current-contact]) - muted? @(re-frame/subscribe [:chats/muted public-key]) - customization-color (or customization-color :primary) - theme @(re-frame/subscribe [:theme]) - on-share #(re-frame/dispatch [:show-popover - (merge - {:view :share-chat-key - :address (or compressed-key - public-key)} - (when (and ens-verified name) - {:ens-name name}))])] - (when profile - [:<> - [quo/header - {:right-accessories [{:icon :main-icons/share - :accessibility-label :share-button - :on-press on-share}] - :left-accessories [{:icon :main-icons/close - :accessibility-label :back-button - :on-press #(re-frame/dispatch [:navigate-back])}]}] - [:<> - [(profile-header/extended-header - {:on-press on-share - :bottom-separator false - :title (profile.utils/displayed-name profile) - :color (user-avatar.style/customization-color customization-color theme) - :photo (profile.utils/photo profile) - :monospace (not ens-verified) - :subtitle secondary-name - :compressed-key compressed-key - :public-key public-key})] - [react/view - {:height 1 :background-color colors/gray-lighter :margin-top 8}] - [nickname-settings profile] - [react/view {:height 1 :background-color colors/gray-lighter}] - [react/view - {:padding-top 17 - :flex-direction :row - :align-items :stretch - :flex 1} - (for [{:keys [label] :as action} (actions profile muted?) - :when label] - ^{:key label} - [button-item action])]]]))) diff --git a/src/legacy/status_im/ui/screens/profile/group_chat/views.cljs b/src/legacy/status_im/ui/screens/profile/group_chat/views.cljs index 16d5cc6b1a..e69de29bb2 100644 --- a/src/legacy/status_im/ui/screens/profile/group_chat/views.cljs +++ b/src/legacy/status_im/ui/screens/profile/group_chat/views.cljs @@ -1,233 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.group-chat.views - (:require - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.common.common :as components.common] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.list.views :as list] - [legacy.status-im.ui.components.profile-header.view :as profile-header] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.chat.photos :as photos] - [legacy.status-im.ui.screens.chat.utils :as chat.utils] - [legacy.status-im.ui.screens.profile.components.styles :as profile.components.styles] - [re-frame.core :as re-frame] - [status-im.constants :as constants] - [status-im.contexts.profile.utils :as profile.utils] - [utils.debounce :as debounce] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :refer [defview letsubs]])) - -(defn hide-sheet-and-dispatch - [event] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (re-frame/dispatch event)) - -(defn member-sheet - [chat-id member us-admin?] - [react/view - [list.item/list-item - {:theme :accent - :icon [chat-icon/contact-icon-contacts-tab member] - :title (profile.utils/displayed-name member) - :subtitle (i18n/label :t/view-profile) - :accessibility-label :view-chat-details-button - :chevron true - :on-press #(hide-sheet-and-dispatch - [:chat.ui/show-profile - (:public-key member)])}] - (when (and us-admin? (not (:admin? member))) - [list.item/list-item - {:theme :accent - :title (i18n/label :t/make-admin) - :accessibility-label :make-admin - :icon :main-icons/make-admin - :on-press #(hide-sheet-and-dispatch [:group-chats.ui/make-admin-pressed - chat-id (:public-key member)])}]) - (when-not (:admin? member) - [list.item/list-item - {:theme :accent - :title (i18n/label :t/remove-from-chat) - :accessibility-label :remove-from-chat - :icon :main-icons/remove-contact - :on-press #(hide-sheet-and-dispatch - [:group-chats.ui/remove-member-pressed chat-id - (:public-key member)])}])]) - -(defn render-member - [{:keys [public-key] :as member} _ _ {:keys [chat-id admin? current-user-identity]}] - (let [{:keys [secondary-name]} member] - [list.item/list-item - (merge - {:title (profile.utils/displayed-name member) - :subtitle secondary-name - :accessibility-label :member-item - :icon [chat-icon/contact-icon-contacts-tab member] - :on-press (when (not= public-key current-user-identity) - #(re-frame/dispatch [:chat.ui/show-profile public-key]))} - (when (:admin? member) - {:accessory :text - :accessory-text (i18n/label :t/group-chat-admin)}) - (when (and admin? - (not (:admin? member)) - (not= public-key current-user-identity)) - {:accessory [quo/button - {:on-press #(re-frame/dispatch - [:bottom-sheet/show-sheet - {:content (fn [] - [member-sheet chat-id member admin?])}]) - :type :icon - :theme :icon - :accessibility-label :menu-option} - :main-icons/more]}))])) - -(defview chat-group-members-view - [chat-id admin? current-user-identity] - (letsubs [members [:contacts/current-chat-contacts]] - (when (seq members) - [list/flat-list - {:data members - :key-fn :address - :render-data {:chat-id chat-id - :admin? admin? - :current-user-identity current-user-identity} - :render-fn render-member}]))) - -(defn members-list - [{:keys [chat-id admin? current-pk allow-adding-members?]}] - [react/view - [quo/list-header (i18n/label :t/members-title)] - (when allow-adding-members? - [list.item/list-item - {:title (i18n/label :t/add-members) - :icon :main-icons/add-contact - :theme :accent - :on-press #(re-frame/dispatch [:open-modal :add-participants-toggle-list])}]) - [chat-group-members-view chat-id admin? current-pk]]) - -(defn hide-sheet-and-dispatch-old - [event] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (debounce/throttle-and-dispatch event 2000)) - -(defn invitation-sheet - [{:keys [id]} contact] - (let [members @(re-frame/subscribe [:contacts/current-chat-contacts]) - allow-adding-members? (< (count members) constants/max-group-chat-participants)] - [react/view - [react/view {:margin-bottom 8 :margin-right 16} - [react/view {:padding-left 72} - (chat.utils/format-author-old contact)] - [react/view {:flex-direction :row :align-items :flex-end} - [react/view {:padding-left 16 :padding-top 4} - [photos/photo (profile.utils/photo contact) {:size 36}]]]] - [list.item/list-item - {:theme :accent - :disabled (not allow-adding-members?) - :title (i18n/label :t/accept) - :subtitle (when-not allow-adding-members? (i18n/label :t/members-limit-reached)) - :accessibility-label :accept-invitation-button - :icon :main-icons/checkmark-circle - :on-press #(hide-sheet-and-dispatch-old - [:group-chats.ui/add-members-from-invitation id (:public-key contact)])}] - [list.item/list-item - {:theme :negative - :title (i18n/label :t/decline) - :accessibility-label :decline-invitation-button - :icon :main-icons/cancel - :on-press #(hide-sheet-and-dispatch-old [:send-group-chat-membership-rejection - id])}]])) - -(defn contacts-list-item - [{:keys [from] :as invitation}] - (let [contact (or @(re-frame/subscribe [:contacts/contact-by-identity from]) - {:public-key from})] - [list.item/list-item - {:title (profile.utils/displayed-name contact) - :icon [chat-icon/contact-icon-contacts-tab contact] - :on-press #(re-frame/dispatch [:show-bottom-sheet - {:content (fn [] - [invitation-sheet invitation contact])}])}])) - -(defview group-chat-invite - [] - (letsubs [{:keys [chat-id]} [:chats/current-chat]] - (let [invitations @(re-frame/subscribe [:group-chat/pending-invitations-by-chat-id chat-id])] - [react/view {:flex 1} - [topbar/topbar {:title (i18n/label :t/group-invite)}] - [react/scroll-view {:flex 1} - [react/view {:margin-top 26} - (if (seq invitations) - [list/flat-list - {:data invitations - :key-fn :id - :render-fn contacts-list-item}] - [react/text - {:style {:color colors/gray - :margin-top 28 - :text-align :center - :padding-horizontal 16}} - (i18n/label :t/empty-pending-invitations-descr)])]]]))) - -(defview group-chat-profile - [] - (letsubs [{:keys [admins chat-id member? chat-name color contacts] :as current-chat} - [:chats/current-chat] - members [:contacts/current-chat-contacts] - current-pk [:multiaccount/public-key] - pinned-messages [:chats/pinned chat-id]] - (when current-chat - (let [admin? (get admins current-pk) - allow-adding-members? (and admin? - member? - (< (count members) constants/max-group-chat-participants))] - [react/view profile.components.styles/profile - [quo/animated-header - {:use-insets true - :left-accessories [{:icon :main-icons/arrow-left - :accessibility-label :back-button - :on-press #(re-frame/dispatch [:navigate-back])}] - :right-accessories (when (and admin? member?) - [{:icon :icons/edit - :accessibility-label :edit-button - :on-press #(re-frame/dispatch [:open-modal - :edit-group-chat-name])}]) - :extended-header (profile-header/extended-header - {:title chat-name - :color color - :subtitle (i18n/label :t/members-count {:count (count contacts)}) - :subtitle-icon :icons/tiny-group})} - [react/view profile.components.styles/profile-form - (when admin? - [list.item/list-item - {:chevron true - :title (i18n/label :t/membership-requests) - :accessibility-label :invite-chat-button - :icon :main-icons/share - :accessory (let [invitations - (count @(re-frame/subscribe - [:group-chat/pending-invitations-by-chat-id - chat-id]))] - (when (pos? invitations) - [components.common/counter {:size 22} invitations])) - :on-press #(re-frame/dispatch [:navigate-to :group-chat-invite])}]) - [list.item/list-item - {:title (i18n/label :t/pinned-messages) - :icon :main-icons/pin - :accessory :text - :accessory-text (count pinned-messages) - :chevron true - :on-press #(re-frame/dispatch [:pin-message/show-pins-bottom-sheet chat-id])}] - (when member? - [list.item/list-item - {:theme :negative - :title (i18n/label :t/leave-chat) - :accessibility-label :leave-chat-button - :icon :main-icons/arrow-left - :on-press #(re-frame/dispatch [:group-chats.ui/leave-chat-pressed chat-id])}]) - [members-list - {:chat-id chat-id - :admin? admin? - :current-pk current-pk - :allow-adding-members? allow-adding-members?}]]]])))) 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 633881dddf..7a5b1b1906 100644 --- a/src/legacy/status_im/ui/screens/profile/user/views.cljs +++ b/src/legacy/status_im/ui/screens/profile/user/views.cljs @@ -1,119 +1,20 @@ (ns legacy.status-im.ui.screens.profile.user.views (:require - [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.common.common :as components.common] - [legacy.status-im.ui.components.copyable-text :as copyable-text] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.list-selection :as list-selection] + [legacy.status-im.ui.components.core :as components] [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.profile-header.view :as profile-header] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.spacing :as spacing] - [legacy.status-im.ui.screens.profile.user.edit-picture :as edit] - [legacy.status-im.ui.screens.profile.user.styles :as styles] - [legacy.status-im.ui.screens.profile.visibility-status.views :as visibility-status] - [legacy.status-im.utils.utils :as utils] - [quo.components.avatars.user-avatar.style :as user-avatar.style] + [quo.core :as quo] [quo.theme] [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.common.qr-codes.view :as qr-codes] - [status-im.config :as config] - [status-im.contexts.profile.utils :as profile.utils] - [utils.ens.stateofus :as stateofus] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(views/defview share-chat-key - [] - (views/letsubs [{:keys [address ens-name]} [:popover/popover] - {:keys [universal-profile-url]} [:profile/profile] - width (reagent/atom nil)] - [react/view {:on-layout #(reset! width (-> ^js % .-nativeEvent .-layout .-width))} - [react/view {:style {:padding-top 16 :padding-horizontal 16}} - (when @width - [qr-codes/qr-code - {:url address - :size (- @width 32)}]) - (when ens-name - [react/view - [copyable-text/copyable-text-view - {:label :t/ens-username - :container-style {:margin-top 12 :margin-bottom 4} - :copied-text ens-name} - [quo/text - {:monospace true - :accessibility-label :ens-username} - ens-name]] - [react/view - {:height 1 - :margin-top 12 - :margin-horizontal -16 - :background-color colors/gray-lighter}]]) - [copyable-text/copyable-text-view - {:label :t/chat-key - :container-style {:margin-top 12 :margin-bottom 4} - :copied-text address} - [quo/text - {:number-of-lines 1 - :ellipsize-mode :middle - :accessibility-label :chat-key - :monospace true} - address]]] - [react/view styles/share-link-button - [quo/button - {:on-press (fn [] - (re-frame/dispatch [:hide-popover]) - (js/setTimeout - #(list-selection/open-share {:message universal-profile-url}) - 250)) - :accessibility-label :share-my-contact-code-button} - (i18n/label :t/share-link)]]])) + [react-native.core :as rn] + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (defn content [] - (let [{:keys [preferred-name - mnemonic]} - @(re-frame/subscribe [:profile/profile]) - active-contacts-count @(re-frame/subscribe [:contacts/active-count]) - chain @(re-frame/subscribe [:chain-keyword]) - registrar (when (or (not= chain :goerli) config/test-stateofus?) - (stateofus/get-cached-registrar chain)) - local-pairing-mode-enabled? config/local-pairing-mode-enabled?] - [:<> - [visibility-status/visibility-status-button - visibility-status/calculate-button-height-and-dispatch-popover] - [quo/separator {:style {:margin-top (:tiny spacing/spacing)}}] - [list.item/list-item - (cond-> {:title (or (when registrar preferred-name) - (i18n/label :t/ens-usernames)) - :subtitle (if registrar - (if preferred-name - (i18n/label :t/ens-your-your-name) - (i18n/label :t/ens-usernames-details)) - (i18n/label :t/ens-network-restriction)) - :subtitle-max-lines (if registrar - (if preferred-name 1 2) - 1) - :accessibility-label :ens-button - :container-margin-top 8 - :disabled (not registrar) - :chevron true - :icon :main-icons/username} - registrar - (assoc :on-press #(re-frame/dispatch [:open-modal :ens-main registrar])))] - [list.item/list-item - {:title (i18n/label :t/contacts) - :icon :main-icons/in-contacts - :accessibility-label :contacts-button - :accessory :text - :accessory-text (if (pos? active-contacts-count) - (str active-contacts-count) - (i18n/label :t/none)) - :chevron true - :on-press #(re-frame/dispatch [:open-modal :contacts-list])}] - [react/view {:padding-top 16} - [quo/list-header (i18n/label :t/settings)]] + (let [{:keys [mnemonic]} (rf/sub [:profile/profile])] + [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) @@ -121,110 +22,20 @@ :chevron true :accessory (when mnemonic [components.common/counter {:size 22} 1]) - :on-press #(re-frame/dispatch [:open-modal :privacy-and-security])}] - (when config/quo-preview-enabled? - [list.item/list-item - {:icon :main-icons/appearance - :title "Quo Preview" - :accessibility-label :appearance-settings-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :quo-preview])}]) - (when config/quo-preview-enabled? - [list.item/list-item - {:icon :main-icons/appearance - :title "Status IM Components" - :accessibility-label :status-im-common-components - :chevron true - :on-press #(re-frame/dispatch [:open-modal :status-im-preview])}]) - [list.item/list-item - {:icon :main-icons/appearance - :title (i18n/label :t/appearance) - :accessibility-label :appearance-settings-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :appearance])}] - [list.item/list-item - {:icon :main-icons/notification - :title (i18n/label :t/notifications) - :accessibility-label :notifications-settings-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :notifications])}] + :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) :accessibility-label :sync-settings-button :chevron true - :on-press #(re-frame/dispatch [:open-modal :sync-settings])}] - [list.item/list-item - {:icon :main-icons/settings-advanced - :title (i18n/label :t/advanced) - :accessibility-label :advanced-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :advanced-settings])}] - [list.item/list-item - {:icon :main-icons/help - :title (i18n/label :t/need-help) - :accessibility-label :help-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :help-center])}] - [list.item/list-item - {:icon :main-icons/info - :title (i18n/label :t/about-app) - :accessibility-label :about-button - :chevron true - :on-press #(re-frame/dispatch [:open-modal :about-app])}] - (when local-pairing-mode-enabled? - [list.item/list-item - {:icon :i/mobile - :title (i18n/label :t/syncing) - :accessibility-label :syncing - :chevron true - :on-press #(re-frame/dispatch [:open-modal :settings-syncing])}]) - [react/view {:padding-vertical 24} - [list.item/list-item - {:icon :main-icons/log-out - :title (i18n/label :t/sign-out) - :accessibility-label :log-out-button - :theme :negative - :on-press - #(re-frame/dispatch [:multiaccounts.logout.ui/logout-pressed])}]]])) + :on-press #(re-frame/dispatch [:open-modal :legacy-sync-settings])}]])) -(defn my-profile +(defn legacy-settings [] - (fn [] - (let [{:keys [public-key - compressed-key - ens-verified - preferred-name - key-uid] - :as profile} - @(re-frame/subscribe [:profile/profile-with-image]) - customization-color (or (:color @(re-frame/subscribe [:onboarding/profile])) - @(re-frame/subscribe [:profile/customization-color key-uid])) - theme @(re-frame/subscribe [:theme]) - on-share #(re-frame/dispatch [:show-popover - {:view :share-chat-key - :address (or compressed-key - public-key) - :ens-name preferred-name}]) - has-picture @(re-frame/subscribe [:profile/has-picture])] - [react/view {:flex 1} - [quo/animated-header - {:right-accessories [{:accessibility-label :share-header-button - :icon :main-icons/share - :on-press on-share}] - :left-accessories [{:accessibility-label :close-header-button - :icon :main-icons/close - :on-press #(re-frame/dispatch [:navigate-back])}] - :use-insets true - :extended-header (profile-header/extended-header - {:on-press on-share - :on-edit #(re-frame/dispatch [:show-bottom-sheet - {:content (edit/bottom-sheet - has-picture)}]) - :color (user-avatar.style/customization-color customization-color - theme) - :title (profile.utils/displayed-name profile) - :photo (profile.utils/photo profile) - :monospace (not ens-verified) - :subtitle (utils/get-shortened-address (or compressed-key public-key))})} - [content]]]))) + [:<> + [quo/page-nav + {:type :no-title + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [content]]) diff --git a/src/legacy/status_im/ui/screens/qr_scanner/styles.cljs b/src/legacy/status_im/ui/screens/qr_scanner/styles.cljs deleted file mode 100644 index 44408c50ff..0000000000 --- a/src/legacy/status_im/ui/screens/qr_scanner/styles.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns legacy.status-im.ui.screens.qr-scanner.styles) - -(def viewfinder-port - {:position :absolute - :left 0 - :top 0 - :bottom 0 - :right 0 - :align-items :center - :justify-content :center - :flex 1}) diff --git a/src/legacy/status_im/ui/screens/qr_scanner/views.cljs b/src/legacy/status_im/ui/screens/qr_scanner/views.cljs deleted file mode 100644 index 288ddfe07b..0000000000 --- a/src/legacy/status_im/ui/screens/qr_scanner/views.cljs +++ /dev/null @@ -1,128 +0,0 @@ -(ns legacy.status-im.ui.screens.qr-scanner.views - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.topbar :as topbar] - [legacy.status-im.ui.screens.qr-scanner.styles :as styles] - [re-frame.core :as re-frame] - [react-native.camera-kit :as camera-kit] - [react-native.core :as rn] - [reagent.core :as reagent] - [status-im.config :as config] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn get-qr-code-data - [^js event] - (when-let [data (-> event .-nativeEvent .-codeStringValue)] - (string/trim data))) - -(defn- topbar - [_ {:keys [title] :as opts}] - [topbar/topbar - {:background colors/black-persist - :use-insets true - :border-bottom false - :navigation :none - :left-component [quo/button - {:type :secondary - :on-press #(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-cancel opts])} - [quo/text {:style {:color colors/white-persist}} - (i18n/label :t/cancel)]] - :title-component [quo/text - {:style {:color colors/white-persist} - :weight :bold - :number-of-lines 1 - :align :center - :size :large} - (or title (i18n/label :t/scan-qr-code))]}]) - -(defn qr-test-view - [opts] - (let [text-value (atom "")] - [react/view - {:flex 1 - :align-items :center - :justify-content :center} - [react/text-input - {:multiline true - :style {:color colors/white-persist} - :on-change-text #(reset! text-value %)}] - [react/view {:flex-direction :row} - [quo/button - {:on-press #(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-cancel opts])} - "Cancel"] - [quo/button - {:on-press #(re-frame/dispatch - [:qr-scanner.callback/scan-qr-code-success opts - (when-let [text @text-value] - (-> text string/trim (string/replace #"^Ethereum:" "ethereum:")))])} - "Ok"]]])) - -(defn corner - [border1 border2 corner-radius] - [react/view - {:style (assoc {:border-color colors/white-persist :width 60 :height 60} - border1 - 5 - border2 - 5 - corner-radius - 32)}]) - -(defn- viewfinder - [size] - [react/view {:style styles/viewfinder-port} - [react/view {:width size :height size :justify-content :space-between} - [react/view {:flex-direction :row :justify-content :space-between} - [corner :border-top-width :border-left-width :border-top-left-radius] - [corner :border-top-width :border-right-width :border-top-right-radius]] - [react/view {:flex-direction :row :justify-content :space-between} - [corner :border-bottom-width :border-left-width :border-bottom-left-radius] - [corner :border-bottom-width :border-right-width :border-bottom-right-radius]]]]) - -(defn on-barcode-read - [opts data] - (re-frame/dispatch [:qr-scanner.callback/scan-qr-code-success opts (get-qr-code-data data)])) - -(defn- navigate-back-handler - [] - (re-frame/dispatch [:navigate-back]) - true) - -(defn f-qr-scanner - [] - (let [read-once? (reagent/atom false) - {:keys [height width]} (rf/sub [:dimensions/window]) - camera-flashlight (rf/sub [:wallet-legacy.send/camera-flashlight]) - opts (rf/sub [:get-screen-params]) - camera-ref (reagent/atom nil)] - [react/view - {:flex 1 - :background-color colors/black-persist} - [topbar camera-flashlight opts] - (if config/qr-test-menu-enabled? - [qr-test-view opts] - [react/view {:flex 1} - [react/with-activity-indicator - {} - [camera-kit/camera - {:ref #(reset! camera-ref %) - :style {:flex 1} - :camera-type camera-kit/camera-type-back - :zoom-mode :off - :scan-barcode true - :on-read-code #(when-not @read-once? - (reset! read-once? true) - (on-barcode-read opts %))}]] - [viewfinder (int (* 2 (/ (min height width) 3)))]])])) - -(defn qr-scanner - [] - (reagent/create-class - {:display-name "qr-scanner" - :component-did-mount #(rn/hw-back-add-listener navigate-back-handler) - :component-will-unmount #(rn/hw-back-remove-listener navigate-back-handler) - :reagent-render f-qr-scanner})) diff --git a/src/legacy/status_im/ui/screens/screens.cljs b/src/legacy/status_im/ui/screens/screens.cljs index aa834b7b16..84f889c2a5 100644 --- a/src/legacy/status_im/ui/screens/screens.cljs +++ b/src/legacy/status_im/ui/screens/screens.cljs @@ -5,18 +5,13 @@ [legacy.status-im.ui.screens.advanced-settings.views :as advanced-settings] [legacy.status-im.ui.screens.appearance.views :as appearance] [legacy.status-im.ui.screens.backup-settings.view :as backup-settings] - [legacy.status-im.ui.screens.browser.bookmarks.views :as bookmarks] [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.contacts-list.views :as contacts-list] - [legacy.status-im.ui.screens.currency-settings.views :as currency-settings] [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.ens.views :as ens] [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.group.views :as group-chat] [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] @@ -30,18 +25,15 @@ [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.contact.views :as contact] - [legacy.status-im.ui.screens.profile.group-chat.views :as profile.group-chat] [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] - [legacy.status-im.ui.screens.qr-scanner.views :as qr-scanner] [legacy.status-im.ui.screens.reset-password.views :as reset-password] [legacy.status-im.ui.screens.rpc-usage-info :as rpc-usage-info] - [legacy.status-im.ui.screens.stickers.views :as stickers] [legacy.status-im.ui.screens.sync-settings.views :as sync-settings] [legacy.status-im.ui.screens.wakuv2-settings.edit-node.views :as edit-wakuv2-node] [legacy.status-im.ui.screens.wakuv2-settings.views :as wakuv2-settings] + [react-native.platform :as platform] [utils.i18n :as i18n])) (defn topbar-options @@ -59,79 +51,92 @@ (defn screens [] - [;;INTRO, ONBOARDING, LOGIN - + [;;PROGRESS {:name :progress :options {:insets {:top? true}} :component progress/progress} - ;;CHAT - {:name :group-chat-invite - ;;TODO parameter in the event - :options {:insets {:top? true}} - :component profile.group-chat/group-chat-invite} + ;;COMMUNITY {:name :legacy-community-members - ;;TODO custom subtitle :options {:insets {:top? true}} :component members/legacy-members-container} - {:name :stickers - :options {:insets {:top? true} - :topBar (topbar-options :t/sticker-market)} - :component stickers/packs} + {:name :legacy-invite-people-community + :options {:insets {:bottom? true :top? true}} + :component communities.invite/legacy-invite} - {:name :stickers-pack - :options {:insets {:top? true}} - :component stickers/pack} + ;;SETTINGS + {:name :legacy-notifications + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component notifications-settings/notifications-settings} - {:name :currency-settings - :options {:topBar (topbar-options :t/main-currency) - :insets {:top? true}} - :component currency-settings/currency-settings} + {:name :legacy-appearance + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component appearance/appearance-view} - ;;PROFILE + ;; ADVANCED + {:name :legacy-advanced-settings + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component advanced-settings/advanced-settings} - {:name :my-profile - :options {:topBar {:visible false}} - :component profile.user/my-profile} - {:name :contacts-list - :options {:topBar (topbar-options :t/contacts) - :insets {:top? true}} - :component contacts-list/contacts-list} - {:name :ens-main - :options {:topBar (topbar-options :t/ens-usernames) - :insets {:top? true}} - :component ens/main} - {:name :ens-search - :options {:topBar (topbar-options :t/ens-your-username) - :insets {:top? true}} - :component ens/search} - {:name :ens-checkout - :options {:topBar (topbar-options :t/ens-your-username) - :insets {:top? true}} - :component ens/checkout} - {:name :ens-confirmation - :options {:topBar (topbar-options :t/ens-your-username) - :insets {:top? true}} - :component ens/confirmation} - {:name :ens-terms - :options {:topBar (topbar-options :t/ens-terms-registration) - :insets {:top? true}} - :component ens/terms} - {:name :ens-name-details - ;;TODO dynamic title - :options {:insets {:top? true}} - :component ens/name-details} - {:name :blocked-users-list - :options {:topBar (topbar-options :t/blocked-users) - :insets {:top? true}} - :component contacts-list/blocked-users-list} + {:name :legacy-:og-level-settings + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component log-level-settings/log-level-settings} + + ;; LEGACY SETTINGS + {:name :legacy-settings + :options {:topBar {:visible false} + :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} + :insets {:top? platform/android?}} + :component sync-settings/sync-settings} + + ;; ABOUT + {:name :about-app + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component about-app/about-app} + + ;; STATUS HELP + {:name :help-center + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component help-center/help-center} + + {:name :glossary + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component glossary/glossary} + + {:name :bug-report + :options {:topBar {:visible false} + :insets {:top? platform/android?}} + :component bug-report/bug-report} + + ;; OTHER {:name :wakuv2-settings - ;;TODO dynamic title :options {:insets {:top? true}} :component wakuv2-settings/wakuv2-settings} {:name :edit-wakuv2-node - ;;TODO dynamic title :options {:insets {:top? true}} :component edit-wakuv2-node/edit-node} {:name :installations @@ -139,29 +144,19 @@ :insets {:top? true}} :component pairing/installations} {:name :offline-messaging-settings - ;;TODO dynamic title :options {:insets {:top? true}} :component offline-messaging-settings/offline-messaging-settings} {:name :edit-mailserver - ;;TODO dynamic title :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 :privacy-and-security - :options {:topBar (topbar-options :t/privacy-and-security) - :insets {:top? true}} - :component privacy-and-security/privacy-and-security} {: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 :appearance - :options {:topBar (topbar-options :t/appearance) - :insets {:top? true}} - :component appearance/appearance-view} {:name :privacy-and-security-profile-pic-show-to :options {:topbar (topbar-options :t/show-profile-pictures-to) :insets {:top? true}} @@ -170,44 +165,7 @@ :options {:topBar (topbar-options :t/show-profile-pictures) :insets {:top? true}} :component privacy-and-security/profile-pic} - {:name :notifications - :options {:topBar (topbar-options :t/notification-settings) - :insets {:top? true}} - :component notifications-settings/notifications-settings} - {:name :sync-settings - :options {:topBar (topbar-options :t/sync-settings) - :insets {:top? true}} - :component sync-settings/sync-settings} - {:name :advanced-settings - :options {:topBar (topbar-options :t/advanced) - :insets {:top? true}} - :component advanced-settings/advanced-settings} - {:name :help-center - :options {:topBar (topbar-options :t/need-help) - :insets {:top? true}} - :component help-center/help-center} - {:name :glossary - :options {:topBar (topbar-options :t/glossary) - :insets {:top? true}} - :component glossary/glossary} - {:name :about-app - :options {:topBar (topbar-options :t/about-app) - :insets {:top? true}} - :component about-app/about-app} - {:name :privacy-policy - :options {:topBar (topbar-options :t/privacy-policy) - :insets {:top? true}} - :component about-app/privacy-policy} - {:name :terms-of-service - :options {:topBar (topbar-options :t/terms-of-service) - :insets {:top? true}} - :component about-app/tos} - {:name :principles - :options {:topBar (topbar-options :t/principles) - :insets {:top? true}} - :component about-app/principles} {:name :manage-dapps-permissions - ;;TODO dynamic title :options {:insets {:top? true}} :component dapps-permissions/manage} {:name :rpc-usage-info @@ -218,10 +176,6 @@ :options {:topBar (topbar-options :t/peers-stats) :insets {:top? true}} :component peers-stats/peers-stats} - {:name :log-level-settings - :options {:topBar (topbar-options :t/log-level-settings) - :insets {:top? true}} - :component log-level-settings/log-level-settings} {:name :fleet-settings :options {:topBar (topbar-options :t/fleet-settings) :insets {:top? true}} @@ -235,7 +189,6 @@ :insets {:top? true}} :component backup-settings/backup-settings} {:name :backup-seed - ;;TODO dynamic navigation :options {:insets {:top? true}} :component profile.seed/backup-seed} {:name :reset-password @@ -248,76 +201,4 @@ {:name :default-sync-period-settings :options {:topBar (topbar-options :t/default-sync-period) :insets {:top? true}} - :component default-sync-period-settings/default-sync-period-settings} - - ;;MODALS - - ;[Chat] Link preview settings - - {:name :link-previews-settings - :options {:topBar (topbar-options :t/chat-link-previews) - :insets {:top? true}} - :component link-previews-settings/link-previews-settings} - - ;[Chat] Edit nickname - {:name :nickname - ;;TODO dyn subtitle - :options {:topBar {:visible false} - :insets {:bottom? true - :top? true}} - :component contact/nickname-view} - - ;[Group chat] Add participants - {:name :add-participants-toggle-list - :on-focus [:group/add-participants-toggle-list] - ;;TODO dyn subtitle - :options {:topBar {:visible false} - :insets {:bottom? true - :top? true}} - :component group-chat/add-participants-toggle-list} - - ;[Communities] Invite people - {:name :legacy-invite-people-community - ;;TODO dyn title - :options {:insets {:bottom? true - :top? true}} - :component communities.invite/legacy-invite} - - ;QR Scanner - {:name :qr-scanner - ;;TODO custom topbar - :options {:topBar {:visible false} - :navigationBar {:backgroundColor colors/black-persist} - :statusBar {:backgroundColor colors/black-persist - :style :light}} - :component qr-scanner/qr-scanner} - - ;;TODO WHY MODAL? - ;[Profile] Notifications settings - {:name :notifications-settings - :options {:topBar (topbar-options :t/notification-settings) - :popGesture false - :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false} - :insets {:bottom? true - :top? true}} - :component notifications-settings/notifications-settings} - - ;[Browser] New bookmark - {:name :new-bookmark - ;;TODO dynamic title - :options {:insets {:bottom? true - :top? true}} - :component bookmarks/new-bookmark} - - ;Profile - {:name :profile - ;;TODO custom toolbar - :options {:insets {:bottom? true - :top? true}} - :component contact/profile-view} - - ;; BUG REPORT - {:name :bug-report - :options {:insets {:top? true}} - :component bug-report/bug-report}]) + :component default-sync-period-settings/default-sync-period-settings}]) diff --git a/src/legacy/status_im/ui/screens/stickers/styles.cljs b/src/legacy/status_im/ui/screens/stickers/styles.cljs deleted file mode 100644 index d67773117d..0000000000 --- a/src/legacy/status_im/ui/screens/stickers/styles.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns legacy.status-im.ui.screens.stickers.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) - -(def screen - {:flex 1}) - -(defn sticker-image - [sticker-icon-size] - {:margin 16 - :width sticker-icon-size - :height sticker-icon-size - :border-radius (/ sticker-icon-size 2)}) - -(defn price-badge - [not-enough-snt?] - {:background-color (if not-enough-snt? colors/gray colors/blue) - :border-radius 14 - :flex-direction :row - :padding-horizontal 6 - :height 28 - :align-items :center}) - -(def installed-icon - {:height 28 - :width 28 - :border-radius 14 - :background-color colors/green - :align-items :center - :justify-content :center}) diff --git a/src/legacy/status_im/ui/screens/stickers/views.cljs b/src/legacy/status_im/ui/screens/stickers/views.cljs deleted file mode 100644 index 6675a9fb27..0000000000 --- a/src/legacy/status_im/ui/screens/stickers/views.cljs +++ /dev/null @@ -1,114 +0,0 @@ -(ns legacy.status-im.ui.screens.stickers.views - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.fast-image :as fast-image] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.stickers.styles :as styles] - [re-frame.core :as re-frame] - [utils.i18n :as i18n] - [utils.money :as money] - [utils.re-frame :as rf]) - (:require-macros [legacy.status-im.utils.views :refer [defview letsubs]])) - -(defn cache - [url] - (str url "&download=true")) - -(defn- thumbnail-icon - [uri size] - [fast-image/fast-image - {:style {:width size :height size :border-radius (/ size 2)} - :source {:uri (cache uri)}}]) - -(defn price-badge - [_] - (let [chain (rf/sub [:ethereum/chain-keyword]) - balance (rf/sub [:balance-default])] - (fn [{:keys [id price pending owned installed]}] - (let [snt (if (= :mainnet chain) (:SNT balance) (:STT balance)) - price (money/bignumber price) - not-enough-snt? (or (nil? snt) (money/equal-to snt 0) (money/greater-than price snt)) - free (money/equal-to price 0)] - (if installed - [react/view styles/installed-icon - [icons/icon :main-icons/check {:color colors/white-persist :height 20 :width 20}]] - [react/touchable-highlight - {:on-press #(cond pending nil - (or owned free) - (re-frame/dispatch [:stickers/install-pack id]) - not-enough-snt? nil - :else (fn [] (js/alert "feature no longer supported")))} - [react/view (styles/price-badge (and (not (or owned free)) not-enough-snt?)) - (when (and (not free) (not owned)) - [icons/tiny-icon :tiny-icons/tiny-snt - {:color colors/white-persist :container-style {:margin-right 6}}]) - (if pending - [react/activity-indicator - {:animating true - :color colors/white-persist}] - [react/text - {:style {:color colors/white-persist} - :accessibility-label :sticker-pack-price} - (cond owned (i18n/label :t/install) - free (i18n/label :t/free) - :else (str (money/wei-> :eth price)))])]]))))) - -(defn pack-badge - [{:keys [name author thumbnail preview id] :as pack}] - [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :stickers-pack {:id id}])} - [react/view {:margin-bottom 27} - [fast-image/fast-image {:style {:height 200 :border-radius 20} :source {:uri (cache preview)}}] - [react/view {:height 64 :align-items :center :flex-direction :row} - [thumbnail-icon thumbnail 40] - [react/view {:padding-horizontal 16 :flex 1} - [react/text {:accessibility-label :sticker-pack-name} name] - [react/text - {:style {:color colors/gray :margin-top 6} - :accessibility-label :sticker-pack-author} author]] - [price-badge pack]]]]) - -(defview packs - [] - (letsubs [all-packs [:stickers/all-packs]] - [react/view styles/screen - [react/keyboard-avoiding-view {:flex 1} - (if (seq all-packs) - [react/scroll-view {:keyboard-should-persist-taps :handled :style {:padding 16}} - [react/view - (for [pack all-packs] - ^{:key pack} - [pack-badge pack])]] - [react/view {:flex 1 :align-items :center :justify-content :center} - [react/activity-indicator {:animating true}]])]])) - -(def sticker-icon-size 60) - -(defview pack-main - [] - (letsubs [{:keys [name author thumbnail stickers] - :as pack} - [:stickers/get-current-pack]] - [react/keyboard-avoiding-view {:flex 1} - (if pack - [react/view {:flex 1} - [react/view {:height 74 :align-items :center :flex-direction :row :padding-horizontal 16} - [thumbnail-icon thumbnail 64] - [react/view {:padding-horizontal 16 :flex 1} - [react/text {:style {:typography :header}} name] - [react/text {:style {:color colors/gray :margin-top 6}} author]] - [price-badge pack]] - [react/view {:style {:padding-top 8 :flex 1}} - [react/scroll-view {:keyboard-should-persist-taps :handled :style {:flex 1}} - [react/view {:flex-direction :row :flex-wrap :wrap} - (for [{:keys [url]} stickers] - ^{:key url} - [fast-image/fast-image - {:style (styles/sticker-image sticker-icon-size) - :source {:uri (cache url)}}])]]]] - [react/view {:flex 1 :align-items :center :justify-content :center} - [react/activity-indicator {:animating true}]])])) - -(defview pack - [] - [pack-main]) diff --git a/src/legacy/status_im/ui/screens/sync_settings/views.cljs b/src/legacy/status_im/ui/screens/sync_settings/views.cljs index 2d9c0c0e7b..b1772e6a3b 100644 --- a/src/legacy/status_im/ui/screens/sync_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/sync_settings/views.cljs @@ -2,12 +2,14 @@ (: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.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] [status-im.constants :as constants] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) (views/defview sync-settings [] @@ -17,65 +19,71 @@ use-mailservers?]} [:profile/profile] current-mailserver-name [:mailserver/current-name]] - [react/scroll-view - [quo/list-header (i18n/label :t/data-syncing)] - [list.item/list-item - {:size :small - :title (i18n/label :t/mobile-network-settings) - :accessibility-label :notifications-button - :on-press #(re-frame/dispatch [:navigate-to :mobile-network-settings]) - :chevron true - :accessory :text - :accessory-text (if syncing-on-mobile-network? - (i18n/label :t/mobile-network-use-mobile) - (i18n/label :t/mobile-network-use-wifi))}] - [list.item/list-item - {:size :small - :title (i18n/label :t/backup-settings) - :accessibility-label :backup-settings-button - :on-press #(re-frame/dispatch [:navigate-to :backup-settings]) - :chevron true - :accessory :text - :accessory-text (if backup-enabled? - (i18n/label :t/backup-enabled) - (i18n/label :t/backup-disabled))}] - [list.item/list-item - {:size :small - :title (i18n/label :t/default-sync-period) - :accessibility-label :default-sync-period-button - :on-press #(re-frame/dispatch [:navigate-to :default-sync-period-settings]) - :chevron true - :accessory :text - :accessory-text (cond - (= default-sync-period constants/two-mins) - (i18n/label :t/two-minutes) - (or - (nil? default-sync-period) - (= default-sync-period constants/one-day)) - (i18n/label :t/one-day) - (= default-sync-period constants/three-days) - (i18n/label :t/three-days) - (= default-sync-period constants/one-week) - (i18n/label :t/one-week) - (= default-sync-period constants/one-month) - (i18n/label :t/one-month))}] - [list.item/list-item - {:size :small - :accessibility-label :offline-messages-settings-button - :title (i18n/label :t/history-nodes) - :on-press #(re-frame/dispatch [:navigate-to :offline-messaging-settings]) - :accessory :text - :accessory-text (when use-mailservers? current-mailserver-name) - :chevron true}] - ;; TODO(Ferossgp): Devider componemt - [react/view - {:height 1 - :background-color colors/gray-lighter - :margin-top 8}] - [quo/list-header (i18n/label :t/device-syncing)] - [list.item/list-item - {:size :small - :title (i18n/label :t/devices) - :accessibility-label :pairing-settings-button - :on-press #(re-frame/dispatch [:navigate-to :installations]) - :chevron true}]])) + [:<> + [quo/page-nav + {:type :no-title + :background :blur + :icon-name :i/close + :on-press #(rf/dispatch [:navigate-back])}] + [react/scroll-view + [components/list-header (i18n/label :t/data-syncing)] + [list.item/list-item + {:size :small + :title (i18n/label :t/mobile-network-settings) + :accessibility-label :notifications-button + :on-press #(re-frame/dispatch [:navigate-to :mobile-network-settings]) + :chevron true + :accessory :text + :accessory-text (if syncing-on-mobile-network? + (i18n/label :t/mobile-network-use-mobile) + (i18n/label :t/mobile-network-use-wifi))}] + [list.item/list-item + {:size :small + :title (i18n/label :t/backup-settings) + :accessibility-label :backup-settings-button + :on-press #(re-frame/dispatch [:navigate-to :backup-settings]) + :chevron true + :accessory :text + :accessory-text (if backup-enabled? + (i18n/label :t/backup-enabled) + (i18n/label :t/backup-disabled))}] + [list.item/list-item + {:size :small + :title (i18n/label :t/default-sync-period) + :accessibility-label :default-sync-period-button + :on-press #(re-frame/dispatch [:navigate-to :default-sync-period-settings]) + :chevron true + :accessory :text + :accessory-text (cond + (= default-sync-period constants/two-mins) + (i18n/label :t/two-minutes) + (or + (nil? default-sync-period) + (= default-sync-period constants/one-day)) + (i18n/label :t/one-day) + (= default-sync-period constants/three-days) + (i18n/label :t/three-days) + (= default-sync-period constants/one-week) + (i18n/label :t/one-week) + (= default-sync-period constants/one-month) + (i18n/label :t/one-month))}] + [list.item/list-item + {:size :small + :accessibility-label :offline-messages-settings-button + :title (i18n/label :t/history-nodes) + :on-press #(re-frame/dispatch [:navigate-to :offline-messaging-settings]) + :accessory :text + :accessory-text (when use-mailservers? current-mailserver-name) + :chevron true}] + ;; TODO(Ferossgp): Devider componemt + [react/view + {:height 1 + :background-color colors/gray-lighter + :margin-top 8}] + [components/list-header (i18n/label :t/device-syncing)] + [list.item/list-item + {:size :small + :title (i18n/label :t/devices) + :accessibility-label :pairing-settings-button + :on-press #(re-frame/dispatch [:navigate-to :installations]) + :chevron true}]]])) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index ebb9e0039b..c8744f941b 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -255,10 +255,6 @@ (def ^:const web3-send-async-callback "web3-send-async-callback") (def ^:const scan-qr-code "scan-qr-code") -(def ^:const faq "https://status.im/faq/") -(def ^:const faq-keycard (str faq "#keycard")) -(def ^:const keycard-integration-link "https://status.im/keycard-integration") - (def ^:const two-mins (* 2 60)) (def ^:const one-day (* 60 60 24)) (def ^:const three-days (* one-day 3)) @@ -267,8 +263,6 @@ (def ^:const privacy-policy-link "https://status.im/privacy-policy/") (def ^:const terms-of-service-link "https://status.im/terms-of-use") -(def ^:const docs-link "https://status.im/docs/") -(def ^:const principles-link "https://our.status.im/our-principles/") (def ^:const create-account-link "https://status.app/help/wallet/create-wallet-accounts") (def ^:const visibility-status-unknown 0) @@ -277,9 +271,6 @@ (def ^:const visibility-status-always-online 3) (def ^:const visibility-status-inactive 4) -(def ^:const wallet-connect-version-1 1) -(def ^:const wallet-connect-version-2 2) - (def ^:const sticker-pack-status-installed 1) (def ^:const sticker-pack-status-pending 2) (def ^:const sticker-pack-status-owned 3) diff --git a/src/status_im/contexts/profile/settings/list_items.cljs b/src/status_im/contexts/profile/settings/list_items.cljs index a9e7514246..48499a38c5 100644 --- a/src/status_im/contexts/profile/settings/list_items.cljs +++ b/src/status_im/contexts/profile/settings/list_items.cljs @@ -57,13 +57,13 @@ :blur? true :action :arrow} {:title (i18n/label :t/notifications) - :on-press #(rf/dispatch [:open-modal :notifications]) + :on-press #(rf/dispatch [:open-modal :legacy-notifications]) :image-props :i/activity-center :image :icon :blur? true :action :arrow} {:title (i18n/label :t/appearance) - :on-press #(rf/dispatch [:open-modal :appearance]) + :on-press #(rf/dispatch [:open-modal :legacy-appearance]) :image-props :i/light :image :icon :blur? true @@ -83,14 +83,14 @@ :blur? true :action :arrow}) {:title (i18n/label :t/advanced) - :on-press #(rf/dispatch [:open-modal :advanced-settings]) + :on-press #(rf/dispatch [:open-modal :legacy-advanced-settings]) :image-props :i/settings :image :icon :blur? true :action :arrow}] ;; temporary link to legacy settings [{:title "Legacy settings" - :on-press #(rf/dispatch [:open-modal :my-profile]) + :on-press #(rf/dispatch [:open-modal :legacy-settings]) :action :arrow :image :icon :blur? true diff --git a/src/status_im/contexts/syncing/syncing_devices_list/view.cljs b/src/status_im/contexts/syncing/syncing_devices_list/view.cljs index 03f3be0fc6..c4ecf84215 100644 --- a/src/status_im/contexts/syncing/syncing_devices_list/view.cljs +++ b/src/status_im/contexts/syncing/syncing_devices_list/view.cljs @@ -3,7 +3,6 @@ [quo.core :as quo] [quo.foundations.colors :as colors] [react-native.core :as rn] - [react-native.safe-area :as safe-area] [status-im.contexts.syncing.device.view :as device] [status-im.contexts.syncing.syncing-devices-list.style :as style] [utils.i18n :as i18n] @@ -20,7 +19,6 @@ (defn view [] (let [devices (rf/sub [:pairing/installations]) - insets (safe-area/get-insets) devices-with-button (map #(assoc % :show-button? true) devices) user-device (first devices-with-button) other-devices (rest devices-with-button) @@ -28,7 +26,7 @@ {:keys [paired-devices unpaired-devices]} (group-by #(if (:enabled? %) :paired-devices :unpaired-devices) other-devices)] - [rn/view {:style (style/container-main (:top insets))} + [quo/overlay {:type :shell :top-inset? true} [quo/page-nav {:type :no-title :background :blur diff --git a/test/appium/tests/critical/chats/test_public_chat_browsing.py b/test/appium/tests/critical/chats/test_public_chat_browsing.py index d83c63af34..eb33687307 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -687,14 +687,11 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): profile_1 = self.home_1.get_profile_view() self.home_1.navigate_back_to_home_view() self.chat_1.profile_button.click() - profile_1.logout_button.scroll_to_element() - profile_1.profile_legacy_button.click() - profile_1.contacts_button.wait_and_click() - profile_1.blocked_users_button.wait_and_click() - profile_1.element_by_text(self.username_2).click() - self.chat_1.unblock_contact_button.click() - self.chat_1.close_button.click() - self.chat_1.navigate_back_to_home_view() + profile_1.profile_messages_button.click() + profile_1.profile_blocked_users_button.wait_and_click() + self.home_1.get_chat(self.username_2).profile_unblock_button.click() + self.chat_1.confirm_block_contact_button.click() + self.chat_1.click_system_back_button(times=3) self.home_2.just_fyi("Check that can send message in community after unblock") self.chat_2.send_message(message_unblocked) diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 29dac0840e..30299e36c0 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -121,6 +121,10 @@ class ChatElement(SilentButton): return ChatImage(self.driver) + @property + def profile_unblock_button(self): + return Button(self.driver, xpath=self.locator + "/*[@content-desc='Unblock']") + class ActivityCenterElement(SilentButton): def __init__(self, driver, username): diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 5ca7b18a92..14fead27dc 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -359,6 +359,8 @@ class ProfileView(BaseView): self.take_photo_button = Button(self.driver, accessibility_id="take-photo-button") self.select_from_gallery_button = Button(self.driver, accessibility_id="select-from-gallery-button") self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon") + self.profile_messages_button = Button(self.driver, accessibility_id="icon, Messages, label-component, icon") + self.profile_blocked_users_button = Button(self.driver, accessibility_id="Blocked users, label-component, icon") self.profile_legacy_button = Button(self.driver, accessibility_id="icon, Legacy settings, label-component, icon")