From b2cae88924d8a7a60eabf9a6bf0e905baf395376 Mon Sep 17 00:00:00 2001 From: flexsurfer Date: Mon, 25 Sep 2023 09:32:55 +0200 Subject: [PATCH 1/4] [#17383] migrate status-im.utils.types (#17389) --- src/status_im/browser/core.cljs | 2 +- src/status_im/browser/permissions_test.cljs | 2 +- src/status_im/chat/models/message.cljs | 2 +- src/status_im/communities/core.cljs | 2 +- src/status_im/contact/block.cljs | 2 +- src/status_im/data_store/chats.cljs | 2 +- src/status_im/keycard/common.cljs | 2 +- src/status_im/keycard/fx.cljs | 2 +- src/status_im/keycard/login.cljs | 2 +- src/status_im/keycard/real_keycard.cljs | 2 +- src/status_im/keycard/recovery.cljs | 2 +- src/status_im/keycard/sign.cljs | 2 +- src/status_im/keycard/simulated_keycard.cljs | 2 +- src/status_im/multiaccounts/create/core.cljs | 2 +- src/status_im/multiaccounts/login/core.cljs | 2 +- src/status_im/multiaccounts/recover/core.cljs | 2 +- src/status_im/multiaccounts/reset_password/core.cljs | 2 +- src/status_im/multiaccounts/update/core.cljs | 2 +- src/status_im/node/core.cljs | 2 +- src/status_im/notifications/local.cljs | 2 +- src/status_im/router/core.cljs | 2 +- src/status_im/signing/core.cljs | 2 +- src/status_im/signing/keycard.cljs | 2 +- src/status_im/transport/message/core.cljs | 2 +- .../ui/screens/privacy_and_security_settings/events.cljs | 2 +- src/status_im/ui/screens/signing/views.cljs | 2 +- src/status_im/utils/{types.cljs => deprecated_types.cljs} | 3 ++- src/status_im/utils/logging/core.cljs | 2 +- src/status_im/utils/test.cljs | 2 +- src/status_im/wallet/accounts/core.cljs | 2 +- src/status_im/wallet_connect/core.cljs | 2 +- src/status_im2/common/log.cljs | 4 ++-- src/status_im2/contexts/add_new_contact/events.cljs | 7 +++---- src/status_im2/contexts/chat/events.cljs | 4 ++-- src/status_im2/contexts/contacts/events.cljs | 4 ++-- src/status_im2/contexts/onboarding/events.cljs | 4 ++-- src/status_im2/contexts/profile/config.cljs | 4 ++-- src/status_im2/contexts/profile/profiles/view.cljs | 4 ++-- 38 files changed, 47 insertions(+), 47 deletions(-) rename src/status_im/utils/{types.cljs => deprecated_types.cljs} (91%) diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index 1dad3be275e..9addb14eca7 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -20,7 +20,7 @@ [utils.url :as url] [react-native.platform :as platform] [status-im.utils.random :as random] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.universal-links.utils :as links] [status-im2.navigation.events :as navigation] [taoensso.timbre :as log] diff --git a/src/status_im/browser/permissions_test.cljs b/src/status_im/browser/permissions_test.cljs index 02c03421e7b..191e173858a 100644 --- a/src/status_im/browser/permissions_test.cljs +++ b/src/status_im/browser/permissions_test.cljs @@ -3,7 +3,7 @@ [status-im.browser.core :as browser] [status-im.browser.core-test :as core.tests] [status-im.browser.permissions :as permissions] - [status-im.utils.types :as types])) + [status-im.utils.deprecated-types :as types])) (deftest permissions-test (let [dapp-name "test.com" diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index 37cb760e29e..30551f0f2d0 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -5,7 +5,7 @@ [status-im.data-store.messages :as data-store.messages] [status-im.transport.message.protocol :as protocol] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.contexts.chat.messages.delete-message.events :as delete-message] [status-im2.contexts.chat.messages.list.events :as message-list] [status-im2.contexts.chat.messages.list.state :as view.state] diff --git a/src/status_im/communities/core.cljs b/src/status_im/communities/core.cljs index 496c107b83c..3d4710a1a9c 100644 --- a/src/status_im/communities/core.cljs +++ b/src/status_im/communities/core.cljs @@ -5,7 +5,7 @@ [quo.design-system.colors :as colors] [quo2.foundations.colors :as quo2.colors] [re-frame.core :as re-frame] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.async-storage.core :as async-storage] [status-im.ui.components.emoji-thumbnail.styles :as emoji-thumbnail-styles] [status-im.utils.universal-links.core :as universal-links] diff --git a/src/status_im/contact/block.cljs b/src/status_im/contact/block.cljs index 1eb51a27f44..487b76e5732 100644 --- a/src/status_im/contact/block.cljs +++ b/src/status_im/contact/block.cljs @@ -5,7 +5,7 @@ [status-im.data-store.chats :as chats-store] [status-im2.contexts.contacts.events :as contacts-store] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.contexts.shell.activity-center.events :as activity-center] [status-im2.navigation.events :as navigation])) diff --git a/src/status_im/data_store/chats.cljs b/src/status_im/data_store/chats.cljs index 8afa017f30a..df78b99a4d1 100644 --- a/src/status_im/data_store/chats.cljs +++ b/src/status_im/data_store/chats.cljs @@ -3,7 +3,7 @@ [status-im2.constants :as constants] [status-im.data-store.messages :as messages] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (defn rpc->type diff --git a/src/status_im/keycard/common.cljs b/src/status_im/keycard/common.cljs index 6f9d15d9958..14ebbc62423 100644 --- a/src/status_im/keycard/common.cljs +++ b/src/status_im/keycard/common.cljs @@ -11,7 +11,7 @@ [utils.datetime :as datetime] [status-im.utils.keychain.core :as keychain] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.navigation.events :as navigation] [taoensso.timbre :as log])) diff --git a/src/status_im/keycard/fx.cljs b/src/status_im/keycard/fx.cljs index cc400ffb976..b7527e217f5 100644 --- a/src/status_im/keycard/fx.cljs +++ b/src/status_im/keycard/fx.cljs @@ -4,7 +4,7 @@ [re-frame.core :as re-frame] [status-im.keycard.card :as card] [native-module.core :as native-module] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (re-frame/reg-fx diff --git a/src/status_im/keycard/login.cljs b/src/status_im/keycard/login.cljs index 116ab0b9b3f..d6b0831b26c 100644 --- a/src/status_im/keycard/login.cljs +++ b/src/status_im/keycard/login.cljs @@ -7,7 +7,7 @@ [status-im.keycard.recovery :as recovery] [status-im.signing.core :as signing.core] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.navigation.events :as navigation] [taoensso.timbre :as log])) diff --git a/src/status_im/keycard/real_keycard.cljs b/src/status_im/keycard/real_keycard.cljs index 37df03a4e0c..192906bc7c5 100644 --- a/src/status_im/keycard/real_keycard.cljs +++ b/src/status_im/keycard/real_keycard.cljs @@ -6,7 +6,7 @@ [status-im.keycard.keycard :as keycard] [native-module.core :as native-module] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (defonce event-emitter diff --git a/src/status_im/keycard/recovery.cljs b/src/status_im/keycard/recovery.cljs index a4ea7b50ac5..91a36575032 100644 --- a/src/status_im/keycard/recovery.cljs +++ b/src/status_im/keycard/recovery.cljs @@ -16,7 +16,7 @@ [utils.datetime :as datetime] [status-im.utils.keychain.core :as keychain] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.navigation.events :as navigation] [taoensso.timbre :as log] [utils.security.core :as security])) diff --git a/src/status_im/keycard/sign.cljs b/src/status_im/keycard/sign.cljs index e16dff8ddb0..de7f3d8d9fc 100644 --- a/src/status_im/keycard/sign.cljs +++ b/src/status_im/keycard/sign.cljs @@ -5,7 +5,7 @@ [status-im.keycard.common :as common] [utils.re-frame :as rf] [utils.money :as money] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (rf/defn sign diff --git a/src/status_im/keycard/simulated_keycard.cljs b/src/status_im/keycard/simulated_keycard.cljs index 979443afb2e..7d09ebe49dc 100644 --- a/src/status_im/keycard/simulated_keycard.cljs +++ b/src/status_im/keycard/simulated_keycard.cljs @@ -9,7 +9,7 @@ [status-im.multiaccounts.create.core :as multiaccounts.create] [native-module.core :as native-module] [status-im.node.core :as node] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.utils :as utils] [taoensso.timbre :as log])) diff --git a/src/status_im/multiaccounts/create/core.cljs b/src/status_im/multiaccounts/create/core.cljs index 61e8fc9a0ac..dc635c09ef7 100644 --- a/src/status_im/multiaccounts/create/core.cljs +++ b/src/status_im/multiaccounts/create/core.cljs @@ -11,7 +11,7 @@ [status-im2.config :as config] [utils.re-frame :as rf] [status-im.utils.signing-phrase.core :as signing-phrase] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [utils.security.core :as security])) (defn normalize-derived-data-keys diff --git a/src/status_im/multiaccounts/login/core.cljs b/src/status_im/multiaccounts/login/core.cljs index efdfb175c00..33db20de80f 100644 --- a/src/status_im/multiaccounts/login/core.cljs +++ b/src/status_im/multiaccounts/login/core.cljs @@ -6,7 +6,7 @@ [status-im.ui.components.react :as react] [utils.re-frame :as rf] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [utils.security.core :as security])) (re-frame/reg-fx diff --git a/src/status_im/multiaccounts/recover/core.cljs b/src/status_im/multiaccounts/recover/core.cljs index 33a30190df1..a480d50454c 100644 --- a/src/status_im/multiaccounts/recover/core.cljs +++ b/src/status_im/multiaccounts/recover/core.cljs @@ -3,7 +3,7 @@ [status-im2.constants :as constants] [status-im.multiaccounts.create.core :as multiaccounts.create] [native-module.core :as native-module] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (re-frame/reg-fx diff --git a/src/status_im/multiaccounts/reset_password/core.cljs b/src/status_im/multiaccounts/reset_password/core.cljs index 3a8c5c99ee7..e4c92f7cf21 100644 --- a/src/status_im/multiaccounts/reset_password/core.cljs +++ b/src/status_im/multiaccounts/reset_password/core.cljs @@ -5,7 +5,7 @@ [native-module.core :as native-module] [status-im.popover.core :as popover] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [utils.security.core :as security])) (rf/defn on-input-change diff --git a/src/status_im/multiaccounts/update/core.cljs b/src/status_im/multiaccounts/update/core.cljs index ca1d5a5bb0d..120c4680d1a 100644 --- a/src/status_im/multiaccounts/update/core.cljs +++ b/src/status_im/multiaccounts/update/core.cljs @@ -1,6 +1,6 @@ (ns status-im.multiaccounts.update.core (:require [status-im.ethereum.ens :as ens] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.constants :as constants] [taoensso.timbre :as log] [utils.re-frame :as rf])) diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index c8d9da2159e..d2a6a18527e 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -3,7 +3,7 @@ [native-module.core :as native-module] [status-im2.config :as config] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [clojure.string :as string] [react-native.platform :as platform])) diff --git a/src/status_im/notifications/local.cljs b/src/status_im/notifications/local.cljs index 31b49e86028..06ee95a3b6b 100644 --- a/src/status_im/notifications/local.cljs +++ b/src/status_im/notifications/local.cljs @@ -11,7 +11,7 @@ [status-im.notifications.android :as pn-android] [utils.re-frame :as rf] [utils.money :as money] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.utils :as utils] [react-native.core :as rn])) diff --git a/src/status_im/router/core.cljs b/src/status_im/router/core.cljs index ceadb510b46..fa066ba4299 100644 --- a/src/status_im/router/core.cljs +++ b/src/status_im/router/core.cljs @@ -7,7 +7,7 @@ [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip681 :as eip681] [status-im.ethereum.ens :as ens] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [native-module.core :as native-module] [status-im.ethereum.stateofus :as stateofus] [utils.validators :as validators] diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index 0b892c2fc49..908890da892 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -16,7 +16,7 @@ [utils.re-frame :as rf] [status-im.utils.hex :as utils.hex] [utils.money :as money] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.utils :as utils] [status-im.wallet.core :as wallet] [status-im.wallet.prices :as prices] diff --git a/src/status_im/signing/keycard.cljs b/src/status_im/signing/keycard.cljs index 039a78ff5b5..0d75a398a7e 100644 --- a/src/status_im/signing/keycard.cljs +++ b/src/status_im/signing/keycard.cljs @@ -3,7 +3,7 @@ [utils.i18n :as i18n] [native-module.core :as native-module] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log])) (re-frame/reg-fx diff --git a/src/status_im/transport/message/core.cljs b/src/status_im/transport/message/core.cljs index e0fa66cb4c2..696f82e3bc1 100644 --- a/src/status_im/transport/message/core.cljs +++ b/src/status_im/transport/message/core.cljs @@ -16,7 +16,7 @@ [status-im.multiaccounts.update.core :as update.core] [status-im.pairing.core :as models.pairing] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.visibility-status-updates.core :as models.visibility-status-updates] [status-im2.contexts.shell.activity-center.events :as activity-center] [status-im2.contexts.chat.messages.pin.events :as messages.pin] diff --git a/src/status_im/ui/screens/privacy_and_security_settings/events.cljs b/src/status_im/ui/screens/privacy_and_security_settings/events.cljs index b2e8a506adb..e58180f9da7 100644 --- a/src/status_im/ui/screens/privacy_and_security_settings/events.cljs +++ b/src/status_im/ui/screens/privacy_and_security_settings/events.cljs @@ -5,7 +5,7 @@ [utils.i18n :as i18n] [native-module.core :as native-module] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [taoensso.timbre :as log] [utils.security.core :as security])) diff --git a/src/status_im/ui/screens/signing/views.cljs b/src/status_im/ui/screens/signing/views.cljs index 6aae6f73802..b9d59d156f4 100644 --- a/src/status_im/ui/screens/signing/views.cljs +++ b/src/status_im/ui/screens/signing/views.cljs @@ -23,7 +23,7 @@ [status-im.ui.screens.signing.styles :as styles] [status-im.ui.screens.wallet.components.views :as wallet.components] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.utils :as utils] [status-im.wallet.utils :as wallet.utils] [utils.security.core :as security])) diff --git a/src/status_im/utils/types.cljs b/src/status_im/utils/deprecated_types.cljs similarity index 91% rename from src/status_im/utils/types.cljs rename to src/status_im/utils/deprecated_types.cljs index 658692d40ad..f3a1f4f4e30 100644 --- a/src/status_im/utils/types.cljs +++ b/src/status_im/utils/deprecated_types.cljs @@ -1,4 +1,5 @@ -(ns status-im.utils.types +(ns status-im.utils.deprecated-types + {:deprecated true :superseded-by "utils.transforms"} (:refer-clojure :exclude [js->clj]) (:require [cljs-bean.core :as clj-bean])) diff --git a/src/status_im/utils/logging/core.cljs b/src/status_im/utils/logging/core.cljs index a8ded5c7a9d..3ddea330e82 100644 --- a/src/status_im/utils/logging/core.cljs +++ b/src/status_im/utils/logging/core.cljs @@ -12,7 +12,7 @@ [utils.re-frame :as rf] [utils.datetime :as datetime] [react-native.platform :as platform] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im2.common.log :as log] [status-im2.config :as config])) diff --git a/src/status_im/utils/test.cljs b/src/status_im/utils/test.cljs index f968dc618c1..322f4304926 100644 --- a/src/status_im/utils/test.cljs +++ b/src/status_im/utils/test.cljs @@ -1,6 +1,6 @@ (ns status-im.utils.test (:require [re-frame.core :as re-frame] - [status-im.utils.types :as types])) + [status-im.utils.deprecated-types :as types])) (def native-status (js/require "../../modules/react-native-status/nodejs/bindings")) diff --git a/src/status_im/wallet/accounts/core.cljs b/src/status_im/wallet/accounts/core.cljs index 50b8d9ea2c3..943e5dabcbc 100644 --- a/src/status_im/wallet/accounts/core.cljs +++ b/src/status_im/wallet/accounts/core.cljs @@ -18,7 +18,7 @@ [utils.re-frame :as rf] [status-im.utils.hex :as hex] [status-im.utils.mobile-sync :as utils.mobile-sync] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.wallet.core :as wallet] [status-im.wallet.prices :as prices] [status-im2.navigation.events :as navigation] diff --git a/src/status_im/wallet_connect/core.cljs b/src/status_im/wallet_connect/core.cljs index a73808ffee9..ee394962d74 100644 --- a/src/status_im/wallet_connect/core.cljs +++ b/src/status_im/wallet_connect/core.cljs @@ -7,7 +7,7 @@ [status-im.signing.core :as signing] [status-im2.config :as config] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [status-im.utils.deprecated-types :as types] [status-im.utils.wallet-connect :as wallet-connect] [taoensso.timbre :as log])) diff --git a/src/status_im2/common/log.cljs b/src/status_im2/common/log.cljs index bc2394c60da..316626d1314 100644 --- a/src/status_im2/common/log.cljs +++ b/src/status_im2/common/log.cljs @@ -2,7 +2,7 @@ (:require [clojure.string :as string] [native-module.core :as native-module] [re-frame.core :as re-frame] - [status-im.utils.types :as types] + [utils.transforms :as transforms] [status-im2.config :as config] [taoensso.timbre :as log] [utils.re-frame :as rf])) @@ -21,7 +21,7 @@ (defn setup [level] (let [handle-error (fn [res] - (let [{:keys [error]} (types/json->clj res)] + (let [{:keys [error]} (transforms/json->clj res)] (when-not (string/blank? error) (log/error "init statusgo logging failed" error)))) logging-params {:enable? true diff --git a/src/status_im2/contexts/add_new_contact/events.cljs b/src/status_im2/contexts/add_new_contact/events.cljs index 826c71467e7..69154d096ae 100644 --- a/src/status_im2/contexts/add_new_contact/events.cljs +++ b/src/status_im2/contexts/add_new_contact/events.cljs @@ -1,7 +1,7 @@ (ns status-im2.contexts.add-new-contact.events (:require [clojure.string :as string] [utils.re-frame :as rf] - [status-im.utils.types :as types] + [utils.transforms :as transforms] [re-frame.core :as re-frame] [status-im.ethereum.core :as ethereum] [status-im.ethereum.ens :as ens] @@ -129,7 +129,7 @@ compressed-key constants/deserialization-key (fn [resp] - (let [{:keys [error]} (types/json->clj resp)] + (let [{:keys [error]} (transforms/json->clj resp)] (if error (on-error error) (on-success (str "0x" (subs resp 5))))))))) @@ -194,6 +194,5 @@ (rf/defn set-new-identity-reconnected [{:keys [db]}] - (let [input (get-in db [:contacts/new-identity :input]) - resubmit? (and input (= :new-contact (get-in db [:view-id])))] + (let [input (get-in db [:contacts/new-identity :input])] (rf/dispatch [:contacts/set-new-identity input]))) diff --git a/src/status_im2/contexts/chat/events.cljs b/src/status_im2/contexts/chat/events.cljs index b51cb4b0967..3092931e88d 100644 --- a/src/status_im2/contexts/chat/events.cljs +++ b/src/status_im2/contexts/chat/events.cljs @@ -14,7 +14,7 @@ [status-im.data-store.chats :as chats-store] [status-im2.contexts.contacts.events :as contacts-store] [status-im.utils.clocks :as utils.clocks] - [status-im.utils.types :as types] + [utils.transforms :as transforms] [reagent.core :as reagent] [quo2.foundations.colors :as colors] [re-frame.core :as re-frame] @@ -234,7 +234,7 @@ (rf/defn handle-one-to-one-chat-created {:events [:chat/one-to-one-chat-created]} [{:keys [db]} chat-id response-js] - (let [chat (chats-store/<-rpc (first (types/js->clj (.-chats ^js response-js)))) + (let [chat (chats-store/<-rpc (first (transforms/js->clj (.-chats ^js response-js)))) contact-js (first (.-contacts ^js response-js)) contact (when contact-js (contacts-store/<-rpc-js contact-js))] {:db (cond-> db diff --git a/src/status_im2/contexts/contacts/events.cljs b/src/status_im2/contexts/contacts/events.cljs index ab437e10c35..e449e8b2d5a 100644 --- a/src/status_im2/contexts/contacts/events.cljs +++ b/src/status_im2/contexts/contacts/events.cljs @@ -1,7 +1,7 @@ (ns status-im2.contexts.contacts.events (:require [oops.core :as oops] - [status-im.utils.types :as types] + [utils.transforms :as transforms] [status-im2.constants :as constants] [taoensso.timbre :as log] [utils.i18n :as i18n] @@ -15,7 +15,7 @@ :secondary-name (.-secondaryName js-contact) :ens-name (.-name js-contact) :nickname (.-localNickname js-contact) - :images (types/js->clj (oops/oget js-contact "images")) + :images (transforms/js->clj (oops/oget js-contact "images")) :ens-verified (oops/oget js-contact "ensVerified") :contact-request-state (oops/oget js-contact "contactRequestState") :last-updated (oops/oget js-contact "lastUpdated") diff --git a/src/status_im2/contexts/onboarding/events.cljs b/src/status_im2/contexts/onboarding/events.cljs index 603672fc797..46bce324e11 100644 --- a/src/status_im2/contexts/onboarding/events.cljs +++ b/src/status_im2/contexts/onboarding/events.cljs @@ -1,7 +1,7 @@ (ns status-im2.contexts.onboarding.events (:require [native-module.core :as native-module] [re-frame.core :as re-frame] - [status-im.utils.types :as types] + [utils.transforms :as transforms] [status-im2.constants :as constants] [taoensso.timbre :as log] [utils.i18n :as i18n] @@ -17,7 +17,7 @@ (native-module/validate-mnemonic (security/safe-unmask-data mnemonic) (fn [result] - (let [{:keys [error keyUID]} (types/json->clj result)] + (let [{:keys [error keyUID]} (transforms/json->clj result)] (if (seq error) (when on-error (on-error error)) (on-success mnemonic keyUID))))))) diff --git a/src/status_im2/contexts/profile/config.cljs b/src/status_im2/contexts/profile/config.cljs index 7a4a6faefe1..ddfcbb96186 100644 --- a/src/status_im2/contexts/profile/config.cljs +++ b/src/status_im2/contexts/profile/config.cljs @@ -2,7 +2,7 @@ (:require [status-im2.config :as config] [native-module.core :as native-module] [clojure.string :as string] - [utils.transforms :as types] + [utils.transforms :as transforms] [utils.re-frame :as rf])) (defn login @@ -47,7 +47,7 @@ (rf/defn get-node-config-callback {:events [:profile.config/get-node-config-callback]} [{:keys [db]} node-config-json] - (let [node-config (types/json->clj node-config-json)] + (let [node-config (transforms/json->clj node-config-json)] {:db (assoc-in db [:profile/profile :wakuv2-config] (get node-config :WakuV2Config))})) diff --git a/src/status_im2/contexts/profile/profiles/view.cljs b/src/status_im2/contexts/profile/profiles/view.cljs index ca062fcfeaa..64275ab83c0 100644 --- a/src/status_im2/contexts/profile/profiles/view.cljs +++ b/src/status_im2/contexts/profile/profiles/view.cljs @@ -16,7 +16,7 @@ [utils.i18n :as i18n] [utils.re-frame :as rf] [utils.security.core :as security] - [utils.transforms :as types])) + [utils.transforms :as transforms])) (defonce push-animation-fn-atom (atom nil)) (defonce pop-animation-fn-atom (atom nil)) @@ -77,7 +77,7 @@ (native-module/delete-multiaccount key-uid (fn [result] - (let [{:keys [error]} (types/json->clj result)] + (let [{:keys [error]} (transforms/json->clj result)] (rf/dispatch [:onboarding-2/on-delete-profile-success key-uid]) (log/info "profile deleted: error" error)))))}]) From 7e646f7823158429c38668a98ae72b1ed5677aac Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Mon, 25 Sep 2023 12:40:27 +0400 Subject: [PATCH 2/4] revert podfile (#17406) --- ios/Podfile.lock | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 7dbce711630..74d395bf130 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -772,15 +772,7 @@ SPEC CHECKSUMS: RNLanguages: 962e562af0d34ab1958d89bcfdb64fafc37c513e RNPermissions: ad71dd4f767ec254f2cd57592fbee02afee75467 RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071 -<<<<<<< HEAD -<<<<<<< HEAD RNReanimated: 43adb0307a62c1ce9694f36f124ca3b51a15272a -======= - RNReanimated: 06a228c5a245ef7b5b03f0efc29d76ce4db9031c ->>>>>>> c50db2fd2 (lint) -======= - RNReanimated: d0db0ee059c33381bca787a2193c27e52750ccaf ->>>>>>> a52fda25e (lint) RNShare: d82e10f6b7677f4b0048c23709bd04098d5aee6c RNStaticSafeAreaInsets: 055ddbf5e476321720457cdaeec0ff2ba40ec1b8 RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9 From 848cac31ba99694312bb4d4b5445c7d09b478bb1 Mon Sep 17 00:00:00 2001 From: Mohsen Ghafouri Date: Mon, 25 Sep 2023 11:55:54 +0300 Subject: [PATCH 3/4] [#17300] fix: syncing device indicator color and some alignment (#17340) --- .../settings/settings_item/style.cljs | 35 ++++++++++--------- .../settings/settings_item/view.cljs | 4 +-- .../contexts/syncing/device/style.cljs | 2 +- .../contexts/syncing/device/view.cljs | 1 + 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/quo2/components/settings/settings_item/style.cljs b/src/quo2/components/settings/settings_item/style.cljs index 07d02d0fa21..3c72c4ca348 100644 --- a/src/quo2/components/settings/settings_item/style.cljs +++ b/src/quo2/components/settings/settings_item/style.cljs @@ -1,22 +1,18 @@ (ns quo2.components.settings.settings-item.style (:require [quo2.foundations.colors :as colors])) -(defn find-icon-height - [description tag image] - (let [icon-height (if (= image :icon-avatar) 32 20) - icon-height (if description 40 icon-height)] - (if tag 72 icon-height))) - (defn container - [{:keys [in-card? tag container-style]}] - (merge {:padding-horizontal 12 - :padding-top (if in-card? 12 13) - :padding-bottom (if in-card? 12 13) - :flex-direction :row - :justify-content :space-between - :height (if tag 96 48)} + [{:keys [container-style]}] + (merge {:padding 12 + :flex-direction :row + :justify-content :space-between} container-style)) +(defn left-sub-container + [{:keys [tag description]}] + {:flex-direction :row + :align-items (if (or tag description) :flex-start :center)}) + (def sub-container {:flex-direction :row :align-items :center}) @@ -24,12 +20,12 @@ (def left-container {:margin-left 12 :height "100%" - :justify-content :center}) + :justify-content :flex-start}) (defn image-container - [description tag image] - {:height (find-icon-height description tag image) - :justify-content :flex-start}) + [image tag description] + {:height (if (= image :icon-avatar) 32 20) + :margin-top (if (or tag description) 1 0)}) (def status-container {:flex-direction :row @@ -57,3 +53,8 @@ :height 15 :border-radius 12 :background-color background-color}) + +(def status-tag-container + {:margin-top 7 + :margin-bottom 2 + :margin-left -1}) diff --git a/src/quo2/components/settings/settings_item/view.cljs b/src/quo2/components/settings/settings_item/view.cljs index 9b6813bca65..9d7252f3cc0 100644 --- a/src/quo2/components/settings/settings_item/view.cljs +++ b/src/quo2/components/settings/settings_item/view.cljs @@ -65,7 +65,7 @@ :label (:label tag-props) :no-icon? true :size :small - :container-style {:margin-top 8}}] + :container-style style/status-tag-container}] :context [context-tag/view (merge tag-props {:type :icon @@ -105,7 +105,7 @@ {:style (style/container props) :on-press on-press :accessibility-label accessibility-label} - [rn/view {:style style/sub-container} + [rn/view {:style (style/left-sub-container props)} [image-component props] [rn/view {:style style/left-container} [text/text {:weight :medium} title] diff --git a/src/status_im2/contexts/syncing/device/style.cljs b/src/status_im2/contexts/syncing/device/style.cljs index 4bf77476844..4cb1de62220 100644 --- a/src/status_im2/contexts/syncing/device/style.cljs +++ b/src/status_im2/contexts/syncing/device/style.cljs @@ -5,4 +5,4 @@ {:border-color colors/white-opa-5 :border-radius 16 :border-width 1 - :margin-top 12}) + :margin-top 11}) diff --git a/src/status_im2/contexts/syncing/device/view.cljs b/src/status_im2/contexts/syncing/device/view.cljs index a59db907c88..79d69a78e75 100644 --- a/src/status_im2/contexts/syncing/device/view.cljs +++ b/src/status_im2/contexts/syncing/device/view.cljs @@ -16,6 +16,7 @@ (cond-> {:container-style style/device-container :title name + :blur? true :image :icon :image-props (cond (#{:mobile :ios :android} (keyword device-type)) :i/mobile From 6fd5a97b59d77a07dce4a7e07688d64f34b3b167 Mon Sep 17 00:00:00 2001 From: Mohsen Ghafouri Date: Mon, 25 Sep 2023 13:19:50 +0300 Subject: [PATCH 4/4] [#17288] refactor: migrate previews to new api (#17366) --- .../list_items/token_value/view.cljs | 6 +- .../navigation/bottom_nav_tab/view.cljs | 2 +- src/quo2/core.cljs | 2 + .../quo_preview/browser/browser_input.cljs | 67 ++---- .../quo_preview/list_items/token_value.cljs | 49 ++-- .../quo_preview/list_items/user_list.cljs | 49 ++-- src/status_im2/contexts/quo_preview/main.cljs | 18 +- .../contexts/quo_preview/messages/gap.cljs | 2 +- .../quo_preview/messages/system_message.cljs | 2 +- .../navigation/bottom_nav_tab.cljs | 57 ++--- .../navigation/floating_shell_button.cljs | 39 ++-- .../quo_preview/navigation/page_nav.cljs | 211 ++++++------------ .../quo_preview/navigation/top_nav.cljs | 69 ++---- .../jump_to/components/bottom_tabs/view.cljs | 4 +- 14 files changed, 194 insertions(+), 383 deletions(-) diff --git a/src/quo2/components/list_items/token_value/view.cljs b/src/quo2/components/list_items/token_value/view.cljs index 64e3c0ecd4a..84dd240d268 100644 --- a/src/quo2/components/list_items/token_value/view.cljs +++ b/src/quo2/components/list_items/token_value/view.cljs @@ -12,9 +12,9 @@ [reagent.core :as reagent])) (defn- internal-view - [{:keys [theme customization-color status token metrics? values on-press]}] + [] (let [state (reagent/atom :default)] - (fn [] + (fn [{:keys [theme customization-color status token metrics? values on-press]}] (let [bg-opacity (case @state :active 10 :pressed 5 @@ -42,7 +42,7 @@ [text/text {:size :paragraph-2 :style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} - (str crypto-value " " (string/upper-case (clj->js token)))]]] + (str crypto-value " " (if token (string/upper-case (clj->js token)) ""))]]] [rn/view {:style {:align-items :flex-end :justify-content :space-between}} diff --git a/src/quo2/components/navigation/bottom_nav_tab/view.cljs b/src/quo2/components/navigation/bottom_nav_tab/view.cljs index a5129c802d5..b9a69523716 100644 --- a/src/quo2/components/navigation/bottom_nav_tab/view.cljs +++ b/src/quo2/components/navigation/bottom_nav_tab/view.cljs @@ -86,6 +86,6 @@ counter-label] [rn/view {:style (styles/notification-dot customization-color)}]))]])) -(defn bottom-nav-tab +(defn view [opts] [:f> f-bottom-nav-tab opts]) diff --git a/src/quo2/core.cljs b/src/quo2/core.cljs index fe561af2a14..34dffaf719d 100644 --- a/src/quo2/core.cljs +++ b/src/quo2/core.cljs @@ -77,6 +77,7 @@ quo2.components.messages.gap quo2.components.messages.system-message quo2.components.navigation.floating-shell-button.view + quo2.components.navigation.bottom-nav-tab.view quo2.components.navigation.page-nav.view quo2.components.navigation.top-nav.view quo2.components.notifications.activity-log.view @@ -262,6 +263,7 @@ (def skeleton-list quo2.components.loaders.skeleton-list.view/view) ;;;; Navigation +(def bottom-nav-tab quo2.components.navigation.bottom-nav-tab.view/view) (def floating-shell-button quo2.components.navigation.floating-shell-button.view/view) (def page-nav quo2.components.navigation.page-nav.view/page-nav) (def top-nav quo2.components.navigation.top-nav.view/view) diff --git a/src/status_im2/contexts/quo_preview/browser/browser_input.cljs b/src/status_im2/contexts/quo_preview/browser/browser_input.cljs index b760b5951d8..5335afd8816 100644 --- a/src/status_im2/contexts/quo_preview/browser/browser_input.cljs +++ b/src/status_im2/contexts/quo_preview/browser/browser_input.cljs @@ -1,55 +1,28 @@ (ns status-im2.contexts.quo-preview.browser.browser-input (:require [quo2.core :as quo] - [react-native.core :as rn] - [react-native.safe-area :as safe-area] [reagent.core :as reagent] - [utils.re-frame :as rf] [status-im2.contexts.quo-preview.preview :as preview])) (def descriptor - [{:label "Show Favicon" - :key :favicon? - :type :boolean} - {:label "Locked" - :key :locked? - :type :boolean} - {:label "Disabled" - :key :disabled? - :type :boolean}]) + [{:key :favicon? :type :boolean} + {:key :locked? :type :boolean} + {:key :blur? :type :boolean} + {:key :placeholder :type :text} + {:key :disabled? :type :boolean} + (preview/customization-color-option)]) -(defn preview-browser-input +(defn view [] - (reagent/with-let [keyboard-shown? (reagent/atom false) - keyboard-show-listener (.addListener rn/keyboard - "keyboardWillShow" - #(reset! keyboard-shown? true)) - keyboard-hide-listener (.addListener rn/keyboard - "keyboardWillHide" - #(reset! keyboard-shown? false)) - {:keys [bottom]} (safe-area/get-insets) - state (reagent/atom {:blur? false - :disabled? false - :favicon? false - :placeholder "Search or enter dapp domain" - :locked? false})] - [preview/preview-container - {:state state - :descriptor descriptor} - [quo/page-nav - {:type :no-title - :icon-name :i/arrow-left - :on-press #(rf/dispatch [:navigate-back])}] - - [rn/flat-list - {:key-fn str - :keyboard-should-persist-taps :always - :style {:flex 1}}] - [rn/view - [quo/browser-input - (assoc @state - :customization-color :blue - :favicon (when (:favicon? @state) :i/verified))] - [rn/view {:style {:height (if-not @keyboard-shown? bottom 0)}}]]] - (finally - (.remove keyboard-show-listener) - (.remove keyboard-hide-listener)))) + (let [state (reagent/atom {:blur? false + :disabled? false + :favicon? false + :placeholder "Search or enter dapp domain" + :locked? false})] + (fn [] + [preview/preview-container + {:state state + :descriptor descriptor} + [quo/browser-input + (assoc @state + :favicon + (when (:favicon? @state) :i/verified))]]))) diff --git a/src/status_im2/contexts/quo_preview/list_items/token_value.cljs b/src/status_im2/contexts/quo_preview/list_items/token_value.cljs index ee813d66bdb..08317b92903 100644 --- a/src/status_im2/contexts/quo_preview/list_items/token_value.cljs +++ b/src/status_im2/contexts/quo_preview/list_items/token_value.cljs @@ -1,42 +1,23 @@ (ns status-im2.contexts.quo-preview.list-items.token-value (:require [quo2.core :as quo] - [react-native.core :as rn] [reagent.core :as reagent] [status-im2.contexts.quo-preview.preview :as preview])) (def descriptor - [{:label "Token:" - :key :token + [{:key :token :type :select - :options [{:key :eth - :value "ETH"} - {:key :snt - :value "SNT"}]} - {:label "State:" - :key :state + :options [{:key :eth} + {:key :snt}]} + {:key :status :type :select - :options [{:key :default - :value "Default"} - {:key :pressed - :value "Pressed"} - {:key :active - :value "Active"}]} - {:label "Status:" - :key :status - :type :select - :options [{:key :empty - :value "Empty"} - {:key :positive - :value "Positive"} - {:key :negative - :value "Negative"}]} + :options [{:key :empty} + {:key :positive} + {:key :negative}]} (preview/customization-color-option) - {:label "Metrics?:" - :key :metrics? - :type :boolean}]) + {:key :metrics? :type :boolean}]) -(defn preview +(defn view [] (let [state (reagent/atom {:token :snt :state :default @@ -49,11 +30,9 @@ :fiat-change "โ‚ฌ0.00"}})] (fn [] [preview/preview-container - {:state state - :descriptor descriptor} - [rn/view - [rn/view - {:style {:align-items :center - :margin-top 50}} - [quo/token-value @state]]]]))) + {:state state + :descriptor descriptor + :component-container-style {:align-items :center + :margin-top 50}} + [quo/token-value @state]]))) diff --git a/src/status_im2/contexts/quo_preview/list_items/user_list.cljs b/src/status_im2/contexts/quo_preview/list_items/user_list.cljs index 200d28fa4f2..f6771969a9f 100644 --- a/src/status_im2/contexts/quo_preview/list_items/user_list.cljs +++ b/src/status_im2/contexts/quo_preview/list_items/user_list.cljs @@ -1,35 +1,19 @@ (ns status-im2.contexts.quo-preview.list-items.user-list - (:require [react-native.core :as rn] - [reagent.core :as reagent] + (:require [reagent.core :as reagent] [status-im2.contexts.quo-preview.preview :as preview] - [quo2.components.list-items.user-list :as user-list] + [quo2.core :as quo] [utils.address :as address])) (def descriptor - [{:label "Primary name" - :key :primary-name + [{:key :primary-name :type :text :limit 24} - {:label "Secondary name" - :key :secondary-name - :type :text} - {:label "Chat key" - :key :chat-key - :type :text} - {:label "Is contact?" - :key :contact? - :type :boolean} - {:label "Is verified?" - :key :verified? - :type :boolean} - {:label "Is untrustworthy?" - :key :untrustworthy? - :type :boolean} - {:label "Online?" - :key :online? - :type :boolean} - {:label "Accessory:" - :key :accessory + {:key :secondary-name :type :text} + {:key :contact? :type :boolean} + {:key :verified? :type :boolean} + {:key :untrustworthy? :type :boolean} + {:key :online? :type :boolean} + {:key :accessory :type :select :options [{:key {:type :options} :value "Options"} @@ -38,7 +22,7 @@ {:key {:type :close} :value "Close"}]}]) -(defn preview-user-list +(defn view [] (let [state (reagent/atom {:primary-name "Alisher Yakupov" :short-chat-key (address/get-shortened-compressed-key @@ -50,11 +34,8 @@ :online? false})] (fn [] [preview/preview-container - {:state state - :descriptor descriptor} - [rn/view {:padding-bottom 150} - [rn/view - {:padding-vertical 60 - :padding--horizontal 15 - :justify-content :center} - [user-list/user-list @state]]]]))) + {:state state + :descriptor descriptor + :component-container-style {:padding-vertical 30 + :padding-horizontal 15}} + [quo/user-list @state]]))) diff --git a/src/status_im2/contexts/quo_preview/main.cljs b/src/status_im2/contexts/quo_preview/main.cljs index 0852e1d4773..6f0d6f4a278 100644 --- a/src/status_im2/contexts/quo_preview/main.cljs +++ b/src/status_im2/contexts/quo_preview/main.cljs @@ -169,7 +169,7 @@ {:name :wallet-ctas :component wallet-ctas/view}] :browser [{:name :browser-input - :component browser-input/preview-browser-input}] + :component browser-input/view}] :calendar [{:name :calendar :component calendar/view} {:name :calendar-day @@ -275,10 +275,10 @@ {:name :preview-lists :component preview-lists/view} {:name :token-value - :component token-value/preview} + :component token-value/view} {:name :user-list :options {:topBar {:visible true}} - :component user-list/preview-user-list}] + :component user-list/view}] :loaders [{:name :skeleton-list :options {:topBar {:visible true}} :component skeleton-list/view}] @@ -287,19 +287,19 @@ {:name :markdown-list :component markdown-list/view}] :messages [{:name :gap - :component messages-gap/preview-messages-gap} + :component messages-gap/view} {:name :system-messages - :component system-message/preview-system-message} + :component system-message/view} {:name :author :component messages-author/view}] :navigation [{:name :bottom-nav-tab - :component bottom-nav-tab/preview-bottom-nav-tab} + :component bottom-nav-tab/view} {:name :top-nav - :component top-nav/preview} + :component top-nav/view} {:name :page-nav - :component page-nav/preview-page-nav} + :component page-nav/view} {:name :floating-shell-button - :component floating-shell-button/preview-floating-shell-button}] + :component floating-shell-button/view}] :notifications [{:name :activity-logs :component activity-logs/preview-activity-logs} {:name :activity-logs-photos diff --git a/src/status_im2/contexts/quo_preview/messages/gap.cljs b/src/status_im2/contexts/quo_preview/messages/gap.cljs index 2210fa9dd7d..9b64c9780ec 100644 --- a/src/status_im2/contexts/quo_preview/messages/gap.cljs +++ b/src/status_im2/contexts/quo_preview/messages/gap.cljs @@ -8,7 +8,7 @@ [{:key :timestamp-far :type :text} {:key :timestamp-near :type :text}]) -(defn preview-messages-gap +(defn view [] (let [state (reagent/atom {:timestamp-far "Jan 8 ยท 09:12" :timestamp-near "Mar 8 ยท 22:42" diff --git a/src/status_im2/contexts/quo_preview/messages/system_message.cljs b/src/status_im2/contexts/quo_preview/messages/system_message.cljs index cede99d5685..fca47b1c2aa 100644 --- a/src/status_im2/contexts/quo_preview/messages/system_message.cljs +++ b/src/status_im2/contexts/quo_preview/messages/system_message.cljs @@ -30,7 +30,7 @@ {:child (when (= (:type @state) :pinned) [rn/text (:content @state)]) :display-name (:pinned-by @state)})) -(defn preview-system-message +(defn view [] (let [state (reagent/atom {:type :pinned :pinned-by "Steve" diff --git a/src/status_im2/contexts/quo_preview/navigation/bottom_nav_tab.cljs b/src/status_im2/contexts/quo_preview/navigation/bottom_nav_tab.cljs index 359481f4325..feaf9efb388 100644 --- a/src/status_im2/contexts/quo_preview/navigation/bottom_nav_tab.cljs +++ b/src/status_im2/contexts/quo_preview/navigation/bottom_nav_tab.cljs @@ -1,15 +1,12 @@ (ns status-im2.contexts.quo-preview.navigation.bottom-nav-tab - (:require [clojure.string :as string] - [quo2.components.navigation.bottom-nav-tab.view :as quo2] + (:require [quo2.core :as quo] [quo2.foundations.colors :as colors] - [react-native.core :as rn] [react-native.reanimated :as reanimated] [reagent.core :as reagent] [status-im2.contexts.quo-preview.preview :as preview])) (def descriptor - [{:label "Type" - :key :icon + [{:key :icon :type :select :options [{:key :i/communities :value "Communities"} @@ -19,33 +16,15 @@ :value "Wallet"} {:key :i/browser :value "Browser"}]} - {:label "Selected?" - :key :selected? - :type :boolean} - {:label "Pass through?" - :key :pass-through? - :type :boolean} - {:label "New Notifications?" - :key :new-notifications? - :type :boolean} - {:label "Notification Indicator" - :key :notification-indicator + {:key :selected? :type :boolean} + {:key :pass-through? :type :boolean} + {:key :new-notifications? :type :boolean} + {:key :notification-indicator :type :select - :options [{:key :counter - :value :counter} - {:key :unread-dot - :value :unread-dot}]} - {:label "Counter Label" - :key :counter-label - :type :text} - - {:label "Customization color" - :key :customization-color - :type :select - :options (map (fn [[k _]] - {:key k - :value (string/capitalize (name k))}) - colors/customization)}]) + :options [{:key :counter} + {:key :unread-dot}]} + {:key :counter-label :type :text} + (preview/customization-color-option)]) (defn get-icon-color [selected? pass-through?] @@ -60,11 +39,11 @@ (reanimated/set-shared-value icon-color-anim (get-icon-color selected? pass-through?)) - [quo2/bottom-nav-tab + [quo/bottom-nav-tab (merge state {:icon-color-anim icon-color-anim}) (:value state)])) -(defn preview-bottom-nav-tab +(defn view [] (let [state (reagent/atom {:icon :i/communities :new-notifications? true @@ -76,10 +55,8 @@ pass-through? (reagent/cursor state [:pass-through?])] (fn [] [preview/preview-container - {:state state - :descriptor descriptor} - [rn/view {:padding-bottom 150} - [rn/view - {:padding-vertical 60 - :align-items :center} - [:f> f-bottom-tab @state @selected? @pass-through?]]]]))) + {:state state + :descriptor descriptor + :component-container-style {:padding-vertical 60 + :align-items :center}} + [:f> f-bottom-tab @state @selected? @pass-through?]]))) diff --git a/src/status_im2/contexts/quo_preview/navigation/floating_shell_button.cljs b/src/status_im2/contexts/quo_preview/navigation/floating_shell_button.cljs index 9c8a2ea378d..cea718f0e60 100644 --- a/src/status_im2/contexts/quo_preview/navigation/floating_shell_button.cljs +++ b/src/status_im2/contexts/quo_preview/navigation/floating_shell_button.cljs @@ -1,29 +1,18 @@ (ns status-im2.contexts.quo-preview.navigation.floating-shell-button (:require [quo2.core :as quo] - [react-native.core :as rn] [reagent.core :as reagent] [utils.i18n :as i18n] [status-im2.contexts.quo-preview.preview :as preview])) (def descriptor - [{:label "Show jump to?" - :key :show-jump-to? - :type :boolean} - {:label "Show search?" - :key :show-search? - :type :boolean} - {:label "Show mention?" - :key :show-mention? - :type :boolean} - {:label "Scroll Type" - :key :scroll-type + [{:key :show-jump-to? :type :boolean} + {:key :show-search? :type :boolean} + {:key :show-mention? :type :boolean} + {:key :scroll-type :type :select - :options [{:key :notification-up - :value "Notification Up"} - {:key :notification-down - :value "Notification Down"} - {:key :scroll-to-bottom - :value "Scroll To Bottom"}]}]) + :options [{:key :notification-up} + {:key :notification-down} + {:key :scroll-to-bottom}]}]) (defn mock-data [{:keys [show-jump-to? show-search? show-mention? scroll-type]}] @@ -41,16 +30,14 @@ (= scroll-type :scroll-to-bottom) (assoc :scroll-to-bottom {:on-press #()}))) -(defn preview-floating-shell-button +(defn view [] (let [state (reagent/atom {:show-jump-to? true :scroll-type :notification-down})] (fn [] [preview/preview-container - {:state state - :descriptor descriptor} - [rn/view {:padding-bottom 150} - [rn/view - {:padding-vertical 60 - :align-items :center} - [quo/floating-shell-button (mock-data @state) nil]]]]))) + {:state state + :descriptor descriptor + :component-container-style {:padding-vertical 60 + :align-items :center}} + [quo/floating-shell-button (mock-data @state) nil]]))) diff --git a/src/status_im2/contexts/quo_preview/navigation/page_nav.cljs b/src/status_im2/contexts/quo_preview/navigation/page_nav.cljs index a67930ab5bf..ca59feacd00 100644 --- a/src/status_im2/contexts/quo_preview/navigation/page_nav.cljs +++ b/src/status_im2/contexts/quo_preview/navigation/page_nav.cljs @@ -2,43 +2,31 @@ (:require [clojure.string :as string] [quo2.core :as quo] [quo2.foundations.colors :as colors] - [react-native.blur :as blur] [react-native.core :as rn] [reagent.core :as reagent] [status-im2.common.resources :as resources] [status-im2.contexts.quo-preview.preview :as preview])) (def ^:private descriptor - [{:label "Type" - :key :type + [{:key :type :type :select - :options [{:key :no-title - :value "No Title"} - {:key :title - :value "Title"} - {:key :dropdown - :value "Dropdown"} - {:key :token - :value "Token"} - {:key :channel - :value "Channel"} + :options [{:key :no-title} + {:key :title} + {:key :dropdown} + {:key :token} + {:key :channel} {:key :title-description :value "Title + Description"} - {:key :wallet-networks - :value "Wallet Networks"} - {:key :community - :value "Community"} - {:key :network - :value "Network"}]} - {:label "Background" - :key :background + {:key :wallet-networks} + {:key :community} + {:key :network}]} + {:key :background :type :select :options (map (fn [bg-type] {:key bg-type :value (string/capitalize (name bg-type))}) [:white :neutral-5 :neutral-90 :neutral-95 :neutral-100 :photo :blur])} - {:label "Icon" - :key :icon-name + {:key :icon-name :type :select :options [{:key :i/placeholder :value "Placeholder"} @@ -60,79 +48,55 @@ :value "3 actions"}])) (def account-switcher - {:key :account-switcher - :value "Account-switcher"}) + {:key :account-switcher}) (def no-title-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options (conj right-side-options account-switcher)}]) (def title-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options (conj right-side-options account-switcher)} - {:label "Title" - :key :title - :type :text} - {:label "Text Align" - :key :text-align + {:key :title :type :text} + {:key :text-align :type :select - :options [{:key :left - :value "Left"} - {:key :center - :value "Center"}]}]) + :options [{:key :left} + {:key :center}]}]) (def dropdown-descriptor - [{:label "Dropdown Selected?" - :key :dropdown-selected? - :type :boolean} - {:label "Dropdown Text" - :key :dropdown-text - :type :text}]) + [{:key :dropdown-selected? :type :boolean} + {:key :dropdown-text :type :text}]) (def token-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options (conj right-side-options account-switcher)} - - {:label "Token Logo" - :key :token-logo + {:key :token-logo :type :select :options [{:key (resources/get-mock-image :status-logo) :value "Status logo"} {:key (resources/get-mock-image :rarible) :value "Rarible"}]} - - {:label "Token Name" - :key :token-name - :type :text} - {:label "Token Abbreviation" - :key :token-abbreviation - :type :text}]) + {:key :token-name + :type :text} + {:key :token-abbreviation + :type :text}]) (def channel-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options right-side-options} - - {:label "Channel Emoji" - :key :channel-emoji + {:key :channel-emoji :type :select :options [{:key "๐Ÿ‡" :value "๐Ÿ‡"} {:key "๐Ÿ‘" :value "๐Ÿ‘"}]} - {:label "Channel Name" - :key :channel-name - :type :text} - {:label "Channel Icon" - :key :channel-icon + {:key :channel-name :type :text} + {:key :channel-icon :type :select :options [{:key :i/locked :value "Locked"} @@ -140,18 +104,12 @@ :value "Unlocked"}]}]) (def title-description-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options (butlast right-side-options)} - {:label "title" - :key :title - :type :text} - {:label "description" - :key :description - :type :text} - {:label "Picture" - :key :picture + {:key :title :type :text} + {:key :description :type :text} + {:key :picture :type :select :options [{:key nil :value "No picture"} @@ -161,74 +119,49 @@ :value "Photo 2"}]}]) (def wallet-networks-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options (conj (take 2 right-side-options) account-switcher)}]) (def community-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options right-side-options} - {:label "Community Logo" - :key :community-logo + {:key :community-logo :type :select :options [{:key (resources/get-mock-image :diamond) :value "Diamond"} {:key (resources/get-mock-image :coinbase) :value "Coinbase"}]} - {:label "Community name" - :key :community-name - :type :text}]) + {:key :community-name :type :text}]) (def network-descriptor - [{:label "Right Side" - :key :right-side + [{:key :right-side :type :select :options right-side-options} - {:label "Network Logo" - :key :network-logo + {:key :network-logo :type :select :options [{:key (resources/get-mock-image :diamond) :value "Diamond"} {:key (resources/get-mock-image :coinbase) :value "Coinbase"}]} - {:label "Network name" - :key :network-name - :type :text}]) + {:key :network-name + :type :text}]) (defn- photo-bg [background] - (when (#{:photo :blur} background) + (when (#{:photo} background) [rn/image {:style {:position :absolute :top 0 :bottom 0 - :left 0 + :left 20 :right 0 :width "100%" :height 200} :source (resources/get-mock-image :photo2)}])) -(defn- blur-bg - [background] - (when (= :blur background) - [rn/view - {:style {:position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0 - :width "100%" - :height 200}} - [blur/view - {:style {:width "100%" - :height 20} - :blur-type :light - :blur-amount 20}]])) - -(defn preview-page-nav +(defn view [{:keys [theme]}] (let [state (reagent/atom {:type :title-description @@ -257,30 +190,30 @@ :network-logo (resources/get-mock-image :diamond)})] (fn [] [preview/preview-container - {:state state - :descriptor (concat descriptor - (case (:type @state) - :no-title no-title-descriptor - :title title-descriptor - :dropdown dropdown-descriptor - :token token-descriptor - :channel channel-descriptor - :title-description title-description-descriptor - :wallet-networks wallet-networks-descriptor - :community community-descriptor - :network network-descriptor - nil))} - [rn/view - {:style {:background-color (case (:background @state) - :white colors/white - :neutral-5 colors/neutral-5 - :neutral-90 colors/neutral-90 - :neutral-95 colors/neutral-95 - :neutral-100 colors/neutral-100 - nil) - :padding-vertical 40 - :height 200 - :width "100%"}} - [photo-bg (:background @state)] - [blur-bg (:background @state)] - [quo/page-nav @state]]]))) + {:state state + :descriptor (concat descriptor + (case (:type @state) + :no-title no-title-descriptor + :title title-descriptor + :dropdown dropdown-descriptor + :token token-descriptor + :channel channel-descriptor + :title-description title-description-descriptor + :wallet-networks wallet-networks-descriptor + :community community-descriptor + :network network-descriptor + nil)) + :blur? (= :blur (:background @state)) + :show-blur-background? (= :blur (:background @state)) + :component-container-style {:background-color (case (:background @state) + :white colors/white + :neutral-5 colors/neutral-5 + :neutral-90 colors/neutral-90 + :neutral-95 colors/neutral-95 + :neutral-100 colors/neutral-100 + nil) + :margin-vertical 40 + :width "100%"}} + + [photo-bg (:background @state)] + [quo/page-nav @state]]))) diff --git a/src/status_im2/contexts/quo_preview/navigation/top_nav.cljs b/src/status_im2/contexts/quo_preview/navigation/top_nav.cljs index 7087e52e934..e16fe943e4e 100644 --- a/src/status_im2/contexts/quo_preview/navigation/top_nav.cljs +++ b/src/status_im2/contexts/quo_preview/navigation/top_nav.cljs @@ -1,11 +1,8 @@ (ns status-im2.contexts.quo-preview.navigation.top-nav (:require [quo2.foundations.colors :as colors] - [react-native.core :as rn] [reagent.core :as reagent] [quo2.core :as quo] - [status-im2.contexts.quo-preview.preview :as preview] - [status-im2.common.resources :as resources] - [quo2.theme :as quo.theme])) + [status-im2.contexts.quo-preview.preview :as preview])) (def descriptor [{:key :notification @@ -21,9 +18,9 @@ :type :number} (preview/customization-color-option)]) -(defn preview +(defn view [] - (let [state (reagent/atom {:noticication-count 0 + (let [state (reagent/atom {:notification-count 0 :customization-color :blue})] (fn [] (let [blur? (:blur? @state) @@ -32,43 +29,25 @@ notification (:notification @state) notification-count (:notification-count @state)] [preview/preview-container - {:state state - :descriptor descriptor} - [rn/view {:padding-bottom 150} - [rn/view - {:padding-vertical 60 - :padding-horizontal 20 - :flex-direction :row - :align-items :center} - (when blur? - [rn/image - {:source (resources/get-mock-image (quo.theme/theme-value :light-blur-background - :dark-blur-background)) - :style {:position :absolute - :top 0 - :left 0 - :right 0 - :bottom 0}}]) - (when jump-to? - [rn/image - {:background-color colors/neutral-100 - :style {:position :absolute - :top 0 - :left 0 - :right 0 - :bottom 0}}]) - [quo/top-nav - {:container-style {:flex 1 :z-index 2} - :max-unread-notifications 99 - :blur? blur? - :notification notification - :customization-color customization-color - :notification-count notification-count - :jump-to? jump-to? - :avatar-props {:online? true - :full-name "Test User"} - :avatar-on-press #(js/alert "avatar pressed") - :scan-on-press #(js/alert "scan pressed") - :activity-center-on-press #(js/alert "activity-center pressed") - :qr-code-on-press #(js/alert "qr pressed")}]]]])))) + {:state state + :descriptor descriptor + :blur? (and blur? (not jump-to?)) + :show-blur-background? (and blur? (not jump-to?)) + :component-container-style {:padding-vertical 60 + :padding-horizontal 20 + :background-color (when jump-to? colors/neutral-100)}} + [quo/top-nav + {:container-style {:flex 1 :z-index 2} + :max-unread-notifications 99 + :blur? blur? + :notification notification + :customization-color customization-color + :notification-count notification-count + :jump-to? jump-to? + :avatar-props {:online? true + :full-name "Test User"} + :avatar-on-press #(js/alert "avatar pressed") + :scan-on-press #(js/alert "scan pressed") + :activity-center-on-press #(js/alert "activity-center pressed") + :qr-code-on-press #(js/alert "qr pressed")}]])))) diff --git a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs index 292092a00eb..440d1552dea 100644 --- a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs @@ -4,11 +4,11 @@ [react-native.gesture :as gesture] [react-native.platform :as platform] [react-native.reanimated :as reanimated] + [quo2.core :as quo] [status-im2.contexts.shell.jump-to.utils :as utils] [status-im2.contexts.shell.jump-to.state :as state] [status-im2.contexts.shell.jump-to.animation :as animation] [status-im2.contexts.shell.jump-to.constants :as shell.constants] - [quo2.components.navigation.bottom-nav-tab.view :as bottom-nav-tab] [status-im2.contexts.shell.jump-to.components.bottom-tabs.style :as style])) (defn blur-overlay-params @@ -25,7 +25,7 @@ icon-color (->> stack-id (get shell.constants/tabs-icon-color-keywords) (get shared-values))] - [bottom-nav-tab/bottom-nav-tab + [quo/bottom-nav-tab (-> notifications-data (get stack-id) (assoc :test-ID stack-id