From d357d7d669f0b67ef9b90c00a9a50c838a702c19 Mon Sep 17 00:00:00 2001 From: Volodymyr Kozieiev Date: Tue, 24 Dec 2024 20:11:43 +0000 Subject: [PATCH] huge cleanup --- .carve_ignore | 185 ------------ .clj-kondo/config.edn | 24 +- src/legacy/status_im/browser/core.cljs | 62 +--- src/legacy/status_im/browser/core_test.cljs | 120 -------- src/legacy/status_im/browser/permissions.cljs | 16 +- .../status_im/browser/permissions_test.cljs | 90 ------ .../status_im/chat/models/mentions.cljs | 2 +- src/legacy/status_im/chat/models/message.cljs | 4 +- src/legacy/status_im/communities/core.cljs | 6 +- .../status_im/data_store/communities.cljs | 6 - src/legacy/status_im/data_store/messages.cljs | 12 +- .../status_im/data_store/pin_messages.cljs | 2 +- src/legacy/status_im/ens/core.cljs | 15 +- src/legacy/status_im/ethereum/tokens.cljs | 51 +--- .../status_im/ethereum/transactions/core.cljs | 87 ++---- src/legacy/status_im/events.cljs | 20 +- src/legacy/status_im/fleet/core.cljs | 2 +- src/legacy/status_im/group_chats/core.cljs | 21 +- src/legacy/status_im/group_chats/db.cljs | 26 -- src/legacy/status_im/log_level/core.cljs | 2 +- .../status_im/mailserver/constants.cljs | 18 -- .../status_im/multiaccounts/create/core.cljs | 6 - .../status_im/multiaccounts/recover/core.cljs | 31 -- .../multiaccounts/reset_password/core.cljs | 94 ------ .../status_im/multiaccounts/update/core.cljs | 47 ++- src/legacy/status_im/node/core.cljs | 9 +- src/legacy/status_im/pairing/core.cljs | 4 +- src/legacy/status_im/profile/core.cljs | 2 +- src/legacy/status_im/qr_scanner/core.cljs | 4 +- .../status_im/react_native/resources.cljs | 8 +- src/legacy/status_im/stickers/core.cljs | 16 -- src/legacy/status_im/subs/ens.cljs | 94 +----- src/legacy/status_im/subs/mailservers.cljs | 42 --- src/legacy/status_im/subs/root.cljs | 1 - src/legacy/status_im/subs/stickers.cljs | 22 -- .../status_im/ui/components/accordion.cljs | 56 ---- .../status_im/ui/components/action_sheet.cljs | 2 +- .../ui/components/animated_header.cljs | 69 ----- .../status_im/ui/components/animation.cljs | 58 ---- .../ui/components/bottom_panel/views.cljs | 152 ---------- .../ui/components/chat_icon/screen.cljs | 89 +----- .../ui/components/chat_icon/styles.cljs | 140 +-------- .../ui/components/checkbox/styles.cljs | 15 - .../ui/components/checkbox/view.cljs | 27 -- .../status_im/ui/components/colors.cljs | 34 +-- .../ui/components/common/common.cljs | 20 +- .../ui/components/common/styles.cljs | 23 -- .../ui/components/copyable_text.cljs | 129 --------- src/legacy/status_im/ui/components/core.cljs | 5 - .../emoji_thumbnail/color_picker.cljs | 52 ---- .../components/emoji_thumbnail/preview.cljs | 19 -- .../ui/components/emoji_thumbnail/styles.cljs | 171 ----------- .../ui/components/emoji_thumbnail/utils.cljs | 16 -- .../status_im/ui/components/invite/views.cljs | 30 -- .../keyboard_avoid_presentation.cljs | 17 -- .../status_im/ui/components/list/footer.cljs | 18 -- .../status_im/ui/components/list/styles.cljs | 41 --- .../ui/components/profile_header/view.cljs | 110 -------- src/legacy/status_im/ui/components/react.cljs | 125 +------- .../ui/components/search_input/view.cljs | 45 --- .../status_im/ui/components/slider.cljs | 10 - src/legacy/status_im/ui/components/tabs.cljs | 36 --- .../status_im/ui/components/text_input.cljs | 2 - .../ui/components/toastable_highlight.cljs | 121 -------- .../ui/components/tooltip/styles.cljs | 31 -- .../ui/components/tooltip/views.cljs | 22 -- .../ui/screens/advanced_settings/views.cljs | 5 - .../ui/screens/browser/bookmarks/views.cljs | 55 ---- .../ui/screens/browser/eip3085/sheet.cljs | 57 ---- .../ui/screens/browser/eip3326/sheet.cljs | 68 ----- .../ui/screens/browser/empty_tab/styles.cljs | 26 -- .../ui/screens/browser/empty_tab/views.cljs | 30 -- .../ui/screens/browser/options/views.cljs | 23 -- .../ui/screens/chat/message/legacy_style.cljs | 54 ---- .../ui/screens/chat/message/legacy_view.cljs | 57 ---- .../status_im/ui/screens/chat/utils.cljs | 30 -- .../ui/screens/communities/invite.cljs | 104 ------- .../ui/screens/fleet_settings/styles.cljs | 3 - .../ui/screens/log_level_settings/styles.cljs | 3 - .../notifications_settings/events.cljs | 6 +- .../edit_mailserver/styles.cljs | 38 --- .../edit_mailserver/views.cljs | 90 ------ .../offline_messaging_settings/styles.cljs | 11 - .../status_im/ui/screens/pairing/styles.cljs | 6 - .../ui/screens/profile/components/sheets.cljs | 32 --- .../ui/screens/profile/components/styles.cljs | 42 +-- .../ui/screens/profile/components/views.cljs | 39 +-- .../ui/screens/profile/seed/styles.cljs | 10 - .../ui/screens/profile/user/edit_picture.cljs | 62 ---- .../ui/screens/profile/user/styles.cljs | 6 - .../profile/visibility_status/styles.cljs | 78 ----- .../profile/visibility_status/utils.cljs | 20 -- .../profile/visibility_status/views.cljs | 239 ---------------- .../ui/screens/reset_password/views.cljs | 80 +----- src/legacy/status_im/ui/screens/screens.cljs | 13 - .../ui/screens/wakuv2_settings/styles.cljs | 4 - src/legacy/status_im/utils/async.cljs | 25 -- src/legacy/status_im/utils/build.clj | 20 -- src/legacy/status_im/utils/core.cljc | 15 - .../status_im/utils/deprecated_types.cljs | 25 +- src/legacy/status_im/utils/dimensions.cljs | 9 +- src/legacy/status_im/utils/image.cljs | 9 - src/legacy/status_im/utils/label.cljs | 25 -- src/legacy/status_im/utils/logging/core.cljs | 10 +- src/legacy/status_im/utils/mobile_sync.cljs | 4 - src/legacy/status_im/utils/name.cljs | 33 --- src/legacy/status_im/utils/priority_map.cljs | 267 ------------------ .../status_im/utils/transducers_test.cljs | 14 - src/legacy/status_im/utils/utils.cljs | 34 --- src/legacy/status_im/utils/utils_test.cljs | 16 +- .../visibility_status_updates/core.cljs | 12 +- src/legacy/status_im/waku/core.cljs | 6 +- src/native_module/core.cljs | 144 ---------- src/native_module/push_notifications.cljs | 4 - .../common/not_implemented/style.cljs | 13 - .../common/not_implemented/view.cljs | 11 - .../community/community_list_view.cljs | 43 --- src/quo/components/community/style.cljs | 8 - .../components/drawers/drawer_top/style.cljs | 4 - .../dropdowns/dropdown_input/style.cljs | 7 - .../components/graph/wallet_graph/style.cljs | 10 +- src/quo/components/header.cljs | 208 -------------- .../components/list_items/account/style.cljs | 7 - .../list_items/missing_keypair/style.cljs | 10 - src/quo/components/loaders/skeleton.cljs | 93 ------ src/quo/components/markdown/list/style.cljs | 3 - .../selectors/reaction_resource.clj | 31 -- .../selectors/reaction_resource.cljs | 12 +- .../components/settings/category/style.cljs | 16 -- .../settings/reorder_item/style.cljs | 3 - .../components/tags/context_tag/style.cljs | 5 - .../components/wallet/token_input/style.cljs | 4 - src/quo/core.cljs | 15 +- src/quo/foundations/colors.cljs | 4 +- src/react_native/audio_toolkit.cljs | 30 -- src/react_native/background_timer.cljs | 8 - src/react_native/core.cljs | 28 +- src/react_native/gesture.cljs | 4 - src/react_native/navigation.cljs | 23 +- src/react_native/permissions.cljs | 5 +- src/react_native/reanimated.cljs | 14 +- src/react_native/svg.cljs | 2 - src/react_native/wallet_connect.cljs | 4 - src/status_im/common/alert_banner/style.cljs | 4 - src/status_im/common/bottom_sheet/style.cljs | 6 - src/status_im/common/home/actions/view.cljs | 10 - src/status_im/common/keychain/events.cljs | 1 - .../common/lightbox/text_sheet/style.cljs | 7 - .../lightbox/zoomable_image/constants.cljs | 2 - .../common/new_device_sheet/style.cljs | 16 +- src/status_im/common/pairing/events.cljs | 4 +- .../password_authentication/events.cljs | 13 - .../common/password_authentication/view.cljs | 42 --- src/status_im/common/router.cljs | 14 - src/status_im/common/router_test.cljs | 1 - src/status_im/common/scan_qr_code/style.cljs | 4 - src/status_im/common/scroll_page/style.cljs | 26 -- src/status_im/common/signals/events.cljs | 3 +- .../enter_password/style.cljs | 5 - src/status_im/common/timer/events.cljs | 18 -- src/status_im/common/universal_links.cljs | 6 - src/status_im/config.cljs | 28 +- src/status_im/constants.cljs | 132 +-------- .../contexts/centralized_metrics/events.cljs | 2 + src/status_im/contexts/chat/events.cljs | 9 +- src/status_im/contexts/chat/events_test.cljs | 9 - .../contexts/chat/group/common/style.cljs | 7 - .../contexts/chat/group/details/style.cljs | 14 - .../chat/home/add_new_contact/style.cljs | 4 +- src/status_im/contexts/chat/home/style.cljs | 26 -- .../chat/messenger/composer/constants.cljs | 13 +- .../chat/messenger/composer/events.cljs | 47 +-- .../messenger/composer/gradients/style.cljs | 42 --- .../messenger/composer/gradients/view.cljs | 30 -- .../chat/messenger/composer/handlers.cljs | 24 -- .../composer/link_preview/events.cljs | 2 +- .../messenger/composer/mentions/style.cljs | 12 - .../chat/messenger/composer/selection.cljs | 25 -- .../chat/messenger/composer/style.cljs | 34 +-- .../chat/messenger/composer/utils.cljs | 36 --- .../chat/messenger/messages/constants.cljs | 1 - .../messages/content/audio/style.cljs | 4 - .../messenger/messages/content/pin/style.cljs | 28 -- .../messages/delete_message/events.cljs | 2 +- .../delete_message_for_me/events.cljs | 2 +- .../chat/messenger/messages/drawers/view.cljs | 7 - .../messenger/messages/list/events_test.cljs | 17 -- .../chat/messenger/messages/list/view.cljs | 59 ---- .../chat/messenger/messages/pin/events.cljs | 2 +- .../messenger/messages/transport/events.cljs | 6 +- .../chat/messenger/photo_selector/events.cljs | 4 +- .../chat/messenger/photo_selector/style.cljs | 31 -- .../accounts_selection/events_test.cljs | 14 - .../share_community_channel/style.cljs | 15 - .../contexts/communities/events.cljs | 2 +- .../contexts/communities/home/style.cljs | 64 ----- .../contexts/communities/overview/utils.cljs | 22 -- .../onboarding/create_password/style.cljs | 3 - .../identifiers/profile_card/style.cljs | 66 +++++ .../onboarding/share_usage/style.cljs | 5 - .../contexts/onboarding/sign_in/style.cljs | 95 ------- .../contexts/preview/quo/preview.clj | 10 - .../contexts/preview/quo/preview.cljs | 3 +- .../preview/quo/tabs/account_selector.cljs | 27 -- .../profile/push_notifications/events.cljs | 5 +- .../profile/settings/header/style.cljs | 14 +- .../password/change_password/style.cljs | 3 - .../settings/screens/password/style.cljs | 9 - .../wallet/network_settings/style.cljs | 6 +- .../shell/activity_center/events.cljs | 17 +- .../shell/activity_center/events_test.cljs | 44 --- .../notification/common/style.cljs | 3 - .../notification/mentions/style.cljs | 3 - .../notification/reply/style.cljs | 3 - .../contexts/shell/activity_center/style.cljs | 18 -- .../contexts/shell/share/events.cljs | 2 +- src/status_im/contexts/shell/share/style.cljs | 27 +- .../syncing/enter_sync_code/style.cljs | 5 - src/status_im/contexts/syncing/events.cljs | 6 +- .../contexts/syncing/setup_syncing/style.cljs | 3 - .../syncing/syncing_devices_list/style.cljs | 6 - src/status_im/contexts/syncing/utils.cljs | 10 +- .../contexts/wallet/account/style.cljs | 4 - .../new_keypair/confirm_backup/style.cljs | 4 - .../add_account/create_account/style.cljs | 4 - .../wallet/bridge/select_asset/style.cljs | 4 - .../wallet/common/activity_tab/constants.cljs | 43 --- .../create_or_edit_account/style.cljs | 15 +- .../contexts/wallet/common/utils.cljs | 129 --------- src/status_im/contexts/wallet/item_types.cljs | 8 - .../wallet/send/select_address/style.cljs | 8 - .../wallet/send/select_asset/style.cljs | 10 - .../send/transaction_settings/style.cljs | 14 - .../wallet/sheets/account_options/style.cljs | 6 - src/status_im/contexts/wallet/swap/utils.cljs | 13 - src/status_im/core.cljs | 2 + src/status_im/events.cljs | 1 - src/status_im/feature_flags.cljs | 6 - src/status_im/navigation/events.cljs | 6 +- src/status_im/setup/hot_reload.cljs | 6 + src/status_im/subs/chats.cljs | 54 +--- src/status_im/subs/communities.cljs | 14 - src/status_im/subs/general.cljs | 18 -- src/status_im/subs/profile.cljs | 83 ------ src/status_im/subs/wallet/buy.cljs | 10 - src/status_im/subs/wallet/collectibles.cljs | 9 - .../subs/wallet/dapps/proposals_test.cljs | 35 --- src/status_im/subs/wallet/send.cljs | 15 - src/test_helpers/component.cljs | 57 ---- src/test_helpers/integration.cljs | 39 --- src/test_helpers/matchers.cljs | 9 - src/test_helpers/unit.clj | 2 +- src/test_helpers/unit.cljs | 11 - src/tests/contract_test/wallet_test.cljs | 4 - src/tests/integration_test/constants.cljs | 2 - src/utils/address.cljs | 11 - src/utils/collection.cljs | 5 - src/utils/collection_test.cljs | 12 + src/utils/datetime.cljs | 36 --- src/utils/datetime_test.cljs | 2 - src/utils/ens/core.cljs | 9 - src/utils/ethereum/chain.cljs | 17 -- src/utils/ethereum/eip/eip681_test.cljs | 13 - src/utils/i18n.cljs | 5 +- src/utils/i18n_goog.cljs | 76 ----- src/utils/money.cljs | 79 ------ src/utils/network/core.cljs | 5 - src/utils/number.cljs | 3 +- src/utils/re_frame.clj | 6 +- src/utils/re_frame_test.cljs | 6 +- src/utils/string.cljs | 19 -- src/utils/transforms.cljs | 7 - src/utils/worklets/bottom_sheet.cljs | 11 - src/utils/worklets/scroll_view.cljs | 7 - 274 files changed, 308 insertions(+), 7441 deletions(-) delete mode 100644 .carve_ignore delete mode 100644 src/legacy/status_im/browser/core_test.cljs delete mode 100644 src/legacy/status_im/browser/permissions_test.cljs delete mode 100644 src/legacy/status_im/group_chats/db.cljs delete mode 100644 src/legacy/status_im/mailserver/constants.cljs delete mode 100644 src/legacy/status_im/multiaccounts/recover/core.cljs delete mode 100644 src/legacy/status_im/multiaccounts/reset_password/core.cljs delete mode 100644 src/legacy/status_im/subs/stickers.cljs delete mode 100644 src/legacy/status_im/ui/components/accordion.cljs delete mode 100644 src/legacy/status_im/ui/components/animated_header.cljs delete mode 100644 src/legacy/status_im/ui/components/bottom_panel/views.cljs delete mode 100644 src/legacy/status_im/ui/components/checkbox/styles.cljs delete mode 100644 src/legacy/status_im/ui/components/checkbox/view.cljs delete mode 100644 src/legacy/status_im/ui/components/copyable_text.cljs delete mode 100644 src/legacy/status_im/ui/components/emoji_thumbnail/color_picker.cljs delete mode 100644 src/legacy/status_im/ui/components/emoji_thumbnail/preview.cljs delete mode 100644 src/legacy/status_im/ui/components/emoji_thumbnail/styles.cljs delete mode 100644 src/legacy/status_im/ui/components/emoji_thumbnail/utils.cljs delete mode 100644 src/legacy/status_im/ui/components/invite/views.cljs delete mode 100644 src/legacy/status_im/ui/components/keyboard_avoid_presentation.cljs delete mode 100644 src/legacy/status_im/ui/components/list/footer.cljs delete mode 100644 src/legacy/status_im/ui/components/profile_header/view.cljs delete mode 100644 src/legacy/status_im/ui/components/search_input/view.cljs delete mode 100644 src/legacy/status_im/ui/components/slider.cljs delete mode 100644 src/legacy/status_im/ui/components/tabs.cljs delete mode 100644 src/legacy/status_im/ui/components/toastable_highlight.cljs delete mode 100644 src/legacy/status_im/ui/screens/browser/bookmarks/views.cljs delete mode 100644 src/legacy/status_im/ui/screens/browser/eip3085/sheet.cljs delete mode 100644 src/legacy/status_im/ui/screens/browser/eip3326/sheet.cljs delete mode 100644 src/legacy/status_im/ui/screens/chat/utils.cljs delete mode 100644 src/legacy/status_im/ui/screens/communities/invite.cljs delete mode 100644 src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/styles.cljs delete mode 100644 src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs delete mode 100644 src/legacy/status_im/ui/screens/profile/components/sheets.cljs delete mode 100644 src/legacy/status_im/ui/screens/profile/user/edit_picture.cljs delete mode 100644 src/legacy/status_im/ui/screens/profile/user/styles.cljs delete mode 100644 src/legacy/status_im/ui/screens/profile/visibility_status/views.cljs delete mode 100644 src/legacy/status_im/utils/image.cljs delete mode 100644 src/legacy/status_im/utils/label.cljs delete mode 100644 src/legacy/status_im/utils/name.cljs delete mode 100644 src/legacy/status_im/utils/priority_map.cljs delete mode 100644 src/quo/components/common/not_implemented/style.cljs delete mode 100644 src/quo/components/common/not_implemented/view.cljs delete mode 100644 src/quo/components/header.cljs delete mode 100644 src/quo/components/loaders/skeleton.cljs delete mode 100644 src/quo/components/selectors/reaction_resource.clj delete mode 100644 src/status_im/common/password_authentication/events.cljs delete mode 100644 src/status_im/common/password_authentication/view.cljs delete mode 100644 src/status_im/common/timer/events.cljs delete mode 100644 src/status_im/contexts/chat/home/style.cljs delete mode 100644 src/status_im/contexts/chat/messenger/composer/gradients/style.cljs delete mode 100644 src/status_im/contexts/chat/messenger/composer/gradients/view.cljs delete mode 100644 src/status_im/contexts/communities/home/style.cljs delete mode 100644 src/status_im/contexts/communities/overview/utils.cljs create mode 100644 src/status_im/contexts/onboarding/identifiers/profile_card/style.cljs delete mode 100644 src/status_im/contexts/onboarding/sign_in/style.cljs delete mode 100644 src/status_im/contexts/preview/quo/preview.clj delete mode 100644 src/status_im/contexts/wallet/send/transaction_settings/style.cljs create mode 100644 src/utils/collection_test.cljs delete mode 100644 src/utils/worklets/bottom_sheet.cljs delete mode 100644 src/utils/worklets/scroll_view.cljs diff --git a/.carve_ignore b/.carve_ignore deleted file mode 100644 index 4c31c0d303..0000000000 --- a/.carve_ignore +++ /dev/null @@ -1,185 +0,0 @@ -legacy.status-im.utils.build/warning-handler -legacy.status-im.utils.build/get-current-sha -status-im.constants/spacing-char -status-im.constants/arg-wrapping-char -legacy.status-im.ios.core/init -legacy.status-im.ui.components.camera/aspects -legacy.status-im.ui.components.camera/capture-targets -legacy.status-im.ui.components.camera/set-torch -legacy.status-im.ui.components.camera/request-access-ios -legacy.status-im.chat.models.message-content/stylings -legacy.status-im.chat.models.message-content/actions -legacy.status-im.chat.models.message-content/blank-string -legacy.status-im.chat.models.message-content/sorted-ranges -legacy.status-im.ethereum.mnemonic/words->passphrase -native-module.core/listener -native-module.core/multiaccount-reset -native-module.core/extract-group-membership-signatures -native-module.core/sign-group-membership -native-module.core/update-mailservers -legacy.status-im.ethereum.abi-spec/bytes-to-hex -legacy.status-im.android.core/init -legacy.status-im.chat.models.message/transport-keys -legacy.status-im.utils.datetime/week -legacy.status-im.utils.datetime/time-ago -legacy.status-im.utils.datetime/format-date -legacy.status-im.utils.datetime/get-ordinal-date -reagent.dom/render -reagent.dom/unmount-component-at-node -reagent.dom/dom-node -reagent.dom/force-update-all -legacy.status-im.multiaccounts.create.core/get-new-key-code -legacy.status-im.ethereum.decode/string -legacy.status-im.ui.screens.network.views/mainnet? -legacy.status-im.data-store.chats/event->string -legacy.status-im.mailserver.constants/seven-days -legacy.status-im.mailserver.constants/connection-timeout -legacy.status-im.hardwallet.card/install-applet -legacy.status-im.hardwallet.card/install-cash-applet -legacy.status-im.multiaccount.login.data-test/all-contacts -legacy.status-im.multiaccount.login.data-test/multiaccounts -legacy.status-im.multiaccount.login.data-test/get-chats -legacy.status-im.multiaccount.login.data-test/transport -legacy.status-im.multiaccount.login.data-test/topics -legacy.status-im.utils.utils/clear-timeout -legacy.status-im.utils.handlers/logged-in -legacy.status-im.multiaccounts.model/credentials -legacy.status-im.multiaccounts.login.core/contract-fleet? -legacy.status-im.multiaccounts.login.core/fetch-nodes -status-im.config/rpc-networks-only? -status-im.config/waku-enabled? -legacy.status-im.utils.pairing/has-paired-installations? -legacy.status-im.tribute-to-talk.core-test/user-cofx -mocks.js-dependencies/action-button -mocks.js-dependencies/camera -mocks.js-dependencies/dismiss-keyboard -mocks.js-dependencies/emoji-picker -mocks.js-dependencies/i18n -mocks.js-dependencies/qr-code -mocks.js-dependencies/svg -mocks.js-dependencies/icons -mocks.js-dependencies/webview -mocks.js-dependencies/desktop-linking -mocks.js-dependencies/desktop-shortcuts -mocks.js-dependencies/snoopy -mocks.js-dependencies/snoopy-filter -mocks.js-dependencies/snoopy-bars -mocks.js-dependencies/snoopy-buffer -mocks.js-dependencies/desktop-menu -mocks.js-dependencies/desktop-config -mocks.js-dependencies/react-native-navigation-twopane -mocks.js-dependencies/react-native-screens -mocks.js-dependencies/react-native-shake -mocks.js-dependencies/back-handler -mocks.js-dependencies/react -mocks.js-dependencies/react-navigation-native -mocks.js-dependencies/react-navigation-stack -mocks.js-dependencies/react-navigation-bottom-tabs -mocks.js-dependencies/react-native-haptic-feedback -mocks.js-dependencies/mock -quo.previews.main/init -legacy.status-im.chat.models.message-list-test/descending-range -legacy.status-im.chat.models.message-list-test/random-range -legacy.status-im.ethereum.eip165/supports? -legacy.status-im.utils.hex/valid-hex? -legacy.status-im.multiaccounts.core/chat-send? -legacy.status-im.hardwallet.simulated-keycard/install-cash-applet -legacy.status-im.hardwallet.simulated-keycard/sign-typed-data -legacy.status-im.utils.core/safe-read-message-content -legacy.status-im.ui.components.react/native-modules -legacy.status-im.ui.components.react/progress-bar -react-native.fs/move-file -react-native.fs/read-dir -react-native.fs/mkdir -react-native.fs/unlink -react-native.fs/file-exists? -legacy.status-im.ui.components.colors/white -legacy.status-im.ui.components.colors/black -legacy.status-im.ui.components.core/animated-header -legacy.status-im.ui.components.core/safe-area-provider -legacy.status-im.ui.components.core/safe-area-consumer -legacy.status-im.ui.components.core/safe-area-view -legacy.status-im.utils.universal-links.core/open! -legacy.status-im.transport.filters.core-test/member-2 -legacy.status-im.ui.screens.chat.ttt/one-to-one-chat-description-container -legacy.status-im.ethereum.ens/ttl -legacy.status-im.ethereum.ens/addr-hash -legacy.status-im.ethereum.ens/name-hash -legacy.status-im.ethereum.ens/ABI-hash -legacy.status-im.ethereum.ens/pubkey-hash -legacy.status-im.network.core/get-network -status-im.constants/desktop-content-types -status-im.constants/blocks-per-hour -status-im.constants/one-earth-day -status-im.constants/left-pane-min-width -status-im.constants/system -status-im.constants/contact-discovery -status-im.constants/send-transaction-failed-parse-response -status-im.constants/send-transaction-failed-parse-params -status-im.constants/send-transaction-no-account-selected -status-im.constants/send-transaction-invalid-tx-sender -status-im.constants/web3-get-logs -status-im.constants/web3-transaction-receipt -status-im.constants/web3-new-filter -status-im.constants/web3-new-pending-transaction-filter -status-im.constants/web3-new-block-filter -status-im.constants/web3-uninstall-filter -status-im.constants/web3-get-filter-changes -status-im.constants/web3-shh-post -status-im.constants/web3-shh-new-identity -status-im.constants/web3-shh-has-identity -status-im.constants/web3-shh-new-group -status-im.constants/web3-shh-add-to-group -status-im.constants/web3-shh-new-filter -status-im.constants/web3-shh-uninstall-filter -status-im.constants/web3-shh-get-filter-changes -status-im.constants/web3-shh-get-messages -status-im.constants/status-create-address -status-im.constants/event-transfer-hash -status-im.constants/regx-rtl-characters -status-im.constants/desktop-msg-chars-hard-limit -status-im.constants/debug-metrics -status-im.constants/scan-qr-code -status-im.constants/ipfs-proto-code -status-im.constants/swarm-proto-code -legacy.status-im.multiaccounts.update.publisher/publish-update! -legacy.status-im.utils.async/task-queue -legacy.status-im.utils.async/async-periodic-run! -legacy.status-im.desktop.core/app-root -legacy.status-im.desktop.core/init -legacy.status-im.chat.models-test/test-db -legacy.status-im.ui.components.spacing/padding-vertical -legacy.status-im.utils.money/percent-change -utils.debounce/clear-all -legacy.status-im.transport.db/create-chat -legacy.status-im.utils.priority-map/priority-map -legacy.status-im.utils.priority-map/priority-map-by -legacy.status-im.utils.priority-map/priority-map-keyfn -legacy.status-im.utils.priority-map/empty-message-map -legacy.status-im.wallet.choose-recipient.core/use-default-eth-gas -legacy.status-im.ui.components.animation/decay -legacy.status-im.ui.components.animation/remove-all-listeners -legacy.status-im.ui.components.animation/stop-animation -legacy.status-im.ui.components.animation/animated -legacy.status-im.ui.components.animation/add -legacy.status-im.ui.components.animation/subtract -legacy.status-im.ui.components.animation/get-layout -legacy.status-im.wallet.transactions-test/uri-query-data -legacy.status-im.utils.name/shortened-name -legacy.status-im.ui.components.button.haptic/trigger -legacy.status-im.contact.db/filter-dapps -legacy.status-im.contact.db/filter-group-contacts -legacy.status-im.contact.db/legacy-pending? -legacy.status-im.utils.transducers-test/preview-call-1 -legacy.status-im.utils.transducers-test/preview-call-2 -legacy.status-im.utils.types/to-string -legacy.status-im.chat.db/datemark? -legacy.status-im.chat.db/gap? -legacy.status-im.chat.db/map->sorted-seq -legacy.status-im.utils.snoopy/status-module-filter -legacy.status-im.utils.snoopy/websocket-filter -legacy.status-im.utils.snoopy/touches-filter -legacy.status-im.utils.snoopy/native-animation-filter -legacy.status-im.utils.snoopy/keyboard-observer-filter -legacy.status-im.utils.multihash/hex -legacy.status-im.utils.multihash/decode-array diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index d34a725d03..0a6d0e2f99 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -4,7 +4,7 @@ legacy.status-im.utils.views/letsubs clojure.core/let reagent.core/with-let clojure.core/let legacy.status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all - utils.re-frame/defn clj-kondo.lint-as/def-catch-all + utils.re-frame/defn clojure.core/defn quo.react/with-deps-check clojure.core/fn quo.previews.preview/list-comp clojure.core/for legacy.status-im.utils.styles/def clojure.core/def @@ -13,7 +13,22 @@ test-helpers.unit/deftest-event clojure.core/defn taoensso.tufte/defnp clojure.core/defn} - :linters {:case-duplicate-test {:level :error} + :linters {:clojure-lsp/unused-public-var {:exclude-when-defined-by #{utils.re-frame/defn} + :exclude #{ + ;; even if we are not + ;; using color now, we + ;; will need it later + quo.foundations.colors + + + ;; not sure if unused + ;; functions here should + ;; be removed: + keycard.keycard + test-helpers.unit + test-helpers.component + react-native.fs}} + :case-duplicate-test {:level :error} :case-quoted-test {:level :error} :case-symbol-test {:level :error} :clj-kondo-config {:level :error} @@ -40,7 +55,8 @@ :equals-true {:level :error} :inline-def {:level :error} :invalid-arity {:skip-args [legacy.status-im.utils.fx/defn - utils.re-frame/defn]} + utils.re-frame/defn + utils.re-frame/merge]} :loop-without-recur {:level :error} :minus-one {:level :error} :misplaced-docstring {:level :error} @@ -53,6 +69,8 @@ :redundant-do {:level :error} :redundant-let {:level :error} :refer-all {:level :error} + ;; ignore error in config itself saying that `:shadowed-fn-param` is unknown + #_{:clj-kondo/ignore [:clj-kondo-config]} :shadowed-fn-param {:level :error} :shadowed-var {:level :error ;; We temporarily use :include to define an diff --git a/src/legacy/status_im/browser/core.cljs b/src/legacy/status_im/browser/core.cljs index 76ccb9bf4e..9854608dfd 100644 --- a/src/legacy/status_im/browser/core.cljs +++ b/src/legacy/status_im/browser/core.cljs @@ -19,8 +19,6 @@ [status-im.constants :as constants] [status-im.contexts.chat.events :as chat.events] [status-im.navigation.events :as navigation] - [taoensso.timbre :as log] - [utils.address :as address] [utils.debounce :as debounce] [utils.ens.core :as utils.ens] [utils.ethereum.chain :as chain] @@ -139,13 +137,11 @@ {:events [:browser/delete-bookmark]} [{:keys [db] :as cofx} url] - (let [old-bookmark (get-in db [:bookmarks/bookmarks url]) - removed-bookmark (merge old-bookmark {:removed true})] - (rf/merge cofx - {:db (update db :bookmarks/bookmarks dissoc url) - :json-rpc/call [{:method "wakuext_removeBookmark" - :params [url] - :on-success #()}]}))) + (rf/merge cofx + {:db (update db :bookmarks/bookmarks dissoc url) + :json-rpc/call [{:method "wakuext_removeBookmark" + :params [url] + :on-success #()}]})) (defn can-go-back? [{:keys [history-index]}] @@ -357,43 +353,11 @@ :id (int id) :result result}}}) -(defn utf8-to-hex - [s] - (let [hex (native-module/utf8-to-hex (str s))] - (if (empty? hex) - nil - hex))) - -(defn normalize-message - "NOTE (andrey) there is no spec for this, so this implementation just to be compatible with MM" - [message] - (if (string/starts-with? message "0x") - message - (utf8-to-hex message))) - -(defn normalize-sign-message-params - "NOTE (andrey) we need this function, because params may be mixed up" - [params typed?] - (let [[first-param second-param] params] - (when (and (string? first-param) (string? second-param)) - (cond - (address/address? first-param) - [first-param (if typed? second-param (normalize-message second-param))] - (address/address? second-param) - [second-param (if typed? first-param (normalize-message first-param))])))) - (rf/defn send-to-bridge {:events [:browser.callback/call-rpc]} [_ message] {:browser/send-to-bridge message}) -(defn web3-sign-message? - [method] - (#{constants/web3-sign-typed-data constants/web3-sign-typed-data-v3 constants/web3-sign-typed-data-v4 - constants/web3-personal-sign - constants/web3-eth-sign constants/web3-keycard-sign-typed-data} - method)) - (rf/defn handle-no-permissions [cofx {:keys [method id]} message-id] (if (= method "eth_accounts") @@ -484,18 +448,6 @@ (when (and message webview) (.injectJavaScript webview msg))))) -(re-frame/reg-fx - :browser/call-rpc - (fn [[payload callback]] - (native-module/call-rpc - (types/clj->json payload) - (fn [response] - (if (= "" response) - (do - (log/warn :web3-response-error) - (callback "web3-response-error" nil)) - (callback nil (.parse js/JSON response))))))) - (re-frame/reg-fx :browser/show-browser-selection (fn [link] @@ -548,8 +500,8 @@ (rf/defn lock-pressed {:events [:browser.ui/lock-pressed]} - [cofx secure?] - (update-browser-option cofx :show-tooltip (if secure? :secure :not-secure))) + [cofx is-secure?] + (update-browser-option cofx :show-tooltip (if is-secure? :secure :not-secure))) (rf/defn close-tooltip-pressed {:events [:browser.ui/close-tooltip-pressed]} diff --git a/src/legacy/status_im/browser/core_test.cljs b/src/legacy/status_im/browser/core_test.cljs deleted file mode 100644 index 8666631706..0000000000 --- a/src/legacy/status_im/browser/core_test.cljs +++ /dev/null @@ -1,120 +0,0 @@ -(ns legacy.status-im.browser.core-test - (:require - [utils.url :as url])) - -(defn has-wrong-properties? - [result dapp-url expected-browser] - (let [browser (get-in result [:db :browser/browsers dapp-url])] - (reduce (fn [acc k] - (if (= (k browser) - (k expected-browser)) - acc - (conj acc [k (str "was expecting " (k expected-browser) " got " (k browser))]))) - nil - (keys expected-browser)))) - -(defn get-dapp-id - [result dapp-url] - (some #(when (= (url/normalize-and-decode-url dapp-url) (first (:history %))) (:browser-id %)) - (vals (get-in result [:db :browser/browsers])))) - -#_(deftest browser-test - (let [dapp1-url "cryptokitties.co" - dapp2-url "http://test2.com"] - - (testing "user opens a dapp" - (let [result-open (browser/open-url {:db {} :now 1} dapp1-url) - dapp1-id (get-dapp-id result-open dapp1-url)] - (is (= dapp1-id (get-in result-open [:db :browser/options :browser-id])) - "browser-id should be dapp1-url") - (is (not (has-wrong-properties? result-open - dapp1-id - {:browser-id dapp1-id - :history-index 0 - :history ["https://cryptokitties.co"] - :dapp? false - :name (i18n/label :t/browser)})) - "some properties of the browser are not correct") - - (testing "then a second dapp" - (let [result-open-2 (browser/open-url {:db (:db result-open) - :now 2} - dapp2-url) - dapp2-id (get-dapp-id result-open-2 dapp2-url)] - (is (= dapp2-id (get-in result-open-2 [:db :browser/options :browser-id])) - "browser-id should be dapp2 host") - (is (not (has-wrong-properties? result-open-2 - dapp2-id - {:browser-id dapp2-id - :history-index 0 - :history ["http://test2.com"] - :dapp? false})) - "some properties of the browser are not correct") - - (testing "then removes the second dapp" - (let [result-remove-2 (browser/remove-browser {:db (:db result-open-2)} dapp2-id)] - (is (= #{dapp1-id} - (set (keys (get-in result-remove-2 [:db :browser/browsers])))) - "the second dapp shouldn't be in the browser list anymore"))))) - - (testing "then opens the dapp again" - (let [result-open-existing (browser/open-existing-browser {:db (:db result-open) - :now 2} - dapp1-id) - dapp1-url2 (str "https://" dapp1-url "/nav2")] - (is (not (has-wrong-properties? result-open-existing - dapp1-id - {:browser-id dapp1-id - :history-index 0 - :history ["https://cryptokitties.co"] - :dapp? false - :name (i18n/label :t/browser)})) - "some properties of the browser are not correct") - (is (nil? (browser/navigate-to-next-page result-open-existing)) - "nothing should happen if user tries to navigate to next page") - (is (nil? (browser/navigate-to-previous-page result-open-existing)) - "nothing should happen if user tries to navigate to previous page") - - (testing "then navigates to a new url in the dapp" - (let [result-navigate (browser/navigation-state-changed - {:db (:db result-open-existing) - :now 4} - (clj->js {"url" dapp1-url2 - "loading" false}) - false)] - (is (not (has-wrong-properties? result-navigate - dapp1-id - {:browser-id dapp1-id - :history-index 1 - :history ["https://cryptokitties.co" dapp1-url2] - :dapp? false - :name (i18n/label :t/browser)})) - "some properties of the browser are not correct") - - (testing "then navigates to previous page" - (let [result-previous (browser/navigate-to-previous-page {:db (:db result-navigate) - :now 5})] - (is - (not (has-wrong-properties? result-previous - dapp1-id - {:browser-id dapp1-id - :history-index 0 - :history ["https://cryptokitties.co" - dapp1-url2] - :dapp? false - :name (i18n/label :t/browser)})) - "some properties of the browser are not correct") - - (testing "then navigates to next page") - (let [result-next (browser/navigate-to-next-page {:db (:db result-previous) - :now 6})] - (is (not - (has-wrong-properties? result-next - dapp1-id - {:browser-id dapp1-id - :history-index 1 - :history ["https://cryptokitties.co" - dapp1-url2] - :dapp? false - :name (i18n/label :t/browser)})) - "some properties of the browser are not correct")))))))))))) diff --git a/src/legacy/status_im/browser/permissions.cljs b/src/legacy/status_im/browser/permissions.cljs index 893a1873f9..85359f1872 100644 --- a/src/legacy/status_im/browser/permissions.cljs +++ b/src/legacy/status_im/browser/permissions.cljs @@ -22,7 +22,7 @@ :icon :main-icons/wallet}}) (rf/defn permission-yield-control - [{:keys [db] :as cofx} dapp-name permission message-id params] + [cofx dapp-name permission message-id] (cond (= permission constants/dapp-permission-qr-code) (rf/merge (assoc-in cofx [:db :browser/options :yielding-control?] true) @@ -33,7 +33,7 @@ :message-id message-id}})))) (rf/defn permission-show-permission - [{:keys [db] :as cofx} dapp-name permission message-id yield-control?] + [{:keys [db]} dapp-name permission message-id yield-control?] {:db (assoc-in db [:browser/options :show-permission] {:requested-permission permission @@ -51,7 +51,7 @@ (rf/defn send-response-to-bridge "Send response to the bridge. If the permission is allowed, send data associated with the permission" - [{:keys [db] :as cofx} permission message-id allowed? data] + [_cofx permission message-id allowed? data] {:browser/send-to-bridge (cond-> {:type constants/api-response :isAllowed allowed? :permission permission @@ -108,13 +108,13 @@ (let [pending-permissions (get-in db [:browser/options :pending-permissions]) next-permission (last pending-permissions) new-cofx (update-in cofx [:db :browser/options :pending-permissions] butlast)] - (when-let [{:keys [yield-control? permission message-id allowed? params]} next-permission] + (when-let [{:keys [yield-control? permission message-id allowed?]} next-permission] (if (and yield-control? allowed?) - (permission-yield-control new-cofx dapp-name permission message-id params) + (permission-yield-control new-cofx dapp-name permission message-id) (permission-show-permission new-cofx dapp-name permission message-id yield-control?))))))) (rf/defn send-response-and-process-next-permission - [{:keys [db] :as cofx} dapp-name requested-permission message-id] + [cofx dapp-name requested-permission message-id] (rf/merge cofx (send-response-to-bridge requested-permission message-id @@ -126,12 +126,12 @@ "Add permission to set of allowed permission and process next permission" {:events [:browser.permissions.ui/dapp-permission-allowed]} [{:keys [db] :as cofx}] - (let [{:keys [requested-permission message-id dapp-name yield-control? params]} + (let [{:keys [requested-permission message-id dapp-name yield-control?]} (get-in db [:browser/options :show-permission])] (rf/merge (assoc-in cofx [:db :browser/options :show-permission] nil) (update-dapp-permissions dapp-name requested-permission true) (if yield-control? - (permission-yield-control dapp-name requested-permission message-id params) + (permission-yield-control dapp-name requested-permission message-id) (send-response-and-process-next-permission dapp-name requested-permission message-id))))) (rf/defn deny-permission diff --git a/src/legacy/status_im/browser/permissions_test.cljs b/src/legacy/status_im/browser/permissions_test.cljs deleted file mode 100644 index 0ba8e76fcf..0000000000 --- a/src/legacy/status_im/browser/permissions_test.cljs +++ /dev/null @@ -1,90 +0,0 @@ -(ns legacy.status-im.browser.permissions-test) - -#_(deftest permissions-test - (let [dapp-name "test.com" - dapp-name2 "test2.org" - cofx {:db (assoc-in (:db (browser/open-url {:db {}} dapp-name)) - [:profile/profile :public-key] - "public-key")} - dapp-id (core.tests/get-dapp-id cofx dapp-name)] - (testing "dapps permissions are initialized" - (is (zero? (count (get-in cofx [:db :dapps/permissions])))) - (is (= dapp-id (get-in cofx [:db :browser/options :browser-id])))) - - (testing "receiving an unsupported permission" - (let [result-ask (browser/process-bridge-message cofx - (types/clj->json - {:type "api-request" - :host dapp-name - :messageId 0 - :permission "FAKE_PERMISSION"}))] - (is (not (get-in result-ask [:browser/send-to-bridge :isAllowed]))))) - - (testing "receiving a supported permission" - (let [result-ask (browser/process-bridge-message cofx - (types/clj->json {:type "api-request" - :host dapp-name - :messageId 1 - :permission "contact-code"}))] - (is (= (get-in result-ask [:db :browser/options :show-permission]) - {:requested-permission "contact-code" - :dapp-name "test.com" - :message-id 1 - :yield-control? nil})) - (is (zero? (count (get-in result-ask [:db :dapps/permissions])))) - - (testing "then user accepts the supported permission" - (let [accept-result (permissions/allow-permission {:db (:db result-ask)})] - (is (= (get accept-result :browser/send-to-bridge) - {:type "api-response" - :messageId 1 - :isAllowed true - :data "public-key" - :permission "contact-code"}) - "the data should have been sent to the bridge") - (is (= (get-in accept-result [:db :dapps/permissions]) - {"test.com" {:dapp "test.com" :permissions ["contact-code"]}}) - "the dapp should now have CONTACT_CODE permission") - - (testing "then dapp asks for permission again" - (let [result-ask-again (browser/process-bridge-message {:db (:db accept-result)} - (types/clj->json - {:type "api-request" - :host dapp-name - :messageId 2 - :permission "contact-code"}))] - (is (= (get result-ask-again :browser/send-to-bridge) - {:type "api-response" - :isAllowed true - :messageId 2 - :data "public-key" - :permission "contact-code"}) - "the response should be immediatly sent to the bridge"))) - - (testing "then user switch to another dapp that asks for permissions" - (let [new-dapp (browser/open-url {:db (:db accept-result)} dapp-name2) - result-ask2 (browser/process-bridge-message {:db (:db new-dapp)} - (types/clj->json - {:type "api-request" - :host dapp-name2 - :messageId 3 - :permission "contact-code"}))] - (is (= (get-in result-ask2 [:db :dapps/permissions]) - {"test.com" {:dapp "test.com" :permissions ["contact-code"]}}) - "there should only be permissions for dapp-name at that point") - (is (nil? (get result-ask2 :browser/send-to-bridge)) - "no message should be sent to the bridge") - - (testing "then user accepts permission for dapp-name2" - (let [accept-result2 (permissions/allow-permission {:db (:db result-ask2)})] - (is (= (get-in accept-result2 [:db :dapps/permissions]) - {"test.com" {:dapp "test.com" :permissions ["contact-code"]} - "test2.org" {:dapp "test2.org" :permissions ["contact-code"]}}) - "there should be permissions for both dapps now") - (is (= (get accept-result2 :browser/send-to-bridge) - {:type "api-response" - :isAllowed true - :messageId 3 - :data "public-key" - :permission "contact-code"}) - "the response should be sent to the bridge"))))))))))) diff --git a/src/legacy/status_im/chat/models/mentions.cljs b/src/legacy/status_im/chat/models/mentions.cljs index 2a8db93264..12e1152aeb 100644 --- a/src/legacy/status_im/chat/models/mentions.cljs +++ b/src/legacy/status_im/chat/models/mentions.cljs @@ -156,7 +156,7 @@ (rf/defn select-mention {:events [:chat.ui/select-mention]} - [{:keys [db]} {:keys [primary-name searched-text match public-key] :as user}] + [{:keys [db]} {:keys [primary-name searched-text match public-key] :as _user}] (let [chat-id (:current-chat-id db) text (get-in db [:chat/inputs chat-id :input-text]) method "wakuext_chatMentionSelectMention" diff --git a/src/legacy/status_im/chat/models/message.cljs b/src/legacy/status_im/chat/models/message.cljs index c90f509140..ca3cf5b598 100644 --- a/src/legacy/status_im/chat/models/message.cljs +++ b/src/legacy/status_im/chat/models/message.cljs @@ -120,7 +120,7 @@ {:db (assoc-in db [:messages chat-id message-id :outgoing-status] status)})) (rf/defn handle-removed-messages - [{:keys [db] :as cofx} removed-messages] + [cofx removed-messages] (let [mark-as-deleted-fx (->> removed-messages (map #(assoc % :message-id (:messageId %) @@ -136,7 +136,7 @@ [message-id] nil))) removed-messages) - remove-messages-fx (fn [{:keys [db]}] + remove-messages-fx (fn [_cofx] {:dispatch [:activity-center.notifications/fetch-unread-count]})] (apply rf/merge cofx diff --git a/src/legacy/status_im/communities/core.cljs b/src/legacy/status_im/communities/core.cljs index 0b2e3492fb..ddcc3d12b2 100644 --- a/src/legacy/status_im/communities/core.cljs +++ b/src/legacy/status_im/communities/core.cljs @@ -43,7 +43,7 @@ (rf/defn member-ban {:events [::member-ban]} - [cofx community-id public-key] + [_cofx community-id public-key] {:json-rpc/call [{:method "wakuext_banUserFromCommunity" :params [{:communityId community-id :user public-key}] @@ -63,7 +63,7 @@ (rf/defn member-kick {:events [::member-kick]} - [cofx community-id public-key] + [_cofx community-id public-key] {:json-rpc/call [{:method "wakuext_removeUserFromCommunity" :params [community-id public-key] :js-response true @@ -97,7 +97,7 @@ (rf/defn add-role-to-member {:events [:community.member/add-role]} - [cofx community-id public-key role-id] + [_cofx community-id public-key role-id] {:json-rpc/call [{:method "wakuext_addRoleToMember" :params [{:communityId community-id :user public-key diff --git a/src/legacy/status_im/data_store/communities.cljs b/src/legacy/status_im/data_store/communities.cljs index 65086ffa31..9e7b1d42a9 100644 --- a/src/legacy/status_im/data_store/communities.cljs +++ b/src/legacy/status_im/data_store/communities.cljs @@ -4,12 +4,6 @@ [status-im.constants :as constants] [utils.transforms :as transforms])) -(defn <-revealed-accounts-rpc - [accounts] - (mapv - #(set/rename-keys % {:isAirdropAddress :airdrop-address?}) - (js->clj accounts :keywordize-keys true))) - (defn <-request-to-join-community-rpc [r] (set/rename-keys r diff --git a/src/legacy/status_im/data_store/messages.cljs b/src/legacy/status_im/data_store/messages.cljs index e8b28089b1..7a20d0b63f 100644 --- a/src/legacy/status_im/data_store/messages.cljs +++ b/src/legacy/status_im/data_store/messages.cljs @@ -16,7 +16,7 @@ :community-id :communityId :clock-value :clock}))) -(defn- <-status-link-previews-rpc +(defn <-status-link-previews-rpc [preview] (-> preview (update :community @@ -40,7 +40,7 @@ (update-in [:community :banner] set/rename-keys {:data-uri :dataUri}) (update-in [:community :icon] set/rename-keys {:data-uri :dataUri}))) -(defn- <-link-preview-rpc +(defn <-link-preview-rpc [preview] (-> preview (update :thumbnail set/rename-keys {:dataUri :data-uri}) @@ -160,17 +160,17 @@ :on-error #(log/error "failed to delete messages by chat-id" % chat-id)}]}) (rf/defn delete-message - [cofx id] + [_cofx id] (delete-message-rpc id)) (rf/defn delete-messages-from - [cofx author] + [_cofx author] (delete-messages-from-rpc author)) (rf/defn mark-messages-seen - [cofx chat-id ids on-success] + [_cofx chat-id ids on-success] (mark-seen-rpc chat-id ids on-success)) (rf/defn delete-messages-by-chat-id - [cofx chat-id] + [_cofx chat-id] (delete-messages-by-chat-id-rpc chat-id)) diff --git a/src/legacy/status_im/data_store/pin_messages.cljs b/src/legacy/status_im/data_store/pin_messages.cljs index 833389255c..d90103bf49 100644 --- a/src/legacy/status_im/data_store/pin_messages.cljs +++ b/src/legacy/status_im/data_store/pin_messages.cljs @@ -29,7 +29,7 @@ :on-error on-error}]}) (rf/defn send-pin-message - [cofx pin-message] + [_cofx pin-message] {:json-rpc/call [{:method "wakuext_sendPinMessage" :params [(messages/->rpc pin-message)] :js-response true diff --git a/src/legacy/status_im/ens/core.cljs b/src/legacy/status_im/ens/core.cljs index b302498b97..b3901488ab 100644 --- a/src/legacy/status_im/ens/core.cljs +++ b/src/legacy/status_im/ens/core.cljs @@ -62,7 +62,7 @@ (rf/defn update-ens-tx-state-and-redirect {:events [:update-ens-tx-state-and-redirect]} - [{:keys [db] :as cofx} new-state username custom-domain? tx-hash] + [cofx new-state username custom-domain? tx-hash] (rf/merge cofx (update-ens-tx-state new-state username custom-domain? tx-hash) (redirect-to-ens-summary))) @@ -178,13 +178,6 @@ :else (re-frame/dispatch [::name-resolved username :taken])))) -(defn registration-cost - [chain-id] - (case chain-id - 3 50 - 5 10 - 1 10)) - (rf/defn register-name {:events [::register-name-pressed]} [{:keys [db]} address] @@ -239,14 +232,14 @@ (let [{:keys [custom-domain?]} (:ens/registration db) chain-id (chain/chain-id db) usernames (into #{} (keys (get-in db [:ens/names chain-id]))) - state (state custom-domain? username usernames)] + st (state custom-domain? username usernames)] (reset! resolve-last-id (random/id)) (merge {:db (update db :ens/registration assoc :username username - :state state)} - (when (= state :searching) + :state st)} + (when (= st :searching) (let [{:profile/keys [profile]} db {:keys [public-key]} profile addresses (addresses-without-watch db) diff --git a/src/legacy/status_im/ethereum/tokens.cljs b/src/legacy/status_im/ethereum/tokens.cljs index 20f51535d8..c9e8c7c867 100644 --- a/src/legacy/status_im/ethereum/tokens.cljs +++ b/src/legacy/status_im/ethereum/tokens.cljs @@ -1,8 +1,7 @@ (ns legacy.status-im.ethereum.tokens (:require - [clojure.string :as string] [utils.ethereum.chain :as chain]) - (:require-macros [legacy.status-im.ethereum.macros :as ethereum.macros :refer [resolve-icons]])) + (:require-macros [legacy.status-im.ethereum.macros :as ethereum.macros])) (def default-native-currency (memoize @@ -13,8 +12,6 @@ :decimals 18 :icon {:source (js/require "../resources/images/tokens/default-token.png")}}))) -(def snt-icon-source (js/require "../resources/images/tokens/mainnet/SNT.png")) - (def all-native-currencies (ethereum.macros/resolve-native-currency-icons {:mainnet {:name "Ether" @@ -38,54 +35,8 @@ :symbol-display :BNBtest :decimals 18}})) -(def native-currency-symbols - (set (map #(-> % val :symbol) all-native-currencies))) - (defn native-currency [{sym :symbol :as current-network}] (let [chain (chain/network->chain-keyword current-network)] (get all-native-currencies chain (default-native-currency sym)))) -(defn ethereum? - [sym] - (native-currency-symbols sym)) - -(def token-icons - {:mainnet (resolve-icons :mainnet) - :xdai (resolve-icons :xdai) - :custom []}) - -(def default-token (js/require "../resources/images/tokens/default-token.png")) - -(defn update-icon - [network token] - (-> token - (assoc-in [:icon :source] (get-in token-icons [network (name (:symbol token))] default-token)) - (update :address string/lower-case))) - -(defn nfts-for - [all-tokens] - (filter :nft? (vals all-tokens))) - -(defn sorted-tokens-for - [all-tokens] - (->> (vals all-tokens) - (filter #(not (:hidden? %))) - (sort #(compare (string/lower-case (:name %1)) - (string/lower-case (:name %2)))))) - -(defn symbol->token - [all-tokens sym] - (some #(when (= sym (:symbol %)) %) (vals all-tokens))) - -(defn address->token - [all-tokens address] - (get all-tokens (string/lower-case address))) - -(defn asset-for - [all-tokens current-network sym] - (let [native-coin (native-currency current-network)] - (if (or (= (:symbol-display native-coin) sym) - (= (:symbol native-coin) sym)) - native-coin - (symbol->token all-tokens sym)))) diff --git a/src/legacy/status_im/ethereum/transactions/core.cljs b/src/legacy/status_im/ethereum/transactions/core.cljs index 57039ddfae..126533368a 100644 --- a/src/legacy/status_im/ethereum/transactions/core.cljs +++ b/src/legacy/status_im/ethereum/transactions/core.cljs @@ -7,37 +7,9 @@ [re-frame.core :as re-frame] [status-im.common.json-rpc.events :as json-rpc] [taoensso.timbre :as log] - [utils.ethereum.chain :as chain] [utils.ethereum.eip.eip55 :as eip55] [utils.re-frame :as rf])) -(def confirmations-count-threshold 12) - -(def etherscan-supported? - #{(chain/chain-keyword->chain-id :mainnet) - (chain/chain-keyword->chain-id :sepolia)}) - -(def binance-mainnet-chain-id (chain/chain-keyword->chain-id :bsc)) -(def binance-testnet-chain-id (chain/chain-keyword->chain-id :bsc-testnet)) - -(def network->subdomain {11155111 "sepolia"}) - -(defn get-transaction-details-url - [chain-id tx-hash] - {:pre [(number? chain-id) (string? tx-hash)] - :post [(or (nil? %) (string? %))]} - (cond - (etherscan-supported? chain-id) - (let [network-subdomain (when-let [subdomain (network->subdomain chain-id)] - (str subdomain "."))] - (str "https://" network-subdomain "etherscan.io/tx/" tx-hash)) - - (= chain-id binance-mainnet-chain-id) - (str "https://bscscan.com/tx/" tx-hash) - - (= chain-id binance-testnet-chain-id) - (str "https://testnet.bscscan.com/tx/" tx-hash))) - (def default-erc20-token {:symbol :ERC20 :decimals 18 @@ -121,16 +93,16 @@ (rf/defn check-transaction "Check if the transaction has been triggered and applies the effects returned by `on-trigger` if that is the case" - [{:keys [db] :as cofx} {:keys [hash] :as transaction}] + [{:keys [db] :as cofx} {h :hash :as transaction}] (when-let [watch-params - (get-in db [:ethereum/watched-transactions hash])] + (get-in db [:ethereum/watched-transactions h])] (let [{:keys [trigger-fn on-trigger]} watch-params] (when (trigger-fn db transaction) (rf/merge cofx {:db (update db :ethereum/watched-transactions dissoc - hash)} + h)} (on-trigger transaction)))))) (rf/defn check-watched-transactions @@ -152,14 +124,14 @@ "We determine a unique id for the transfer before adding it because some transaction can contain multiple transfers and they would overwrite each other in the transfer map if identified by hash" - [{:keys [db] :as cofx} {:keys [hash id address] :as transfer}] - (let [transfer-by-hash (get-in db [:wallet-legacy :accounts address :transactions hash])] + [{:keys [db] :as cofx} {h :hash :keys [id address] :as transfer}] + (let [transfer-by-hash (get-in db [:wallet-legacy :accounts address :transactions h])] (when-let [unique-id (when-not (= transfer transfer-by-hash) (if (and transfer-by-hash (not (= :pending (:type transfer-by-hash)))) id - hash))] + h))] (rf/merge cofx {:db (assoc-in db [:wallet-legacy :accounts address :transactions unique-id] @@ -170,11 +142,7 @@ [db address] (get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :min-block])) -(defn get-max-block-with-transfers - [db address] - (get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :max-block])) - -(defn min-block-transfers-count +(defn min-block-transfers-count-fn [db address] (get-in db [:wallet-legacy :accounts @@ -187,14 +155,14 @@ {:keys [min-block min-block-transfers-count]} (reduce (fn [{:keys [min-block] :as acc} - {:keys [block hash]}] + {h :hash block :block}] (cond (or (nil? min-block) (> min-block (js/parseInt block))) {:min-block (js/parseInt block) :min-block-transfers-count 1} (and (= min-block block) - (nil? (get-in db [:wallet-legacy :accounts checksum :transactions hash]))) + (nil? (get-in db [:wallet-legacy :accounts checksum :transactions h]))) (update acc :min-block-transfers-count inc) :else acc)) @@ -203,7 +171,7 @@ (js/parseInt min-block-string)) :min-block-transfers-count - (min-block-transfers-count db address)} + (min-block-transfers-count-fn db address)} transfers)] (log/debug "[transactions] set-lowest-fetched-block" "address" address @@ -238,7 +206,7 @@ {:db (update-fetching-status db addresses :history? false)}) (rf/defn tx-history-end-reached - [{:keys [db] :as cofx} address] + [{:keys [db]} address] (let [syncing-allowed? (utils.mobile-sync/syncing-allowed? db)] {:db (assoc-in db [:wallet-legacy :fetching address :all-fetched?] @@ -247,23 +215,22 @@ :all-preloaded))})) (rf/defn handle-new-transfer - [{:keys [db] :as cofx} transfers {:keys [address limit]}] + [cofx transfers {:keys [address limit]}] (log/debug "[transfers] new-transfers" "address" address "count" (count transfers) "limit" limit) - (let [checksum (eip55/address->checksum address) - max-known-block (get-max-block-with-transfers db address) - effects (cond-> [(when (seq transfers) - (set-lowest-fetched-block checksum transfers))] + (let [checksum (eip55/address->checksum address) + effects (cond-> [(when (seq transfers) + (set-lowest-fetched-block checksum transfers))] - (seq transfers) - (concat - [] - (mapv add-transfer transfers)) + (seq transfers) + (concat + [] + (mapv add-transfer transfers)) - (< (count transfers) limit) - (conj (tx-history-end-reached checksum)))] + (< (count transfers) limit) + (conj (tx-history-end-reached checksum)))] (apply rf/merge cofx (tx-fetching-ended [checksum]) effects))) (rf/defn new-transfers @@ -311,16 +278,12 @@ :limit limit)]) :on-error #(re-frame/dispatch [::tx-fetching-failed address])}))))) -(defn some-transactions-loaded? - [db address] - (not-empty (get-in db [:wallet-legacy :accounts address :transactions]))) - (rf/defn fetch-more-tx {:events [:transactions/fetch-more]} [{:keys [db] :as cofx} address] - (let [min-known-block (or (get-min-known-block db address) - (:ethereum/current-block db)) - min-block-transfers-count (or (min-block-transfers-count db address) 0)] + (let [min-known-block (or (get-min-known-block db address) + (:ethereum/current-block db)) + min-count (or (min-block-transfers-count-fn db address) 0)] (rf/merge cofx {:transactions/get-transfers @@ -333,7 +296,7 @@ ;; the whole `default-transfers-limit` of transfers the number of transfers already received ;; for `min-known-block` is added to the page size. :limit-per-address {address (+ default-transfers-limit - min-block-transfers-count)}}} + min-count)}}} (tx-fetching-in-progress [address])))) (rf/defn get-fetched-transfers diff --git a/src/legacy/status_im/events.cljs b/src/legacy/status_im/events.cljs index 90afefe6a8..d8a6046ad9 100644 --- a/src/legacy/status_im/events.cljs +++ b/src/legacy/status_im/events.cljs @@ -59,21 +59,11 @@ (fn [options] (permissions/request-notifications options))) -(re-frame/reg-fx - :ui/show-error - (fn [content] - (utils/show-popup "Error" content))) - (re-frame/reg-fx :ui/show-confirmation (fn [options] (utils/show-confirmation options))) -(re-frame/reg-fx - :ui/close-application - (fn [_] - (native-module/close-application))) - (re-frame/reg-fx ::app-state-change-fx (fn [state] @@ -83,11 +73,6 @@ (theme/change-device-theme (rn/get-color-scheme))) (native-module/app-state-change state))) -(re-frame/reg-fx - :ui/listen-to-window-dimensions-change - (fn [] - (dimensions/add-event-listener))) - (rf/defn dismiss-keyboard {:events [:dismiss-keyboard]} [_] @@ -233,7 +218,4 @@ :on-success (fn [on-ramps] (re-frame/dispatch [::crypto-loaded on-ramps]))}]}) -(re-frame/reg-event-fx :buy-crypto.ui/open-screen - (fn [] - {:fx [[:dispatch [:wallet-legacy/keep-watching]] - [:dispatch [:open-modal :buy-crypto nil]]]})) + diff --git a/src/legacy/status_im/fleet/core.cljs b/src/legacy/status_im/fleet/core.cljs index d504f791be..b08b42a1b6 100644 --- a/src/legacy/status_im/fleet/core.cljs +++ b/src/legacy/status_im/fleet/core.cljs @@ -84,7 +84,7 @@ (rf/defn save {:events [:fleet.ui/save-fleet-confirmed]} - [{:keys [db now] :as cofx} fleet] + [{:keys [db] :as cofx} fleet] (let [old-fleet (get-in db [:profile/profile :fleet])] (when (not= fleet old-fleet) (multiaccounts.update/multiaccount-update diff --git a/src/legacy/status_im/group_chats/core.cljs b/src/legacy/status_im/group_chats/core.cljs index e77b534486..a2479cd890 100644 --- a/src/legacy/status_im/group_chats/core.cljs +++ b/src/legacy/status_im/group_chats/core.cljs @@ -40,7 +40,7 @@ (rf/defn remove-member "Format group update message and sign membership" {:events [:group-chats.ui/remove-member-pressed]} - [_ chat-id member do-not-navigate?] + [_ chat-id member _do-not-navigate?] {:json-rpc/call [{:method "wakuext_removeMemberFromGroupChat" :params [nil chat-id member] :js-response true @@ -48,7 +48,7 @@ (rf/defn remove-members {:events [:group-chats.ui/remove-members-pressed]} - [{{:group-chat/keys [deselected-members]} :db :as cofx} chat-id] + [{{:group-chat/keys [deselected-members]} :db :as _cofx} chat-id] {:json-rpc/call [{:method "wakuext_removeMembersFromGroupChat" :params [nil chat-id deselected-members] :js-response true @@ -104,7 +104,7 @@ (rf/defn leave "Leave chat" {:events [:group-chats.ui/leave-chat-confirmed]} - [{:keys [db] :as cofx} chat-id] + [_cofx chat-id] {:json-rpc/call [{:method "wakuext_leaveGroupChat" :params [nil chat-id true] :js-response true @@ -128,7 +128,7 @@ (rf/defn name-changed "Save chat from edited profile" {:events [:group-chats.ui/name-changed]} - [{:keys [db] :as cofx} chat-id new-name] + [{:keys [db] :as _cofx} chat-id new-name] (when (valid-name? new-name) {:db (assoc-in db [:chats chat-id :name] new-name) :json-rpc/call [{:method "wakuext_changeGroupChatName" @@ -149,7 +149,7 @@ (rf/defn send-group-chat-membership-request "Send group chat membership request" {:events [:send-group-chat-membership-request]} - [{{:keys [chats] :as db} :db :as cofx} chat-id] + [{{:keys [chats] :as db} :db :as _cofx} chat-id] (let [{:keys [invitation-admin]} (get chats chat-id) message (get-in db [:chat/memberships chat-id :message])] {:db (assoc-in db [:chat/memberships chat-id] nil) @@ -161,7 +161,7 @@ (rf/defn send-group-chat-membership-rejection "Send group chat membership rejection" {:events [:send-group-chat-membership-rejection]} - [cofx invitation-id] + [_cofx invitation-id] {:json-rpc/call [{:method "wakuext_sendGroupChatInvitationRejection" :params [nil invitation-id] :js-response true @@ -176,15 +176,6 @@ % invitations))}) -(defn member-removed? - [{:keys [membership-update-events]} pk] - (->> membership-update-events - (filter #(contains? (set (:members %)) pk)) - (sort-by :clockValue >) - first - :type - (= constants/invitation-state-removed))) - (rf/defn deselect-member {:events [:deselect-member]} [{:keys [db]} id] diff --git a/src/legacy/status_im/group_chats/db.cljs b/src/legacy/status_im/group_chats/db.cljs deleted file mode 100644 index 09ca7ed8d8..0000000000 --- a/src/legacy/status_im/group_chats/db.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns legacy.status-im.group-chats.db) - -(def members-added-type 3) - -(defn member? - [public-key {:keys [members contacts users]}] - (let [members-list (into #{} (concat (keys users) contacts (map #(:id %) members)))] - (contains? members-list public-key))) - -(defn invited? - [my-public-key {:keys [contacts]}] - (contains? contacts my-public-key)) - -(defn get-inviter-pk - [my-public-key {:keys [membership-update-events]}] - (->> membership-update-events - reverse - (keep (fn [{:keys [from type members]}] - (when (and (= type members-added-type) - ((set members) my-public-key)) - from))) - first)) - -(defn group-chat? - [chat] - (and (:group-chat chat) (not (:public? chat)))) diff --git a/src/legacy/status_im/log_level/core.cljs b/src/legacy/status_im/log_level/core.cljs index 1f865a00bd..c1538ae855 100644 --- a/src/legacy/status_im/log_level/core.cljs +++ b/src/legacy/status_im/log_level/core.cljs @@ -7,7 +7,7 @@ (rf/defn save-log-level {:events [:log-level.ui/change-log-level-confirmed]} - [{:keys [db now] :as cofx} log-level] + [{:keys [db] :as cofx} log-level] (let [old-log-level (get-in db [:profile/profile :log-level])] (when (not= old-log-level log-level) (multiaccounts.update/multiaccount-update diff --git a/src/legacy/status_im/mailserver/constants.cljs b/src/legacy/status_im/mailserver/constants.cljs deleted file mode 100644 index 5f9054e651..0000000000 --- a/src/legacy/status_im/mailserver/constants.cljs +++ /dev/null @@ -1,18 +0,0 @@ -(ns ^{:doc "Mailserver events and API"} legacy.status-im.mailserver.constants) - -(def one-day (* 24 3600)) -(def seven-days (* 7 one-day)) -(def max-gaps-range (* 30 one-day)) -(def max-request-range one-day) -(def maximum-number-of-attempts 2) -(def request-timeout 30) -(def min-limit 100) -(def max-limit 1000) -(def backoff-interval-ms 3000) -(def default-limit max-limit) -;; If a mailserver fails, how long before we should consider them again -;; for selection, in ms -(def cooloff-period 120000) -(def connection-timeout - "Time after which mailserver connection is considered to have failed" - 10000) diff --git a/src/legacy/status_im/multiaccounts/create/core.cljs b/src/legacy/status_im/multiaccounts/create/core.cljs index af59e96715..270b418fa3 100644 --- a/src/legacy/status_im/multiaccounts/create/core.cljs +++ b/src/legacy/status_im/multiaccounts/create/core.cljs @@ -1,7 +1,6 @@ (ns legacy.status-im.multiaccounts.create.core (:require [legacy.status-im.utils.deprecated-types :as types] - [legacy.status-im.utils.signing-phrase.core :as signing-phrase] [native-module.core :as native-module] [re-frame.core :as re-frame] [status-im.constants :as constants] @@ -29,11 +28,6 @@ derived (update :derived normalize-derived-data-keys))) -(re-frame/reg-cofx - ::get-signing-phrase - (fn [cofx _] - (assoc cofx :signing-phrase (signing-phrase/generate)))) - (re-frame/reg-fx :multiaccount-generate-and-derive-addresses (fn [] diff --git a/src/legacy/status_im/multiaccounts/recover/core.cljs b/src/legacy/status_im/multiaccounts/recover/core.cljs deleted file mode 100644 index d1c08f30b8..0000000000 --- a/src/legacy/status_im/multiaccounts/recover/core.cljs +++ /dev/null @@ -1,31 +0,0 @@ -(ns legacy.status-im.multiaccounts.recover.core - (:require - [legacy.status-im.multiaccounts.create.core :as multiaccounts.create] - [legacy.status-im.utils.deprecated-types :as types] - [native-module.core :as native-module] - [re-frame.core :as re-frame] - [status-im.constants :as constants] - [taoensso.timbre :as log])) - -(re-frame/reg-fx - ::import-multiaccount - (fn [{:keys [passphrase password success-event]}] - (log/debug "[recover] ::import-multiaccount") - (native-module/multiaccount-import-mnemonic - passphrase - password - (fn [result] - (let [{:keys [id] :as root-data} - (multiaccounts.create/normalize-multiaccount-data-keys - (types/json->clj result))] - (native-module.core/multiaccount-derive-addresses - id - [constants/path-wallet-root - constants/path-eip1581 - constants/path-whisper - constants/path-default-wallet] - (fn [result] - (let [derived-data (multiaccounts.create/normalize-derived-data-keys - (types/json->clj result))] - (re-frame/dispatch [success-event root-data derived-data]))))))))) - diff --git a/src/legacy/status_im/multiaccounts/reset_password/core.cljs b/src/legacy/status_im/multiaccounts/reset_password/core.cljs deleted file mode 100644 index f0beac4814..0000000000 --- a/src/legacy/status_im/multiaccounts/reset_password/core.cljs +++ /dev/null @@ -1,94 +0,0 @@ -(ns legacy.status-im.multiaccounts.reset-password.core - (:require - [clojure.string :as string] - [legacy.status-im.popover.core :as popover] - [legacy.status-im.utils.deprecated-types :as types] - [native-module.core :as native-module] - [re-frame.core :as re-frame] - [utils.re-frame :as rf] - [utils.security.core :as security])) - -(rf/defn on-input-change - {:events [::handle-input-change]} - [{:keys [db]} input-id value] - (let [new-password (get-in db [:multiaccount/reset-password-form-vals :new-password]) - error (when (and (= input-id :confirm-new-password) - (pos? (count new-password)) - (pos? (count value)) - (not= value new-password)) - :t/password-mismatch)] - {:db (-> db - (assoc-in [:multiaccount/reset-password-form-vals input-id] value) - (assoc-in [:multiaccount/reset-password-errors input-id] error))})) - -(rf/defn clear-form-vals - {:events [::clear-form-vals]} - [{:keys [db]}] - {:db (dissoc db :multiaccount/reset-password-form-vals :multiaccount/reset-password-errors)}) - -(rf/defn set-current-password-error - {:events [::handle-verification-error ::password-reset-error]} - [{:keys [db]} error] - {:db (assoc-in db [:multiaccount/reset-password-errors :current-password] error)}) - -(rf/defn password-reset-success - {:events [::password-reset-success]} - [{:keys [db] :as cofx}] - (rf/merge cofx - {:db (dissoc - db - :multiaccount/reset-password-form-vals - :multiaccount/reset-password-errors - :multiaccount/reset-password-next-enabled? - :multiaccount/resetting-password?)})) - -(defn change-db-password-cb - [res] - (let [{:keys [error]} (types/json->clj res)] - (if (not (string/blank? error)) - (re-frame/dispatch [::password-reset-error error]) - (re-frame/dispatch [::password-reset-success])))) - -(re-frame/reg-fx - ::change-db-password - (fn [[key-uid {:keys [current-password new-password]}]] - (native-module/reset-password - key-uid - (native-module/sha3 (security/safe-unmask-data current-password)) - (native-module/sha3 (security/safe-unmask-data new-password)) - change-db-password-cb))) - -(rf/defn handle-verification-success - {:events [::handle-verification-success]} - [{:keys [db] :as cofx} form-vals] - (let [{:keys [key-uid name]} (:profile/profile db)] - (rf/merge cofx - {::change-db-password [key-uid form-vals] - :db (assoc db - :multiaccount/resetting-password? - true)} - (popover/show-popover {:view :password-reset-popover - :prevent-closing? true})))) - -(defn handle-verification - [form-vals result] - (let [{:keys [error]} (types/json->clj result)] - (if (not (string/blank? error)) - (re-frame/dispatch [::handle-verification-error :t/wrong-password]) - (re-frame/dispatch [::handle-verification-success form-vals])))) - -(re-frame/reg-fx - ::validate-current-password-and-reset - (fn [{:keys [address current-password] :as form-vals}] - (let [hashed-pass (native-module/sha3 (security/safe-unmask-data current-password))] - (native-module/verify address - hashed-pass - (partial handle-verification form-vals))))) - -(rf/defn reset - {:events [::reset]} - [{:keys [db]} form-vals] - {::validate-current-password-and-reset - (assoc form-vals - :address - (get-in db [:profile/profile :wallet-root-address]))}) diff --git a/src/legacy/status_im/multiaccounts/update/core.cljs b/src/legacy/status_im/multiaccounts/update/core.cljs index b187b30cf1..12dcd3c2b5 100644 --- a/src/legacy/status_im/multiaccounts/update/core.cljs +++ b/src/legacy/status_im/multiaccounts/update/core.cljs @@ -9,7 +9,7 @@ (rf/defn send-contact-update [{:keys [db]}] - (let [{:keys [name preferred-name display-name address]} (:profile/profile db)] + (let [{:keys [name preferred-name display-name]} (:profile/profile db)] {:json-rpc/call [{:method "wakuext_sendContactUpdates" :params [(or preferred-name display-name name) "" ""] :on-success #(log/debug "sent contact update")}]})) @@ -79,30 +79,27 @@ synced-stickers)) (rf/defn optimistic - [{:keys [db] :as cofx} setting setting-value] - (let [current-multiaccount (:profile/profile db) - setting-value (if (= :currency setting) - (settings/rpc->currency setting-value) - setting-value) - db (case setting - :stickers/packs-pending - (let [packs-pending (keys (js->clj setting-value))] - (update db :stickers/packs-pending conj packs-pending)) - :stickers/packs-installed - (let [packs-installed-keys (keys (js->clj setting-value))] - (reduce #(assoc-in %1 - [:stickers/packs %2 :status] - constants/sticker-pack-status-installed) - db - packs-installed-keys)) - :stickers/recent-stickers - (let [recent-stickers-from-remote (augment-synchronized-recent-stickers - (types/js->clj setting-value) - (:stickers/packs db)) - merged (into recent-stickers-from-remote - (:stickers/recent-stickers db))] - (assoc db :stickers/recent-stickers recent-stickers-from-remote)) - db)] + [{:keys [db]} setting setting-value] + (let [setting-value (if (= :currency setting) + (settings/rpc->currency setting-value) + setting-value) + db (case setting + :stickers/packs-pending + (let [packs-pending (keys (js->clj setting-value))] + (update db :stickers/packs-pending conj packs-pending)) + :stickers/packs-installed + (let [packs-installed-keys (keys (js->clj setting-value))] + (reduce #(assoc-in %1 + [:stickers/packs %2 :status] + constants/sticker-pack-status-installed) + db + packs-installed-keys)) + :stickers/recent-stickers + (let [recent-stickers-from-remote (augment-synchronized-recent-stickers + (types/js->clj setting-value) + (:stickers/packs db))] + (assoc db :stickers/recent-stickers recent-stickers-from-remote)) + db)] {:db (if setting-value (assoc-in db [:profile/profile setting] setting-value) (update db :profile/profile dissoc setting)) diff --git a/src/legacy/status_im/node/core.cljs b/src/legacy/status_im/node/core.cljs index e24bd89307..cb3e60665e 100644 --- a/src/legacy/status_im/node/core.cljs +++ b/src/legacy/status_im/node/core.cljs @@ -1,7 +1,6 @@ (ns legacy.status-im.node.core (:require - [legacy.status-im.utils.deprecated-types :as types] - [status-im.config :as config])) + [legacy.status-im.utils.deprecated-types :as types])) (defn fleets [{:keys [custom-fleets]}] @@ -9,9 +8,3 @@ (mapv #(:fleets (types/json->clj %)) $) (conj $ custom-fleets) (reduce merge $))) - -(defn current-fleet-key - [db] - (keyword (get-in db - [:profile/profile :fleet] - config/fleet))) diff --git a/src/legacy/status_im/pairing/core.cljs b/src/legacy/status_im/pairing/core.cljs index f3808bf8b2..7d2e8d4b7a 100644 --- a/src/legacy/status_im/pairing/core.cljs +++ b/src/legacy/status_im/pairing/core.cljs @@ -98,7 +98,7 @@ :deviceType utils.platform/os}]})) (rf/defn init - [cofx] + [_cofx] {:pairing/get-our-installations nil}) (rf/defn enable @@ -254,7 +254,7 @@ (rf/defn pair-and-sync {:events [:pairing/pair-and-sync]} - [cofx installation-id] + [_cofx installation-id] {:fx [[:json-rpc/call [{:method "wakuext_enableInstallationAndSync" :params [{:installationId installation-id}] diff --git a/src/legacy/status_im/profile/core.cljs b/src/legacy/status_im/profile/core.cljs index 94b3d238c4..94d228bd83 100644 --- a/src/legacy/status_im/profile/core.cljs +++ b/src/legacy/status_im/profile/core.cljs @@ -37,7 +37,7 @@ (rf/defn finish-success {:events [:my-profile/finish-success]} - [{:keys [db] :as cofx}] + [{:keys [db]}] {:db (update db :my-profile/seed assoc :step :finish :error nil :word nil)}) (rf/defn finish diff --git a/src/legacy/status_im/qr_scanner/core.cljs b/src/legacy/status_im/qr_scanner/core.cljs index 9ddf87401c..040db8e48a 100644 --- a/src/legacy/status_im/qr_scanner/core.cljs +++ b/src/legacy/status_im/qr_scanner/core.cljs @@ -23,7 +23,7 @@ (rf/defn set-qr-code {:events [:qr-scanner.callback/scan-qr-code-success]} - [{:keys [db]} opts data] + [_ opts data] (when-let [handler (:handler opts)] {:dispatch [handler data opts]})) @@ -46,7 +46,7 @@ (= (:public-key profile) public-key)) (rf/defn handle-private-chat - [{:keys [db] :as cofx} {:keys [chat-id]}] + [{:keys [db]} {:keys [chat-id]}] (if-not (own-public-key? db chat-id) {:dispatch [:chat.ui/start-chat chat-id]} {:effects.utils/show-popup {:title (i18n/label :t/unable-to-read-this-code) diff --git a/src/legacy/status_im/react_native/resources.cljs b/src/legacy/status_im/react_native/resources.cljs index 111f5be215..bd4d7c20ab 100644 --- a/src/legacy/status_im/react_native/resources.cljs +++ b/src/legacy/status_im/react_native/resources.cljs @@ -1,6 +1,4 @@ -(ns legacy.status-im.react-native.resources - (:require - [legacy.status-im.ui.components.colors :as colors])) +(ns legacy.status-im.react-native.resources) (def ui {:empty-chats-header (js/require "../resources/images/ui/empty-chats-header.png") @@ -52,10 +50,6 @@ :no-contacts (js/require "../resources/images/ui/no-contacts.png") :no-contacts-dark (js/require "../resources/images/ui/no-contacts-dark.png")}) -(defn get-theme-image - [k] - (get ui (when (colors/dark?) (keyword (str (name k) "-dark"))) (get ui k))) - (def loaded-images (atom {})) (defn get-image diff --git a/src/legacy/status_im/stickers/core.cljs b/src/legacy/status_im/stickers/core.cljs index 88282686b6..9224369b63 100644 --- a/src/legacy/status_im/stickers/core.cljs +++ b/src/legacy/status_im/stickers/core.cljs @@ -2,7 +2,6 @@ (:require [legacy.status-im.utils.utils :as utils] [re-frame.core :as re-frame] - [status-im.common.json-rpc.events :as json-rpc] [status-im.constants :as constants] [utils.ethereum.chain :as chain] [utils.re-frame :as rf])) @@ -23,21 +22,6 @@ :params [(chain/chain-id db) id] :on-success #()}]})) -(re-frame/reg-fx :stickers/load-packs - (fn [chain-id] - (json-rpc/call {:method "stickers_market" - :params [chain-id] - :on-success [:stickers/stickers-market-success]}) - (json-rpc/call {:method "stickers_installed" - :params [] - :on-success [:stickers/stickers-installed-success]}) - (json-rpc/call {:method "stickers_pending" - :params [] - :on-success [:stickers/stickers-pending-success]}) - (json-rpc/call {:method "stickers_recent" - :params [] - :on-success [:stickers/stickers-recent-success]}))) - (rf/defn pending-pack {:events [:stickers/pending-pack]} [{db :db} id] diff --git a/src/legacy/status_im/subs/ens.cljs b/src/legacy/status_im/subs/ens.cljs index 842fd1704d..23ed8d09fe 100644 --- a/src/legacy/status_im/subs/ens.cljs +++ b/src/legacy/status_im/subs/ens.cljs @@ -1,64 +1,6 @@ (ns legacy.status-im.subs.ens (:require - [clojure.string :as string] - [legacy.status-im.ens.core :as ens] - [re-frame.core :as re-frame] - [utils.address :as address] - [utils.ethereum.chain :as chain] - [utils.money :as money])) - -(re-frame/reg-sub - :ens/preferred-name - :<- [:profile/profile] - (fn [multiaccount] - (:preferred-name multiaccount))) - -(re-frame/reg-sub - :ens/search-screen - :<- [:ens/registration] - (fn [{:keys [custom-domain? username state]}] - {:state state - :username username - :custom-domain? custom-domain?})) - -(defn- ens-amount-label - [chain-id] - (str (ens/registration-cost chain-id) - (case chain-id - 3 " STT" - 1 " SNT" - ""))) - -(re-frame/reg-sub - :ens/checkout-screen - :<- [:ens/registration] - :<- [:chain-keyword] - :<- [:multiaccount/default-account] - :<- [:multiaccount/public-key] - :<- [:chain-id] - :<- [:wallet-legacy] - (fn [[{:keys [custom-domain? username address]} - chain default-account public-key chain-id wallet]] - (let [address (or address (address/normalized-hex (:address default-account))) - balance (get-in wallet [:accounts address :balance])] - {:address address - :username username - :public-key public-key - :custom-domain? custom-domain? - :chain chain - :amount-label (ens-amount-label chain-id) - :sufficient-funds? (money/sufficient-funds? - (money/formatted->internal (money/bignumber 10) - (chain/chain-keyword->snt-symbol chain) - 18) - (get balance (chain/chain-keyword->snt-symbol chain)))}))) - -(re-frame/reg-sub - :ens/confirmation-screen - :<- [:ens/registration] - (fn [{:keys [username state]}] - {:state state - :username username})) + [re-frame.core :as re-frame])) (re-frame/reg-sub :ens/current-names @@ -66,37 +8,3 @@ :<- [:chain-id] (fn [[all-names chain-id]] (get all-names chain-id))) - -(re-frame/reg-sub - :ens.name/screen - :<- [:get-screen-params :ens-name-details] - :<- [:ens/current-names] - (fn [[name ens]] - (let [{:keys [address public-key expiration-date releasable?]} (get ens name) - pending? (nil? address)] - (cond-> {:name name - :custom-domain? (not (string/ends-with? name ".stateofus.eth"))} - pending? - (assoc :pending? true) - (not pending?) - (assoc :address address - :public-key public-key - :releasable? releasable? - :expiration-date expiration-date))))) - -(re-frame/reg-sub - :ens.main/screen - :<- [:ens/current-names] - :<- [:profile/profile] - :<- [:ens/preferred-name] - :<- [:ens/registrations] - (fn [[names multiaccount preferred-name registrations]] - (let [not-in-progress-names (reduce (fn [acc {:keys [username custom-domain?]}] - (let [full-name (ens/fullname custom-domain? username)] - (remove #(= % full-name) acc))) - (keys names) - (vals registrations))] - {:names not-in-progress-names - :profile/profile multiaccount - :preferred-name preferred-name - :registrations registrations}))) diff --git a/src/legacy/status_im/subs/mailservers.cljs b/src/legacy/status_im/subs/mailservers.cljs index 68d8f757b9..d9254159f8 100644 --- a/src/legacy/status_im/subs/mailservers.cljs +++ b/src/legacy/status_im/subs/mailservers.cljs @@ -11,31 +11,6 @@ (fn [[current-mailserver-id current-fleet mailservers]] (get-in mailservers [current-fleet current-mailserver-id :name]))) -(re-frame/reg-sub - :mailserver/connecting? - :<- [:mailserver/state] - (fn [state] - (#{:connecting :added} state))) - -(re-frame/reg-sub - :mailserver/connection-error? - :<- [:mailserver/state] - (fn [state] - (#{:error :disconnected} state))) - -(re-frame/reg-sub - :mailserver/fetching? - :<- [:mailserver/state] - :<- [:mailserver/pending-requests] - :<- [:mailserver/connecting?] - :<- [:mailserver/connection-error?] - :<- [:mailserver/request-error?] - (fn [[state pending-requests connecting? connection-error? request-error?]] - (and pending-requests - (= state :connected) - (pos-int? pending-requests) - (not (or connecting? connection-error? request-error?))))) - (re-frame/reg-sub :mailserver/fleet-mailservers :<- [:fleets/current-fleet] @@ -43,23 +18,6 @@ (fn [[current-fleet mailservers]] (current-fleet mailservers))) -(re-frame/reg-sub - :mailserver.edit/connected? - :<- [:mailserver.edit/mailserver] - :<- [:mailserver/current-id] - (fn [[mailserver current-mailserver-id]] - (= (get-in mailserver [:id :value]) - current-mailserver-id))) - -(re-frame/reg-sub - :mailserver.edit/validation-errors - :<- [:mailserver.edit/mailserver] - (fn [mailserver] - (set (keep - (fn [[k {:keys [error]}]] - (when error k)) - mailserver)))) - (re-frame/reg-sub :mailserver/preferred-id :<- [:profile/profile] diff --git a/src/legacy/status_im/subs/root.cljs b/src/legacy/status_im/subs/root.cljs index 0d825c1920..bb088bfc89 100644 --- a/src/legacy/status_im/subs/root.cljs +++ b/src/legacy/status_im/subs/root.cljs @@ -3,7 +3,6 @@ legacy.status-im.subs.browser legacy.status-im.subs.ens legacy.status-im.subs.mailservers - legacy.status-im.subs.stickers [re-frame.core :as re-frame])) (defn reg-root-key-sub diff --git a/src/legacy/status_im/subs/stickers.cljs b/src/legacy/status_im/subs/stickers.cljs deleted file mode 100644 index 8790cab798..0000000000 --- a/src/legacy/status_im/subs/stickers.cljs +++ /dev/null @@ -1,22 +0,0 @@ -(ns legacy.status-im.subs.stickers - (:require - [re-frame.core :as re-frame] - [status-im.constants :as constants])) - -(re-frame/reg-sub - :stickers/all-packs - :<- [:stickers/packs] - (fn [packs] - (map (fn [{:keys [status] :as pack}] - (-> pack - (assoc :installed (= status constants/sticker-pack-status-installed)) - (assoc :pending (= status constants/sticker-pack-status-pending)) - (assoc :owned (= status constants/sticker-pack-status-owned)))) - (vals packs)))) - -(re-frame/reg-sub - :stickers/get-current-pack - :<- [:get-screen-params] - :<- [:stickers/all-packs] - (fn [[{:keys [id]} packs]] - (first (filter #(= (:id %) id) packs)))) diff --git a/src/legacy/status_im/ui/components/accordion.cljs b/src/legacy/status_im/ui/components/accordion.cljs deleted file mode 100644 index 4aee7c9e18..0000000000 --- a/src/legacy/status_im/ui/components/accordion.cljs +++ /dev/null @@ -1,56 +0,0 @@ -(ns legacy.status-im.ui.components.accordion - (:require - [legacy.status-im.ui.components.colors :as colors] - [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] - [reagent.core :as reagent])) - -(defn drop-down-icon - [{:keys [opened? dropdown-margin-left]}] - [react/view {:flex-direction :row :align-items :center} - [icons/icon (if opened? :main-icons/dropdown-up :main-icons/dropdown) - {:container-style {:align-items :center - :margin-left dropdown-margin-left - :justify-content :center} - :resize-mode :center - :color colors/black}]]) - -(defn section - "Render collapsible section" - [_props] - (let [opened? (reagent/atom (get _props :default))] - (fn - [{:keys [title content icon opened disabled - padding-vertical dropdown-margin-left - open-container-style - on-open on-close] - :or {padding-vertical 8 - dropdown-margin-left 8 - open-container-style {} - on-open #() - on-close #()}}] - (let [on-press #(do - (apply (if @opened? on-close on-open) []) - (swap! opened? not))] - [react/view - (merge {:padding-vertical padding-vertical} - (when @opened? open-container-style)) - (if (string? title) - [list.item/list-item - {:title title - :icon icon - :on-press on-press - :accessory [drop-down-icon (or @opened? opened)]}] - [react/touchable-opacity {:on-press on-press :disabled disabled} - [react/view - {:flex-direction :row - :margin-right 14 - :justify-content :space-between} - title - [drop-down-icon - {:opened? (or @opened? opened) - :dropdown-margin-left dropdown-margin-left}]]]) - (when (or @opened? opened) - content)])))) - diff --git a/src/legacy/status_im/ui/components/action_sheet.cljs b/src/legacy/status_im/ui/components/action_sheet.cljs index 76ae3c3313..9e792750cd 100644 --- a/src/legacy/status_im/ui/components/action_sheet.cljs +++ b/src/legacy/status_im/ui/components/action_sheet.cljs @@ -1,7 +1,7 @@ (ns legacy.status-im.ui.components.action-sheet (:require ["react-native" :refer (ActionSheetIOS)] - [legacy.status-im.utils.core :as utils] + [utils.collection :as utils] [utils.i18n :as i18n])) (defn- callback diff --git a/src/legacy/status_im/ui/components/animated_header.cljs b/src/legacy/status_im/ui/components/animated_header.cljs deleted file mode 100644 index b8f74f55b3..0000000000 --- a/src/legacy/status_im/ui/components/animated_header.cljs +++ /dev/null @@ -1,69 +0,0 @@ -(ns legacy.status-im.ui.components.animated-header - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.header :as header] - [oops.core :refer [oget]] - [react-native.core :as rn] - [react-native.platform :as platform] - [react-native.safe-area :as safe-area] - [reagent.core :as reagent])) - -(defn header-wrapper-style - [{:keys [offset]}] - (merge - {:background-color (:ui-background @colors/theme)} - (when (and offset platform/ios?) - {:z-index 2 - :shadow-radius 16 - :shadow-color (:shadow-01 @colors/theme) - :shadow-offset {:width 0 :height 4}}))) - -(defn title-style - [layout] - {:flex 1 - :justify-content :center - :padding-right (get-in layout [:right :width])}) - -(defn header-container - [] - (let [layout (reagent/atom {}) - offset (reagent/atom 0) - on-layout (fn [evt] - (reset! offset (oget evt "nativeEvent" "layout" "height")))] - (fn [{:keys [extended-header refresh-control refreshing-sub refreshing-counter] :as props} children] - [rn/view - {:flex 1 - :pointer-events :box-none} - [rn/view - {:pointer-events :box-none - :style (header-wrapper-style {:offset @offset})} - [header/header - (merge - {:get-layout (fn [el l] (swap! layout assoc el l)) - :border-bottom false - :title-align :left} - (dissoc props :extended-header))]] - (into [rn/scroll-view - {:refreshControl (when refresh-control - (refresh-control - (and @refreshing-sub - @refreshing-counter))) - :style {:z-index 1} - :scrollEventThrottle 16} - [rn/view {:pointer-events :box-none} - [rn/view - {:pointer-events :box-none - :on-layout on-layout} - [extended-header - {:offset @offset}]]]] - children)]))) - -(defn header - [{:keys [use-insets] :as props} & children] - (if use-insets - [header-container - (-> props - (dissoc :use-insets) - (assoc :insets (safe-area/get-insets))) - children] - [header-container props children])) diff --git a/src/legacy/status_im/ui/components/animation.cljs b/src/legacy/status_im/ui/components/animation.cljs index 377cf353ae..264de9bc07 100644 --- a/src/legacy/status_im/ui/components/animation.cljs +++ b/src/legacy/status_im/ui/components/animation.cljs @@ -35,12 +35,6 @@ anim-value (clj->js (add-native-driver config)))) -(defn decay - [anim-value config] - (.decay ^js react/animated - anim-value - (clj->js (add-native-driver config)))) - (defn anim-sequence [animations] (.sequence ^js react/animated (clj->js animations))) @@ -49,65 +43,13 @@ [animations] (.parallel ^js react/animated (clj->js animations))) -(defn anim-delay - [duration] - (.delay ^js react/animated duration)) - -(defn event - [mapping config] - (.event ^js react/animated (clj->js mapping) (clj->js config))) - -(defn add-listener - [^js anim-value listener] - (.addListener anim-value listener)) - -(defn remove-all-listeners - [^js anim-value] - (.removeAllListeners anim-value)) - -(defn stop-animation - [^js anim-value] - (.stopAnimation anim-value)) - -(defn set-value - [^js anim-value value] - (.setValue anim-value value)) - -(def animated (.-Animated ^js rn)) (def animated-value (-> ^js rn .-Animated .-Value)) -(def animated-value-xy (-> ^js rn .-Animated .-ValueXY)) (def easing (-> ^js rn .-Easing)) (defn create-value [value] (new animated-value value)) -(defn create-value-xy - [value] - (new animated-value-xy value)) - -(defn add - [anim-x anim-y] - ((-> ^js rn .-Animated .add) anim-x anim-y)) - -(defn subtract - [anim-x anim-y] - ((-> ^js rn .-Animated .-subtract) anim-x anim-y)) - -(defn x - [^js value-xy] - (.-x value-xy)) - -(defn y - [^js value-xy] - (.-y value-xy)) - -(defn get-layout - [^js value-xy] - (js->clj (.getLayout value-xy))) - (defn easing-in [] (.-in ^js easing)) (defn easing-out [] (.-out ^js easing)) -(defn cubic [] (.-cubic ^js easing)) -(def bezier (.-bezier ^js easing)) diff --git a/src/legacy/status_im/ui/components/bottom_panel/views.cljs b/src/legacy/status_im/ui/components/bottom_panel/views.cljs deleted file mode 100644 index 453a6d3b73..0000000000 --- a/src/legacy/status_im/ui/components/bottom_panel/views.cljs +++ /dev/null @@ -1,152 +0,0 @@ -(ns legacy.status-im.ui.components.bottom-panel.views - (:require - ["react-native" :refer (BackHandler)] - [legacy.status-im.ui.components.animation :as anim] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.react :as react] - [react-native.platform :as platform] - [reagent.core :as reagent]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(def back-listener (atom nil)) - -(defn remove-back-listener - [] - (when @back-listener - (.remove ^js @back-listener) - (reset! back-listener nil))) - -(defn add-back-listener - [] - (remove-back-listener) - (reset! back-listener (.addEventListener BackHandler - "hardwareBackPress" - (fn [] true)))) - -(defn hide-panel-anim - [bottom-anim-value alpha-value window-height] - (remove-back-listener) - (react/dismiss-keyboard!) - (anim/start - (anim/parallel - [(anim/spring bottom-anim-value - {:toValue (- window-height) - :useNativeDriver true}) - (anim/timing alpha-value - {:toValue 0 - :duration 500 - :useNativeDriver true})]))) - -(defn show-panel-anim - [bottom-anim-value alpha-value] - (add-back-listener) - (anim/start - (anim/parallel - [(anim/spring bottom-anim-value - {:toValue 40 - :useNativeDriver true}) - (anim/timing alpha-value - {:toValue 0.4 - :duration 500 - :useNativeDriver true})]))) - -(defn bottom-panel - [_ render window-height on-close on-touch-outside show-overlay?] - (let [bottom-anim-value (anim/create-value window-height) - alpha-value (anim/create-value 0) - clear-timeout (atom nil) - update? (atom nil) - current-obj (reagent/atom nil)] - (reagent/create-class - {:UNSAFE_componentWillMount (fn [^js args] - (let [[_ obj _ _] (.-argv (.-props args))] - (when @clear-timeout (js/clearTimeout @clear-timeout)) - (when (or (not= obj @current-obj) @update?) - (cond - @update? - (do (reset! update? false) - (show-panel-anim bottom-anim-value alpha-value)) - - (and @current-obj obj) - (do (reset! update? true) - (js/setTimeout #(reset! current-obj obj) 600) - (hide-panel-anim bottom-anim-value - alpha-value - (- window-height))) - - obj - (do (reset! current-obj obj) - (show-panel-anim bottom-anim-value alpha-value)) - - :else - (do (reset! clear-timeout (js/setTimeout #(reset! current-obj - nil) - 600)) - (hide-panel-anim bottom-anim-value - alpha-value - (- window-height))))))) - :UNSAFE_componentWillUpdate (fn [_ [_ obj _ _]] - (when @clear-timeout (js/clearTimeout @clear-timeout)) - (when (or (not= obj @current-obj) @update?) - (cond - @update? - (do (reset! update? false) - (show-panel-anim bottom-anim-value alpha-value)) - - (and @current-obj obj) - (do (reset! update? true) - (js/setTimeout #(reset! current-obj obj) 600) - (hide-panel-anim bottom-anim-value - alpha-value - (- window-height))) - - obj - (do (reset! current-obj obj) - (show-panel-anim bottom-anim-value alpha-value)) - - :else - (do (reset! clear-timeout (js/setTimeout #(reset! current-obj - nil) - 600)) - (hide-panel-anim bottom-anim-value - alpha-value - (- window-height)))))) - :reagent-render (fn [] - (if @current-obj - [react/keyboard-avoiding-view - {:style {:position :absolute :top 0 :bottom 0 :left 0 :right 0} - :ignore-offset true} - - [react/view {:flex 1} - (when (and platform/ios? show-overlay?) - [react/animated-view - {:flex 1 - :background-color colors/black-persist - :opacity alpha-value}]) - (when on-touch-outside - [react/touchable-opacity - {:active-opacity 0 - :on-press on-touch-outside - :style {:flex 1}}]) - [react/animated-view - {:style {:position :absolute - :transform [{:translateY bottom-anim-value}] - :bottom 0 - :left 0 - :right 0}} - [react/view {:flex 1} - [render @current-obj]]]]] - ;;TODO this is not great, improve! - #(do (on-close) - nil)))}))) - -(views/defview animated-bottom-panel - [m view on-close on-touch-outside show-overlay?] - (views/letsubs [{window-height :height} [:dimensions/window]] - [bottom-panel - (when m - (select-keys m - [:from :contact :amount :token :approve? :message :cancel? :hash :name :url :icons - :wc-version :params :connector :description :topic :relay :self :peer :permissions - :state])) view window-height on-close on-touch-outside - (if-not (nil? show-overlay?) show-overlay? true)])) diff --git a/src/legacy/status_im/ui/components/chat_icon/screen.cljs b/src/legacy/status_im/ui/components/chat_icon/screen.cljs index d053164c08..dabdf4dd12 100644 --- a/src/legacy/status_im/ui/components/chat_icon/screen.cljs +++ b/src/legacy/status_im/ui/components/chat_icon/screen.cljs @@ -3,7 +3,6 @@ [clojure.string :as string] [legacy.status-im.ui.components.chat-icon.styles :as styles] [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.screens.chat.photos :as photos] [legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils] [quo.components.avatars.user-avatar.style :as user-avatar.style] @@ -12,8 +11,7 @@ [re-frame.core :as re-frame.core] [react-native.core :as rn] [status-im.contexts.profile.utils :as profile.utils] - [utils.ens.core :as utils.ens] - [utils.image-server :as image-server])) + [utils.ens.core :as utils.ens])) ;;TODO REWORK THIS NAMESPACE @@ -37,20 +35,6 @@ [rn/text {:style (:default-chat-icon-text styles)} (get-name-first-char name)]])) -(defn chat-icon-view - [chat-id group-chat name styles] - [rn/view (:container styles) - (if group-chat - [default-chat-icon name styles] - (let [photo-path @(re-frame.core/subscribe [:chats/photo-path chat-id])] - [photos/photo photo-path styles]))]) - -(defn emoji-chat-icon - [emoji styles] - (when-not (string/blank? emoji) - [rn/view (:default-chat-icon styles) - [rn/text {:style (:default-chat-icon-text styles)} emoji]])) - (defn profile-photo-plus-dot-view [{:keys [public-key full-name customization-color photo-container photo-path community?]}] (let [theme @(re-frame.core/subscribe [:theme]) @@ -88,35 +72,6 @@ {:style dot-styles :accessibility-label dot-accessibility-label}])])) -(defn emoji-chat-icon-view - [chat-id group-chat name emoji styles] - [rn/view (:container styles) - (if group-chat - (if (string/blank? emoji) - [default-chat-icon name styles] - [emoji-chat-icon emoji styles]) - [profile-photo-plus-dot-view - {:public-key chat-id - :photo-container (:default-chat-icon styles)}])]) - -(defn chat-icon-view-chat-list - [chat-id group-chat name color] - [chat-icon-view chat-id group-chat name - {:container styles/container-chat-list - :size 40 - :chat-icon styles/chat-icon-chat-list - :default-chat-icon (styles/default-chat-icon-chat-list color) - :default-chat-icon-text (styles/default-chat-icon-text 40)}]) - -(defn chat-icon-view-chat-sheet - [chat-id group-chat name color] - [chat-icon-view chat-id group-chat name - {:container styles/container-chat-list - :size 40 - :chat-icon styles/chat-icon-chat-list - :default-chat-icon (styles/default-chat-icon-chat-list color) - :default-chat-icon-text (styles/default-chat-icon-text 40)}]) - (defn custom-icon-view-list [name color & [size]] [rn/view (styles/container-list-size (or size 40)) @@ -147,44 +102,4 @@ :default-chat-icon (styles/default-chat-icon-profile colors/default-chat-color size) :default-chat-icon-text (styles/default-chat-icon-text size)}]) -(defn profile-icon-view - [photo-path name color emoji edit? size override-styles public-key community?] - (let [styles (merge {:container {:width size :height size} - :size size - :chat-icon styles/chat-icon-profile - :default-chat-icon (styles/default-chat-icon-profile color size) - :default-chat-icon-text (if (string/blank? emoji) - (styles/default-chat-icon-text size) - (styles/emoji-chat-icon-text size))} - override-styles) - img-config (:config photo-path) - photo-path (if img-config - ;; temp support new media server avatar for old component - {:uri (image-server/get-image-uri - img-config - {:size size - :full-name name - :font-size (get-in styles [:default-chat-icon-text :font-size]) - :background-color (get-in styles [:default-chat-icon :background-color]) - :indicator-size 0 - :indicator-border 0 - :indicator-color "#000000" - :color (get-in styles [:default-chat-icon-text :color]) - :length 2 - :ring? (not (utils.ens/is-valid-eth-name? name)) - :ring-width 2})} - photo-path)] - [rn/view (:container styles) - (if (and photo-path (seq photo-path)) - [profile-photo-plus-dot-view - {:photo-path photo-path - :public-key public-key - :photo-container (:container styles) - :community? community?}] - [rn/view {:accessibility-label :chat-icon} - (if (string/blank? emoji) - [default-chat-icon name styles] - [emoji-chat-icon emoji styles])]) - (when edit? - [rn/view {:style (styles/chat-icon-profile-edit)} - [icons/tiny-icon :tiny-icons/tiny-edit {:color colors/white-persist}]])])) + diff --git a/src/legacy/status_im/ui/components/chat_icon/styles.cljs b/src/legacy/status_im/ui/components/chat_icon/styles.cljs index 8e7e2afb1f..7e93cba42e 100644 --- a/src/legacy/status_im/ui/components/chat_icon/styles.cljs +++ b/src/legacy/status_im/ui/components/chat_icon/styles.cljs @@ -1,7 +1,6 @@ (ns legacy.status-im.ui.components.chat-icon.styles (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.emoji-thumbnail.utils :as emoji-utils])) + [legacy.status-im.ui.components.colors :as colors])) (defn default-chat-icon [color] @@ -13,51 +12,6 @@ :border-radius 20 :background-color color}) -(defn default-chat-icon-redesign - [color size] - {:margin 0 - :width size - :height size - :align-items :center - :justify-content :center - :border-radius (/ size 2) - :background-color color}) - -(defn default-chat-icon-chat-list - [color] - (merge (default-chat-icon color) - {:width 40 - :height 40 - :border-radius 20})) - -(defn default-list-chat-icon-redesign - [color size] - (merge (default-chat-icon-redesign color size) - {:width size - :height size - :border-radius (/ size 2)})) - -(defn default-community-icon-chat-list - [color] - (merge (default-chat-icon color) - {:width 48 - :height 48 - :border-radius 48})) - -(defn default-token-icon-chat-list - [color] - (merge (default-chat-icon color) - {:width 20 - :height 20 - :border-radius 20})) - -(defn default-chat-icon-chat-toolbar - [color size] - (merge (default-chat-icon color) - {:width size - :height size - :border-radius size})) - (defn default-chat-icon-profile [color size] (merge (default-chat-icon color) @@ -72,71 +26,12 @@ :font-size (/ size 2) :line-height size}) -(defn emoji-chat-icon-text - [size] - {:font-size (emoji-utils/emoji-font-size size) - :line-height size - :margin-top (emoji-utils/emoji-top-margin-for-vertical-alignment size)}) ;; Required for vertical alignment bug - Check function defination for more info - (def chat-icon {:margin 4 :border-radius 20 :width 40 :height 40}) -(defn chat-icon-redesign - [size] - {:margin 4 - :border-radius (/ size 2) - :width size - :height size}) - -(def chat-icon-chat-list - (merge chat-icon - {:width 40 - :height 40 - :margin 0})) - -(defn community-status-icon - [size] - {:margin 4 - :border-radius 10 - :width size - :height size}) - -(def community-icon-chat-list - (merge chat-icon - {:width 48 - :height 48 - :margin 0})) - -(defn community-icon-chat-list-redesign - [size] - (merge (chat-icon size) - {:width size - :height size - :margin 0})) - -(defn community-status-chat-list-icon - [size] - (merge (community-status-icon size) - {:width size - :height size - :margin 0})) - -(def token-icon-chat-list - (merge chat-icon - {:width 20 - :height 20 - :margin 0})) - -(defn chat-icon-chat-toolbar - [size] - (merge chat-icon - {:width size - :height size - :margin 0})) - (defn custom-size-icon [size] (merge chat-icon @@ -144,44 +39,11 @@ :height size :margin 0})) -(def chat-icon-profile - (merge chat-icon - {:width 64 - :height 64 - :border-radius 32})) - (def container-chat-list {:width 40 :height 40}) -(def token-icon-container-chat-list - {:width 20 - :height 20}) - -(def community-icon-container-chat-list - {:width 48 - :height 48}) - (defn container-list-size [size] {:width size :height size}) - -(defn container-chat-toolbar - [size] - {:width size - :height size}) - -(defn chat-icon-profile-edit - [] - {:width 24 - :height 24 - :border-radius 12 - :border-width 1 - :border-color colors/white-persist - :background-color colors/blue - :justify-content :center - :align-items :center - :position :absolute - :bottom -2 - :right -2}) diff --git a/src/legacy/status_im/ui/components/checkbox/styles.cljs b/src/legacy/status_im/ui/components/checkbox/styles.cljs deleted file mode 100644 index 91495ce0bc..0000000000 --- a/src/legacy/status_im/ui/components/checkbox/styles.cljs +++ /dev/null @@ -1,15 +0,0 @@ -(ns legacy.status-im.ui.components.checkbox.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) - -(def wrapper - {:width 24 :height 24 :align-items :center :justify-content :center}) - -(defn icon-check-container - [checked?] - {:background-color (if checked? colors/blue colors/gray-lighter) - :align-items :center - :justify-content :center - :border-radius 2 - :width 18 - :height 18}) diff --git a/src/legacy/status_im/ui/components/checkbox/view.cljs b/src/legacy/status_im/ui/components/checkbox/view.cljs deleted file mode 100644 index f1a31dc8d4..0000000000 --- a/src/legacy/status_im/ui/components/checkbox/view.cljs +++ /dev/null @@ -1,27 +0,0 @@ -(ns legacy.status-im.ui.components.checkbox.view - (:require - [legacy.status-im.ui.components.checkbox.styles :as styles] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.react :as react])) - -(defn checkbox - "react/check-box is currently not available on iOS, - use it once it is available on all platforms" - [{:keys [on-value-change checked? accessibility-label style] - :or {accessibility-label :checkbox}}] - [(if on-value-change react/touchable-highlight react/view) - (merge {:style (merge - styles/wrapper - style) - :accessibility-label (str accessibility-label - "-" - (if checked? "on" "off"))} - (when on-value-change - {:on-press #(on-value-change (not checked?))})) - (if checked? - [icons/tiny-icon - :tiny-icons/tiny-check - {:container-style (styles/icon-check-container true) - :color colors/white-persist}] - [react/view {:style (styles/icon-check-container false)}])]) diff --git a/src/legacy/status_im/ui/components/colors.cljs b/src/legacy/status_im/ui/components/colors.cljs index c5f5875e26..374fd638aa 100644 --- a/src/legacy/status_im/ui/components/colors.cljs +++ b/src/legacy/status_im/ui/components/colors.cljs @@ -125,16 +125,12 @@ (def white-persist (:ui-background light-theme)) ;; this doesn't with theme (def white-transparent-10 (:interactive-03 light-theme)) ;; Used as icon background color for a dark foreground (def white-transparent (:icon-03 light-theme)) ;; Used as icon color on dark background and input placeholder color -(def white-transparent-persist (:icon-03 light-theme)) (def white-transparent-70 (:text-03 light-theme)) (def white-transparent-70-persist (:text-03 light-theme)) (def mentioned-background (:mentioned-background old-colors-mapping-light)) (def mentioned-border (:mentioned-border old-colors-mapping-light)) -(def red-light "#ffe5ea") ;; error tooltip TODO (andrey) should be white, but shadow - ;; needed - ;; BLACK (def black (:text-01 light-theme)) ;; Used as the default text color (def black-persist (:ui-background dark-theme)) ;; this doesn't with theme @@ -143,10 +139,7 @@ ;; color for containers like "Backup recovery phrase" (def black-transparent-20 (:backdrop light-theme)) ; accounts divider (def black-transparent-40 (:backdrop light-theme)) -(def black-transparent-40-persist (:backdrop light-theme)) (def black-transparent-50 (:backdrop light-theme)) -(def black-light "#2d2d2d") ;; sign-with-keycard-button -(def black-transparent-86 (:ui-03 light-theme)) ;; DARK GREY (def gray (:text-02 light-theme)) ;; Dark grey, used as a background for a light foreground and @@ -160,7 +153,7 @@ ;; ACCENT BLUE (def blue (:interactive-01 light-theme)) ;; Accent blue, used as main wallet color, and ios home add ;; button -(def blue-persist (:interactive-01 light-theme)) + ;; LIGHT BLUE (def blue-light (:interactive-02 light-theme)) ;; Light Blue (def blue-transparent-10 (alpha blue 0.1)) ;; unknown @@ -168,7 +161,7 @@ ;; RED (def red (:negative-01 light-theme)) ;; Used to highlight errors or "dangerous" actions (def red-transparent-10 (alpha red 0.1)) ;;action-row ;; ttt finish -(def red-audio-recorder "#fa6565") + ;; GREEN (def green "#44d058") ;; icon for successful inboud transaction @@ -177,32 +170,9 @@ ;; YELLOW (def pin-background (:pin-background old-colors-mapping-light)) ;; Light yellow, used as background for pinned messages -(def purple "#887af9") -(def orange "#FE8F59") -(def chat-colors - ["#fa6565" - "#7cda00" - purple - "#51d0f0" - orange - "#d37ef4"]) - -(def account-colors - ["#9B832F" - "#D37EF4" - "#1D806F" - "#FA6565" - "#7CDA00" - purple - "#8B3131"]) - -(def mention-incoming "#0DA4C9") -(def mention-outgoing "#9EE8FA") (def text black) (def text-gray gray) -(def default-community-color "#773377") - (def default-chat-color "#a187d5") ;; legacy ;; THEME diff --git a/src/legacy/status_im/ui/components/common/common.cljs b/src/legacy/status_im/ui/components/common/common.cljs index 88dc21646a..be1be60925 100644 --- a/src/legacy/status_im/ui/components/common/common.cljs +++ b/src/legacy/status_im/ui/components/common/common.cljs @@ -1,28 +1,10 @@ (ns legacy.status-im.ui.components.common.common (:require [legacy.status-im.ui.components.common.styles :as styles] - [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.components.react :as react] - [reagent.core :as reagent] - [utils.i18n :as i18n]) + [reagent.core :as reagent]) (:require-macros [legacy.status-im.utils.views :refer [defview letsubs]])) -(defn logo - [{:keys [size]}] - [icons/icon :icons/logo (styles/logo size)]) - -;;TODO DEPRECATED, use legacy.status-im.ui.components.badge -(defn counter - ([value] (counter nil value)) - ([{:keys [size accessibility-label] :or {size 18}} value] - (let [more-than-9 (> value 9)] - [react/view {:style (styles/counter-container size)} - [react/text - (cond-> {:style (styles/counter-label size)} - accessibility-label - (assoc :accessibility-label accessibility-label)) - (if more-than-9 (i18n/label :t/counter-9-plus) value)]]))) - (def small-screen-image-k 0.8) (def small-screen-height 600) diff --git a/src/legacy/status_im/ui/components/common/styles.cljs b/src/legacy/status_im/ui/components/common/styles.cljs index 95a5f787a3..d6052db7df 100644 --- a/src/legacy/status_im/ui/components/common/styles.cljs +++ b/src/legacy/status_im/ui/components/common/styles.cljs @@ -11,29 +11,6 @@ :align-items :center :justify-content :center}) -(defn logo - [icon-size] - {:width icon-size - :height icon-size - :color :none - :container-style {}}) - -(defn counter-container - [size] - {:width size - :height size - :border-radius (/ size 2) - :background-color colors/blue - :align-items :center - :justify-content :center}) - -(defn counter-label - [size] - {:font-size (inc (/ size 2)) - :typography :main-medium - :color colors/white-persist - :text-align :center}) - (def image-contain {:align-self :stretch :align-items :center diff --git a/src/legacy/status_im/ui/components/copyable_text.cljs b/src/legacy/status_im/ui/components/copyable_text.cljs deleted file mode 100644 index c6cd8bc3b3..0000000000 --- a/src/legacy/status_im/ui/components/copyable_text.cljs +++ /dev/null @@ -1,129 +0,0 @@ -(ns legacy.status-im.ui.components.copyable-text - (:require - [legacy.status-im.ui.components.animation :as animation] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.react :as react] - [reagent.core :as reagent] - [utils.i18n :as i18n])) - -(defn hide-cue-atom - [anim-opacity anim-y cue-atom] - (animation/start - (animation/parallel - [(animation/timing - anim-opacity - {:toValue 0 - :duration 140 - :delay 1000 - :easing (.-ease ^js animation/easing) - :useNativeDriver true}) - (animation/timing - anim-y - {:toValue 0 - :duration 140 - :delay 1000 - :easing (.-ease ^js animation/easing) - :useNativeDriver true})]) - #(reset! cue-atom false))) - -(defn show-cue-atom - [anim-opacity anim-y cue-atom y] - (when @cue-atom - (animation/start - (animation/parallel - [(animation/timing - anim-opacity - {:toValue 1 - :duration 140 - :easing (.-ease ^js animation/easing) - :useNativeDriver true}) - (animation/timing - anim-y - {:toValue y - :duration 140 - :easing (.-ease ^js animation/easing) - :useNativeDriver true})]) - #(hide-cue-atom anim-opacity anim-y cue-atom)))) - -(defn copy-action-visual-cue - [anim-opacity anim-y width cue-atom] - [react/animated-view - {:style - {:opacity anim-opacity - :transform [{:translateY anim-y}] - :max-width @width - :z-index (if @cue-atom 1 -1) - :height 34 - :position :absolute - :border-radius 8 - :align-self :center - :align-items :center - :justify-content :center - :shadow-offset {:width 0 :height 4} - :shadow-radius 12 - :elevation 8 - :shadow-opacity 1 - :shadow-color "rgba(0, 34, 51, 0.08)" - :background-color colors/white}} - [react/view - {:padding-horizontal 16 - :padding-vertical 7 - :border-radius 8 - :background-color colors/white - :shadow-offset {:width 0 :height 2} - :shadow-radius 4 - :shadow-opacity 1 - :shadow-color "rgba(0, 34, 51, 0.16)"} - [react/text - {:style - {:typography :main-medium - ;; line height specified here because of figma spec - :line-height 20 - :font-size 14}} - (i18n/label :t/sharing-copied-to-clipboard)]]]) - -(defn copyable-text-view - [{:keys [label container-style]} content] - (let [cue-atom (reagent/atom false) - background-color (or (get container-style :background-color) colors/white) - width (reagent/atom 0) - height (reagent/atom 0) - anim-y (animation/create-value 0) - anim-opacity (animation/create-value 0)] - (reagent/create-class - {:reagent-render - (fn [{:keys [copied-text]} _] - (let [copy-fn #(when (not @cue-atom) - (reset! cue-atom true) - (show-cue-atom - anim-opacity - anim-y - cue-atom - (if (> @height 34) - (- (/ @height 2)) - (- (+ 17 @height)))) - (react/copy-to-clipboard copied-text))] - [react/view - {:style (if container-style container-style {}) - :on-layout - #(do - (reset! width (-> ^js % .-nativeEvent .-layout .-width)) - (reset! height (-> ^js % .-nativeEvent .-layout .-height)))} - (when label - [react/text - {:style - {:font-size 13 - ;; line height specified here because of figma spec - :line-height 18 - :font-weight "500" - :color colors/gray - :margin-bottom 4}} - (i18n/label label)]) - [copy-action-visual-cue anim-opacity anim-y width cue-atom] - [react/touchable-highlight - {:active-opacity (if @cue-atom 1 0.85) - :underlay-color colors/black - :on-press copy-fn - :on-long-press copy-fn} - [react/view {:background-color background-color} - content]]]))}))) diff --git a/src/legacy/status_im/ui/components/core.cljs b/src/legacy/status_im/ui/components/core.cljs index 3e914580f0..a8fa3a41c5 100644 --- a/src/legacy/status_im/ui/components/core.cljs +++ b/src/legacy/status_im/ui/components/core.cljs @@ -1,10 +1,8 @@ (ns legacy.status-im.ui.components.core (:require - [legacy.status-im.ui.components.animated-header :as animated-header] [legacy.status-im.ui.components.button.view :as button] [legacy.status-im.ui.components.controls.view :as controls] [legacy.status-im.ui.components.header :as header] - [legacy.status-im.ui.components.list.footer :as list-footer] [legacy.status-im.ui.components.list.header :as list-header] [legacy.status-im.ui.components.separator :as separator] [legacy.status-im.ui.components.text :as text] @@ -12,11 +10,8 @@ (def text text/text) (def header header/header) -(def animated-header animated-header/header) (def text-input text-input/text-input) (def button button/button) (def list-header list-header/header) -(def list-footer list-footer/footer) - (def radio controls/radio) (def separator separator/separator) diff --git a/src/legacy/status_im/ui/components/emoji_thumbnail/color_picker.cljs b/src/legacy/status_im/ui/components/emoji_thumbnail/color_picker.cljs deleted file mode 100644 index 53577c6d16..0000000000 --- a/src/legacy/status_im/ui/components/emoji_thumbnail/color_picker.cljs +++ /dev/null @@ -1,52 +0,0 @@ -(ns legacy.status-im.ui.components.emoji-thumbnail.color-picker - (:require - [legacy.status-im.ui.components.emoji-thumbnail.styles :as styles] - [react-native.core :as rn])) - -(def emoji-picker-colors-row1 - [{:name "red" :color "#F5A3A3" :key "1"} - {:name "pink" :color "#F5A3BF" :key "2"} - {:name "magenta" :color "#E9A3F5" :key "3"} - {:name "purple" :color "#C0A3F5" :key "4"} - {:name "indigo" :color "#A3B0F5" :key "5"} - {:name "blue" :color "#A3C2F5" :key "6"} - {:name "cyan" :color "#A3DCF5" :key "7"}]) - -(def emoji-picker-colors-row2 - [{:name "teal" :color "#A3ECF5" :key "8"} - {:name "mint" :color "#A3F5E2" :key "9"} - {:name "green" :color "#A3F5BA" :key "10"} - {:name "moss" :color "#CFF5A3" :key "11"} - {:name "lemon" :color "#EEF5A3" :key "12"} - {:name "yellow" :color "#F5F5A3" :key "13"}]) - -(def emoji-picker-colors-row3 - [{:name "honey" :color "#F5E4A3" :key "14"} - {:name "orange" :color "#F5D7A3" :key "15"} - {:name "peach" :color "#F5B6A3" :key "16"} - {:name "brown" :color "#E0C2B8" :key "17"} - {:name "grey" :color "#CCCCCC" :key "18"} - {:name "dove" :color "#DAE2E7" :key "19"} - {:name "white" :color "#FFFFFF" :key "20"}]) - -(defn colors-row - [color-circle container-style colors] - [rn/view {:style container-style :accessibility-label :colors-row} - (for [x colors] - [color-circle x])]) - -(defn color-picker-section - [color-circle] - [:<> - [colors-row ;; Row - 1st - color-circle - (merge styles/emoji-picker-color-row-container styles/emoji-picker-row1-style) - emoji-picker-colors-row1] - [colors-row ;; Row - 2nd - color-circle - (merge styles/emoji-picker-color-row-container styles/emoji-picker-row2-style) - emoji-picker-colors-row2] - [colors-row ;; Row - 3rd - color-circle - (merge styles/emoji-picker-color-row-container styles/emoji-picker-row3-style) - emoji-picker-colors-row3]]) diff --git a/src/legacy/status_im/ui/components/emoji_thumbnail/preview.cljs b/src/legacy/status_im/ui/components/emoji_thumbnail/preview.cljs deleted file mode 100644 index f424d87ee7..0000000000 --- a/src/legacy/status_im/ui/components/emoji_thumbnail/preview.cljs +++ /dev/null @@ -1,19 +0,0 @@ -(ns legacy.status-im.ui.components.emoji-thumbnail.preview - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.emoji-thumbnail.styles :as styles] - [legacy.status-im.ui.components.react :as react])) - -(defn emoji-thumbnail - [emoji color size] - (when-not (string/blank? emoji) - [react/view (styles/emoji-thumbnail-icon color size) - [react/text - {:style (styles/emoji-thumbnail-icon-text size) - :accessibility-label :thumbnail-emoji} emoji]])) - -(defn emoji-thumbnail-touchable - [emoji color size func] - (when-not (string/blank? emoji) - [react/touchable-opacity {:on-press func} - [emoji-thumbnail emoji color size]])) diff --git a/src/legacy/status_im/ui/components/emoji_thumbnail/styles.cljs b/src/legacy/status_im/ui/components/emoji_thumbnail/styles.cljs deleted file mode 100644 index 5449c02cc8..0000000000 --- a/src/legacy/status_im/ui/components/emoji_thumbnail/styles.cljs +++ /dev/null @@ -1,171 +0,0 @@ -(ns legacy.status-im.ui.components.emoji-thumbnail.styles - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.emoji-thumbnail.utils :as emoji-utils] - [react-native.platform :as platform])) - -(defn emoji-thumbnail-icon - [color size] - {:width size - :height size - :align-items :center - :justify-content :center - :border-radius (/ size 2) - :background-color color - :border-width 0.5 - :border-color "rgba(0,0,0,0.1)" - :accessibility-label :thumbnail-container-circle}) - -(defn emoji-thumbnail-icon-text - [size] - {:font-size (emoji-utils/emoji-font-size size) - :line-height size - :margin-top (emoji-utils/emoji-top-margin-for-vertical-alignment size)}) ;; Required for vertical alignment bug - Check function defination for more info - - -;; Styles Related to Emoji Thumbnail Picker - -(def emoji-thumbnail-preview-size 60) - -(def emoji-picker-upper-components-size - (if platform/android? 350 405)) - -(defn emoji-picker-gray-color - [] - (if (colors/dark?) "#c3c3bc99" "#3C3C4399")) - -(defn emoji-picker-category-container - [] - (if (colors/dark?) "#110d0a" "#EEF2F5")) - -(defn emoji-picker-active-category-container - [] - (if (colors/dark?) "#87877f33" "#78788033")) - -(defn emoji-picker-active-category-color - [] - (if (colors/dark?) "#bbbbbb" "#000000")) - -(def emoji-thumbnail-preview - {:margin-top 16 - :margin-bottom 16 - :align-items :center - :justify-content :center - :accessibility-label :emoji-preview}) - -(defn emoji-picker-keyboard-container - [] - {:border-radius 0 - :background-color (colors/get-color :ui-background)}) - -(defn emoji-picker-search-bar - [] - {:border-radius 10 - :height 36 - :background-color (:ui-01 @colors/theme)}) - -(defn emoji-picker-search-bar-text - [] - {:color (emoji-picker-gray-color)}) - -(defn emoji-picker-header - [] - {:font-size 13 - :color (emoji-picker-gray-color) - :font-weight "600" - :margin-top 7 - :margin-bottom 0}) - -(defn emoji-keyboard - [func] - {:onEmojiSelected func - :emojiSize 23 - :containerStyles (emoji-picker-keyboard-container) - :categoryPosition "floating" - :categoryContainerColor (emoji-picker-category-container) - :activeCategoryColor (emoji-picker-active-category-color) - :activeCategoryContainerColor (emoji-picker-active-category-container) - :categoryColor (emoji-picker-gray-color) - :enableSearchBar true - :searchBarTextStyles (emoji-picker-search-bar-text) - :searchBarStyles (emoji-picker-search-bar) - :searchBarPlaceholderColor (emoji-picker-gray-color) - :closeSearchColor (emoji-picker-gray-color) - :headerStyles (emoji-picker-header) - :disabledCategory ["symbols"]}) - -(def emoji-picker-color-row-container - {:flex-direction "row" - :justify-content "space-around" - :flex-grow 1}) - -(def emoji-picker-row1-style - {:margin-top 10}) - -(def emoji-picker-row2-style - {:margin-top 10 - :margin-bottom 10 - :margin-left 25 - :margin-right 25}) - -(def emoji-picker-row3-style - {:margin-bottom 10}) - -(defn emoji-picker-color-border - [item_color color-selected?] - {:height 44 - :width 44 - :border-radius 22 - :border-width 2 - :border-color (if color-selected? item_color "#00000000") - :align-items :center - :justify-content :center}) - -(defn emoji-picker-color - [item_color] - {:height 36 - :width 36 - :border-radius 18 - :border-width 0.5 - :background-color item_color - :border-color "rgba(0,0,0,0.1)"}) - -(def emoji-picker-default-thumbnails - [{:emoji "๐Ÿบ" :color "#CCCCCC"} - {:emoji "๐Ÿ†" :color "#F5E4A3"} - {:emoji "๐Ÿฆ€" :color "#F5A3A3"} - {:emoji "๐Ÿ" :color "#F5D7A3"} - {:emoji "๐Ÿณ" :color "#A3DCF5"} - {:emoji "๐Ÿฆ•" :color "#CFF5A3"} - {:emoji "๐Ÿฅ" :color "#F5F5A3"} - {:emoji "๐Ÿ‡" :color "#DAE2E7"} - {:emoji "๐Ÿ’" :color "#E0C2B8"} - {:emoji "๐Ÿฆ" :color "#CCCCCC"} - {:emoji "๐Ÿค " :color "#E0C2B8"} - {:emoji "๐Ÿ‘พ" :color "#F5A3BF"} - {:emoji "๐Ÿ•ด๏ธ" :color "#CCCCCC"} - {:emoji "๐Ÿ’ƒ" :color "#F5A3A3"} - {:emoji "๐Ÿฆน" :color "#E9A3F5"} - {:emoji "๐Ÿ•" :color "#F5D7A3"} - {:emoji "๐Ÿฆ‡" :color "#C0A3F5"} - {:emoji "๐Ÿฆœ" :color "#F5A3A3"} - {:emoji "๐Ÿข" :color "#CFF5A3"} - {:emoji "๐ŸฆŽ" :color "#CFF5A3"} - {:emoji "๐ŸŠ" :color "#CFF5A3"} - {:emoji "๐Ÿฆ‹" :color "#F5B6A3"} - {:emoji "๐Ÿ•ธ๏ธ" :color "#CCCCCC"} - {:emoji "๐Ÿฆˆ" :color "#A3DCF5"} - {:emoji "โ˜˜๏ธ" :color "#CFF5A3"} - {:emoji "๐Ÿ‡" :color "#E9A3F5"} - {:emoji "๐ŸŽ" :color "#F5B6A3"} - {:emoji "๐Ÿฅฅ" :color "#E0C2B8"} - {:emoji "๐Ÿง€" :color "#F5E4A3"} - {:emoji "๐Ÿฅช" :color "#F5D7A3"} - {:emoji "๐Ÿฅฃ" :color "#A3DCF5"} - {:emoji "๐Ÿœ" :color "#F5B6A3"} - {:emoji "๐Ÿง" :color "#A3DCF5"} - {:emoji "โ˜•" :color "#DAE2E7"} - {:emoji "๐Ÿท" :color "#F5A3A3"} - {:emoji "๐Ÿš†" :color "#A3DCF5"} - {:emoji "๐Ÿ‘“" :color "#CCCCCC"} - {:emoji "๐ŸŽถ" :color "#A3DCF5"}]) diff --git a/src/legacy/status_im/ui/components/emoji_thumbnail/utils.cljs b/src/legacy/status_im/ui/components/emoji_thumbnail/utils.cljs deleted file mode 100644 index 57ef46d6b1..0000000000 --- a/src/legacy/status_im/ui/components/emoji_thumbnail/utils.cljs +++ /dev/null @@ -1,16 +0,0 @@ -(ns legacy.status-im.ui.components.emoji-thumbnail.utils - (:require - [react-native.platform :as platform])) - -(defn emoji-font-size - [container_size] - (int (* (/ container_size 10) 6))) - -;; React Native Bug: Till version 0.65 React Native has a bug. It doesn't center text/emoji -;; inside the container(In Android & Web Only). Even with the textAlign: "center" and other properties. -;; So this top margin is required so that emoji will center in the emoji circle. -;; More Info: https://github.com/facebook/react-native/issues/32198 -;; TODO: Remove this top margin, if future updates of react-native fix this issue. -(defn emoji-top-margin-for-vertical-alignment - [container_size] - (if platform/android? (- (int (/ container_size 20))) 0)) diff --git a/src/legacy/status_im/ui/components/invite/views.cljs b/src/legacy/status_im/ui/components/invite/views.cljs deleted file mode 100644 index c52fea8955..0000000000 --- a/src/legacy/status_im/ui/components/invite/views.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns legacy.status-im.ui.components.invite.views - (:require - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.list.item :as list.item] - [re-frame.core :as re-frame] - [utils.i18n :as i18n])) - -(defn button - [] - [quo/button - {:on-press #(re-frame/dispatch [:invite.events/share-link nil]) - :accessibility-label :invite-friends-button} - (i18n/label :t/invite-friends)]) - -(defn list-item - [{:keys [accessibility-label]}] - [list.item/list-item - {:theme :accent - :title (i18n/label :t/invite-friends) - :icon :main-icons/share - :accessibility-label accessibility-label - :on-press (fn [] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (js/setTimeout - #(re-frame/dispatch [:invite.events/share-link nil]) - 250))}]) - - - - diff --git a/src/legacy/status_im/ui/components/keyboard_avoid_presentation.cljs b/src/legacy/status_im/ui/components/keyboard_avoid_presentation.cljs deleted file mode 100644 index e3e4a8bb8e..0000000000 --- a/src/legacy/status_im/ui/components/keyboard_avoid_presentation.cljs +++ /dev/null @@ -1,17 +0,0 @@ -(ns legacy.status-im.ui.components.keyboard-avoid-presentation - (:require - [legacy.status-im.ui.components.react :as react] - [react-native.utils :as rn.utils] - [reagent.core :as reagent])) - -(defn keyboard-avoiding-view - [& argv] - (let [[props children] (rn.utils/get-props-and-children argv)] - (reagent/as-element - (into [react/keyboard-avoiding-view - (update props - :keyboard-vertical-offset - + - 20 - (if (:ignore-offset props) 44 0))] - children)))) diff --git a/src/legacy/status_im/ui/components/list/footer.cljs b/src/legacy/status_im/ui/components/list/footer.cljs deleted file mode 100644 index 844758d6ec..0000000000 --- a/src/legacy/status_im/ui/components/list/footer.cljs +++ /dev/null @@ -1,18 +0,0 @@ -(ns legacy.status-im.ui.components.list.footer - (:require - [legacy.status-im.ui.components.spacing :as spacing] - [legacy.status-im.ui.components.text :as text] - [react-native.core :as rn] - [react-native.utils :as rn.utils])) - -(defn footer - [& argv] - (let [[props children] (rn.utils/get-props-and-children argv) - {:keys [color] - :or {color :secondary}} - props] - [rn/view - {:style (merge (:base spacing/padding-horizontal) - (:small spacing/padding-vertical))} - (into [text/text {:color color}] - children)])) diff --git a/src/legacy/status_im/ui/components/list/styles.cljs b/src/legacy/status_im/ui/components/list/styles.cljs index edef95b639..edcccd7fe0 100644 --- a/src/legacy/status_im/ui/components/list/styles.cljs +++ b/src/legacy/status_im/ui/components/list/styles.cljs @@ -3,47 +3,6 @@ [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.utils.styles :as styles])) -(def item - {:flex-direction :row - :justify-content :center - :padding-horizontal 16}) - -(def item-content-view - {:flex 1 - :flex-direction :column - :justify-content :center}) - -(def item-checkbox - {:flex 1 - :flex-direction :column - :align-items :center - :justify-content :center}) - -(def icon-size 24) -(def icon-wrapper-size (+ icon-size (* 2 8))) - -(def item-icon-wrapper - {:width icon-wrapper-size - :height icon-wrapper-size - :align-items :center - :justify-content :center}) - -(def item-icon - {:width icon-size - :height icon-size}) - -(def left-item-wrapper - {:justify-content :center - :margin-vertical 12}) - -(def content-item-wrapper - {:flex 1 - :justify-content :center - :margin-horizontal 16}) - -(def right-item-wrapper - {:justify-content :center}) - (def base-separator {:height 1 :background-color colors/black-transparent}) diff --git a/src/legacy/status_im/ui/components/profile_header/view.cljs b/src/legacy/status_im/ui/components/profile_header/view.cljs deleted file mode 100644 index 5a24a2dd93..0000000000 --- a/src/legacy/status_im/ui/components/profile_header/view.cljs +++ /dev/null @@ -1,110 +0,0 @@ -(ns legacy.status-im.ui.components.profile-header.view - (: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.core :as quo] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.spacing :as spacing] - [react-native.core :as rn] - [react-native.reanimated :as animated])) - -(def avatar-extended-size 64) -(def avatar-minimized-size 40) -(def subtitle-margin 4) - -(defn container-style - [{:keys [animation minimized]}] - (merge {:flex-direction :row - :padding-vertical 4 - :align-items :center} - (if-not minimized - (:base spacing/padding-horizontal) - {:opacity animation}))) - -(defn header-bottom-separator - [] - {:margin-bottom (:tiny spacing/spacing) - :height (:small spacing/spacing) - :border-bottom-width 1 - :border-bottom-color (:ui-01 @colors/theme)}) - -(defn header-text - [] - {:padding-left (:base spacing/spacing) - :flex 1 - :justify-content :center}) - -(defn header-subtitle - [{:keys [minimized]}] - (merge {:padding-right (:large spacing/spacing) - :flex-direction :row - :align-items :center} - (when-not minimized - {:padding-top subtitle-margin}))) - -(defn extended-header - [{:keys [title photo color membership subtitle subtitle-icon on-edit on-press monospace - bottom-separator emoji public-key community?] - :or {bottom-separator true}}] - (fn [{:keys [animation minimized]}] - (let [wrapper (if on-press - [rn/touchable-opacity {:on-press on-press}] - [:<>]) - editable (if (and (not minimized) on-edit) - [rn/touchable-opacity {:on-press on-edit}] - [:<>])] - (into - wrapper - [[animated/view {:pointer-events :box-none} - [animated/view - {:style (container-style {:animation animation - :minimized minimized}) - :pointer-events :box-none} - (into editable - [[animated/view {:pointer-events :box-none} - [chat-icon.screen/profile-icon-view - photo title color emoji (and (not minimized) on-edit) - (if minimized avatar-minimized-size avatar-extended-size) - nil public-key community?]]]) - [animated/view - {:style (header-text) - :pointer-events :box-none} - [quo/text - {:animated? true - :number-of-lines (if minimized 1 2) - :size (if minimized :base :x-large) - :weight :bold - :elipsize-mode :tail - :accessibility-role :text - :accessibility-label :default-username} - title] - (when membership - [quo/text - {:number-of-lines 1 - :ellipsize-mode :middle - :monospace monospace - :size (if minimized :small :base) - :color :secondary} - membership]) - (when subtitle - [animated/view - {:style (header-subtitle {:minimized minimized}) - :pointer-events :box-none} - (when subtitle-icon - [icons/icon subtitle-icon - {:color (:icon-02 @colors/theme) - :width 16 - :height 16 - :container-style {:margin-right 4}}]) - [quo/text - {:number-of-lines 1 - :ellipsize-mode :middle - :monospace monospace - :size (if minimized :small :base) - :color :secondary} - subtitle]])]] - (when-not minimized - [animated/view - {:pointer-events :none - :style (when bottom-separator (header-bottom-separator))}])]])))) - diff --git a/src/legacy/status_im/ui/components/react.cljs b/src/legacy/status_im/ui/components/react.cljs index ce9abf362c..6027922d67 100644 --- a/src/legacy/status_im/ui/components/react.cljs +++ b/src/legacy/status_im/ui/components/react.cljs @@ -2,26 +2,19 @@ (:require ["@react-native-clipboard/clipboard" :default Clipboard] ["@react-native-community/blur" :as blur] - ["@react-native-community/masked-view" :default MaskedView] ["react" :as reactjs] - ["react-native" :as react-native :refer (Keyboard BackHandler)] + ["react-native" :as react-native :refer (Keyboard)] ["react-native-fast-image" :as FastImage] - ["react-native-image-crop-picker" :default image-picker] - ["react-native-linear-gradient" :default LinearGradient] ["react-native-navigation" :refer (Navigation)] [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.text-style :as typography] - [legacy.status-im.utils.utils :as utils] [react-native.platform :as platform] [reagent.core :as reagent] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) + [utils.i18n :as i18n])) -(def native-modules (.-NativeModules react-native)) ;; React Components -(def app-state (.-AppState react-native)) (def view (reagent/adapt-react-class (.-View react-native))) (def scroll-view-class (reagent/adapt-react-class (.-ScrollView react-native))) @@ -34,15 +27,6 @@ (def fast-image-class (reagent/adapt-react-class FastImage)) -(defn image-get-size [uri callback] (.getSize (.-Image react-native) uri callback)) -(defn resolve-asset-source - [uri] - (js->clj (.resolveAssetSource (.-Image react-native) uri) :keywordize-keys true)) - -(def linear-gradient (reagent/adapt-react-class LinearGradient)) - -(def masked-view (reagent/adapt-react-class MaskedView)) - (def blur-view (reagent/adapt-react-class (.-BlurView blur))) (defn valid-source? @@ -64,23 +48,12 @@ [switch-class props]) (def touchable-highlight-class (reagent/adapt-react-class (.-TouchableHighlight react-native))) -(def pressable-class (reagent/adapt-react-class (.-Pressable react-native))) -(def touchable-without-feedback-class - (reagent/adapt-react-class (.-TouchableWithoutFeedback react-native))) -(def touchable-opacity-class (reagent/adapt-react-class (.-TouchableOpacity react-native))) (def activity-indicator-class (reagent/adapt-react-class (.-ActivityIndicator react-native))) (defn activity-indicator [props] [activity-indicator-class (update props :color #(or % colors/gray))]) -(defn small-loading-indicator - [color] - [activity-indicator - {:color color - :ios {:size :small} - :android {:size :16}}]) - (def animated (.-Animated react-native)) (def animated-view-class @@ -89,19 +62,11 @@ (def animated-flat-list-class (reagent/adapt-react-class (.-FlatList ^js animated))) -(def animated-scroll-view-class - (reagent/adapt-react-class (.-ScrollView ^js animated))) - (defn animated-view [props & content] (vec (conj content props animated-view-class))) -(defn animated-scroll-view - [props & children] - (vec (conj children props animated-scroll-view-class))) - (def dimensions (.-Dimensions react-native)) -(def keyboard (.-Keyboard react-native)) (def dismiss-keyboard! #(.dismiss ^js Keyboard)) (def linking (.-Linking react-native)) @@ -190,61 +155,16 @@ [{style :style k :key}] [text {:style style} (i18n/label k)]) -(defn touchable-opacity - [props content] - [touchable-opacity-class props content]) - (defn touchable-highlight [props content] [touchable-highlight-class (merge {:underlay-color :transparent} props) content]) -(defn pressable - [props content] - [pressable-class props content]) - -(defn touchable-without-feedback - [props content] - [touchable-without-feedback-class - props - content]) - (defn get-dimensions [name] (js->clj (.get ^js dimensions name) :keywordize-keys true)) -;; Image picker -(defn show-access-error - [o] - (when (= "E_PERMISSION_MISSING" (.-code ^js o)) - (utils/show-popup (i18n/label :t/error) - (i18n/label :t/photos-access-error)))) - -(defn show-image-picker - ([images-fn] - (show-image-picker images-fn nil nil)) - ([images-fn - {:keys [media-type] - :or {media-type "any"} - :as props} - finally-callback] - (-> ^js image-picker - (.openPicker (clj->js (merge {:mediaType media-type} - props))) - (.then images-fn) - (.catch show-access-error) - (.finally finally-callback)))) - -(defn show-image-picker-camera - ([images-fn] - (show-image-picker-camera images-fn nil nil)) - ([images-fn props finally-callback] - (-> ^js image-picker - (.openCamera (clj->js props)) - (.then images-fn) - (.catch show-access-error) - (.finally finally-callback)))) ;; Clipboard @@ -255,10 +175,7 @@ [s] (.setString ^js Clipboard s)) -(defn get-from-clipboard - [clbk] - (let [clipboard-contents (.getString ^js Clipboard)] - (.then clipboard-contents #(clbk %)))) + ;; KeyboardAvoidingView (def navigation-const (atom nil)) @@ -278,42 +195,6 @@ (update props :keyboard-vertical-offset + 44 (:status-bar-height @navigation-const))))] children)) -(defn keyboard-avoiding-view-new - [props & children] - (into [keyboard-avoiding-view-class - (merge (when platform/ios? {:behavior :padding}) - (if (:ignore-offset props) - props - (update props :keyboard-vertical-offset + 44)))] - children)) - (defn scroll-view [props & children] (vec (conj children props scroll-view-class))) - -(views/defview with-activity-indicator - [{:keys [timeout style enabled? preview]} component] - (views/letsubs - [loading (reagent/atom true)] - {:component-did-mount (fn [] - (if (or (nil? timeout) - (> 100 timeout)) - (reset! loading false) - (utils/set-timeout #(reset! loading false) - timeout)))} - (if (and (not enabled?) @loading) - (or preview - [view - {:style (or style - {:justify-content :center - :align-items :center})} - [activity-indicator {:animating true}]]) - component))) - -(defn hw-back-add-listener - [callback] - (.addEventListener BackHandler "hardwareBackPress" callback)) - -(defn hw-back-remove-listener - [callback] - (.removeEventListener BackHandler "hardwareBackPress" callback)) diff --git a/src/legacy/status_im/ui/components/search_input/view.cljs b/src/legacy/status_im/ui/components/search_input/view.cljs deleted file mode 100644 index 86b7e06c17..0000000000 --- a/src/legacy/status_im/ui/components/search_input/view.cljs +++ /dev/null @@ -1,45 +0,0 @@ -(ns legacy.status-im.ui.components.search-input.view - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.core :as quo] - [reagent.core :as reagent] - [utils.i18n :as i18n])) - -(defn search-input-old - [{:keys [search-active?]}] - (let [input-ref (atom nil) - search-active? (or search-active? (reagent/atom nil))] - (fn [{:keys [on-focus on-change on-blur on-cancel search-filter auto-focus]}] - [quo/text-input - {:placeholder (i18n/label :t/search) - :accessibility-label :search-input - :blur-on-submit true - :multiline false - :get-ref #(reset! input-ref %) - :default-value search-filter - :auto-focus auto-focus - :on-cancel on-cancel - :show-cancel true - :auto-correct false - :auto-capitalize :none - :input-style {:height 36 - :padding-top 2 - :padding-bottom 2} - :before {:icon :main-icons/search - :style {:padding-horizontal 8} - :on-press #(some-> ^js @input-ref - (.focus)) - :icon-opts {:color (:icon-02 @colors/theme)}} - :on-focus #(do - (when on-focus - (on-focus search-filter)) - (reset! search-active? true)) - :on-blur #(do - (when on-blur - (on-blur)) - (reset! search-active? false)) - :on-change (fn [e] - (let [^js native-event (.-nativeEvent ^js e) - text (.-text native-event)] - (when on-change - (on-change text))))}]))) diff --git a/src/legacy/status_im/ui/components/slider.cljs b/src/legacy/status_im/ui/components/slider.cljs deleted file mode 100644 index 71fb37f8a9..0000000000 --- a/src/legacy/status_im/ui/components/slider.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns legacy.status-im.ui.components.slider - (:require - ["@react-native-community/slider" :default Slider] - ["react-native" :refer (Animated)] - [reagent.core :as reagent])) - -(def slider (reagent/adapt-react-class Slider)) - -(def animated-slider - (reagent/adapt-react-class (.createAnimatedComponent Animated Slider))) diff --git a/src/legacy/status_im/ui/components/tabs.cljs b/src/legacy/status_im/ui/components/tabs.cljs deleted file mode 100644 index fbadd6bc81..0000000000 --- a/src/legacy/status_im/ui/components/tabs.cljs +++ /dev/null @@ -1,36 +0,0 @@ -(ns legacy.status-im.ui.components.tabs - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.react :as react])) - -(defn tab-title - [state k label active?] - [react/view {:align-items :center} - [react/touchable-highlight - {:on-press #(swap! state assoc :tab k) - :underlay-color colors/gray-lighter - :accessibility-label (str label "-item-button") - :style {:border-radius 8}} - [react/view {:padding-horizontal 12 :padding-vertical 8} - [react/text - {:style {:font-weight "500" :color (if active? colors/blue colors/gray) :line-height 22}} - label]]] - (when active? - [react/view {:width 24 :height 3 :border-radius 4 :background-color colors/blue}])]) - -(defn tab-button - [state k label active?] - [react/view - {:flex 1 - :align-items :center - :border-radius 8 - :background-color (if active? colors/blue colors/blue-light)} - [react/touchable-highlight - {:on-press #(swap! state assoc :tab k) - :accessibility-label (str label "-item-button") - :style {:border-radius 8} - :flex 1} - [react/view {:padding-horizontal 12 :padding-vertical 8} - [react/text - {:style {:font-weight "500" :color (if active? colors/white colors/blue) :line-height 22}} - label]]]]) diff --git a/src/legacy/status_im/ui/components/text_input.cljs b/src/legacy/status_im/ui/components/text_input.cljs index e47883c64b..ff67c2d642 100644 --- a/src/legacy/status_im/ui/components/text_input.cljs +++ b/src/legacy/status_im/ui/components/text_input.cljs @@ -26,8 +26,6 @@ (s/nilable (s/or :string string? :component vector?))) (s/def ::cancel-label (s/nilable string?)) -(s/def ::default-value (s/nilable string?)) -(s/def ::placeholder (s/nilable string?)) (s/def ::keyboard-type (s/nilable (s/or :string string? :keyword keyword?))) ; TODO: make set diff --git a/src/legacy/status_im/ui/components/toastable_highlight.cljs b/src/legacy/status_im/ui/components/toastable_highlight.cljs deleted file mode 100644 index d28dd1873e..0000000000 --- a/src/legacy/status_im/ui/components/toastable_highlight.cljs +++ /dev/null @@ -1,121 +0,0 @@ -(ns legacy.status-im.ui.components.toastable-highlight - "A wrapped touchable highlight that presents a toast when clicked" - (:require - [legacy.status-im.ui.components.animation :as animation] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.react :as react] - [reagent.core :as reagent])) - -(defn hide-cue-atom - [anim-opacity anim-y cue-atom] - (animation/start - (animation/parallel - [(animation/timing - anim-opacity - {:toValue 0 - :duration 140 - :delay 1000 - :easing (.-ease ^js animation/easing) - :useNativeDriver true}) - (animation/timing - anim-y - {:toValue 0 - :duration 140 - :delay 1000 - :easing (.-ease ^js animation/easing) - :useNativeDriver true})]) - #(reset! cue-atom false))) - -(defn show-cue-atom - [anim-opacity anim-y cue-atom y] - (when @cue-atom - (animation/start - (animation/parallel - [(animation/timing - anim-opacity - {:toValue 1 - :duration 140 - :easing (.-ease ^js animation/easing) - :useNativeDriver true}) - (animation/timing - anim-y - {:toValue y - :duration 140 - :easing (.-ease ^js animation/easing) - :useNativeDriver true})]) - #(hide-cue-atom anim-opacity anim-y cue-atom)))) - -(defn toast - [anim-opacity anim-y width cue-atom label] - [react/animated-view - {:style - {:opacity anim-opacity - :transform [{:translateY anim-y}] - :max-width @width - :z-index (if @cue-atom 1 -1) - :height 34 - :position :absolute - :border-radius 8 - :align-self :center - :align-items :center - :justify-content :center - :shadow-offset {:width 0 :height 4} - :shadow-radius 12 - :elevation 8 - :shadow-opacity 1 - :shadow-color "rgba(0, 34, 51, 0.08)" - :background-color colors/white}} - [react/view - {:padding-horizontal 16 - :padding-vertical 7 - :border-radius 8 - :background-color colors/white - :shadow-offset {:width 0 :height 2} - :shadow-radius 4 - :shadow-opacity 1 - :shadow-color "rgba(0, 34, 51, 0.16)"} - [react/text - {:style - {:typography :main-medium - ;; line height specified here because of figma spec - :line-height 20 - :font-size 14}} - label]]]) - -(defn toastable-highlight-view - [{:keys [toast-label on-press - container-style]} - content] - (let [cue-atom (reagent/atom false) - width (reagent/atom 0) - height (reagent/atom 0) - anim-y (animation/create-value 0) - anim-opacity (animation/create-value 0)] - (reagent/create-class - {:reagent-render - (fn [{:keys []} _] - (let [press-fn #(when (not @cue-atom) - (reset! cue-atom true) - (show-cue-atom - anim-opacity - anim-y - cue-atom - (if (> @height 34) - (- (/ @height 2)) - (- (+ 17 @height)))) - (when on-press - (on-press)))] - [react/view - {:style (if container-style container-style {}) - :on-layout - #(do - (reset! width (-> ^js % .-nativeEvent .-layout .-width)) - (reset! height (-> ^js % .-nativeEvent .-layout .-height)))} - [toast anim-opacity anim-y width cue-atom toast-label] - [react/touchable-highlight - {:active-opacity (if @cue-atom 1 0.85) - :underlay-color colors/black - :on-press press-fn - :on-long-press press-fn} - [react/view {:background-color colors/white} - content]]]))}))) diff --git a/src/legacy/status_im/ui/components/tooltip/styles.cljs b/src/legacy/status_im/ui/components/tooltip/styles.cljs index 0974a54c8a..cf5c783c70 100644 --- a/src/legacy/status_im/ui/components/tooltip/styles.cljs +++ b/src/legacy/status_im/ui/components/tooltip/styles.cljs @@ -4,17 +4,6 @@ [legacy.status-im.utils.styles :as styles] [status-im.config :as config])) -(def tooltip-container - (merge - {:position :absolute - :align-items :center - :left 0 - :right 0 - :top 0} - ;;we need this for e2e tests - (when-not config/tooltip-events? - {:pointer-events :none}))) - (styles/def bottom-tooltip-container {:position :absolute :align-items :center @@ -38,20 +27,6 @@ (assoc :margin-top -20 :position :relative))) -(defn tooltip-text-container - [color] - {:padding-horizontal 16 - :padding-vertical 6 - :elevation 3 - :background-color color - :border-radius 8 - :shadow-radius 12 - :shadow-offset {:width 0 :height 4} - :shadow-opacity 0.16 - :shadow-color (if (colors/dark?) - "rgba(0, 0, 0, 0.75)" - "rgba(0, 34, 51)")}) - (def bottom-tooltip-text-container {:flex-direction :row :align-items :center @@ -61,12 +36,6 @@ :background-color colors/gray :border-radius 8}) -(defn tooltip-text - [font-size] - {:color colors/red - :line-height 15 - :font-size font-size}) - (def bottom-tooltip-text {:color colors/white}) diff --git a/src/legacy/status_im/ui/components/tooltip/views.cljs b/src/legacy/status_im/ui/components/tooltip/views.cljs index 36a0fbcd80..9f3dea8f29 100644 --- a/src/legacy/status_im/ui/components/tooltip/views.cljs +++ b/src/legacy/status_im/ui/components/tooltip/views.cljs @@ -8,28 +8,6 @@ [legacy.status-im.ui.components.tooltip.styles :as styles]) (:require-macros [legacy.status-im.utils.views :as views])) -(views/defview tooltip - [label & - [{:keys [bottom-value color font-size container-style] - :or {bottom-value 30 color colors/white font-size 15}} - accessibility-label]] - (views/letsubs [bottom-anim-value (animation/create-value bottom-value) - opacity-value (animation/create-value 0)] - {:component-did-mount (animations/animate-tooltip bottom-value bottom-anim-value opacity-value -10)} - [react/view (merge styles/tooltip-container container-style) - [react/animated-view {:style (styles/tooltip-animated bottom-anim-value opacity-value)} - (when label - [react/view (styles/tooltip-text-container color) - [react/text - {:style (styles/tooltip-text font-size) - :accessibility-label accessibility-label} - label]]) - #_[icons/icon :icons/tooltip-tip - (assoc - styles/tooltip-triangle - :color - color)]]])) - (views/defview bottom-tooltip-info [label on-close] (views/letsubs [bottom-anim-value (animation/create-value 75) 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 e6ae1b5e5f..e5e883734d 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -9,11 +9,6 @@ [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) -(defn hide-sheet-and-dispatch - [event] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (re-frame/dispatch event)) - (defn- normal-mode-settings-data [{:keys [current-log-level light-client-enabled? diff --git a/src/legacy/status_im/ui/screens/browser/bookmarks/views.cljs b/src/legacy/status_im/ui/screens/browser/bookmarks/views.cljs deleted file mode 100644 index 4e5fa3b52a..0000000000 --- a/src/legacy/status_im/ui/screens/browser/bookmarks/views.cljs +++ /dev/null @@ -1,55 +0,0 @@ -(ns legacy.status-im.ui.screens.browser.bookmarks.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.react :as react] - [legacy.status-im.ui.components.toolbar :as toolbar] - [legacy.status-im.ui.components.topbar :as topbar] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [utils.i18n :as i18n])) - -(defn screen - [{url :url name :name new-arg :new}] - (let [input-name (reagent/atom name)] - (fn [] - (let [edit? (not new-arg)] - [kb-presentation/keyboard-avoiding-view - {:style {:flex 1} - :ignore-offset true} - [topbar/topbar - {:modal? true - :border-bottom true - :title (if edit? (i18n/label :t/edit-favourite) (i18n/label :t/new-favourite))}] - [react/view {:flex 1} - [quo/text-input - {:container-style {:margin 16 :margin-top 10} - :accessibility-label :bookmark-input - :max-length 100 - :auto-focus true - :show-cancel false - :label (i18n/label :t/name) - :default-value @input-name - :on-change-text #(reset! input-name %)}] - [react/text {:style {:margin 16 :color colors/gray}} - url]] - [toolbar/toolbar - {:show-border? true - :center - [quo/button - {:accessibility-label :save-bookmark - :type :secondary - :disabled (string/blank? @input-name) - :on-press #(do (if edit? - (re-frame/dispatch [:browser/update-bookmark - {:url url :name @input-name}]) - (re-frame/dispatch [:browser/store-bookmark - {:url url :name @input-name}])) - (re-frame/dispatch [:navigate-back]))} - (if edit? (i18n/label :t/save) (i18n/label :t/add-favourite))]}]])))) - -(defn new-bookmark - [] - [screen @(re-frame/subscribe [:get-screen-params])]) diff --git a/src/legacy/status_im/ui/screens/browser/eip3085/sheet.cljs b/src/legacy/status_im/ui/screens/browser/eip3085/sheet.cljs deleted file mode 100644 index 0b7dcf0647..0000000000 --- a/src/legacy/status_im/ui/screens/browser/eip3085/sheet.cljs +++ /dev/null @@ -1,57 +0,0 @@ -(ns legacy.status-im.ui.screens.browser.eip3085.sheet - (: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.core :as quo] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.browser.styles :as styles] - [re-frame.core :as re-frame] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(views/defview permissions-panel - [_dapp-name message-id params] - (views/letsubs [{:keys [dapp? dapp]} [:get-current-browser]] - [react/view {} - [react/view styles/permissions-panel-icons-container - (if dapp? - [chat-icon.screen/dapp-icon-permission dapp 40] - [react/view styles/permissions-panel-dapp-icon-container - [icons/icon :main-icons/dapp {:color colors/gray}]]) - [react/view {:margin-left 8 :margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 8} - [react/view styles/dot]] - [react/view styles/permissions-panel-ok-icon-container - [icons/icon :tiny-icons/tiny-check styles/permissions-panel-ok-ico]] - [react/view {:margin-left 8 :margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 8} - [react/view styles/dot]] - [react/view styles/permissions-panel-wallet-icon-container - [icons/icon :main-icons/wallet {:color colors/white}]]] - [react/view - {:style {:flex-direction :row - :justify-content :center - :margin-horizontal 8 - :margin-top 24}} - [react/view - {:flex 1 - :margin-horizontal 8} - [quo/button - {:theme :negative - :on-press #(re-frame/dispatch [:eip3085.ui/dapp-permission-denied message-id params])} - (i18n/label :t/deny)]] - [react/view - {:flex 1 - :margin-horizontal 8} - [quo/button - {:theme :positive - :style {:margin-horizontal 8} - :on-press #(re-frame/dispatch [:eip3085.ui/dapp-permission-allowed message-id params])} - (i18n/label :t/allow)]]]])) diff --git a/src/legacy/status_im/ui/screens/browser/eip3326/sheet.cljs b/src/legacy/status_im/ui/screens/browser/eip3326/sheet.cljs deleted file mode 100644 index cc26237573..0000000000 --- a/src/legacy/status_im/ui/screens/browser/eip3326/sheet.cljs +++ /dev/null @@ -1,68 +0,0 @@ -(ns legacy.status-im.ui.screens.browser.eip3326.sheet - (:require - [legacy.status-im.network.core :as network] - [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.core :as quo] - [legacy.status-im.ui.components.icons.icons :as icons] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.browser.styles :as styles] - [re-frame.core :as re-frame] - [utils.debounce :as debounce] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(views/defview permissions-panel - [dapp-name message-id {:keys [network-from network-to target-network-id] :as params}] - (views/letsubs [{:keys [dapp? dapp]} [:get-current-browser]] - [react/view {} - [react/view styles/permissions-panel-icons-container - (if dapp? - [chat-icon.screen/dapp-icon-permission dapp 40] - [react/view styles/permissions-panel-dapp-icon-container - [icons/icon :main-icons/dapp {:color colors/gray}]]) - [react/view {:margin-left 8 :margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 8} - [react/view styles/dot]] - [react/view styles/permissions-panel-ok-icon-container - [icons/icon :tiny-icons/tiny-check styles/permissions-panel-ok-ico]] - [react/view {:margin-left 8 :margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 4} - [react/view styles/dot]] - [react/view {:margin-right 8} - [react/view styles/dot]] - [react/view styles/permissions-panel-wallet-icon-container - [icons/icon :main-icons/wallet {:color colors/white}]]] - [react/text {:style styles/permissions-panel-title-label :number-of-lines 2} - (str "\"" dapp-name "\" Allow this site to switch the network?")] - [react/text {:style styles/permissions-panel-description-label :number-of-lines 5} - (str "This will switch the selected network within Status to a previously added network:\n" - network-from - " -> " - network-to - "\nit will require login/logout")] - [react/view - {:style {:flex-direction :row - :justify-content :center - :margin-horizontal 8 - :margin-top 24}} - [react/view - {:flex 1 - :margin-horizontal 8} - [quo/button - {:theme :negative - :on-press #(re-frame/dispatch [:eip3326.ui/dapp-permission-denied message-id params])} - (i18n/label :t/deny)]] - [react/view - {:flex 1 - :margin-horizontal 8} - [quo/button - {:theme :positive - :style {:margin-horizontal 8} - :on-press #(debounce/throttle-and-dispatch [::network/connect-network-pressed target-network-id] - 1000)} - (i18n/label :t/allow)]]]])) diff --git a/src/legacy/status_im/ui/screens/browser/empty_tab/styles.cljs b/src/legacy/status_im/ui/screens/browser/empty_tab/styles.cljs index 21fe3aac46..b5399cfbcb 100644 --- a/src/legacy/status_im/ui/screens/browser/empty_tab/styles.cljs +++ b/src/legacy/status_im/ui/screens/browser/empty_tab/styles.cljs @@ -10,15 +10,6 @@ {:margin-horizontal 16 :margin-vertical 10}) -(defn browser-icon-container - [] - {:width 40 - :height 40 - :border-radius 20 - :background-color colors/gray-lighter - :align-items :center - :justify-content :center}) - (defn dapp-store-container [] {:margin 16 @@ -35,20 +26,3 @@ :font-size 15 :font-weight "500" :line-height 22}) - -(defn dapps-account - [color] - {:flex-direction :row - :background-color color - :border-radius 36 - :padding-horizontal 8 - :padding-vertical 6 - :align-items :center - :justify-content :center - :shadow-offset {:width 0 :height 1} - :shadow-radius 6 - :shadow-opacity 1 - :shadow-color (if (colors/dark?) - "rgba(0, 0, 0, 0.75)" - "rgba(0, 12, 63, 0.2)") - :elevation 2}) diff --git a/src/legacy/status_im/ui/screens/browser/empty_tab/views.cljs b/src/legacy/status_im/ui/screens/browser/empty_tab/views.cljs index 421c7b05a7..059fd9ed68 100644 --- a/src/legacy/status_im/ui/screens/browser/empty_tab/views.cljs +++ b/src/legacy/status_im/ui/screens/browser/empty_tab/views.cljs @@ -8,7 +8,6 @@ [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.browser.accounts :as accounts] [legacy.status-im.ui.screens.browser.empty-tab.styles :as styles] [legacy.status-im.ui.screens.browser.views :as browser] [re-frame.core :as re-frame] @@ -95,35 +94,6 @@ [react/text {:style {:line-height 22 :font-size 15 :color colors/gray}} (i18n/label :t/favourites)]])]) -(views/defview select-account - [] - (views/letsubs [accounts [:accounts-without-watch-only] - {:keys [name color] :as dapps-account} [:dapps-account]] - [react/view - {:position :absolute - :z-index 2 - :align-items :center - :bottom 16 - :left 0 - :right 0 - :padding-horizontal 32} - [quo/button - {:accessibility-label :select-account - :type :scale - :on-press #(re-frame/dispatch [:show-bottom-sheet - {:content (accounts/accounts-list accounts - dapps-account)}])} - [react/view (styles/dapps-account color) - [icons/icon :main-icons/account {:color colors/white-persist}] - [react/view {:flex-shrink 1} - [react/text - {:numberOfLines 1 - :style {:margin-horizontal 6 - :color colors/white-persist - :typography :main-medium}} - name]] - [icons/icon :main-icons/dropdown {:color colors/white-transparent-persist}]]]])) - (views/defview empty-tab [] (views/letsubs [bookmarks [:bookmarks/active] diff --git a/src/legacy/status_im/ui/screens/browser/options/views.cljs b/src/legacy/status_im/ui/screens/browser/options/views.cljs index 2f8028a6e3..ef100da677 100644 --- a/src/legacy/status_im/ui/screens/browser/options/views.cljs +++ b/src/legacy/status_im/ui/screens/browser/options/views.cljs @@ -2,13 +2,10 @@ (:require [legacy.status-im.browser.core :as browser] [legacy.status-im.qr-scanner.core :as qr-scanner] - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon] [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.components.list.item :as list.item] [legacy.status-im.ui.components.react :as react] - [legacy.status-im.utils.utils :as utils] [re-frame.core :as re-frame] [utils.i18n :as i18n])) @@ -17,26 +14,6 @@ (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) -(defn wallet-connection - [host account] - (fn [] - [react/view {:flex 1} - [react/text {:style {:align-self :center :margin-horizontal 16 :margin-vertical 8}} - (str "โ€œ" host "โ€ " (i18n/label :t/has-permissions))] - [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)) - :accessory [icons/icon :main-icons/check {:color colors/gray}]}] - [react/view {:padding-vertical 8} - [react/view {:style {:height 1 :background-color (colors/alpha colors/black 0.1)}}]] - [list.item/list-item - {:theme :negative - :title (i18n/label :t/revoke-access) - :accessibility-label :revoke-access - :icon :main-icons/cancel - :on-press #(hide-sheet-and-dispatch [:browser/revoke-dapp-permissions host])}]])) - (defn browser-options [url _account empty-tab name] (fn [] diff --git a/src/legacy/status_im/ui/screens/chat/message/legacy_style.cljs b/src/legacy/status_im/ui/screens/chat/message/legacy_style.cljs index 012fa121ea..7d87887960 100644 --- a/src/legacy/status_im/ui/screens/chat/message/legacy_style.cljs +++ b/src/legacy/status_im/ui/screens/chat/message/legacy_style.cljs @@ -6,10 +6,6 @@ [quo.foundations.typography :as typography] [status-im.constants :as constants])) -(defn style-message-text - [] - {:color colors/text}) - (defn message-wrapper [{:keys [in-popover?]}] (if (not in-popover?) @@ -17,25 +13,6 @@ :padding-right 5} {:margin-right 10})) -(defn emoji-message - [{:keys [incoming-group]}] - {:font-size 28 - :line-height 34 ;TODO: Smaller crops the icon on the top - :margin-right 0 ;; Margin to display outgoing message status - :margin-top (if incoming-group 4 0)}) - -(defn message-view - [{:keys [content-type]}] - (merge - {:border-radius 10} - (when (= content-type constants/content-type-emoji) - {:flex-direction :row}))) - -(defn message-view-content - [] - {:padding-bottom 6 - :overflow :hidden}) - (def status-container {:padding-horizontal 5}) @@ -201,34 +178,3 @@ :border-bottom-right-radius 10 :border-color colors/gray-lighter}) -(defn contact-request-status-label - [state] - {:width 136 - :border-radius 8 - :flex 1 - :justify-content :center - :align-items :center - :background-color (when (= :retry state) - colors/blue-light) - :border-width 1 - :border-color (condp = state - constants/contact-request-message-state-accepted colors/green-transparent-10 - constants/contact-request-message-state-declined colors/red-light - constants/contact-request-message-state-pending colors/gray-lighter - nil) - :padding-vertical 10 - :padding-horizontal 16}) - -(defn content-type-contact-request - [] - {:width 168 - :min-height 224.71 - :border-radius 8 - :border-width 1 - :border-color colors/gray-lighter - :align-items :center - :padding-bottom 10 - :margin-vertical 4 - :align-self :flex-start - :margin-right 0 - :margin-left 8}) diff --git a/src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs b/src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs index 69bcac00f6..f77e3371f0 100644 --- a/src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs +++ b/src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs @@ -1,6 +1,5 @@ (ns legacy.status-im.ui.screens.chat.message.legacy-view (:require - [legacy.status-im.react-native.resources :as resources] [legacy.status-im.ui.components.colors :as quo.colors] [legacy.status-im.ui.screens.chat.message.legacy-style :as style] [quo.core :as quo] @@ -154,64 +153,8 @@ [rn/text {:style (style/status-text)}] (-> content :parsed-text peek :children))]])) -(defn contact-request-status-pending - [] - [rn/view {:style {:flex-direction :row}} - [quo/text - {:style {:margin-right 5.27} - :weight :medium - :color :secondary} - (i18n/label :t/contact-request-pending)] - [rn/activity-indicator - {:animating true - :size :small - :color quo.colors/gray}]]) - -(defn contact-request-status-accepted - [] - [quo/text - {:style {:color quo.colors/green} - :weight :medium} - (i18n/label :t/contact-request-accepted)]) - -(defn contact-request-status-declined - [] - [quo/text - {:style {:color quo.colors/red} - :weight :medium} - (i18n/label :t/contact-request-declined)]) - -(defn contact-request-status-label - [state] - [rn/view {:style (style/contact-request-status-label state)} - (condp = state - constants/contact-request-message-state-pending [contact-request-status-pending] - constants/contact-request-message-state-accepted [contact-request-status-accepted] - constants/contact-request-message-state-declined [contact-request-status-declined] - nil)]) - ;;;; SYSTEM -;; CONTACT REQUEST (like system message ? ) no wrapper -(defn system-contact-request - [message _] - [rn/view {:style (style/content-type-contact-request)} - [rn/image - {:source (resources/get-image :hand-wave) - :style {:width 112 - :height 97}}] - [quo/text - {:style {:margin-top 6} - :weight :bold - :size :heading-2} - (i18n/label :t/contact-request)] - [rn/view {:style {:padding-horizontal 16}} - [quo/text - {:style {:margin-top 2 - :margin-bottom 14}} - (get-in message [:content :text])]] - [contact-request-status-label (:contact-request-state message)]]) - (defview community-content [{:keys [community-id] :as message}] (letsubs [{:keys [name description verified] :as community} [:communities/community community-id]] diff --git a/src/legacy/status_im/ui/screens/chat/utils.cljs b/src/legacy/status_im/ui/screens/chat/utils.cljs deleted file mode 100644 index 5ccce8a7b8..0000000000 --- a/src/legacy/status_im/ui/screens/chat/utils.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns legacy.status-im.ui.screens.chat.utils - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.react :as react] - [utils.i18n :as i18n])) - -(defn format-author-old - ([contact] (format-author-old contact nil)) - ([{:keys [primary-name secondary-name nickname]} {:keys [modal profile? you?]}] - (if (not (string/blank? secondary-name)) - [react/nested-text - {:number-of-lines 2 - :style {:color (if modal colors/white-persist colors/blue) - :font-size (if profile? 15 13) - :line-height (if profile? 22 18) - :font-weight "500"}} - (subs primary-name 0 81) - (when you? - [{:style {:color colors/gray :font-weight "400" :font-size 13}} - (str " " (i18n/label :t/You))]) - (when nickname - [{:style {:color colors/gray :font-weight "400"}} - (str " " (subs secondary-name 0 81))])] - [react/text - {:style {:color (if modal colors/white-persist colors/gray) - :font-size (if profile? 15 12) - :line-height (if profile? 22 18) - :font-weight "400"}} - primary-name]))) diff --git a/src/legacy/status_im/ui/screens/communities/invite.cljs b/src/legacy/status_im/ui/screens/communities/invite.cljs deleted file mode 100644 index 7090df5a79..0000000000 --- a/src/legacy/status_im/ui/screens/communities/invite.cljs +++ /dev/null @@ -1,104 +0,0 @@ -(ns legacy.status-im.ui.screens.communities.invite - (:require - [clojure.string :as string] - [legacy.status-im.ui.components.chat-icon.screen :as chat-icon.screen] - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.toolbar :as toolbar] - [legacy.status-im.ui.components.topbar :as topbar] - [quo.theme] - [react-native.core :as rn] - [reagent.core :as reagent] - [status-im.constants :as constants] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn header - [user-pk] - [:<> - [rn/view - {:style {:padding-horizontal 16 - :padding-vertical 8}} - [quo/text-input - {:label (i18n/label :t/enter-user-pk) - :placeholder (i18n/label :t/enter-user-pk) - :on-change-text #(reset! user-pk %) - :default-value @user-pk - :auto-focus true}]] - [quo/separator {:style {:margin-vertical 8}}] - [quo/list-header (i18n/label :t/contacts)]]) - -(defn contacts-list-item - [{:keys [public-key active] :as contact} _ _ {:keys [selected]}] - (let [{:keys [primary-name secondary-name]} contact] - [list.item/list-item - {:title primary-name - :subtitle secondary-name - :icon [chat-icon.screen/contact-icon-contacts-tab contact] - :accessory :checkbox - :active active - :on-press (fn [] - (if active - (swap! selected disj public-key) - (swap! selected conj public-key)))}])) - -(defn legacy-invite - [] - (let [user-pk (reagent/atom "") - contacts-selected (reagent/atom #{}) - {:keys [invite?]} (rf/sub [:get-screen-params])] - (fn [] - (let [theme (quo.theme/use-theme) - contacts-data (rf/sub [:contacts/active]) - {community-id :id - :keys [permissions - can-manage-users?]} - (rf/sub [:communities/edited-community]) - selected @contacts-selected - selected-contacts-count (count selected) - contacts (map (fn [{:keys [public-key] :as contact}] - (assoc contact :active (contains? selected public-key))) - contacts-data) - ;; no-membership communities can only be shared - can-invite? (and can-manage-users? - invite? - (not= (:access permissions) constants/community-no-membership-access)) - on-press-share-community (rn/use-callback - (fn [] - (rf/dispatch [:communities/share-community-confirmation-pressed - selected community-id]) - (rf/dispatch [:navigate-back]) - (rf/dispatch [:toasts/upsert - {:type :positive - :theme theme - :text (if (= 1 selected-contacts-count) - (i18n/label :t/one-user-was-invited) - (i18n/label - :t/n-users-were-invited - {:count selected-contacts-count}))}])) - [community-id selected selected-contacts-count theme])] - [:<> - [topbar/topbar - {:title (i18n/label (if can-invite? - :t/invite-people - :t/community-share-title)) - :modal? true}] - [rn/flat-list - {:style {:flex 1} - :content-container-style {:padding-vertical 16} - ;:header [header user-pk] - :render-data {:selected contacts-selected} - :render-fn contacts-list-item - :key-fn (fn [{:keys [active public-key]}] - (str public-key active)) - :data contacts}] - [toolbar/toolbar - {:show-border? true - :center - [quo/button - {:disabled (and (string/blank? @user-pk) - (zero? selected-contacts-count)) - :accessibility-label :share-community-link - :type :secondary - :on-press on-press-share-community} - (i18n/label (if can-invite? :t/invite :t/share))]}]])))) diff --git a/src/legacy/status_im/ui/screens/fleet_settings/styles.cljs b/src/legacy/status_im/ui/screens/fleet_settings/styles.cljs index 4ed58afb45..1cac42f0d4 100644 --- a/src/legacy/status_im/ui/screens/fleet_settings/styles.cljs +++ b/src/legacy/status_im/ui/screens/fleet_settings/styles.cljs @@ -3,9 +3,6 @@ [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.utils.styles :as styles])) -(def wrapper - {:flex 1}) - (def fleet-item-inner {:padding-horizontal 16}) diff --git a/src/legacy/status_im/ui/screens/log_level_settings/styles.cljs b/src/legacy/status_im/ui/screens/log_level_settings/styles.cljs index 867214bb6c..b774307e13 100644 --- a/src/legacy/status_im/ui/screens/log_level_settings/styles.cljs +++ b/src/legacy/status_im/ui/screens/log_level_settings/styles.cljs @@ -3,9 +3,6 @@ [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.utils.styles :as styles])) -(def wrapper - {:flex 1}) - (def log-level-item-inner {:padding-horizontal 16}) diff --git a/src/legacy/status_im/ui/screens/notifications_settings/events.cljs b/src/legacy/status_im/ui/screens/notifications_settings/events.cljs index ed383c6e49..368f2d951c 100644 --- a/src/legacy/status_im/ui/screens/notifications_settings/events.cljs +++ b/src/legacy/status_im/ui/screens/notifications_settings/events.cljs @@ -18,7 +18,7 @@ (rf/defn notification-non-contacts {:events [:push-notifications/switch-non-contacts]} - [{:keys [db] :as cofx} enabled?] + [cofx enabled?] (let [method (if enabled? "wakuext_enablePushNotificationsFromContactsOnly" "wakuext_disablePushNotificationsFromContactsOnly")] @@ -32,7 +32,7 @@ (rf/defn notification-block-mentions {:events [:push-notifications/switch-block-mentions]} - [{:keys [db] :as cofx} enabled?] + [cofx enabled?] (let [method (if enabled? "wakuext_enablePushNotificationsBlockMentions" "wakuext_disablePushNotificationsBlockMentions")] @@ -48,7 +48,7 @@ (rf/defn notification-switch {:events [:push-notifications/switch]} - [{:keys [db] :as cofx} enabled?] + [cofx enabled?] (rf/merge cofx (if enabled? {:effects/push-notifications-enable nil} diff --git a/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/styles.cljs b/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/styles.cljs deleted file mode 100644 index 851bb08db4..0000000000 --- a/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/styles.cljs +++ /dev/null @@ -1,38 +0,0 @@ -(ns legacy.status-im.ui.screens.offline-messaging-settings.edit-mailserver.styles - (:require - [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.utils.styles :as styles])) - -(def edit-mailserver-view - {:flex 1 - :margin-horizontal 16 - :margin-vertical 15}) - -(def qr-code - {:padding 16}) - -(def button-container - {:margin-top 8 - :margin-bottom 16 - :margin-horizontal 16}) - -(def button - {:height 52 - :align-items :center - :justify-content :center - :border-radius 8 - :ios {:opacity 0.9}}) - -(styles/def connect-button - (assoc button - :background-color - colors/blue)) - -(styles/def delete-button - (assoc button - :background-color - colors/red)) - -(def button-label - {:color colors/white - :font-size 17}) diff --git a/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs b/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs deleted file mode 100644 index 4a8e1421a3..0000000000 --- a/src/legacy/status_im/ui/screens/offline_messaging_settings/edit_mailserver/views.cljs +++ /dev/null @@ -1,90 +0,0 @@ -(ns legacy.status-im.ui.screens.offline-messaging-settings.edit-mailserver.views - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - [clojure.string :as string] - [legacy.status-im.qr-scanner.core :as qr-scanner] - [legacy.status-im.ui.components.core :as quo] - [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.offline-messaging-settings.edit-mailserver.styles :as styles] - [re-frame.core :as re-frame] - [utils.i18n :as i18n])) - -(defn connect-button - [id] - [react/touchable-highlight {:on-press #(re-frame/dispatch [:mailserver.ui/connect-pressed id])} - [react/view styles/button-container - [react/view - {:style styles/connect-button - :accessibility-label :mailserver-connect-button} - [react/text {:style styles/button-label} - (i18n/label :t/connect)]]]]) - -(defn delete-button - [id] - [react/touchable-highlight {:on-press #(re-frame/dispatch [:mailserver.ui/delete-pressed id])} - [react/view styles/button-container - [react/view - {:style styles/delete-button - :accessibility-label :mailserver-delete-button} - [react/text {:style styles/button-label} - (i18n/label :t/delete)]]]]) - -(views/defview edit-mailserver - [] - (views/letsubs [mailserver [:mailserver.edit/mailserver] - connected? [:mailserver.edit/connected?] - validation-errors [:mailserver.edit/validation-errors]] - (let [url (get-in mailserver [:url :value]) - id (get-in mailserver [:id :value]) - name (get-in mailserver [:name :value]) - is-valid? (and (not (string/blank? url)) - (not (string/blank? name)) - (empty? validation-errors)) - invalid-url? (contains? validation-errors :url)] - [react/keyboard-avoiding-view - {:style {:flex 1} - :ignore-offset true} - [topbar/topbar {:title (i18n/label (if id :t/mailserver-details :t/add-mailserver))}] - [react/scroll-view {:keyboard-should-persist-taps :handled} - [react/view styles/edit-mailserver-view - [react/view {:padding-vertical 8} - [quo/text-input - {:label (i18n/label :t/name) - :placeholder (i18n/label :t/specify-name) - :default-value name - :on-change-text #(re-frame/dispatch [:mailserver.ui/input-changed :name %]) - :auto-focus true}]] - [react/view - {:flex 1 - :padding-vertical 8} - [quo/text-input - {:label (i18n/label :t/mailserver-address) - :placeholder (i18n/label :t/mailserver-format) - :default-value url - :show-cancel false - :on-change-text #(re-frame/dispatch [:mailserver.ui/input-changed :url %]) - :bottom-value 0 - :error (when (and (not (string/blank? url)) - invalid-url?) - (i18n/label :t/invalid-format - {:format (i18n/label :t/mailserver-format)})) - :after {:icon :main-icons/qr - :on-press #(re-frame/dispatch - [::qr-scanner/scan-code - {:title (i18n/label :t/add-mailserver) - :handler :mailserver.callback/qr-code-scanned}])}}]] - (when (and id - (not connected?)) - [react/view - [connect-button id] - [delete-button id]])]] - [toolbar/toolbar - {:right - [quo/button - {:type :secondary - :after :main-icon/next - :disabled (not is-valid?) - :on-press #(re-frame/dispatch [:mailserver.ui/save-pressed])} - (i18n/label :t/save)]}]]))) diff --git a/src/legacy/status_im/ui/screens/offline_messaging_settings/styles.cljs b/src/legacy/status_im/ui/screens/offline_messaging_settings/styles.cljs index cdaef3841f..5a1fa5e449 100644 --- a/src/legacy/status_im/ui/screens/offline_messaging_settings/styles.cljs +++ b/src/legacy/status_im/ui/screens/offline_messaging_settings/styles.cljs @@ -18,17 +18,6 @@ (def mailserver-item-name-text {:typography :title}) -(defn mailserver-icon-container - [connected?] - {:width 40 - :height 40 - :border-radius 20 - :background-color (if connected? - colors/blue - colors/black-transparent) - :align-items :center - :justify-content :center}) - (def switch-container {:height 52}) diff --git a/src/legacy/status_im/ui/screens/pairing/styles.cljs b/src/legacy/status_im/ui/screens/pairing/styles.cljs index 318eff85aa..3126e8dc6c 100644 --- a/src/legacy/status_im/ui/screens/pairing/styles.cljs +++ b/src/legacy/status_im/ui/screens/pairing/styles.cljs @@ -6,12 +6,6 @@ (def wrapper {:flex 1}) -(styles/def installation-item - {:flex-direction :row - :align-items :center - :ios {:height 64} - :android {:height 56}}) - (def installation-list {:padding-horizontal 16 :flex 1}) diff --git a/src/legacy/status_im/ui/screens/profile/components/sheets.cljs b/src/legacy/status_im/ui/screens/profile/components/sheets.cljs deleted file mode 100644 index d6eb2939b3..0000000000 --- a/src/legacy/status_im/ui/screens/profile/components/sheets.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.components.sheets - (:require - [legacy.status-im.ui.components.core :as quo] - [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.profile.components.styles :as styles] - [re-frame.core :as re-frame] - [reagent.core :as reagent] - [utils.i18n :as i18n]) - (:require-macros [legacy.status-im.utils.views :as views])) - -(views/defview block-contact - [] - (views/letsubs [{:keys [public-key]} [:popover/popover] - in-progress? (reagent/atom false)] - [react/view {:style {:padding-top 16 :padding-horizontal 24 :padding-bottom 8}} - [react/text {:style styles/sheet-text} - (i18n/label :t/block-contact-details)] - [react/view {:align-items :center :margin-top 16} - [quo/button - {:theme :negative - :disabled @in-progress? - :loading @in-progress? - :accessibility-label :block-contact-confirm - :on-press #(do (reset! in-progress? true) - (re-frame/dispatch [:contact/block-contact public-key]))} - (i18n/label :t/block)] - [react/view {:height 8}] - [quo/button - {:type :secondary - :disabled @in-progress? - :on-press #(re-frame/dispatch [:hide-popover])} - (i18n/label :t/close)]]])) diff --git a/src/legacy/status_im/ui/screens/profile/components/styles.cljs b/src/legacy/status_im/ui/screens/profile/components/styles.cljs index ca4298c3cd..83856f85c1 100644 --- a/src/legacy/status_im/ui/screens/profile/components/styles.cljs +++ b/src/legacy/status_im/ui/screens/profile/components/styles.cljs @@ -1,6 +1,4 @@ -(ns legacy.status-im.ui.screens.profile.components.styles - (:require - [legacy.status-im.ui.components.colors :as colors])) +(ns legacy.status-im.ui.screens.profile.components.styles) ;; profile header elements @@ -14,15 +12,6 @@ :align-items :center :height 52}) -(def settings-item-icon - {:background-color colors/blue-light - :width 34 - :height 34 - :border-radius 34 - :margin-right 16 - :justify-content :center - :align-items :center}) - (def settings-item-text-wrapper {:flex 1 :flex-direction :row @@ -30,32 +19,3 @@ (def settings-item-text {:flex-wrap :nowrap}) - -(def settings-item-destructive - {:color colors/red}) - -(def settings-item-disabled - {:color colors/gray}) - -(def settings-item-value - {:flex 1 - :flex-wrap :nowrap - :text-align :right - :padding-right 10 - :color colors/gray}) - -;; shared profile styles - -(def profile - {:flex 1 - :flex-direction :column}) - -(def profile-form - {:padding-vertical 16}) - -;; sheets - -(def sheet-text - {:text-align :center - :line-height 22 - :font-size 15}) diff --git a/src/legacy/status_im/ui/screens/profile/components/views.cljs b/src/legacy/status_im/ui/screens/profile/components/views.cljs index 834102838f..adec170fd4 100644 --- a/src/legacy/status_im/ui/screens/profile/components/views.cljs +++ b/src/legacy/status_im/ui/screens/profile/components/views.cljs @@ -1,48 +1,11 @@ (ns legacy.status-im.ui.screens.profile.components.views (:require - [clojure.string :as string] [legacy.status-im.ui.components.colors :as colors] - [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.screens.profile.components.styles :as styles] - [utils.i18n :as i18n])) + [legacy.status-im.ui.screens.profile.components.styles :as styles])) ;; settings items elements -(defn settings-item - [{:keys [item-text label-kw value action-fn active? destructive? hide-arrow? - accessibility-label icon icon-content] - :or {value "" active? true}}] - [react/touchable-highlight - (cond-> {:on-press action-fn - :disabled (not active?)} - accessibility-label - (assoc :accessibility-label accessibility-label)) - [react/view styles/settings-item - (when icon - [react/view styles/settings-item-icon - [icons/icon icon {:color colors/blue}]]) - [react/view styles/settings-item-text-wrapper - [react/text - {:style (merge styles/settings-item-text - (when destructive? - styles/settings-item-destructive) - (when-not active? - styles/settings-item-disabled) - (when icon - {:font-size 17})) - :number-of-lines 1} - (or item-text (i18n/label label-kw))] - (when-not (string/blank? value) - [react/text - {:style styles/settings-item-value - :number-of-lines 1} - value])] - (if icon-content - icon-content - (when (and active? (not hide-arrow?)) - [icons/icon :main-icons/next {:color colors/gray-transparent-40}]))]]) - (defn settings-switch-item [{:keys [label-kw value action-fn active?] :or {active? true}}] diff --git a/src/legacy/status_im/ui/screens/profile/seed/styles.cljs b/src/legacy/status_im/ui/screens/profile/seed/styles.cljs index a9d20df3ad..3c333d2179 100644 --- a/src/legacy/status_im/ui/screens/profile/seed/styles.cljs +++ b/src/legacy/status_im/ui/screens/profile/seed/styles.cljs @@ -103,13 +103,3 @@ {:flex-direction :row :margin-top 16 :margin-bottom 32}) - -(def backup-seed - {:font-weight "700" - :text-align :center}) - -(def step-n - {:margin-top 5 - :font-size 14 - :text-align :center - :color colors/gray}) diff --git a/src/legacy/status_im/ui/screens/profile/user/edit_picture.cljs b/src/legacy/status_im/ui/screens/profile/user/edit_picture.cljs deleted file mode 100644 index d065b21ccf..0000000000 --- a/src/legacy/status_im/ui/screens/profile/user/edit_picture.cljs +++ /dev/null @@ -1,62 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.user.edit-picture - (:require - [legacy.status-im.ui.components.list.item :as list.item] - [legacy.status-im.ui.components.react :as react] - [re-frame.core :as re-frame] - [react-native.platform :as platform] - [status-im.config :as config] - [status-im.contexts.profile.settings.events] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(def crop-size 1000) -(def crop-opts - {:cropping true - :cropperCircleOverlay true - :width crop-size - :height crop-size}) - -(defn pick-pic - [] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (when platform/ios? - (rf/dispatch [:alert-banners/hide])) - (react/show-image-picker - #(re-frame/dispatch [:profile.settings/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size]) - crop-opts - #(rf/dispatch [:alert-banners/unhide]))) - -(defn take-pic - [] - (re-frame/dispatch [:bottom-sheet/hide-old]) - (when platform/ios? - (rf/dispatch [:alert-banners/hide])) - (react/show-image-picker-camera - #(re-frame/dispatch [:profile.settings/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size]) - crop-opts - #(rf/dispatch [:alert-banners/unhide]))) - -(defn bottom-sheet - [has-picture] - (fn [] - [:<> - [list.item/list-item - {:accessibility-label :take-photo - :theme :accent - :icon :main-icons/camera - :title (i18n/label :t/profile-pic-take) - :on-press take-pic}] - [list.item/list-item - {:accessibility-label :pick-photo - :icon :main-icons/gallery - :theme :accent - :title (i18n/label :t/profile-pic-pick) - :on-press pick-pic}] - (when (and config/enable-remove-profile-picture? - has-picture) - [list.item/list-item - {:accessibility-label :remove-photo - :icon :main-icons/delete - :theme :accent - :title (i18n/label :t/profile-pic-remove) - :on-press #(re-frame/dispatch [:profile.settings/delete-profile-picture])}])])) diff --git a/src/legacy/status_im/ui/screens/profile/user/styles.cljs b/src/legacy/status_im/ui/screens/profile/user/styles.cljs deleted file mode 100644 index f22af2be19..0000000000 --- a/src/legacy/status_im/ui/screens/profile/user/styles.cljs +++ /dev/null @@ -1,6 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.user.styles) - -(def share-link-button - {:margin-top 12 - :margin-horizontal 16 - :margin-bottom 16}) diff --git a/src/legacy/status_im/ui/screens/profile/visibility_status/styles.cljs b/src/legacy/status_im/ui/screens/profile/visibility_status/styles.cljs index dd53ca0d18..7be5809c33 100644 --- a/src/legacy/status_im/ui/screens/profile/visibility_status/styles.cljs +++ b/src/legacy/status_im/ui/screens/profile/visibility_status/styles.cljs @@ -3,19 +3,6 @@ [legacy.status-im.ui.components.colors :as colors] [quo.foundations.colors :as quo.colors])) -(defn visibility-status-button-container - [] - {:background-color (:interactive-02 @colors/theme) - :margin-left 16 - :border-radius 16 - :border-top-left-radius 4 - :align-self :flex-start - :flex-direction :row - :align-items :center - :justify-content :center - :padding 6 - :padding-right 12}) - (defn visibility-status-dot [{:keys [color size new-ui?]} theme] (if new-ui? @@ -31,68 +18,3 @@ :border-radius (/ size 2) :border-width 1 :border-color colors/white})) - -(defn visibility-status-profile-dot - [{:keys [color size border-width margin-left new-ui?]} theme] - (merge (visibility-status-dot {:color color - :size size - :new-ui? new-ui?} - theme) - {:margin-right 6 - :margin-left margin-left - :border-width border-width})) - -(defn visibility-status-text - [] - {:color (:text-01 @colors/theme) - :font-size 16 - :text-align :center}) - -(defn visibility-status-subtitle - [] - {:color (:text-02 @colors/theme) - :font-size 16 - :margin-left 22 - :margin-right 6}) - -(defn visibility-status-option - [] - {:flex-direction :row - :align-items :center}) - -(defn visibility-status-options - [scale position] - {:background-color (if (colors/dark?) - (:interactive-02 @colors/theme) - colors/white) - :border-radius 16 - :border-top-left-radius 4 - :justify-content :center - :align-self :flex-start - :left 16 - :top -76 - :padding-bottom 6 - :padding-top 8 - :transform [{:scaleY scale} - {:translateY position}]}) - -(defn visibility-status-popover-container - [] - {:position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0}) - -(defn visibility-status-popover-ios-backdrop - [alpha-value] - {:flex 1 - :background-color colors/black-persist - :opacity alpha-value}) - -(defn visibility-status-popover-child-container - [window-height] - {:position :absolute - :height window-height - :left 0 - :right 0}) diff --git a/src/legacy/status_im/ui/screens/profile/visibility_status/utils.cljs b/src/legacy/status_im/ui/screens/profile/visibility_status/utils.cljs index 5895361110..a6db60e4fc 100644 --- a/src/legacy/status_im/ui/screens/profile/visibility_status/utils.cljs +++ b/src/legacy/status_im/ui/screens/profile/visibility_status/utils.cljs @@ -40,26 +40,6 @@ :title (i18n/label :t/status-inactive) :subtitle (i18n/label :t/status-inactive-subtitle)}}) -(def visibility-status-type-data-old - {constants/visibility-status-unknown - {:color colors/red - :title (i18n/label :t/error)} - constants/visibility-status-automatic - {:color colors/color-online - :title (i18n/label :t/status-automatic) - :subtitle (i18n/label :t/status-automatic-subtitle)} - constants/visibility-status-dnd - {:color colors/color-dnd - :title (i18n/label :t/status-dnd) - :subtitle (i18n/label :t/status-dnd-subtitle)} - constants/visibility-status-always-online - {:color colors/color-online - :title (i18n/label :t/status-always-online)} - constants/visibility-status-inactive - {:color colors/color-inactive - :title (i18n/label :t/status-inactive) - :subtitle (i18n/label :t/status-inactive-subtitle)}}) - (defn calculate-real-status-type [{:keys [status-type clock]}] (let [status-lifespan (if (= status-type constants/visibility-status-automatic) diff --git a/src/legacy/status_im/ui/screens/profile/visibility_status/views.cljs b/src/legacy/status_im/ui/screens/profile/visibility_status/views.cljs deleted file mode 100644 index b5936ad687..0000000000 --- a/src/legacy/status_im/ui/screens/profile/visibility_status/views.cljs +++ /dev/null @@ -1,239 +0,0 @@ -(ns legacy.status-im.ui.screens.profile.visibility-status.views - (:require-macros [legacy.status-im.utils.views :as views]) - (:require - ["react-native" :refer (BackHandler)] - [legacy.status-im.ui.components.animation :as anim] - [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.screens.profile.visibility-status.styles :as styles] - [legacy.status-im.ui.screens.profile.visibility-status.utils :as utils] - [re-frame.core :as re-frame] - [react-native.core :as rn] - [react-native.platform :as platform] - [reagent.core :as reagent] - [status-im.constants :as constants] - [utils.re-frame :as rf])) - -;; === Code Related to visibility-status-button === - -(def button-ref (atom nil)) - -(defn dispatch-popover - [top] - (re-frame/dispatch [:show-visibility-status-popover {:top top}])) - -(defn dispatch-visibility-status-update - [status-type] - (re-frame/dispatch - [:visibility-status-updates/delayed-visibility-status-update status-type])) - -(defn calculate-button-height-and-dispatch-popover - [] - (.measure - ^js - @button-ref - (fn [_ _ _ _ _ page-y] - (dispatch-popover page-y)))) - -(defn profile-visibility-status-dot - [status-type color theme] - (let [automatic? (= status-type - constants/visibility-status-automatic) - [border-width margin-left size] (if automatic? [1 -10 12] [0 6 10]) - new-ui? true] - [:<> - (when automatic? - [rn/view - {:style (styles/visibility-status-profile-dot - {:color colors/color-inactive - :size size - :border-width border-width - :margin-left 6 - :new-ui? new-ui?} - theme)}]) - [rn/view - {:style (styles/visibility-status-profile-dot - {:color color - :size size - :border-width border-width - :margin-left margin-left - :new-ui? new-ui?} - theme)}]])) - -(defn visibility-status-button - [on-press props] - (let [logged-in? (rf/sub [:multiaccount/logged-in?]) - {:keys [status-type]} (rf/sub [:multiaccount/current-user-visibility-status]) - status-type (if (and logged-in? (nil? status-type)) - (do - (dispatch-visibility-status-update - constants/visibility-status-automatic) - constants/visibility-status-automatic) - status-type) - {:keys [color title]} (get utils/visibility-status-type-data-old status-type)] - [rn/touchable-opacity - (merge - {:on-press on-press - :accessibility-label :visibility-status-button - :style (styles/visibility-status-button-container) - :ref #(reset! button-ref ^js %)} - props) - [profile-visibility-status-dot status-type color] - [rn/text {:style (styles/visibility-status-text)} title]])) - -;; === Code Related to visibility-status-popover === -(def scale (anim/create-value 0)) -(def position (anim/create-value 0)) -(def alpha-value (anim/create-value 0)) - -(defn hide-options - [] - (anim/start - (anim/parallel - [(anim/timing scale - {:toValue 0 - :duration 140 - :useNativeDriver true}) - (anim/timing position - {:toValue 50 - :duration 210 - :useNativeDriver true}) - (anim/timing alpha-value - {:toValue 0 - :duration 200 - :useNativeDriver true})]))) - -(defn show-options - [] - (anim/start - (anim/parallel - [(anim/timing scale - {:toValue 1 - :duration 210 - :useNativeDriver true}) - (anim/timing position - {:toValue 80 - :duration 70 - :useNativeDriver true}) - (anim/timing alpha-value - {:toValue 0.4 - :duration 200 - :useNativeDriver true})]))) - -(defn status-option-pressed - [request-close status-type] - (request-close) - (dispatch-visibility-status-update status-type)) - -(defn status-option - [{:keys [request-close status-type]}] - (let [{:keys [color title subtitle]} - (get utils/visibility-status-type-data-old status-type)] - [rn/touchable-opacity - {:style {:padding 6} - :accessibility-label :visibility-status-option - :on-press #(status-option-pressed - request-close - status-type)} - [rn/view {:style (styles/visibility-status-option)} - [profile-visibility-status-dot status-type color] - [rn/text {:style (styles/visibility-status-text)} title]] - (when-not (nil? subtitle) - [rn/text {:style (styles/visibility-status-subtitle)} subtitle])])) - -(defn visibility-status-options - [request-close top] - [react/view - {:position :absolute - :top (int top)} - [visibility-status-button request-close {:ref nil :active-opacity 1}] - [react/animated-view - {:style - (styles/visibility-status-options scale position) - :accessibility-label :visibility-status-options} - [status-option - {:status-type constants/visibility-status-always-online - :request-close request-close}] - [quo/separator {:style {:margin-top 8}}] - [status-option - {:status-type constants/visibility-status-inactive - :request-close request-close}] - [quo/separator] - [status-option - {:status-type constants/visibility-status-automatic - :request-close request-close}]]]) - -(defn popover-view - [_ window-height] - (let [clear-timeout (atom nil) - current-popover (reagent/atom nil) - update? (reagent/atom nil) - request-close (fn [] - (reset! clear-timeout - (js/setTimeout - #(do (reset! current-popover nil) - (re-frame/dispatch - [:hide-visibility-status-popover])) - 200)) - (hide-options) - true) - on-show (fn [] - (show-options) - (when platform/android? - (.removeEventListener BackHandler - "hardwareBackPress" - request-close) - (.addEventListener BackHandler - "hardwareBackPress" - request-close))) - on-hide (fn [] - (when platform/android? - (.removeEventListener BackHandler - "hardwareBackPress" - request-close)))] - (reagent/create-class - {:UNSAFE_componentWillUpdate - (fn [_ [_ popover _]] - (when @clear-timeout (js/clearTimeout @clear-timeout)) - (cond - @update? - (do (reset! update? false) - (on-show)) - - (and @current-popover popover) - (do (reset! update? true) - (js/setTimeout #(reset! current-popover popover) 600) - (hide-options)) - - popover - (do (reset! current-popover popover) - (on-show)) - - :else - (do (reset! current-popover nil) - (on-hide)))) - :component-will-unmount on-hide - :reagent-render - (fn [] - (when @current-popover - (let [{:keys [top]} @current-popover] - [react/view - {:style (styles/visibility-status-popover-container)} - (when platform/ios? - [react/animated-view - {:style (styles/visibility-status-popover-ios-backdrop - alpha-value)}]) - [react/view - {:style (styles/visibility-status-popover-child-container - window-height)} - [react/touchable-highlight - {:style {:flex 1} - :on-press request-close} - [visibility-status-options request-close top]]]])))}))) - -(views/defview visibility-status-popover - [] - (views/letsubs [popover [:visibility-status-popover/popover] - {window-height :height} [:dimensions/window]] - [popover-view popover window-height])) diff --git a/src/legacy/status_im/ui/screens/reset_password/views.cljs b/src/legacy/status_im/ui/screens/reset_password/views.cljs index 91f99a738b..f74a8e96e3 100644 --- a/src/legacy/status_im/ui/screens/reset_password/views.cljs +++ b/src/legacy/status_im/ui/screens/reset_password/views.cljs @@ -1,91 +1,13 @@ (ns legacy.status-im.ui.screens.reset-password.views (:require - [legacy.status-im.multiaccounts.reset-password.core :as reset-password] [legacy.status-im.ui.components.colors :as colors] [legacy.status-im.ui.components.core :as quo] [legacy.status-im.ui.components.icons.icons :as icons] [legacy.status-im.ui.components.react :as react] - [legacy.status-im.ui.components.toolbar :as toolbar] [re-frame.core :as re-frame] - [utils.i18n :as i18n] - [utils.security.core :as security]) + [utils.i18n :as i18n]) (:require-macros [legacy.status-im.utils.views :refer [defview letsubs]])) -(defn input-field - [{:keys [id errors on-submit disabled? focus?] - :or {disabled? false focus? false}}] - [react/view {:style {:opacity (if disabled? 0.33 1)}} - [quo/text-input - {:placeholder (i18n/label id) - :default-value "" - :auto-focus focus? - :editable (not disabled?) - :accessibility-label id - :show-cancel false - :style {:margin-bottom 32} - :on-submit-editing on-submit - :on-change-text #(re-frame/dispatch [::reset-password/handle-input-change - id - (security/mask-data %)]) - :secure-text-entry true - :error (when-let [error (get errors id)] - (if (keyword? error) - (i18n/label error) - error))}]]) - -(defview reset-password - [] - (letsubs [{:keys [form-vals errors next-enabled? resetting?]} - [:multiaccount/reset-password-form-vals-and-errors]] - (let [{:keys [current-password - new-password]} - form-vals - on-submit #(re-frame/dispatch [::reset-password/reset form-vals])] - [react/keyboard-avoiding-view {:flex 1} - [react/view - {:style {:flex 1 - :justify-content :space-between}} - [react/view - {:style {:margin-top 32 - :padding-horizontal 16 - :padding-vertical 16}} - [input-field - {:id :current-password - :errors errors - :on-sumbit on-submit - :disabled? false - :focus? true}] - [input-field - {:id :new-password - :errors errors - :on-sumbit on-submit - :disabled? (zero? (count current-password))}] - [input-field - {:id :confirm-new-password - :errors errors - :on-sumbit on-submit - :disabled? (zero? (count new-password))}]] - [quo/text - {:color :secondary - :align :center - :size :small - :style {:padding-horizontal 16}} - (i18n/label :t/password-description)] - [toolbar/toolbar - {:show-border? true - :right - [quo/button - {:on-press on-submit - :accessibility-label :next-button - :disabled (or (not next-enabled?) - ;; disable on resetting? so the user cannot press the next - ;; button recklessly - ;; https://github.com/status-im/status-mobile/pull/12245#issuecomment-874827573 - resetting?) - :type :secondary - :after :main-icons/next} - (i18n/label :t/next)]}]]]))) - (defview reset-password-popover [] (letsubs [{:keys [resetting?]} [:multiaccount/reset-password-form-vals-and-errors]] diff --git a/src/legacy/status_im/ui/screens/screens.cljs b/src/legacy/status_im/ui/screens/screens.cljs index 2d75645e56..f2ee4efedd 100644 --- a/src/legacy/status_im/ui/screens/screens.cljs +++ b/src/legacy/status_im/ui/screens/screens.cljs @@ -5,7 +5,6 @@ [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.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.default-sync-period-settings.view :as default-sync-period-settings] [legacy.status-im.ui.screens.fleet-settings.views :as fleet-settings] @@ -13,14 +12,12 @@ [legacy.status-im.ui.screens.help-center.views :as help-center] [legacy.status-im.ui.screens.log-level-settings.views :as log-level-settings] [legacy.status-im.ui.screens.notifications-settings.views :as notifications-settings] - [legacy.status-im.ui.screens.offline-messaging-settings.edit-mailserver.views :as edit-mailserver] [legacy.status-im.ui.screens.offline-messaging-settings.views :as offline-messaging-settings] [legacy.status-im.ui.screens.pairing.views :as pairing] [legacy.status-im.ui.screens.peers-stats :as peers-stats] [legacy.status-im.ui.screens.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.reset-password.views :as reset-password] [legacy.status-im.ui.screens.rpc-usage-info :as rpc-usage-info] [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] @@ -54,9 +51,6 @@ :options {:insets {:top? true}} :component members/legacy-members-container} - {:name :legacy-invite-people-community - :options {:insets {:bottom? true :top? true}} - :component communities.invite/legacy-invite} ;;SETTINGS {:name :legacy-notifications @@ -122,9 +116,6 @@ {:name :offline-messaging-settings :options {:insets {:top? true}} :component offline-messaging-settings/offline-messaging-settings} - {:name :edit-mailserver - :options {:insets {:top? true}} - :component edit-mailserver/edit-mailserver} {:name :rpc-usage-info :options {:topBar (topbar-options :t/rpc-usage-info) :insets {:top? true}} @@ -144,10 +135,6 @@ {:name :backup-seed :options {:insets {:top? platform/android? :bottom? true}} :component profile.seed/backup-seed} - {:name :reset-password - :options {:topBar (topbar-options :t/reset-password) - :insets {:top? true}} - :component reset-password/reset-password} {:name :default-sync-period-settings :options {:topBar (topbar-options :t/default-sync-period) :insets {:top? true}} diff --git a/src/legacy/status_im/ui/screens/wakuv2_settings/styles.cljs b/src/legacy/status_im/ui/screens/wakuv2_settings/styles.cljs index ee729c6f91..9944e6874c 100644 --- a/src/legacy/status_im/ui/screens/wakuv2_settings/styles.cljs +++ b/src/legacy/status_im/ui/screens/wakuv2_settings/styles.cljs @@ -17,7 +17,3 @@ (def node-item-name-text {:font-size 17}) - -(def switch-container - {:height 50 - :padding-left 15}) diff --git a/src/legacy/status_im/utils/async.cljs b/src/legacy/status_im/utils/async.cljs index 1e94f4b9f6..a4ac0473a1 100644 --- a/src/legacy/status_im/utils/async.cljs +++ b/src/legacy/status_im/utils/async.cljs @@ -14,13 +14,6 @@ ;; This wrapping is required as core.async macro replaces tries and catch with ;; https://github.com/clojure/core.async/blob/18d2f903b169c681ed008dd9545dc33458604b89/src/main/clojure/cljs/core/async/impl/ioc_helpers.cljs#L74 ;; and this does not seem to play nice with desktop, and the error is bubble up killing the go-loop -(defn run-task - [f] - (try - (f) - (catch :default e - (log/error "failed to run task" e)))) - (defn chunked-pipe! "Connects input channel to the output channel with time-based chunking. `flush-time` parameter decides for how long we are waiting to accumulate @@ -42,28 +35,10 @@ (async/close! output-ch)) (recur acc (seq acc))))))) -(defn task-queue - "Creates `core.async` channel which will process 0 arg functions put there in serial fashion. - Takes the same argument/s as `core.async/chan`, those arguments will be delegated to the - channel constructor. - Returns task-queue where tasks represented by 0 arg task functions can be put for processing." - [& args] - (let [queue (apply async/chan args)] - (async/go-loop [task-fn (async/ (shell/sh "bash" "./scripts/version/build_no.sh") diff --git a/src/legacy/status_im/utils/core.cljc b/src/legacy/status_im/utils/core.cljc index 4a7d7abc38..60f00bb30d 100644 --- a/src/legacy/status_im/utils/core.cljc +++ b/src/legacy/status_im/utils/core.cljc @@ -18,18 +18,3 @@ s)) (def truncate-str (memoize truncate-str-memo)) - -(defn first-index - "Returns first index in coll where predicate on coll element is truthy" - [pred coll] - (->> coll - (keep-indexed (fn [idx e] - (when (pred e) - idx))) - first)) - -(defn index-by - "Given a collection and a unique key function, returns a map that indexes the collection. - Similar to group-by except that the map values are single objects (depends on key uniqueness)." - [k coll] - (into {} (map #(vector (k %) %) coll))) diff --git a/src/legacy/status_im/utils/deprecated_types.cljs b/src/legacy/status_im/utils/deprecated_types.cljs index faea22bd1d..7794ddfaa3 100644 --- a/src/legacy/status_im/utils/deprecated_types.cljs +++ b/src/legacy/status_im/utils/deprecated_types.cljs @@ -1,5 +1,5 @@ (ns legacy.status-im.utils.deprecated-types - {:deprecated true :superseded-by "utils.transforms"} + #_{:deprecated true :superseded-by "utils.transforms"} (:refer-clojure :exclude [js->clj]) (:require [cljs-bean.core :as clj-bean])) @@ -7,12 +7,6 @@ ;; NOTE(19/12/22 yqrashawn) this namespace has been moved to the utils.transforms namespace, ;; we keep this only for old (status 1.0) code, can be removed with old code later -(defn to-string - [s] - (if (keyword? s) - (name s) - s)) - (defn js->clj [data] (cljs.core/js->clj data :keywordize-keys true)) @@ -21,10 +15,6 @@ [data spaces] (.stringify js/JSON (clj-bean/->js data) nil spaces)) -(defn js->pretty-json - [data] - (.stringify js/JSON data nil 2)) - (defn clj->json [data] (clj->pretty-json data 0)) @@ -37,16 +27,3 @@ (catch js/Error _ (when (string? json) json))))) -(defn json->js - [json] - (when-not (= json "undefined") - (try - (.parse js/JSON json) - (catch js/Error _ - (when (string? json) json))))) - -(def serialize clj->json) -(defn deserialize - [o] - (try (json->clj o) - (catch :default _ nil))) diff --git a/src/legacy/status_im/utils/dimensions.cljs b/src/legacy/status_im/utils/dimensions.cljs index af79add73b..d49a834716 100644 --- a/src/legacy/status_im/utils/dimensions.cljs +++ b/src/legacy/status_im/utils/dimensions.cljs @@ -1,13 +1,6 @@ (ns legacy.status-im.utils.dimensions (:require - [legacy.status-im.ui.components.react :as react] - [re-frame.core :as re-frame])) - -(defn add-event-listener - [] - (.addEventListener ^js react/dimensions - "change" - #(re-frame/dispatch-sync [:update-window-dimensions %]))) + [legacy.status-im.ui.components.react :as react])) (defn window ([] diff --git a/src/legacy/status_im/utils/image.cljs b/src/legacy/status_im/utils/image.cljs deleted file mode 100644 index 2537bd22bb..0000000000 --- a/src/legacy/status_im/utils/image.cljs +++ /dev/null @@ -1,9 +0,0 @@ -(ns legacy.status-im.utils.image - (:require - [clojure.string :as string])) - -(defn source - [photo-path] - (when-not (and (not (string/blank? photo-path)) - (string/starts-with? photo-path "contacts://")) - {:uri photo-path})) diff --git a/src/legacy/status_im/utils/label.cljs b/src/legacy/status_im/utils/label.cljs deleted file mode 100644 index 447e06f60a..0000000000 --- a/src/legacy/status_im/utils/label.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns legacy.status-im.utils.label - (:require - [utils.i18n :as i18n])) - -(defn stringify - [keyword-or-number] - (cond - (string? keyword-or-number) - keyword-or-number - - (and (qualified-keyword? keyword-or-number) - (= "t" (namespace keyword-or-number))) - (i18n/label keyword-or-number) - - (and (qualified-keyword? keyword-or-number) - (not= "t" (namespace keyword-or-number))) - (str (namespace keyword-or-number) "/" (name keyword-or-number)) - - (simple-keyword? keyword-or-number) - (name keyword-or-number) - - (number? keyword-or-number) - (str keyword-or-number) - - :else nil)) diff --git a/src/legacy/status_im/utils/logging/core.cljs b/src/legacy/status_im/utils/logging/core.cljs index 270ae5ef99..21ecf4e336 100644 --- a/src/legacy/status_im/utils/logging/core.cljs +++ b/src/legacy/status_im/utils/logging/core.cljs @@ -192,7 +192,7 @@ (rf/defn share-logs-file {:events [::share-logs-file]} - [{:keys [db] :as cofx} archive-uri] + [cofx archive-uri] (rf/merge cofx (dialog-closed) @@ -202,9 +202,9 @@ (rf/defn details {:events [:logging/report-details]} - [{:keys [db]} key value] + [{:keys [db]} k value] {:db (-> db - (assoc-in [:bug-report/details key] value) + (assoc-in [:bug-report/details k] value) (dissoc :bug-report/description-error))}) (def min-description-lenght 6) @@ -218,7 +218,7 @@ (rf/defn submit-report {:events [:logging/submit-report]} - [{:keys [db] :as cofx} details steps] + [{:keys [db] :as cofx}] (if-let [error (validate-description db)] {:db (assoc db :bug-report/description-error error)} (rf/merge @@ -247,7 +247,7 @@ (rf/defn submit-gh-issue {:events [:logging/submit-gh-issue]} - [{:keys [db] :as cofx} details steps] + [{:keys [db] :as cofx}] (rf/merge cofx {:db (dissoc db :bug-report/details)} diff --git a/src/legacy/status_im/utils/mobile_sync.cljs b/src/legacy/status_im/utils/mobile_sync.cljs index 2a4cfc89a0..66a7da1662 100644 --- a/src/legacy/status_im/utils/mobile_sync.cljs +++ b/src/legacy/status_im/utils/mobile_sync.cljs @@ -1,9 +1,5 @@ (ns legacy.status-im.utils.mobile-sync) -(defn cellular? - [network-type] - (= network-type "cellular")) - (defn syncing-allowed? [db] (let [network (:network/type db) diff --git a/src/legacy/status_im/utils/name.cljs b/src/legacy/status_im/utils/name.cljs deleted file mode 100644 index dd7818dc26..0000000000 --- a/src/legacy/status_im/utils/name.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns legacy.status-im.utils.name - (:require - [clojure.string :as string])) - -(defn too-long? - [name max-len] - (> (count name) max-len)) - -(defn max-name - [name max-len] - (let [names (string/split name " ")] - (first - (reduce (fn [[name done] next-name] - (if done - name - (let [new-name (string/join " " [name next-name])] - (if (too-long? new-name max-len) - (let [new-name' (str name " " (first next-name) ".")] - (if (too-long? new-name' max-len) - [name true] - [new-name' true])) - [new-name])))) - [(first names)] - (rest names))))) - -(defn shortened-name - [name max-len] - (if (> (count name) max-len) - (let [name' (max-name name max-len)] - (if (too-long? name' max-len) - (str (string/trim (subs name 0 max-len)) "...") - name')) - name)) diff --git a/src/legacy/status_im/utils/priority_map.cljs b/src/legacy/status_im/utils/priority_map.cljs deleted file mode 100644 index 662ed9efef..0000000000 --- a/src/legacy/status_im/utils/priority_map.cljs +++ /dev/null @@ -1,267 +0,0 @@ -(ns legacy.status-im.utils.priority-map - (:require - [cljs.core :as core] - [cljs.reader :refer [register-tag-parser!]]) - (:require-macros [cljs.core :as coreclj])) - -;; from -;; https://github.com/tailrecursion/cljs-priority-map/blob/master/src/cljs/tailrecursion/priority_map.cljs -;; fixing `vals` and `keys` function - -#_{:clj-kondo/ignore [:shadowed-var]} -(deftype PersistentPriorityMap [priority->set-of-items item->priority meta keyfn ^:mutable __hash] - IPrintWithWriter - (-pr-writer [coll writer opts] - (let [pr-pair (fn [keyval] - (pr-sequential-writer writer #'cljs.core/pr-writer "" " " "" opts keyval))] - (pr-sequential-writer writer - pr-pair - "#legacy.status-im.utils.priority-map {" - ", " - "}" - opts - coll))) - - IWithMeta - (-with-meta [_this meta] - (PersistentPriorityMap. priority->set-of-items item->priority meta keyfn __hash)) - - IMeta - (-meta [_this] meta) - - ICollection - (-conj [this entry] - (if (vector? entry) - (-assoc this (-nth entry 0) (-nth entry 1)) - (reduce -conj this entry))) - - IEmptyableCollection - (-empty [_this] - #_{:clj-kondo/ignore [:unresolved-symbol]} - (with-meta - legacy.status-im.utils.priority-map.PersistentPriorityMap.EMPTY - meta)) - - IEquiv - (-equiv [_this other] - (-equiv item->priority other)) - - IHash - (-hash [this] - (coreclj/caching-hash this core/hash-unordered-coll __hash)) - - ISeqable - (-seq [_this] - (if keyfn - (seq (for [[_ item-set] priority->set-of-items - item item-set] - (MapEntry. item (item->priority item) nil))) - (seq (for [[priority item-set] priority->set-of-items - item item-set] - (MapEntry. item priority nil))))) - - IReversible - (-rseq [_coll] - (if keyfn - (seq (for [[_ item-set] (rseq priority->set-of-items) - item item-set] - (MapEntry. item (item->priority item) nil))) - (seq (for [[priority item-set] (rseq priority->set-of-items) - item item-set] - (MapEntry. item priority nil))))) - - ICounted - (-count [_this] - (count item->priority)) - - ILookup - (-lookup [_this item] - (get item->priority item)) - (-lookup [_coll item not-found] - (get item->priority item not-found)) - - IStack - (-peek [_this] - (when-not (zero? (count item->priority)) - (let [f (first priority->set-of-items) - item (first (val f))] - (if keyfn - [item (item->priority item)] - [item (key f)])))) - (-pop [_this] - (if (zero? (count item->priority)) - (throw (js/Error. "Can't pop empty priority map")) - (let [f (first priority->set-of-items) - item-set (val f) - item (first item-set) - priority-key (key f)] - (if (= (count item-set) 1) - (PersistentPriorityMap. - (dissoc priority->set-of-items priority-key) - (dissoc item->priority item) - meta - keyfn - nil) - (PersistentPriorityMap. - (assoc priority->set-of-items priority-key (disj item-set item)) - (dissoc item->priority item) - meta - keyfn - nil))))) - - IAssociative - (-assoc [this item priority] - (if-let [current-priority (get item->priority item nil)] - (if (= current-priority priority) - this - (let [priority-key (keyfn priority) - current-priority-key (keyfn current-priority) - item-set (get priority->set-of-items current-priority-key)] - (if (= (count item-set) 1) - (PersistentPriorityMap. - (assoc (dissoc priority->set-of-items current-priority-key) - priority-key - (conj (get priority->set-of-items priority-key #{}) item)) - (assoc item->priority item priority) - meta - keyfn - nil) - (PersistentPriorityMap. - (assoc priority->set-of-items - current-priority-key - (disj (get priority->set-of-items current-priority-key) item) - priority-key - (conj (get priority->set-of-items priority-key #{}) item)) - (assoc item->priority item priority) - meta - keyfn - nil)))) - (let [priority-key (keyfn priority)] - (PersistentPriorityMap. - (assoc priority->set-of-items - priority-key - (conj (get priority->set-of-items priority-key #{}) item)) - (assoc item->priority item priority) - meta - keyfn - nil)))) - - (-contains-key? [_this item] - (contains? item->priority item)) - - IMap - (-dissoc [this item] - (let [priority (item->priority item ::not-found)] - (if (= priority ::not-found) - this - (let [priority-key (keyfn priority) - item-set (priority->set-of-items priority-key)] - (if (= (count item-set) 1) - (PersistentPriorityMap. - (dissoc priority->set-of-items priority-key) - (dissoc item->priority item) - meta - keyfn - nil) - (PersistentPriorityMap. - (assoc priority->set-of-items priority-key (disj item-set item)) - (dissoc item->priority item) - meta - keyfn - nil)))))) - - ISorted - (-sorted-seq [this ascending?] - ((if ascending? seq rseq) this)) - (-sorted-seq-from [_this k ascending?] - (let [sets (if ascending? - (subseq priority->set-of-items >= k) - (rsubseq priority->set-of-items <= k))] - (if keyfn - (seq (for [[_ item-set] sets - item item-set] - [item (item->priority item)])) - (seq (for [[priority item-set] sets - item item-set] - [item priority]))))) - (-entry-key [_this entry] - (keyfn (val entry))) - (-comparator [_this] compare) - - IFn - (-invoke [this item] - (-lookup this item)) - (-invoke [this item not-found] - (-lookup this item not-found))) - -#_{:clj-kondo/ignore [:unresolved-symbol]} -(set! legacy.status-im.utils.priority-map.PersistentPriorityMap.EMPTY - (PersistentPriorityMap. (sorted-map) {} {} identity nil)) - -(defn- pm-empty-by - [f-comparator] - (PersistentPriorityMap. (sorted-map-by f-comparator) {} {} identity nil)) - -(defn- pm-empty-keyfn - ([keyfn] - (PersistentPriorityMap. (sorted-map) {} {} keyfn nil)) - ([keyfn f-comparator] - (PersistentPriorityMap. (sorted-map-by f-comparator) {} {} keyfn nil))) - -(defn- read-priority-map - [elems] - (if (map? elems) - (into PersistentPriorityMap.EMPTY elems) - (throw (js/Error "Priority map literal expects a map for its elements.")))) - -(register-tag-parser! "legacy.status-im.utils.priority-map" read-priority-map) - -(defn priority-map - "keyval => key val - Returns a new priority map with supplied mappings." - ([& keyvals] - #_{:clj-kondo/ignore [:unresolved-symbol]} - (loop [in (seq keyvals) - out legacy.status-im.utils.priority-map.PersistentPriorityMap.EMPTY] - (if in - (recur (nnext in) (assoc out (first in) (second in))) - out)))) - -(defn priority-map-by - "keyval => key val - Returns a new priority map with supplied - mappings, using the supplied comparator." - ([f-comparator & keyvals] - (loop [in (seq keyvals) - out (pm-empty-by f-comparator)] - (if in - (recur (nnext in) (assoc out (first in) (second in))) - out)))) - -(defn priority-map-keyfn - "keyval => key val - Returns a new priority map with supplied - mappings, using the supplied keyfn." - ([keyfn & keyvals] - (loop [in (seq keyvals) - out (pm-empty-keyfn keyfn)] - (if in - (recur (nnext in) (assoc out (first in) (second in))) - out)))) - -(defn priority-map-keyfn-by - "keyval => key val - Returns a new priority map with supplied - mappings, using the supplied keyfn and comparator." - ([keyfn f-comparator & keyvals] - (loop [in (seq keyvals) - out (pm-empty-keyfn keyfn f-comparator)] - (if in - (recur (nnext in) (assoc out (first in) (second in))) - out)))) - -(def empty-message-map - (priority-map-keyfn-by :clock-value >)) - -(def empty-transaction-map - (priority-map-keyfn-by :block #(< (int %1) (int %2)))) diff --git a/src/legacy/status_im/utils/transducers_test.cljs b/src/legacy/status_im/utils/transducers_test.cljs index 7d6fb51ae3..150a487587 100644 --- a/src/legacy/status_im/utils/transducers_test.cljs +++ b/src/legacy/status_im/utils/transducers_test.cljs @@ -3,20 +3,6 @@ [cljs.test :refer-macros [deftest is testing]] [legacy.status-im.utils.transducers :as transducers])) -(def preview-call-1 - {:jail-id 1 - :path [:preview] - :params {:chat-id 1} - :callback (fn [] - [[:msg-id 1]])}) - -(def preview-call-2 - {:jail-id 1 - :path [:preview] - :params {:chat-id 1} - :callback (fn [] - [[:msg-id 2]])}) - (def jail-calls '({:jail-id 1 :path [:suggestions] diff --git a/src/legacy/status_im/utils/utils.cljs b/src/legacy/status_im/utils/utils.cljs index c5061d0e6b..57b72d230c 100644 --- a/src/legacy/status_im/utils/utils.cljs +++ b/src/legacy/status_im/utils/utils.cljs @@ -2,8 +2,6 @@ (:require ["react-native" :as react-native] ["react-native-background-timer" :default background-timer] - [clojure.string :as string] - [goog.string :as gstring] [re-frame.core :as re-frame] [utils.address :as address] [utils.ethereum.eip.eip55 :as eip55] @@ -71,10 +69,6 @@ [cb ms] (.setTimeout background-timer cb ms)) -(defn clear-timeout - [id] - (.clearTimeout background-timer id)) - (defn set-interval [cb ms] (.setInterval background-timer cb ms)) @@ -90,13 +84,6 @@ (when (and ms dispatch) (set-timeout #(re-frame/dispatch dispatch) ms))))) -(re-frame/reg-fx - ::clear-timeouts - (fn [ids] - (doseq [id ids] - (when id - (clear-timeout id))))) - (defn get-shortened-address "Takes first and last 4 digits from address including leading 0x and adds unicode ellipsis in between" @@ -108,24 +95,3 @@ [address] (when address (get-shortened-address (eip55/address->checksum (address/normalized-hex address))))) - -;;TODO (14/11/22 flexsurfer) haven't moved yet -(defn format-decimals - [amount places] - (let [decimal-part (get (string/split (str amount) ".") 1)] - (if (> (count decimal-part) places) - (gstring/format (str "%." places "f") amount) - (or (str amount) 0)))) - -(defn safe-nth - [coll index] - (when (number? index) - (nth coll index))) - -(defn svg? - [some-string] - (string/ends-with? some-string ".svg")) - -(defn exclude-svg-resources - [lst] - (remove svg? lst)) diff --git a/src/legacy/status_im/utils/utils_test.cljs b/src/legacy/status_im/utils/utils_test.cljs index 6e51140cc9..55b9eff605 100644 --- a/src/legacy/status_im/utils/utils_test.cljs +++ b/src/legacy/status_im/utils/utils_test.cljs @@ -1,8 +1,7 @@ (ns legacy.status-im.utils.utils-test (:require [cljs.test :refer-macros [deftest is]] - [legacy.status-im.utils.core :as u] - [legacy.status-im.utils.utils :as uu])) + [legacy.status-im.utils.core :as u])) (deftest truncate-str-test (is (= (u/truncate-str "Long string" 7) "Long...")) ; threshold is less then string length @@ -11,16 +10,3 @@ (is (= (u/truncate-str "Long string" 11) "Long string")) ; threshold is the same as string length (is (= (u/truncate-str "Long string" 20) "Long string"))) ; threshold is more then string length -(deftest first-index-test - (is (= 2 - (u/first-index (partial = :test) - '(:a :b :test :c :test)))) - (is (= nil - (u/first-index (partial = :test) - '(:a :b :c))))) - -(deftest format-decimals-test - (is (= "1" (uu/format-decimals 1 5))) - (is (= "1.1" (uu/format-decimals 1.1 5))) - (is (= "1.111111" (uu/format-decimals 1.111111 7))) - (is (= "1.1" (uu/format-decimals 1.111 1)))) diff --git a/src/legacy/status_im/visibility_status_updates/core.cljs b/src/legacy/status_im/visibility_status_updates/core.cljs index 95e0b49d3c..c6188b7813 100644 --- a/src/legacy/status_im/visibility_status_updates/core.cljs +++ b/src/legacy/status_im/visibility_status_updates/core.cljs @@ -101,7 +101,7 @@ (rf/defn update-visibility-status {:events [:visibility-status-updates/update-visibility-status]} - [{:keys [db] :as cofx} status-type] + [{:keys [db]} status-type] {:db (update-in db [:profile/profile :current-user-visibility-status] merge @@ -113,10 +113,10 @@ (rf/defn send-visibility-status-updates? {:events [:visibility-status-updates/send-visibility-status-updates?]} - [cofx val] + [cofx value] (multiaccounts.update/multiaccount-update cofx :send-status-updates? - val + value {})) (rf/defn visibility-status-option-pressed @@ -142,7 +142,7 @@ (rf/defn delayed-visibility-status-update {:events [:visibility-status-updates/delayed-visibility-status-update]} - [{:keys [db]} status-type] + [_ status-type] {:dispatch-later [{:ms 200 :dispatch @@ -150,13 +150,13 @@ (rf/defn peers-summary-change [{:keys [db] :as cofx} peers-count] - (let [send-visibility-status-updates? + (let [send-updates? (get-in db [:profile/profile :send-status-updates?]) status-type (get-in db [:profile/profile :current-user-visibility-status :status-type])] (when (and (> peers-count 0) - send-visibility-status-updates? + send-updates? (= status-type constants/visibility-status-inactive)) (rf/merge cofx {:dispatch-later [{:ms 1000 diff --git a/src/legacy/status_im/waku/core.cljs b/src/legacy/status_im/waku/core.cljs index 84c15b5257..5c9fb33c8d 100644 --- a/src/legacy/status_im/waku/core.cljs +++ b/src/legacy/status_im/waku/core.cljs @@ -16,7 +16,7 @@ (rf/defn set-input {:events [:wakuv2.ui/input-changed]} - [{:keys [db] :as cofx} input-key value] + [{:keys [db]} input-key value] {:db (assoc-in db [:wakuv2-nodes/manage input-key] {:value value @@ -81,7 +81,7 @@ (rf/defn save-all-pressed {:events [:wakuv2.ui/save-all-pressed]} - [{:keys [db] :as cofx}] + [_cofx] {:ui/show-confirmation {:title (i18n/label :t/close-app-title) :content (i18n/label :t/wakuv2-change-nodes) @@ -92,7 +92,7 @@ (rf/defn save-all {:events [:wakuv2.ui/save-all-confirmed]} - [{:keys [db] :as cofx}] + [{:keys [db]}] (let [new-nodes (->> (:wakuv2-nodes/list db) vals (map #(vector (:name %1) (:address %1))) diff --git a/src/native_module/core.cljs b/src/native_module/core.cljs index fc1f3a4ee8..2af2b36062 100644 --- a/src/native_module/core.cljs +++ b/src/native_module/core.cljs @@ -85,14 +85,6 @@ ([callback] (.acceptTerms ^js (account-manager) callback))) -(defn prepare-dir-and-update-config - [key-uid config callback] - (log/debug "[native-module] prepare-dir-and-update-config") - (.prepareDirAndUpdateConfig ^js (account-manager) - key-uid - config - #(callback (types/json->clj %)))) - (defn login-account "NOTE: beware, the password has to be sha3 hashed" [{:keys [keyUid] :as request}] @@ -134,19 +126,6 @@ (clear-web-data) (.logout ^js (account-manager))) -(defn multiaccount-derive-addresses - "NOTE: this should be named derive-accounts - this only derive addresses, they still need to be stored - with `multiaccount-store-derived` if you want to be able to - reuse the derived addresses later" - [account-id paths callback] - (log/debug "[native-module] multiaccount-derive-addresses") - (when (status) - (.multiAccountDeriveAddresses ^js (account-manager) - (types/clj->json {:accountID account-id - :paths paths}) - callback))) - (defn multiaccount-generate-and-derive-addresses "used to generate multiple multiaccounts for onboarding NOTE: nothing is saved so you will need to use @@ -161,54 +140,15 @@ :paths paths}) callback)) -(defn multiaccount-import-mnemonic - [mnemonic password callback] - (log/debug "[native-module] multiaccount-import-mnemonic") - (.multiAccountImportMnemonic ^js (account-manager) - (types/clj->json {:mnemonicPhrase mnemonic - ;;NOTE this is not the multiaccount password - :Bip39Passphrase password}) - callback)) - -(defn verify - "NOTE: beware, the password has to be sha3 hashed" - [address hashed-password callback] - (log/debug "[native-module] verify") - (.verify ^js (account-manager) address hashed-password callback)) - (defn set-soft-input-mode [mode] (log/debug "[native-module] set-soft-input-mode") (.setSoftInputMode ^js (ui-helper) mode)) -(defn call-rpc - [payload callback] - (log/debug "[native-module] call-rpc") - (.callRPC ^js (network) payload callback)) - (defn call-private-rpc [payload callback] (.callPrivateRPC ^js (network) payload callback)) -(defn hash-transaction - "used for keycard" - [rpcParams callback] - (log/debug "[native-module] hash-transaction") - (.hashTransaction ^js (encryption) rpcParams callback)) - -(defn hash-message - "used for keycard" - [message callback] - (log/debug "[native-module] hash-message") - (.hashMessage ^js (encryption) message callback)) - -(defn start-searching-for-local-pairing-peers - "starts a UDP multicast beacon that both listens for and broadcasts to LAN peers" - [callback] - (log/info "[native-module] Start Searching for Local Pairing Peers" - {:fn :start-searching-for-local-pairing-peers}) - (.startSearchForLocalPairingPeers ^js (network) callback)) - (defn local-pairing-preflight-outbound-check "Checks whether the device has allows connecting to the local server" [callback] @@ -257,24 +197,6 @@ :public-key public-key}) (.multiformatDeserializePublicKey ^js (encryption) public-key deserialization-key callback)) -(defn hash-typed-data - "used for keycard" - [data callback] - (log/debug "[native-module] hash-typed-data") - (.hashTypedData ^js (encryption) data callback)) - -(defn hash-typed-data-v4 - "used for keycard" - [data callback] - (log/debug "[native-module] hash-typed-data-v4") - (.hashTypedDataV4 ^js (encryption) data callback)) - -(defn send-transaction-with-signature - "used for keycard" - [rpcParams sig callback] - (log/debug "[native-module] send-transaction-with-signature") - (.sendTransactionWithSignature ^js (network) rpcParams sig callback)) - (defn sign-message "NOTE: beware, the password in rpcParams has to be sha3 hashed" ([rpcParams] @@ -283,43 +205,11 @@ (log/debug "[native-module] sign-message") (.signMessage ^js (encryption) rpcParams callback))) -(defn recover-message - [rpcParams callback] - (log/debug "[native-module] recover") - (.recover ^js (network) rpcParams callback)) - -(defn send-transaction - "NOTE: beware, the password has to be sha3 hashed" - [rpcParams hashed-password callback] - (log/debug "[native-module] send-transaction") - (.sendTransaction ^js (network) rpcParams hashed-password callback)) - -(defn sign-typed-data - "NOTE: beware, the password has to be sha3 hashed" - ([data account hashed-password] - (native-utils/promisify-native-module-call sign-typed-data data account hashed-password)) - ([data account hashed-password callback] - (log/debug "[native-module] sign-typed-data") - (.signTypedData ^js (encryption) data account hashed-password callback))) - -(defn sign-typed-data-v4 - "NOTE: beware, the password has to be sha3 hashed" - ([data account hashed-password] - (native-utils/promisify-native-module-call sign-typed-data-v4 data account hashed-password)) - ([data account hashed-password callback] - (log/debug "[native-module] sign-typed-data-v4") - (.signTypedDataV4 ^js (encryption) data account hashed-password callback))) - (defn send-logs [dbJson js-logs callback] (log/debug "[native-module] send-logs") (.sendLogs ^js (log-manager) dbJson js-logs callback)) -(defn close-application - [] - (log/debug "[native-module] close-application") - (.closeApplication ^js (status))) - (defn connection-change [type expensive?] (log/debug "[native-module] connection-change") @@ -388,23 +278,6 @@ ;; in unknown scenarios we also consider the device rooted to avoid degrading security :else (callback true))) -(defn encode-transfer - [to-norm amount-hex] - (log/debug "[native-module] encode-transfer") - (.encodeTransfer ^js (encryption) to-norm amount-hex)) - -(defn encode-function-call - [method params] - (log/debug "[native-module] encode-function-call") - (.encodeFunctionCall ^js (encryption) method (types/clj->json params))) - -(defn decode-parameters - [bytes-string types] - (log/debug "[native-module] decode-parameters") - (let [json-str (.decodeParameters ^js (encryption) - (types/clj->json {:bytesString bytes-string :types types}))] - (types/json->clj json-str))) - (defn hex-to-number [hex] (log/debug "[native-module] hex-to-number") @@ -422,11 +295,6 @@ (when s (.sha3 ^js (encryption) (str s)))) -(defn utf8-to-hex - [s] - (log/debug "[native-module] utf8-to-hex") - (.utf8ToHex ^js (encryption) s)) - (defn hex-to-utf8 [s] (log/debug "[native-module] hex-to-utf8") @@ -480,18 +348,6 @@ (log/debug "[native-module] delete-multiaccount") (.deleteMultiaccount ^js (account-manager) key-uid callback)) -(defn delete-imported-key - "Delete imported key file." - [key-uid address hashed-password callback] - (log/debug "[native-module] delete-imported-key") - (.deleteImportedKey ^js (status) key-uid address hashed-password callback)) - -(defn reset-keyboard-input - [input selection] - (log/debug "[native-module] resetKeyboardInput") - (when platform/android? - (.resetKeyboardInputCursor ^js (ui-helper) input selection))) - (defn reset-password ([key-uid current-password-hashed new-password-hashed] (native-utils/promisify-native-module-call reset-password diff --git a/src/native_module/push_notifications.cljs b/src/native_module/push_notifications.cljs index 408cf0d97e..c0c7a7108a 100644 --- a/src/native_module/push_notifications.cljs +++ b/src/native_module/push_notifications.cljs @@ -16,10 +16,6 @@ [chat-id] (.clearMessageNotifications ^js (push-notification) chat-id)) -(defn clear-all-message-notifications - [] - (.clearAllMessageNotifications ^js (push-notification))) - (defn create-channel [{:keys [channel-id channel-name]}] (.createChannel ^js (push-notification) diff --git a/src/quo/components/common/not_implemented/style.cljs b/src/quo/components/common/not_implemented/style.cljs deleted file mode 100644 index 0c348e48d5..0000000000 --- a/src/quo/components/common/not_implemented/style.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns quo.components.common.not-implemented.style - (:require - [quo.foundations.colors :as colors])) - -(defn text - [blur? theme] - {:border-color :red - :border-width 1 - :color (if blur? - colors/white - (colors/theme-colors colors/neutral-100 - colors/white - theme))}) diff --git a/src/quo/components/common/not_implemented/view.cljs b/src/quo/components/common/not_implemented/view.cljs deleted file mode 100644 index 0cbeea575e..0000000000 --- a/src/quo/components/common/not_implemented/view.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns quo.components.common.not-implemented.view - (:require - [quo.components.common.not-implemented.style :as style] - [quo.theme :as quo.theme] - [react-native.core :as rn])) - -(defn view - [{:keys [blur?]}] - (let [theme (quo.theme/use-theme)] - [rn/text {:style (style/text blur? theme)} - "not implemented"])) diff --git a/src/quo/components/community/community_list_view.cljs b/src/quo/components/community/community_list_view.cljs index 5e359006d8..cf4ad50943 100644 --- a/src/quo/components/community/community_list_view.cljs +++ b/src/quo/components/community/community_list_view.cljs @@ -38,49 +38,6 @@ unread-messages? [unread-grey-dot :unviewed-messages-public])]) -(defn communities-list-view-item - [{:keys [customization-color] :as props} - {:keys [name locked? status muted unread-messages? unread-mentions-count community-icon tokens]}] - (let [theme (quo.theme/use-theme)] - [rn/view - {:style (merge (style/community-card 16 theme) - {:margin-bottom 12})} - [rn/touchable-highlight - (merge {:style {:height 56 - :border-radius 16}} - props) - [rn/view {:style style/detail-container} - [rn/view (style/list-info-container) - [community-icon/community-icon - {:images community-icon} 32] - [rn/view - {:flex 1 - :margin-horizontal 12} - [text/text - {:weight :semi-bold - :size :paragraph-1 - :accessibility-label :community-name-text - :number-of-lines 1 - :ellipsize-mode :tail - :style {:color (when muted - (colors/theme-colors - colors/neutral-40 - colors/neutral-60 - theme))}} - name] - [community-view/community-stats-column - {:type :list-view}]] - (if (= status :gated) - [community-view/permission-tag-container - {:locked? locked? - :tokens tokens}] - [notification-view - {:customization-color customization-color - :theme theme - :muted? muted - :unread-mentions-count unread-mentions-count - :unread-messages? unread-messages?}])]]]])) - (defn- title-color [unread-messages? muted theme] (cond diff --git a/src/quo/components/community/style.cljs b/src/quo/components/community/style.cljs index 3a2b2bf338..492d62c6cf 100644 --- a/src/quo/components/community/style.cljs +++ b/src/quo/components/community/style.cljs @@ -68,14 +68,6 @@ colors/neutral-90 theme)}) -(defn list-info-container - [] - {:flex-direction :row - :border-radius 16 - :padding-horizontal 12 - :align-items :center - :padding-vertical 8}) - (defn membership-info-container [] {:flex-direction :row diff --git a/src/quo/components/drawers/drawer_top/style.cljs b/src/quo/components/drawers/drawer_top/style.cljs index 3a7a03a923..d225532c59 100644 --- a/src/quo/components/drawers/drawer_top/style.cljs +++ b/src/quo/components/drawers/drawer_top/style.cljs @@ -21,10 +21,6 @@ {:margin-right 8 :justify-content :center}) -(defn network-text-color - [network] - {:color (colors/custom-color network)}) - (def row {:flex-direction :row :align-items :center}) diff --git a/src/quo/components/dropdowns/dropdown_input/style.cljs b/src/quo/components/dropdowns/dropdown_input/style.cljs index 14fe9132d0..1a1dc661bc 100644 --- a/src/quo/components/dropdowns/dropdown_input/style.cljs +++ b/src/quo/components/dropdowns/dropdown_input/style.cljs @@ -4,13 +4,6 @@ (def gap 8) -(def blur-view - {:position :absolute - :top 0 - :left 0 - :right 0 - :bottom 0}) - (def left-icon {:margin-right gap}) diff --git a/src/quo/components/graph/wallet_graph/style.cljs b/src/quo/components/graph/wallet_graph/style.cljs index e777a79908..6f328a406f 100644 --- a/src/quo/components/graph/wallet_graph/style.cljs +++ b/src/quo/components/graph/wallet_graph/style.cljs @@ -1,6 +1,4 @@ -(ns quo.components.graph.wallet-graph.style - (:require - [quo.foundations.colors :as colors])) +(ns quo.components.graph.wallet-graph.style) (def gradient-background {:height 294 @@ -14,12 +12,6 @@ :padding-top -10 :height 0}) -(def illustration - {:height 96 - :background-color colors/danger-50 - :align-items :center - :justify-content :center}) - (def empty-state {:width 375 :height 116}) diff --git a/src/quo/components/header.cljs b/src/quo/components/header.cljs deleted file mode 100644 index 2696e44c67..0000000000 --- a/src/quo/components/header.cljs +++ /dev/null @@ -1,208 +0,0 @@ -(ns quo.components.header - (:require - [oops.core :refer [oget]] - [quo.components.buttons.button.view :as button] - [quo.components.markdown.text :as text] - [quo.foundations.colors :as colors] - [quo.theme :as quo.theme] - [react-native.core :as rn] - [react-native.reanimated :as reanimated])) - -(def header-height 56) - -(defn header-wrapper-style - [{:keys [height border-bottom background theme]}] - (merge - {:background-color (colors/theme-colors - colors/neutral-5 - colors/neutral-95 - theme) - :height height} - (when background - {:background-color background}) - (when border-bottom - {:border-bottom-width 1 - :border-bottom-color (colors/theme-colors - colors/neutral-5 - colors/neutral-95 - theme)}))) - -(def absolute-fill - {:position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0}) - -(def content - {:flex 1 - :flex-direction :row - :align-items :center - :justify-content :center}) - -(def left-style - {:position :absolute - :left 0 - :top 0 - :bottom 0 - :justify-content :center - :align-items :flex-start}) - -(def right-style - {:position :absolute - :right 0 - :top 0 - :bottom 0 - :justify-content :center - :align-items :flex-end}) - -(defn get-title-style - [{:keys [left right]} title-align] - (merge - absolute-fill - (case title-align - :left {:left (:width left) - :right (:width right)} - {:align-items :center - :justify-content :center - :left (max (:width left) (:width right)) - :right (max (:width left) (:width right))}))) - -(def header-actions-style - {:flex 1 - :flex-direction :row - :align-items :center - :justify-content :center - :padding-horizontal 4}) - -(def header-action-placeholder - {:width 16}) - -(def element - {:align-items :center - :justify-content :center - :flex 1}) - -(defn header-action - [{:keys [icon label on-press disabled accessibility-label]}] - [button/button - {:on-press on-press - :disabled? disabled - :icon-only? (boolean icon) - :accessibility-label accessibility-label} - (cond - icon icon - label label)]) - -(defn header-actions - [{:keys [accessories component]}] - [rn/view {:style element} - (cond - (seq accessories) - (into [rn/view {:style header-actions-style}] - (map header-action accessories)) - - component component - - :else - [rn/view {:style header-action-placeholder}])]) - -(defn header-title - [{:keys [title subtitle component title-align]}] - [:<> - (cond - component component - - (and title subtitle) - [:<> - [text/text - {:weight :medium - :number-of-lines 1} - title] - [text/text - {:weight :regular - :color :secondary - :number-of-lines 1} - subtitle]] - - title [text/text - {:weight :bold - :number-of-lines 0 - :align title-align - :size :large} - title])]) - -(defn header - [{:keys [left-accessories left-component border-bottom left-width right-width - right-accessories right-component insets get-layout - title subtitle title-component style title-align - background] - :or {title-align :center - border-bottom false}}] - (let [theme (quo.theme/use-theme) - [layout set-layout] (rn/use-state {:left {:width (or left-width 8) - :height header-height} - :right {:width (or right-width 8) - :height header-height} - :title {:width 0 - :height header-height}}) - handle-layout (rn/use-callback - (fn [el get-layout] - (fn [evt] - (let [width (oget evt "nativeEvent" "layout" "width") - height (oget evt "nativeEvent" "layout" "height")] - (when get-layout - (get-layout el - {:width width - :height height})) - (set-layout - (assoc layout - el - {:width width - :height height}))))) - [layout]) - status-bar-height (get insets :top 0) - height (+ header-height status-bar-height) - title-style (rn/use-memo (fn [] (get-title-style layout title-align)) - [layout title-align])] - [reanimated/view - {:style (header-wrapper-style {:height height - :background background - :border-bottom border-bottom - :theme theme})} - [rn/view - {:pointer-events :box-none - :height status-bar-height}] - [rn/view - {:style (merge {:height header-height} - style) - :pointer-events :box-none} - [rn/view - {:style absolute-fill - :pointer-events :box-none} - [rn/view - {:style content - :pointer-events :box-none} - [rn/view - {:style left-style - :on-layout (handle-layout :left get-layout) - :pointer-events :box-none} - [header-actions - {:accessories left-accessories - :component left-component}]] - [rn/view - {:style title-style - :on-layout (handle-layout :title get-layout) - :pointer-events :box-none} - [header-title - {:title title - :subtitle subtitle - :title-align title-align - :component title-component}]] - [rn/view - {:style right-style - :on-layout (handle-layout :right get-layout) - :pointer-events :box-none} - [header-actions - {:accessories right-accessories - :component right-component}]]]]]])) diff --git a/src/quo/components/list_items/account/style.cljs b/src/quo/components/list_items/account/style.cljs index d94e1badc0..d04fe32ad7 100644 --- a/src/quo/components/list_items/account/style.cljs +++ b/src/quo/components/list_items/account/style.cljs @@ -67,13 +67,6 @@ :height 22 :align-items :center}) -(defn account-address - [blur? theme] - {:height 18 - :color (if blur? - colors/white-opa-40 - (colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}) - (def title-icon-container {:margin-left 4}) diff --git a/src/quo/components/list_items/missing_keypair/style.cljs b/src/quo/components/list_items/missing_keypair/style.cljs index edc34857c9..d4925ad7e7 100644 --- a/src/quo/components/list_items/missing_keypair/style.cljs +++ b/src/quo/components/list_items/missing_keypair/style.cljs @@ -21,16 +21,6 @@ colors/neutral-80-opa-40 theme))}) -(defn icon-container - [{:keys [blur? theme]}] - {:border-radius 32 - :border-width 1 - :border-color (if blur? - colors/white-opa-5 - (colors/theme-colors colors/neutral-20 - colors/neutral-80 - theme))}) - (def name-container {:flex 1 :padding-right 16 diff --git a/src/quo/components/loaders/skeleton.cljs b/src/quo/components/loaders/skeleton.cljs deleted file mode 100644 index cb403af7d7..0000000000 --- a/src/quo/components/loaders/skeleton.cljs +++ /dev/null @@ -1,93 +0,0 @@ -(ns quo.components.loaders.skeleton - (:require - [quo.foundations.colors :as colors] - [quo.theme :as quo.theme] - [react-native.core :as rn] - [react-native.masked-view :as masked-view] - [react-native.reanimated :as reanimated] - [reagent.core :as reagent])) - -(def message-skeleton-height 54) - -(def avatar-skeleton-size 32) - -(def message-content-width - [{:author 80 - :message 249} - {:author 124 - :message 156} - {:author 96 - :message 212} - {:author 112 - :message 144}]) - -;; Standlone message skeleton -(defn- f-message-skeleton - {:deprecated "quo.components.loaders.skeleton-list.view should be used instead"} - [{:keys [theme]}] - - (let [color (colors/theme-colors colors/neutral-5 colors/neutral-70 theme) - loading-color (colors/theme-colors colors/neutral-10 colors/neutral-60 theme) - content-width (rand-nth message-content-width) - author-width (content-width :author) - message-width (content-width :message) - {window-width :width} (rn/get-window) - translate-x (reanimated/use-shared-value (- window-width)) - animated-gradient-style (reanimated/apply-animations-to-style - {:transform [{:translateX translate-x}]} - {:width window-width - :height "100%"})] - (reanimated/animate-shared-value-with-repeat translate-x window-width 1000 :linear (- 1) false) - [masked-view/masked-view - {:style {:height message-skeleton-height} - :maskElement (reagent/as-element - [rn/view - {:style {:height message-skeleton-height - :flex-direction :row - :padding-vertical 11 - :background-color :transparent - :padding-left 21}} - [rn/view - {:style {:height avatar-skeleton-size - :width avatar-skeleton-size - :border-radius (/ avatar-skeleton-size 2) - :background-color color - :overflow :hidden}}] - [rn/view - {:style {:padding-left 8 - :background-color :transparent}} - [rn/view - {:style {:height 8 - :width author-width - :border-radius 6 - :background-color color - :margin-bottom 8 - :overflow :hidden}}] - [rn/view - {:style {:height 16 - :width message-width - :border-radius 6 - :overflow :hidden - :background-color color}}]]])} - [rn/view - {:style {:flex 1 - :background-color color}} - [reanimated/linear-gradient - {:colors [color color loading-color color color] - :start {:x 0 :y 0} - :end {:x 1 :y 0} - :style animated-gradient-style}]]])) - -(defn view - [{:keys [parent-height]}] - (let [theme (quo.theme/use-theme) - number-of-skeletons (int (Math/floor (/ parent-height message-skeleton-height)))] - [rn/view - {:style {:background-color (colors/theme-colors - colors/white - colors/neutral-90 - theme) - :flex 1}} - (doall - (for [n (range number-of-skeletons)] - [:f> f-message-skeleton {:key n :theme theme}]))])) diff --git a/src/quo/components/markdown/list/style.cljs b/src/quo/components/markdown/list/style.cljs index 132517fe17..0df496c2ab 100644 --- a/src/quo/components/markdown/list/style.cljs +++ b/src/quo/components/markdown/list/style.cljs @@ -9,8 +9,5 @@ :align-items :flex-start} container-style)) -(def index - {:margin-left 5}) - (def text-container {:margin-left 8}) diff --git a/src/quo/components/selectors/reaction_resource.clj b/src/quo/components/selectors/reaction_resource.clj deleted file mode 100644 index e4356f6a73..0000000000 --- a/src/quo/components/selectors/reaction_resource.clj +++ /dev/null @@ -1,31 +0,0 @@ -(ns quo.components.selectors.reaction-resource - (:require - [clojure.java.io :as io] - [clojure.string :as string])) - -(def ^:private reactions-dir "./resources/images/reactions/") - -(defn- resolve-reaction - [reaction] - (let [path (str reactions-dir (name reaction) ".png") - file (io/file path)] - (when (.exists file) - `(js/require ~(str "." path))))) - -(defn- find-all-image-base-names - [] - (let [dir (io/file reactions-dir)] - (->> dir - file-seq - (filter #(string/ends-with? % "png")) - (map #(.getName %)) - (map #(string/replace % #"\.png$" "")) - (map #(first (string/split % #"@"))) - distinct))) - -(defmacro resolve-all-reactions - [] - (reduce (fn [acc reaction] - (assoc acc reaction (resolve-reaction reaction))) - {} - (find-all-image-base-names))) diff --git a/src/quo/components/selectors/reaction_resource.cljs b/src/quo/components/selectors/reaction_resource.cljs index d019c3d870..f4e2c3370d 100644 --- a/src/quo/components/selectors/reaction_resource.cljs +++ b/src/quo/components/selectors/reaction_resource.cljs @@ -1,8 +1,4 @@ -(ns quo.components.selectors.reaction-resource - (:require-macros [quo.components.selectors.reaction-resource :refer [resolve-all-reactions]])) - -(def ^:private reactions - (resolve-all-reactions)) +(ns quo.components.selectors.reaction-resource) (def system-emojis {:reaction/thumbs-up "๐Ÿ‘" @@ -12,9 +8,3 @@ :reaction/sad "๐Ÿ˜ข" :reaction/angry "๐Ÿ˜ก"}) -(defn get-reaction - [reaction] - (assert (keyword? reaction) "Reaction should be a keyword") - (assert (= "reaction" (namespace reaction)) - "Reaction keyword should be namespaced with :reaction") - (get reactions (name reaction))) diff --git a/src/quo/components/settings/category/style.cljs b/src/quo/components/settings/category/style.cljs index ee59a5f51b..002acc9af5 100644 --- a/src/quo/components/settings/category/style.cljs +++ b/src/quo/components/settings/category/style.cljs @@ -44,19 +44,3 @@ :background-color (if blur? :transparent (colors/theme-colors colors/neutral-5 colors/neutral-95 theme))}) - -(defn blur-container - [] - {:position :absolute - :left 0 - :right 0 - :bottom 0 - :top 0 - :overflow :hidden}) - -(defn blur-view - [theme] - {:style {:flex 1} - :blur-radius 10 - :blur-type theme - :blur-amount 20}) diff --git a/src/quo/components/settings/reorder_item/style.cljs b/src/quo/components/settings/reorder_item/style.cljs index 308d85d6a1..e6422b9a59 100644 --- a/src/quo/components/settings/reorder_item/style.cljs +++ b/src/quo/components/settings/reorder_item/style.cljs @@ -141,9 +141,6 @@ :width 19 :margin-right 3}) -(def tab-item-label - {:font-size 14}) - (defn tab-icon [theme] {:height 16 diff --git a/src/quo/components/tags/context_tag/style.cljs b/src/quo/components/tags/context_tag/style.cljs index eed0e684ff..8ee8e73de9 100644 --- a/src/quo/components/tags/context_tag/style.cljs +++ b/src/quo/components/tags/context_tag/style.cljs @@ -117,8 +117,3 @@ (if (= size 24) {:margin-left 4} {:margin-left 2})) - -(def audio - {:margin-right 6 - :flex-direction :row - :align-items :center}) diff --git a/src/quo/components/wallet/token_input/style.cljs b/src/quo/components/wallet/token_input/style.cljs index ca79e504df..a9fdacf574 100644 --- a/src/quo/components/wallet/token_input/style.cljs +++ b/src/quo/components/wallet/token_input/style.cljs @@ -19,10 +19,6 @@ {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) :padding-bottom 3}) -(def text-input-container - {:flex-direction :row - :align-items :flex-end}) - (defn input-container [window-width] {:width (- window-width 120) diff --git a/src/quo/core.cljs b/src/quo/core.cljs index 50a057b8fc..ca877bed2f 100644 --- a/src/quo/core.cljs +++ b/src/quo/core.cljs @@ -67,7 +67,6 @@ quo.components.gradient.gradient-cover.view quo.components.graph.interactive-graph.view quo.components.graph.wallet-graph.view - quo.components.header quo.components.icon quo.components.info.info-message.view quo.components.info.information-box.view @@ -254,13 +253,9 @@ (def community-token-gating quo.components.community.community-token-gating.view/view) (def communities-membership-list-item quo.components.community.community-list-view/communities-membership-list-item) -(def community-stats-column quo.components.community.community-view/community-stats-column) (def community-stat quo.components.community.community-stat.view/view) (def community-tags quo.components.community.community-view/community-tags) -(def community-title quo.components.community.community-view/community-title) -(def permission-tag-container quo.components.community.community-view/permission-tag-container) (def discover-card quo.components.community.banner.view/view) -(def community-icon quo.components.community.icon/community-icon) (def channel-action quo.components.community.channel-action.view/view) (def channel-actions quo.components.community.channel-actions.view/view) @@ -298,7 +293,6 @@ (def wallet-graph quo.components.graph.wallet-graph.view/view) ;;;; Header -(def header quo.components.header/header) (def animated-header-list quo.components.animated-header-flatlist.view/animated-header-list) ;;;; Gradient @@ -377,8 +371,6 @@ ;;;; Notifications (def activity-log quo.components.notifications.activity-log.view/view) (def activity-logs-photos quo.components.notifications.activity-logs-photos.view/view) -(def notification-dot quo.components.common.notification-dot.view/view) -(def count-down-circle quo.components.notifications.count-down-circle/circle-timer) (def notification quo.components.notifications.notification.view/notification) (def toast quo.components.notifications.toast.view/toast) @@ -450,14 +442,11 @@ (def channel-name quo.components.text-combinations.channel-name.view/view) (def page-top quo.components.text-combinations.page-top.view/view) (def standard-title quo.components.text-combinations.standard-title.view/view) -(def ^{:deprecated "quo.components.text-combinations.page-top.view should be used instead"} - text-combinations +(def ;; ^{:deprecated "quo.components.text-combinations.page-top.view should be used instead"} + text-combinations quo.components.text-combinations.view/view) (def username quo.components.text-combinations.username.view/view) -;;;; Utilities - Outside of design system -(def token quo.components.utilities.token.view/view) - ;;;; Wallet (def account-card quo.components.wallet.account-card.view/view) (def account-origin quo.components.wallet.account-origin.view/view) diff --git a/src/quo/foundations/colors.cljs b/src/quo/foundations/colors.cljs index d2831b0c9c..acdea1b037 100644 --- a/src/quo/foundations/colors.cljs +++ b/src/quo/foundations/colors.cljs @@ -352,8 +352,8 @@ opacity 0-100 (optional) - if set theme is ignored and goes to 50 suffix internally" (memoize resolve-color*)) -(def ^{:deprecated true :superseded-by "resolve-color"} - custom-color +(def ;; ^{:deprecated true :superseded-by "resolve-color"} + custom-color "(custom-color color suffix opacity) color :primary/:purple/... suffix 50/60 diff --git a/src/react_native/audio_toolkit.cljs b/src/react_native/audio_toolkit.cljs index 6ac8881c13..c0d791e064 100644 --- a/src/react_native/audio_toolkit.cljs +++ b/src/react_native/audio_toolkit.cljs @@ -7,11 +7,8 @@ (def PLAYING (.-PLAYING ^js MediaStates)) (def PAUSED (.-PAUSED ^js MediaStates)) (def RECORDING (.-RECORDING ^js MediaStates)) -(def PREPARED (.-PREPARED ^js MediaStates)) (def IDLE (.-IDLE ^js MediaStates)) -(def ERROR (.-ERROR ^js MediaStates)) (def DESTROYED (.-DESTROYED ^js MediaStates)) -(def SEEKING (.-SEEKING ^js MediaStates)) ;; get PlaybackCategories from react module (def PLAYBACK (.-Playback ^js PlaybackCategories)) @@ -59,15 +56,6 @@ (on-error {:error (.-err err) :message (.-message err)}) (on-prepared)))))) -(defn prepare-recorder - [recorder on-prepared on-error] - (when (and recorder (.-canPrepare ^js recorder)) - (.prepare ^js recorder - (fn [^js err] - (if err - (on-error {:error (.-err err) :message (.-message err)}) - (on-prepared)))))) - (defn start-recording [recorder on-start on-error] (when (and recorder @@ -90,24 +78,6 @@ (on-stop)))) (on-stop))) -(defn pause-recording - [recorder on-pause on-error] - (when (and recorder (.-isRecording ^js recorder)) - (.pause ^js recorder - (fn [^js err] - (if err - (on-error {:error (.-err err) :message (.-message err)}) - (on-pause)))))) - -(defn start-playing - [player on-start on-error] - (when (and player (.-canPlay ^js player)) - (.play ^js player - (fn [^js err] - (if err - (on-error {:error (.-err err) :message (.-message err)}) - (on-start)))))) - (defn stop-playing [player on-stop on-error] (if (and player (.-isPlaying ^js player)) diff --git a/src/react_native/background_timer.cljs b/src/react_native/background_timer.cljs index c5af269229..736d1d9a7a 100644 --- a/src/react_native/background_timer.cljs +++ b/src/react_native/background_timer.cljs @@ -9,11 +9,3 @@ (defn clear-timeout [id] (.clearTimeout background-timer id)) - -(defn set-interval - [cb ms] - (.setInterval background-timer cb ms)) - -(defn clear-interval - [id] - (.clearInterval background-timer id)) diff --git a/src/react_native/core.cljs b/src/react_native/core.cljs index 33aef6ed54..f65643f0fe 100644 --- a/src/react_native/core.cljs +++ b/src/react_native/core.cljs @@ -2,7 +2,6 @@ (:require ["react" :as react] ["react-native" :as react-native] - [oops.core :as oops] [promesa.core :as promesa] [react-native.flat-list :as flat-list] [react-native.platform :as platform] @@ -64,7 +63,7 @@ (into [touchable-highlight-class (utils/custom-pressable-props props)] children)) (defn touchable-without-feedback - {:deprecated "pressable should be used instead"} + #_{:deprecated "pressable should be used instead"} [props child] [touchable-without-feedback-class (utils/custom-pressable-props props) child]) @@ -81,8 +80,6 @@ (def dismiss-keyboard! #(.dismiss keyboard)) -(def device-event-emitter (.-DeviceEventEmitter ^js react-native)) - (defn hide-splash-screen [] (.hide ^js (-> react-native .-NativeModules .-SplashScreen))) @@ -136,16 +133,8 @@ (def use-state react/useState) -(def create-ref react/createRef) - (def use-ref react/useRef) -(defn current-ref - [ref] - (oops/oget ref "current")) - -(def create-context react/createContext) - (def use-context react/useContext) (defn use-ref-atom @@ -172,8 +161,8 @@ js/undefined)) (defn use-effect - {:deprecated - "use-mount or use-unmount should be used, more here https://github.com/status-im/status-mobile/blob/develop/doc/ui-guidelines.md#effects"} + #_{:deprecated + "use-mount or use-unmount should be used, more here https://github.com/status-im/status-mobile/blob/develop/doc/ui-guidelines.md#effects"} ([handler] (use-effect handler nil)) ([handler deps] @@ -216,22 +205,11 @@ :linear (-> ^js layout-animation .-Presets .-linear) :spring (-> ^js layout-animation .-Presets .-spring)}) -(def find-node-handle (.-findNodeHandle ^js react-native)) - (defn selectable-text-input-manager [] (when (exists? (.-NativeModules ^js react-native)) (.-RNSelectableTextInputManager ^js (.-NativeModules ^js react-native)))) -;; TODO: iOS native implementation https://github.com/status-im/status-mobile/issues/14137 -(defonce selectable-text-input - (if platform/android? - (reagent/adapt-react-class - (.requireNativeComponent ^js react-native "RNSelectableTextInput")) - view)) - (def linking (.-Linking react-native)) (defn open-url [link] (.openURL ^js linking link)) - -(def set-status-bar-style react-native/StatusBar.setBarStyle) diff --git a/src/react_native/gesture.cljs b/src/react_native/gesture.cljs index e4c6578476..b7e0a4da8f 100644 --- a/src/react_native/gesture.cljs +++ b/src/react_native/gesture.cljs @@ -39,10 +39,6 @@ (defn min-distance [gesture dist] (.minDistance ^js gesture dist)) -(defn fail-offset-x [gesture offset] (.failOffsetX ^js gesture offset)) - -(defn hit-slop [gesture settings] (.hitSlop ^js gesture settings)) - (defn number-of-taps [gesture amount] (.numberOfTaps ^js gesture amount)) (defn enabled [gesture enabled?] (.enabled ^js gesture enabled?)) diff --git a/src/react_native/navigation.cljs b/src/react_native/navigation.cljs index 55ed10a5de..433fffa4b5 100644 --- a/src/react_native/navigation.cljs +++ b/src/react_native/navigation.cljs @@ -14,10 +14,6 @@ [root] (.setRoot ^js Navigation (clj->js root))) -(defn set-stack-root - [stack component] - (.setStackRoot ^js Navigation stack (clj->js component))) - (defn push [arg1 arg2] (.push ^js Navigation arg1 (clj->js arg2))) @@ -65,20 +61,6 @@ [handler] (.registerModalDismissedListener ^js (.events ^js Navigation) handler)) -(defn reg-component-did-appear-listener - [handler] - (.registerComponentDidAppearListener - ^js (.events ^js Navigation) - (fn [^js evn] - (handler (keyword (.-componentName evn)))))) - -(defn reg-component-did-disappear-listener - [handler] - (.registerComponentDidDisappearListener - ^js (.events ^js Navigation) - (fn [^js evn] - (handler (.-componentName evn))))) - (defn merge-options [id opts] (.mergeOptions Navigation id (clj->js opts))) @@ -95,7 +77,4 @@ :bottom-tabs-height (.-bottomTabsHeight consts) :status-bar-height (.-statusBarHeight consts)}))) -(defn bind-component - [^js/Object this component-id] - (set! (. this -navigationEventListener) - (.. Navigation events (bindComponent this component-id)))) + diff --git a/src/react_native/permissions.cljs b/src/react_native/permissions.cljs index 6c097e8af9..5299fa49e6 100644 --- a/src/react_native/permissions.cljs +++ b/src/react_native/permissions.cljs @@ -1,8 +1,7 @@ (ns react-native.permissions (:require ["react-native-permissions" :refer - [check openSettings PERMISSIONS requestMultiple requestNotifications - RESULTS]] + [check PERMISSIONS requestMultiple requestNotifications RESULTS]] [react-native.platform :as platform] [taoensso.timbre :as log])) @@ -47,8 +46,6 @@ (.then #(on-result (not (#{(.-BLOCKED RESULTS) (.-DENIED RESULTS)} %)))) (.catch #(on-error %)))) -(def open-settings openSettings) - (defn request-notifications "`notification-options` is only used on iOS. A map with `:status` and `settings` (only for iOS) is passed to the callbacks. diff --git a/src/react_native/reanimated.cljs b/src/react_native/reanimated.cljs index 464b7f3e57..447f870fc0 100644 --- a/src/react_native/reanimated.cljs +++ b/src/react_native/reanimated.cljs @@ -13,14 +13,11 @@ withSequence withDecay Easing - Keyframe cancelAnimation SlideInUp SlideOutUp LinearTransition - enableLayoutAnimations - useAnimatedScrollHandler - runOnJS)] + useAnimatedScrollHandler)] ["react-native-redash" :refer (withPause)] [react-native.flat-list :as rn-flat-list] [react-native.platform :as platform] @@ -29,8 +26,6 @@ [utils.transforms :as transforms] [utils.worklets.core :as worklets.core])) -(def enable-layout-animations enableLayoutAnimations) - (def ^:const default-duration 300) ;; Animations @@ -73,13 +68,11 @@ (def with-delay withDelay) (def with-spring withSpring) (def with-decay withDecay) -(def key-frame Keyframe) (def with-repeat withRepeat) (def with-sequence withSequence) (def with-pause withPause) (def cancel-animation cancelAnimation) -(def run-on-js runOnJS) ;; Easings (def bezier (.-bezier ^js Easing)) @@ -195,8 +188,3 @@ (clj->js {:duration duration :easing (default-easing)}))))) -(defn with-timing-duration - [v duration] - (with-timing v - (clj->js {:duration duration - :easing (in-out (.-quad ^js Easing))}))) diff --git a/src/react_native/svg.cljs b/src/react_native/svg.cljs index e9397c2d87..9bdbac0d00 100644 --- a/src/react_native/svg.cljs +++ b/src/react_native/svg.cljs @@ -10,7 +10,5 @@ (def defs (reagent/adapt-react-class Svg/Defs)) (def circle (reagent/adapt-react-class Svg/Circle)) (def svg-xml (reagent/adapt-react-class Svg/SvgXml)) -(def svg-uri (reagent/adapt-react-class Svg/SvgUri)) -(def g (reagent/adapt-react-class Svg/G)) (def linear-gradient (reagent/adapt-react-class Svg/LinearGradient)) (def stop (reagent/adapt-react-class Svg/Stop)) diff --git a/src/react_native/wallet_connect.cljs b/src/react_native/wallet_connect.cljs index bfc5608446..609a23823d 100644 --- a/src/react_native/wallet_connect.cljs +++ b/src/react_native/wallet_connect.cljs @@ -80,10 +80,6 @@ "core.pairing.pair" (bean/->js {:uri url}))) -(defn get-pairings - [web3-wallet] - (oops/ocall web3-wallet "core.pairing.getPairings")) - (defn register-handler [{:keys [web3-wallet event handler]}] (oops/ocall web3-wallet diff --git a/src/status_im/common/alert_banner/style.cljs b/src/status_im/common/alert_banner/style.cljs index 3594d37dcc..acbbbde4cc 100644 --- a/src/status_im/common/alert_banner/style.cljs +++ b/src/status_im/common/alert_banner/style.cljs @@ -2,10 +2,6 @@ (def border-radius 20) -(defn container - [background-color] - {:background-color background-color}) - (def second-banner-wrapper {:margin-top (- border-radius) :overflow :hidden diff --git a/src/status_im/common/bottom_sheet/style.cljs b/src/status_im/common/bottom_sheet/style.cljs index ca83a1fb04..dda8182ccf 100644 --- a/src/status_im/common/bottom_sheet/style.cljs +++ b/src/status_im/common/bottom_sheet/style.cljs @@ -15,12 +15,6 @@ :border-top-left-radius sheet-border-radius :border-top-right-radius sheet-border-radius}) -(def gradient-bg - {:position :absolute - :top 0 - :left 0 - :right 0}) - (def shell-bg {:background-color colors/bottom-sheet-background-blur :flex 1}) diff --git a/src/status_im/common/home/actions/view.cljs b/src/status_im/common/home/actions/view.cljs index 251a711b46..1a2bd6e03b 100644 --- a/src/status_im/common/home/actions/view.cljs +++ b/src/status_im/common/home/actions/view.cljs @@ -266,16 +266,6 @@ :chevron? false})) ;; TODO(OmarBasem): Requires design input. -(defn rename-entry - [] - (entry {:icon :i/edit - :label (i18n/label :t/rename) - :on-press #(js/alert "TODO: to be implemented, requires design input") - :danger? false - :accessibility-label :rename-contact - :sub-label nil - :chevron? false})) - (defn show-qr-entry [public-key] (entry {:icon :i/qr-code diff --git a/src/status_im/common/keychain/events.cljs b/src/status_im/common/keychain/events.cljs index 4e4a9095b2..8475c4b255 100644 --- a/src/status_im/common/keychain/events.cljs +++ b/src/status_im/common/keychain/events.cljs @@ -44,7 +44,6 @@ (callback false))) (def auth-method-biometric "biometric") -(def auth-method-biometric-prepare "biometric-prepare") (def auth-method-none "none") (defn save-auth-method! diff --git a/src/status_im/common/lightbox/text_sheet/style.cljs b/src/status_im/common/lightbox/text_sheet/style.cljs index 83de40364c..5999742d2a 100644 --- a/src/status_im/common/lightbox/text_sheet/style.cljs +++ b/src/status_im/common/lightbox/text_sheet/style.cljs @@ -13,13 +13,6 @@ :left 0 :right 0})) -(defn text-style - [expandable-text?] - {:color colors/white - :margin-horizontal 20 - :align-items (when-not expandable-text? :center) - :flex-grow 1}) - (def bar-container {:height constants/bar-container-height :left 0 diff --git a/src/status_im/common/lightbox/zoomable_image/constants.cljs b/src/status_im/common/lightbox/zoomable_image/constants.cljs index d22d8d4131..8e7b995319 100644 --- a/src/status_im/common/lightbox/zoomable_image/constants.cljs +++ b/src/status_im/common/lightbox/zoomable_image/constants.cljs @@ -14,6 +14,4 @@ (def ^:const default-duration 300) -(def ^:const default-dimension 1000) - (def ^:const margin 16) diff --git a/src/status_im/common/new_device_sheet/style.cljs b/src/status_im/common/new_device_sheet/style.cljs index 9d71a9df06..1ccdca33ce 100644 --- a/src/status_im/common/new_device_sheet/style.cljs +++ b/src/status_im/common/new_device_sheet/style.cljs @@ -1,5 +1,4 @@ -(ns status-im.common.new-device-sheet.style - (:require [quo.foundations.colors :as colors])) +(ns status-im.common.new-device-sheet.style) (def heading {:padding-left 20 @@ -8,16 +7,3 @@ (def message {:padding-horizontal 20 :padding-top 4}) - -(def warning - {:margin-horizontal 20 - :margin-top 10}) - -(def drawer-container - {:padding-horizontal 13 - :padding-top 16}) - -(def settings-subtext - {:color colors/white-opa-70 - :align-self :center - :margin-bottom 12}) diff --git a/src/status_im/common/pairing/events.cljs b/src/status_im/common/pairing/events.cljs index 10fb284760..a8e269fcb4 100644 --- a/src/status_im/common/pairing/events.cljs +++ b/src/status_im/common/pairing/events.cljs @@ -17,8 +17,8 @@ constants/local-pairing-event-connection-success) (= action constants/local-pairing-action-connect)) - connection-error? (and (= type - constants/local-pairing-event-connection-error)) + connection-error? (= type + constants/local-pairing-event-connection-error) error-on-pairing? (contains? constants/local-pairing-event-errors type) completed-pairing? (and (= type constants/local-pairing-event-transfer-success) diff --git a/src/status_im/common/password_authentication/events.cljs b/src/status_im/common/password_authentication/events.cljs deleted file mode 100644 index bb5f6c976a..0000000000 --- a/src/status_im/common/password_authentication/events.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.common.password-authentication.events - (:require - [status-im.navigation.events :as navigation] - [utils.re-frame :as rf])) - -(rf/defn close - {:events [:password-authentication/show]} - [{:keys [db]} content button] - (rf/merge {:db (assoc db - :password-authentication - {:error nil - :button button})} - (navigation/show-bottom-sheet content))) diff --git a/src/status_im/common/password_authentication/view.cljs b/src/status_im/common/password_authentication/view.cljs deleted file mode 100644 index d800836732..0000000000 --- a/src/status_im/common/password_authentication/view.cljs +++ /dev/null @@ -1,42 +0,0 @@ -(ns status-im.common.password-authentication.view - (:require - [native-module.core :as native-module] - [quo.core :as quo] - [react-native.core :as rn] - [reagent.core :as reagent] - [status-im.contexts.profile.utils :as profile.utils] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn view - [] - (let [entered-password (reagent/atom "")] - (fn [] - (let [profile (rf/sub [:profile/profile-with-image]) - {:keys [error button]} (rf/sub [:password-authentication])] - [rn/view {:padding-horizontal 20} - [quo/text {:size :heading-1 :weight :semi-bold} - (i18n/label :t/enter-password)] - [rn/view {:style {:margin-top 8 :margin-bottom 20}} - [quo/context-tag - {:size 24 - :full-name (profile.utils/displayed-name profile) - :profile-picture (profile.utils/photo profile)}]] - [quo/input - {:type :password - :label (i18n/label :t/profile-password) - :placeholder (i18n/label :t/type-your-password) - :error? (when (not-empty error) error) - :auto-focus true - :on-change-text #(reset! entered-password %)}] - (when (not-empty error) - [quo/info-message - {:status :error - :size :default - :icon :i/info - :container-style {:margin-top 8}} - (i18n/label :t/oops-wrong-password)]) - [quo/button - {:container-style {:margin-bottom 12 :margin-top 40} - :on-press #((:on-press button) (native-module/sha3 @entered-password))} - (:label button)]])))) diff --git a/src/status_im/common/router.cljs b/src/status_im/common/router.cljs index 994bb21071..1d6e63a957 100644 --- a/src/status_im/common/router.cljs +++ b/src/status_im/common/router.cljs @@ -26,9 +26,7 @@ (def status-web2-domain "status.app") -(def user-path "u#") (def user-with-data-path "u/") -(def community-path "c#") (def community-with-data-path "c/") (def channel-path "cc/") @@ -244,18 +242,6 @@ (cb {:type :community-chat :error :not-found}))) -(defn match-browser - [uri {:keys [domain]}] - ;; NOTE: We rebuild domain from original URI and matched domain - (let [domain (->> (string/split uri domain) - second - (str domain))] - (if (security/safe-link? domain) - {:type :browser - :url domain} - {:type :browser - :error :unsafe-link}))) - (defn match-browser-string [domain] (if (security/safe-link? domain) diff --git a/src/status_im/common/router_test.cljs b/src/status_im/common/router_test.cljs index 62bee66024..6b667b2b22 100644 --- a/src/status_im/common/router_test.cljs +++ b/src/status_im/common/router_test.cljs @@ -7,7 +7,6 @@ "0x04fbce10971e1cd7253b98c7b7e54de3729ca57ce41a2bfb0d1c4e0a26f72c4b6913c3487fa1b4bb86125770f1743fb4459da05c1cbe31d938814cfaf36e252073") (def chat-id "59eb36e6-9d4d-4724-9d3a-8a3cdc5e8a8e-0x04f383daedc92a66add4c90d8884004ef826cba113183a0052703c8c77fed1522f88f44550498d20679af98907627059a295e43212a1cd3c1f21a157704d608c13") -(def chat-name-url "Test%20group%20chat") (def chat-name "Test group chat") (deftest parse-uris-test diff --git a/src/status_im/common/scan_qr_code/style.cljs b/src/status_im/common/scan_qr_code/style.cljs index 1fc3bde2d0..1db2406402 100644 --- a/src/status_im/common/scan_qr_code/style.cljs +++ b/src/status_im/common/scan_qr_code/style.cljs @@ -49,10 +49,6 @@ {:padding-horizontal screen-padding :color colors/white}) -(def tabs-container - {:padding-horizontal screen-padding - :margin-top 20}) - (def scan-qr-code-container {:margin-top 20}) diff --git a/src/status_im/common/scroll_page/style.cljs b/src/status_im/common/scroll_page/style.cljs index 0b52cc9da7..d977f5d281 100644 --- a/src/status_im/common/scroll_page/style.cljs +++ b/src/status_im/common/scroll_page/style.cljs @@ -4,14 +4,6 @@ [react-native.platform :as platform] [react-native.reanimated :as reanimated])) -(defn image-slider - [size] - {:top -64 - :height size - :width size - :z-index 4 - :flex 1}) - (defn blur-slider [animation height theme] (reanimated/apply-animations-to-style @@ -26,24 +18,6 @@ (colors/theme-colors colors/white colors/neutral-80 theme) :transparent)})) -(defn sticky-header-title - [animation] - (reanimated/apply-animations-to-style - {:opacity animation} - {:position :absolute - :flex-direction :row - :left 64 - :top 16 - :margin-top 44})) - -(def sticky-header-image - {:border-radius 12 - :border-width 0 - :border-color :transparent - :width 24 - :height 24 - :margin-right 8}) - (defn children-container [{:keys [border-radius background-color]}] {:flex 1 diff --git a/src/status_im/common/signals/events.cljs b/src/status_im/common/signals/events.cljs index c1090dd470..68f12dbf10 100644 --- a/src/status_im/common/signals/events.cljs +++ b/src/status_im/common/signals/events.cljs @@ -13,8 +13,7 @@ (rf/defn summary [{:keys [db] :as cofx} peers-summary] - (let [previous-summary (:peers-summary db) - peers-count (count peers-summary)] + (let [peers-count (count peers-summary)] (rf/merge cofx {:db (assoc db :peers-summary peers-summary diff --git a/src/status_im/common/standard_authentication/enter_password/style.cljs b/src/status_im/common/standard_authentication/enter_password/style.cljs index a691bd5788..84133df4b4 100644 --- a/src/status_im/common/standard_authentication/enter_password/style.cljs +++ b/src/status_im/common/standard_authentication/enter_password/style.cljs @@ -5,11 +5,6 @@ :border-top-left-radius 12 :border-top-right-radius 12}) -(def error-message - {:margin-top 8 - :flex-direction :row - :align-items :center}) - (def enter-password-button {:margin-top 45 :margin-bottom 12}) diff --git a/src/status_im/common/timer/events.cljs b/src/status_im/common/timer/events.cljs deleted file mode 100644 index 18caa871fb..0000000000 --- a/src/status_im/common/timer/events.cljs +++ /dev/null @@ -1,18 +0,0 @@ -(ns status-im.common.timer.events - (:require - [re-frame.core :as re-frame] - [react-native.background-timer :as background-timer])) - -(re-frame/reg-fx - :background-timer/dispatch-later - (fn [params] - (doseq [{:keys [ms dispatch]} params] - (when (and ms dispatch) - (background-timer/set-timeout #(re-frame/dispatch dispatch) ms))))) - -(re-frame/reg-fx - :background-timer/clear-timeouts - (fn [ids] - (doseq [id ids] - (when id - (background-timer/clear-timeout id))))) diff --git a/src/status_im/common/universal_links.cljs b/src/status_im/common/universal_links.cljs index 35e47849da..730b6c5af1 100644 --- a/src/status_im/common/universal_links.cljs +++ b/src/status_im/common/universal_links.cljs @@ -257,9 +257,3 @@ ;;error "route ip+net: netlinkrib: permission denied" is fixed on status-go side #_(native-module/start-searching-for-local-pairing-peers #(log/info "[local-pairing] errors from local-pairing-preflight-outbound-check ->" %))) - -(defn finalize - "Remove event listener for url" - [] - (log/debug "universal-links: finalizing") - (.removeEventListener ^js rn/linking "url" url-event-listener)) diff --git a/src/status_im/config.cljs b/src/status_im/config.cljs index 86877c589e..735c75aa59 100644 --- a/src/status_im/config.cljs +++ b/src/status_im/config.cljs @@ -50,29 +50,15 @@ (def opensea-api-key OPENSEA_API_KEY) (def status-proxy-enabled? true) (def status-proxy-stage-name (get-config :STATUS_PROXY_STAGE_NAME "test")) -(def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1"))) -(def mailserver-confirmations-enabled? (enabled? (get-config :MAILSERVER_CONFIRMATIONS_ENABLED))) (def pairing-popup-disabled? (enabled? (get-config :PAIRING_POPUP_DISABLED "0"))) (def cached-webviews-enabled? (enabled? (get-config :CACHED_WEBVIEWS_ENABLED 0))) -(def snoopy-enabled? (enabled? (get-config :SNOOPY 0))) -(def dev-build? (enabled? (get-config :DEV_BUILD 0))) -(def max-message-delivery-attempts (js/parseInt (get-config :MAX_MESSAGE_DELIVERY_ATTEMPTS "6"))) + ;; NOTE: only disabled in releases -(def local-notifications? (enabled? (get-config :LOCAL_NOTIFICATIONS "1"))) (def blank-preview? (enabled? (get-config :BLANK_PREVIEW "1"))) -(def group-chat-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED "0"))) (def tooltip-events? (enabled? (get-config :TOOLTIP_EVENTS "0"))) -(def commands-enabled? (enabled? (get-config :COMMANDS_ENABLED "0"))) -(def keycard-test-menu-enabled? (enabled? (get-config :KEYCARD_TEST_MENU "1"))) -(def qr-test-menu-enabled? (enabled? (get-config :QR_READ_TEST_MENU "0"))) (def quo-preview-enabled? (enabled? (get-config :ENABLE_QUO_PREVIEW "0"))) -(def database-management-enabled? (enabled? (get-config :DATABASE_MANAGEMENT_ENABLED "0"))) (def debug-webview? (enabled? (get-config :DEBUG_WEBVIEW "0"))) -(def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0"))) (def two-minutes-syncing? (enabled? (get-config :TWO_MINUTES_SYNCING "0"))) -(def swap-enabled? (enabled? (get-config :SWAP_ENABLED "0"))) -(def stickers-test-enabled? (enabled? (get-config :STICKERS_TEST_ENABLED "0"))) -(def local-pairing-mode-enabled? (enabled? (get-config :LOCAL_PAIRING_ENABLED "1"))) (def show-not-implemented-features? (enabled? (get-config :SHOW_NOT_IMPLEMENTED_FEATURES "0"))) ;; CONFIG VALUES @@ -81,8 +67,6 @@ (def fleet (get-config :FLEET "")) (def apn-topic (get-config :APN_TOPIC "im.status.ethereum")) (def max-installations 2) -; currently not supported in status-go -(def enable-remove-profile-picture? false) (defn env-variable->int [env-var-name default-value] @@ -114,16 +98,6 @@ (def fast-create-community-enabled? (enabled? (get-config :FAST_CREATE_COMMUNITY_ENABLED "0"))) -(def waku-nodes-config - {:status.prod - ["enrtree://AL65EKLJAUXKKPG43HVTML5EFFWEZ7L4LOKTLZCLJASG4DSESQZEC@prod.status.nodes.status.im"] - :status.test - ["enrtree://AIO6LUM3IVWCU2KCPBBI6FEH2W42IGK3ASCZHZGG5TIXUR56OGQUO@test.status.nodes.status.im"] - :waku.sandbox - ["enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im"] - :waku.test - ["enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im"]}) - (def community-accounts-selection-enabled? true) (def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1"))) (def test-networks-enabled? (enabled? (get-config :TEST_NETWORKS_ENABLED "0"))) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 625aafce01..eed98cdaa4 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -8,7 +8,6 @@ (def ^:const content-type-sticker 2) (def ^:const content-type-status 3) (def ^:const content-type-emoji 4) -(def ^:const content-type-command 5) (def ^:const content-type-system-text 6) (def ^:const content-type-image 7) (def ^:const content-type-audio 8) @@ -23,7 +22,6 @@ ;; Not implemented in status-go, only used for testing/ui work (def ^:const content-type-gif 100) -(def ^:const content-type-link 101) (def ^:const content-type-album 102) (def ^:const contact-request-state-none 0) @@ -32,11 +30,9 @@ (def ^:const contact-request-state-received 3) (def ^:const contact-request-state-dismissed 4) -(def ^:const contact-verification-status-unknown 0) (def ^:const contact-verification-status-pending 1) (def ^:const contact-verification-status-accepted 2) (def ^:const contact-verification-status-declined 3) -(def ^:const contact-verification-status-cancelled 4) (def ^:const contact-verification-status-trusted 5) (def ^:const contact-verification-status-untrustworthy 6) @@ -79,7 +75,6 @@ (def ^:const chat-preview-type-community 0) (def ^:const chat-preview-type-non-community 1) -(def ^:const contact-request-message-state-none 0) (def ^:const contact-request-message-state-pending 1) (def ^:const contact-request-message-state-accepted 2) (def ^:const contact-request-message-state-declined 3) @@ -98,27 +93,12 @@ emoji-reaction-sad :reaction/sad emoji-reaction-angry :reaction/angry}) -(def ^:const invitation-state-unknown 0) (def ^:const invitation-state-requested 1) (def ^:const invitation-state-rejected 2) (def ^:const invitation-state-approved 3) -(def ^:const invitation-state-granted 4) -(def ^:const invitation-state-removed 5) - (def ^:const message-type-one-to-one 1) -(def ^:const message-type-public-group 2) -(def ^:const message-type-private-group 3) (def ^:const message-type-private-group-system-message 4) -(def ^:const message-type-community-chat 5) -(def ^:const message-type-gap 6) -(def ^:const command-state-request-address-for-transaction 1) -(def ^:const command-state-request-address-for-transaction-declined 2) -(def ^:const command-state-request-address-for-transaction-accepted 3) -(def ^:const command-state-request-transaction 4) -(def ^:const command-state-request-transaction-declined 5) -(def ^:const command-state-transaction-pending 6) -(def ^:const command-state-transaction-sent 7) (def ^:const profile-default-color :blue) (def ^:const profile-name-max-length 20) @@ -157,33 +137,13 @@ (def ^:const mailserver-password "status-offline-inbox") -(def ^:const send-transaction-failed-parse-response 1) -(def ^:const send-transaction-failed-parse-params 2) -(def ^:const send-transaction-no-account-selected 3) -(def ^:const send-transaction-invalid-tx-sender 4) -(def ^:const send-transaction-err-decrypt 5) -(def ^:const web3-send-transaction "eth_sendTransaction") -(def ^:const web3-personal-sign "personal_sign") -(def ^:const web3-eth-sign "eth_sign") -(def ^:const web3-sign-typed-data "eth_signTypedData") -(def ^:const web3-sign-typed-data-v3 "eth_signTypedData_v3") -(def ^:const web3-sign-typed-data-v4 "eth_signTypedData_v4") - -(def ^:const web3-keycard-sign-typed-data "keycard_signTypedData") - -(def ^:const status-create-address "status_createaddress") - -(def ^:const community-unknown-membership-access 0) (def ^:const community-no-membership-access 1) (def ^:const community-invitation-only-access 2) (def ^:const community-on-request-access 3) -(def ^:const community-token-permission-unknown 0) (def ^:const community-token-permission-become-admin 1) (def ^:const community-token-permission-become-member 2) -(def ^:const community-token-permission-can-view-channel 3) -(def ^:const community-token-permission-can-view-and-post-channel 4) (def ^:const community-token-permission-become-token-master 5) (def ^:const community-token-permission-become-token-owner 6) (def ^:const community-role-permissions @@ -195,21 +155,11 @@ (def ^:const community-token-type-erc20 1) (def ^:const community-token-type-erc721 2) -;; Community rules for joining -(def ^:const community-rule-ens-only "ens-only") - -(def ^:const community-channel-access-no-membership 1) -(def ^:const community-channel-access-invitation-only 2) -(def ^:const community-channel-access-on-request 3) (def ^:const community-request-to-join-state-pending 1) -(def ^:const community-request-to-join-state-declined 2) (def ^:const community-request-to-join-state-accepted 3) -(def ^:const community-request-to-join-state-cancelled 4) - (def ^:const community-id-length 68) -(def ^:const toast-chain-down-duration 5000) ; BIP44 Wallet Root Key, the extended key from which any wallet can be derived (def ^:const path-wallet-root "m/44'/60'/0'/0") @@ -225,19 +175,9 @@ (def ^:const path-ledger-live "m/44'/60'") (def ^:const path-keepkey "m/44'/60'") -(def ^:const path-default-wallet-keyword (keyword path-default-wallet)) -(def ^:const path-whisper-keyword (keyword path-whisper)) -(def ^:const path-wallet-root-keyword (keyword path-wallet-root)) -(def ^:const path-eip1581-keyword (keyword path-eip1581)) - -(def ^:const method-id-transfer "0xa9059cbb") -(def ^:const method-id-approve "0x095ea7b3") -(def ^:const method-id-approve-and-call "0xcae9ca51") (def regx-string-universal-link-encoded-data-base64 "(?:[A-Za-z0-9+/_-]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?") -(def regx-universal-link-encoded-data-base64 - (str "^" regx-string-universal-link-encoded-data-base64 "$")) (def regx-string-any-ascii "[\\x00-\\x7F]") (def regx-string-compressed-key "zQ3[0-9A-HJ-NP-Za-km-z]{46}") (def regx-string-public-key "0x04[0-9a-f]{128}") @@ -247,9 +187,6 @@ (def regx-private-key #"^[0-9a-fA-F]{64}$") (def regx-emoji #"^((?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F|[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])+$") -(def regx-bold #"\*[^*]+\*") -(def regx-italic #"~[^~]+~") -(def regx-backquote #"`[^`]+`") (def regx-string-universal-link (str "((^https?://status.app/)|(^status-app://))" "(" @@ -266,12 +203,9 @@ (str "wallet/" regx-string-any-ascii "+")]) ")$")) (def regx-universal-link (re-pattern regx-string-universal-link)) -(def regx-community-universal-link #"((^https?://status.app/)|(^status-app://))c/([\x00-\x7F]+)$") (def regx-deep-link #"((^ethereum:.*)|(^status-app://[\x00-\x7F]+$))") (def regx-ens #"^(?=.{5,255}$)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$") - (def regx-starts-with-uuid #"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}") -(def regx-full-or-partial-address #"^0x[a-fA-F0-9]{1,40}$") ;; Wallet Connect (def ^:const wallet-connect-metadata-icon @@ -323,8 +257,6 @@ (def ^:const history-state-changed "history-state-changed") (def ^:const web3-send-async-read-only "web3-send-async-read-only") (def ^:const web3-send-async-callback "web3-send-async-callback") -(def ^:const scan-qr-code "scan-qr-code") - (def ^:const two-mins (* 2 60)) (def ^:const one-day (* 60 60 24)) (def ^:const three-days (* one-day 3)) @@ -332,8 +264,6 @@ (def ^:const one-week (* one-day 7)) (def ^:const one-month (* one-day 31)) -(def ^:const privacy-policy-link "https://status.im/privacy-policy/") -(def ^:const terms-of-service-link "https://status.im/terms-of-use") (def ^:const create-account-link "https://status.app/help/wallet/create-wallet-accounts") (def ^:const mobile-upvote-link "https://status-mobile.featureupvote.com") @@ -347,8 +277,6 @@ (def ^:const sticker-pack-status-pending 2) (def ^:const sticker-pack-status-owned 3) -(def ^:const community-member-role-all 1) -(def ^:const community-member-role-manage-users 2) (def ^:const community-member-role-moderator 3) (def ^:const delete-message-undo-time-limit-ms 4000) @@ -379,15 +307,6 @@ 4 (- (* image-size 0.5) 0.5) 5 (- (* image-size 0.5) 0.5)}}) -(def ^:const spam-message-frequency-threshold 4) -(def ^:const spam-interval-ms 1000) -(def ^:const default-cooldown-period-ms 10000) -(def ^:const cooldown-reset-threshold 3) -(def ^:const cooldown-periods-ms - {1 2000 - 2 5000 - 3 10000}) - ;; any message that comes after this amount of ms will be grouped separately (def ^:const group-ms 300000) @@ -401,19 +320,15 @@ (def ^:const local-pairing-role-receiver "receiver") ;; sender and receiver events -(def ^:const local-pairing-event-peer-discovered "peer-discovered") (def ^:const local-pairing-event-connection-success "connection-success") (def ^:const local-pairing-event-connection-error "connection-error") (def ^:const local-pairing-event-transfer-success "transfer-success") (def ^:const local-pairing-event-transfer-error "transfer-error") -(def ^:const local-pairing-event-received-installation "received-installation") + ;; receiver events (def ^:const local-pairing-event-received-account "received-account") -(def ^:const local-pairing-event-process-success "process-success") (def ^:const local-pairing-event-process-error "process-error") -(def ^:const local-pairing-event-received-keystore-files "received-keystore-files") - (def ^:const local-pairing-event-errors #{local-pairing-event-connection-error local-pairing-event-transfer-error @@ -421,9 +336,7 @@ (def ^:const local-pairing-action-connect 1) (def ^:const local-pairing-action-pairing-account 2) -(def ^:const local-pairing-action-sync-device 3) (def ^:const local-pairing-action-pairing-installation 4) -(def ^:const local-pairing-action-peer-discovery 5) (def ^:const local-pairing-action-keystore-files-transfer 6) (def ^:const serialization-key @@ -440,20 +353,10 @@ keys with base16 hexadecimal encoding" "f") -(def ^:const multi-code-prefix - "We prefix our keys with 0xe701 prior to serialisation them" - "0xe701") - (def ^:const appearance-type-system 0) (def ^:const appearance-type-light 1) (def ^:const appearance-type-dark 2) -(def ^:const bottom-sheet-animation-delay 450) -(def ^:const local-pair-event-process-success "process-success") -(def ^:const local-pair-event-process-error "process-error") -(def ^:const local-pair-action-connect 1) -(def ^:const local-pair-action-pairing-account 2) -(def ^:const local-pair-action-sync-device 3) (def ^:const everyone-mention-id "0x00001") @@ -463,7 +366,6 @@ (def ^:const auth-method-password "password") (def ^:const auth-method-biometric "biometric") -(def ^:const auth-method-biometric-prepare "biometric-prepare") (def ^:const auth-method-none "none") ;; NOTE all android biometrics falls under :Biometrics @@ -471,10 +373,6 @@ (def ^:const biometrics-type-touch-id :TouchID) (def ^:const biometrics-type-face-id :FaceID) -(def ^:const onboarding-generating-keys-navigation-retry-ms 3000) - -(def ^:const image-description-in-lightbox? false) - (def ^:const audio-max-duration-ms 120000) (def ^:const onboarding-modal-animation-duration 300) @@ -503,9 +401,6 @@ {:ethereum "ethereum" :sepolia "sepolia"}) -(def ^:const ethereum "ethereum") -(def ^:const sepolia "sepolia") - (def ^:const mainnet-chain-ids #{ethereum-mainnet-chain-id arbitrum-mainnet-chain-id optimism-mainnet-chain-id}) @@ -547,43 +442,18 @@ (def ^:const wallet-account-name-max-length 20) -(def ^:const status-address-domain ".stateofus.eth") -(def ^:const eth-address-domain ".eth") -(def ^:const gas-rate-low 0) (def ^:const gas-rate-medium 1) -(def ^:const gas-rate-high 2) - (def ^:const send-type-transfer 0) -(def ^:const send-type-ens-register 1) -(def ^:const send-type-ens-release 2) -(def ^:const send-type-ens-set-pub-key 3) -(def ^:const send-type-stickers-buy 4) (def ^:const send-type-bridge 5) (def ^:const send-type-erc-721-transfer 6) (def ^:const send-type-erc-1155-transfer 7) (def ^:const send-type-swap 8) -(def ^:const multi-transaction-type-send 0) -(def ^:const multi-transaction-type-approve 1) -(def ^:const multi-transaction-type-bridge 2) -(def ^:const multi-transaction-type-swap 3) -(def ^:const multi-transaction-type-unknown 255) - -(def ^:const contract-function-signature-erc20-approve "approve(address,uint256)") - -(def ^:const bridge-name-transfer "Transfer") -(def ^:const bridge-name-erc-721-transfer "ERC721Transfer") -(def ^:const bridge-name-erc-1155-transfer "ERC1155Transfer") (def ^:const bridge-name-hop "Hop") -(def ^:const bridge-name-paraswap "Paraswap") -(def ^:const bridge-name-celer "CBridge") (def ^:const bridge-assets #{"ETH" "USDT" "USDC" "DAI"}) -(def ^:const wallet-contract-type-uknown 0) -(def ^:const wallet-contract-type-erc-20 1) -(def ^:const wallet-contract-type-erc-721 2) (def ^:const wallet-contract-type-erc-1155 3) (def ^:const alert-banner-height 40) diff --git a/src/status_im/contexts/centralized_metrics/events.cljs b/src/status_im/contexts/centralized_metrics/events.cljs index f758922a0d..037cdeb9e8 100644 --- a/src/status_im/contexts/centralized_metrics/events.cljs +++ b/src/status_im/contexts/centralized_metrics/events.cljs @@ -21,6 +21,8 @@ (native-module/add-centralized-metric event)))) context) +;; ignore warning, interceptor used from interceptor_metrics.cljc +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (def interceptor (interceptor/->interceptor :id :centralized-metrics diff --git a/src/status_im/contexts/chat/events.cljs b/src/status_im/contexts/chat/events.cljs index f6a9943f01..8ba733b1aa 100644 --- a/src/status_im/contexts/chat/events.cljs +++ b/src/status_im/contexts/chat/events.cljs @@ -44,11 +44,6 @@ ([cofx chat-id] (community-chat? (get-chat cofx chat-id)))) -(defn active-chat? - [cofx chat-id] - (let [chat (get-chat cofx chat-id)] - (:active chat))) - (defn group-chat? ([chat] (and (multi-user-chat? chat) @@ -162,7 +157,7 @@ (rf/defn deactivate-chat "Deactivate chat in db, no side effects" - [{:keys [db now] :as cofx} chat-id] + [{:keys [db] :as cofx} chat-id] (rf/merge cofx {:db (-> (if (get-in db [:chats chat-id :muted]) @@ -268,7 +263,7 @@ (rf/defn close-and-remove-chat "Closes the chat and removes it from chat list while retaining history, producing all necessary effects for that" {:events [:chat.ui/close-and-remove-chat]} - [{:keys [db now] :as cofx} chat-id] + [cofx chat-id] (rf/merge cofx {:effects/push-notifications-clear-message-notifications [chat-id]} (deactivate-chat chat-id) diff --git a/src/status_im/contexts/chat/events_test.cljs b/src/status_im/contexts/chat/events_test.cljs index efa3211aff..e0ad6ebce3 100644 --- a/src/status_im/contexts/chat/events_test.cljs +++ b/src/status_im/contexts/chat/events_test.cljs @@ -73,15 +73,6 @@ (let [cofx {:db {:chats {chat-id {}}}}] (is (not (chat/group-chat? cofx chat-id))))))) -(def test-db - {:profile/profile {:public-key "me"} - - :messages {"status" {"4" {} "5" {} "6" {}}} - :chats {"status" {:public? true - :group-chat true} - "opened" {} - "1-1" {}}}) - (deftest navigate-to-chat-test (let [chat-id "test_chat" db {:pagination-info {chat-id {:all-loaded? true}}}] diff --git a/src/status_im/contexts/chat/group/common/style.cljs b/src/status_im/contexts/chat/group/common/style.cljs index 5f5a5a75bc..3e4d4af94e 100644 --- a/src/status_im/contexts/chat/group/common/style.cljs +++ b/src/status_im/contexts/chat/group/common/style.cljs @@ -3,13 +3,6 @@ (def avatar {:width 88 :margin-top 12 :margin-left 20}) -(def hole - {:y (- 80 32) - :x (+ (- 80 32) 8) - :width 32 - :height 32 - :borderRadius 10}) - (def camera {:position :absolute :right 0 :bottom 0}) (defn color-label diff --git a/src/status_im/contexts/chat/group/details/style.cljs b/src/status_im/contexts/chat/group/details/style.cljs index 624b1f8e2f..225fd3049e 100644 --- a/src/status_im/contexts/chat/group/details/style.cljs +++ b/src/status_im/contexts/chat/group/details/style.cljs @@ -7,20 +7,6 @@ :margin-bottom 20 :padding-horizontal 20}) -(defn action-container - [color theme] - {:background-color (colors/theme-alpha color 0.1 0.1 theme) - :flex 0.29 - :border-radius 16 - :padding 12}) - -(defn count-container - [theme] - {:width 16 - :height 16 - :border-radius 6 - :background-color (colors/theme-colors colors/neutral-80-opa-5 colors/white-opa-5 theme)}) - (defn close-icon [theme] {:background-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme) diff --git a/src/status_im/contexts/chat/home/add_new_contact/style.cljs b/src/status_im/contexts/chat/home/add_new_contact/style.cljs index f7364eb0f7..91406c8e9d 100644 --- a/src/status_im/contexts/chat/home/add_new_contact/style.cljs +++ b/src/status_im/contexts/chat/home/add_new_contact/style.cljs @@ -80,6 +80,4 @@ colors/neutral-40 theme)}) -(def button-view-profile - {:margin-top 24 - :width "100%"}) + diff --git a/src/status_im/contexts/chat/home/style.cljs b/src/status_im/contexts/chat/home/style.cljs deleted file mode 100644 index 58735c9ea1..0000000000 --- a/src/status_im/contexts/chat/home/style.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.contexts.chat.home.style - (:require - [react-native.platform :as platform] - [react-native.safe-area :as safe-area])) - -(def tabs - {:padding-horizontal 20 - :padding-top 16 - :padding-bottom 12}) - -(def blur - {:position :absolute - :top 0 - :right 0 - :left 0 - :bottom 0}) - -(defn blur-container - [] - {:overflow (if platform/ios? :visible :hidden) - :position :absolute - :z-index 1 - :top 0 - :right 0 - :left 0 - :padding-top (safe-area/get-top)}) diff --git a/src/status_im/contexts/chat/messenger/composer/constants.cljs b/src/status_im/contexts/chat/messenger/composer/constants.cljs index b400331f68..418264d5d5 100644 --- a/src/status_im/contexts/chat/messenger/composer/constants.cljs +++ b/src/status_im/contexts/chat/messenger/composer/constants.cljs @@ -1,18 +1,7 @@ -(ns status-im.contexts.chat.messenger.composer.constants - (:require - [quo.foundations.typography :as typography] - [react-native.platform :as platform])) - -(def ^:const bar-container-height 20) - -(def ^:const input-height 32) +(ns status-im.contexts.chat.messenger.composer.constants) (def ^:const actions-container-height 56) -(def ^:const composer-default-height (+ bar-container-height input-height actions-container-height)) - -(def ^:const line-height (if platform/ios? 18 (:line-height typography/paragraph-1))) - (def ^:const images-padding-top 12) (def ^:const images-padding-bottom 8) (def ^:const images-container-height diff --git a/src/status_im/contexts/chat/messenger/composer/events.cljs b/src/status_im/contexts/chat/messenger/composer/events.cljs index e10e89fd5c..61a2cb0c3e 100644 --- a/src/status_im/contexts/chat/messenger/composer/events.cljs +++ b/src/status_im/contexts/chat/messenger/composer/events.cljs @@ -8,7 +8,6 @@ [taoensso.timbre :as log] [utils.debounce :as debounce] [utils.emojilib :as emoji] - [utils.i18n :as i18n] [utils.re-frame :as rf] utils.string)) @@ -28,35 +27,12 @@ (let [current-chat-id (:current-chat-id db)] {:db (assoc-in db [:chat/inputs current-chat-id :input-ref] input-ref)})) -(rf/defn set-input-content-height - {:events [:chat.ui/set-input-content-height]} - [{db :db} content-height chat-id] - (let [current-chat-id (or chat-id (:current-chat-id db))] - {:db (assoc-in db [:chat/inputs current-chat-id :input-content-height] content-height)})) - -(rf/defn set-input-maximized - {:events [:chat.ui/set-input-maximized]} - [{db :db} maximized? chat-id] - (let [current-chat-id (or chat-id (:current-chat-id db))] - {:db (assoc-in db [:chat/inputs current-chat-id :input-maximized?] maximized?)})) - (rf/defn set-input-focused - {:events [:chat.ui/set-input-focused]} + {:events [:chat.ui/setnn-input-focused]} [{db :db} focused? chat-id] (let [current-chat-id (or chat-id (:current-chat-id db))] {:db (assoc-in db [:chat/inputs current-chat-id :focused?] focused?)})) -(rf/defn set-input-audio - {:events [:chat.ui/set-input-audio]} - [{db :db} audio chat-id] - (let [current-chat-id (or chat-id (:current-chat-id db))] - {:db (assoc-in db [:chat/inputs current-chat-id :audio] audio)})) - -(rf/defn set-recording - {:events [:chat.ui/set-recording]} - [{db :db} recording?] - {:db (assoc db :chats/recording? recording?)}) - (rf/defn reply-to-message "Sets reference to previous chat message and focuses on input" {:events [:chat.ui/reply-to-message]} @@ -200,25 +176,6 @@ (link-preview/reset-unfurled) (messages.transport/send-chat-messages messages))))) -(rf/defn send-audio-message - {:events [:chat/send-audio]} - [{:keys [db] :as cofx} audio-path duration] - (let [{:keys [current-chat-id]} db - {:keys [message-id]} - (get-in db [:chat/inputs current-chat-id :metadata :responding-to-message])] - (when-not (string/blank? audio-path) - (rf/merge - {:db (assoc-in db [:chat/inputs current-chat-id :metadata :responding-to-message] nil)} - (messages.transport/send-chat-messages - [(merge - {:chat-id current-chat-id - :content-type constants/content-type-audio - :audio-path audio-path - :audio-duration-ms duration - :text (i18n/label :t/update-to-listen-audio {"locale" "en"})} - (when message-id - {:response-to message-id}))]))))) - (defn- process-link-previews [link-previews] (->> link-previews @@ -231,7 +188,7 @@ (rf/defn send-edited-message [{:keys [db] - :as cofx} text {:keys [message-id quoted-message chat-id]}] + :as cofx} text {:keys [message-id quoted-message]}] (rf/merge cofx {:json-rpc/call diff --git a/src/status_im/contexts/chat/messenger/composer/gradients/style.cljs b/src/status_im/contexts/chat/messenger/composer/gradients/style.cljs deleted file mode 100644 index c500eccb75..0000000000 --- a/src/status_im/contexts/chat/messenger/composer/gradients/style.cljs +++ /dev/null @@ -1,42 +0,0 @@ -(ns status-im.contexts.chat.messenger.composer.gradients.style - (:require - [quo.foundations.colors :as colors] - [react-native.reanimated :as reanimated] - [status-im.contexts.chat.messenger.composer.constants :as constants])) - -(defn- top-gradient-style - [opacity z-index showing-extra-space?] - (reanimated/apply-animations-to-style - {:opacity opacity} - {:height (when (pos-int? z-index) 80) - :position :absolute - :z-index z-index - :top (+ constants/bar-container-height - (if showing-extra-space? - constants/edit-container-height - 0)) - :left 0 - :right 0})) - -(defn top-gradient - [opacity z-index showing-extra-space? theme] - {:colors [(colors/theme-colors colors/white-opa-0 colors/neutral-95-opa-0 theme) - (colors/theme-colors colors/white colors/neutral-95 theme)] - :start {:x 0 :y 1} - :end {:x 0 :y 0} - :style (top-gradient-style opacity z-index showing-extra-space?)}) - -(def bottom-gradient-style - {:height constants/line-height - :position :absolute - :bottom 0 - :left 0 - :right 0}) - -(defn bottom-gradient - [theme] - {:colors [(colors/theme-colors colors/white colors/neutral-95 theme) - (colors/theme-colors colors/white-opa-0 colors/neutral-95-opa-0 theme)] - :start {:x 0 :y 1} - :end {:x 0 :y 0} - :style bottom-gradient-style}) diff --git a/src/status_im/contexts/chat/messenger/composer/gradients/view.cljs b/src/status_im/contexts/chat/messenger/composer/gradients/view.cljs deleted file mode 100644 index 998954e01c..0000000000 --- a/src/status_im/contexts/chat/messenger/composer/gradients/view.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.contexts.chat.messenger.composer.gradients.view - (:require - [quo.theme] - [react-native.core :as rn] - [react-native.linear-gradient :as linear-gradient] - [react-native.reanimated :as reanimated] - [status-im.contexts.chat.messenger.composer.gradients.style :as style] - [utils.re-frame :as rf])) - -(defn f-view - [{:keys [input-ref]} - {:keys [gradient-z-index]} - {:keys [gradient-opacity]} - show-bottom-gradient?] - (let [theme (quo.theme/use-theme) - showing-extra-space? (boolean (or (rf/sub [:chats/edit-message]) - (rf/sub [:chats/reply-message])))] - [:<> - [reanimated/linear-gradient - (style/top-gradient gradient-opacity @gradient-z-index showing-extra-space? theme)] - (when show-bottom-gradient? - [rn/pressable - {:on-press #(when @input-ref (.focus ^js @input-ref)) - :style {:z-index 1} - :accessibility-label :bottom-gradient} - [linear-gradient/linear-gradient (style/bottom-gradient theme)]])])) - -(defn view - [props state animations show-bottom-gradient?] - [:f> f-view props state animations show-bottom-gradient?]) diff --git a/src/status_im/contexts/chat/messenger/composer/handlers.cljs b/src/status_im/contexts/chat/messenger/composer/handlers.cljs index 22a8dad1ca..38094342c8 100644 --- a/src/status_im/contexts/chat/messenger/composer/handlers.cljs +++ b/src/status_im/contexts/chat/messenger/composer/handlers.cljs @@ -1,10 +1,7 @@ (ns status-im.contexts.chat.messenger.composer.handlers (:require [clojure.string :as string] - [oops.core :as oops] - [react-native.core :as rn] [status-im.contexts.chat.messenger.composer.constants :as constants] - [status-im.contexts.chat.messenger.composer.selection :as selection] [utils.debounce :as debounce] [utils.number] [utils.re-frame :as rf])) @@ -17,24 +14,3 @@ (if (string/ends-with? text "@") (rf/dispatch [:mention/on-change-text text]) (debounce/debounce-and-dispatch [:mention/on-change-text text] 300))) - -(defn selection-change - "A method that handles our custom selector for `B I U`" - [event - {:keys [input-ref selection-event selection-manager]} - {:keys [lock-selection? cursor-position first-level? menu-items]}] - (let [start (oops/oget event "nativeEvent.selection.start") - end (oops/oget event "nativeEvent.selection.end") - selection? (not= start end) - text-input-handle (rn/find-node-handle @input-ref)] - (when-not @lock-selection? - (reset! cursor-position end)) - (when (and selection? (not @first-level?)) - (js/setTimeout #(oops/ocall selection-manager :startActionMode text-input-handle) 500)) - (when (and (not selection?) (not @first-level?)) - (oops/ocall selection-manager :hideLastActionMode) - (selection/reset-to-first-level-menu first-level? menu-items)) - (when @selection-event - (let [{:keys [start end text-input-handle]} @selection-event] - (selection/update-selection text-input-handle start end) - (reset! selection-event nil))))) diff --git a/src/status_im/contexts/chat/messenger/composer/link_preview/events.cljs b/src/status_im/contexts/chat/messenger/composer/link_preview/events.cljs index 8b823736f1..985e0c1493 100644 --- a/src/status_im/contexts/chat/messenger/composer/link_preview/events.cljs +++ b/src/status_im/contexts/chat/messenger/composer/link_preview/events.cljs @@ -129,7 +129,7 @@ (rf/defn unfurl-parsed-urls-error {:events [:link-preview/unfurl-parsed-urls-error]} - [{:keys [db]} request-id error] + [_cofx request-id error] (log/error "Failed to unfurl URLs" {:request-id request-id :error error diff --git a/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs b/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs index 1639d2b1b8..158aa2e254 100644 --- a/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs +++ b/src/status_im/contexts/chat/messenger/composer/mentions/style.cljs @@ -14,18 +14,6 @@ :shadow-offset {:width 0 :height (colors/theme-colors 8 12 theme)}) (assoc styles :elevation 10))) -(defn inner - [top theme] - (add-shadow theme - {:position :absolute - :top (- (+ 8 top)) - :left 8 - :right 8 - :border-radius 16 - :z-index 4 - :max-height constants/mentions-max-height - :background-color (colors/theme-colors colors/white colors/neutral-95 theme)})) - (defn container [opacity top theme] [{:opacity opacity} diff --git a/src/status_im/contexts/chat/messenger/composer/selection.cljs b/src/status_im/contexts/chat/messenger/composer/selection.cljs index bcf872420b..e2451afe38 100644 --- a/src/status_im/contexts/chat/messenger/composer/selection.cljs +++ b/src/status_im/contexts/chat/messenger/composer/selection.cljs @@ -83,28 +83,3 @@ :strikethrough #(append-markdown-char % "~~")}) (def second-level-menu-items (map i18n/label (keys second-level-menus))) - -(defn on-menu-item-touched - [{:keys [first-level? event-type] :as params}] - (let [menus (if @first-level? first-level-menus second-level-menus) - menu-item-key (nth (keys menus) event-type) - action (get menus menu-item-key)] - (action params))) - -(defn on-selection - [event - {:keys [input-ref selection-event]} - {:keys [first-level? menu-items]}] - (let [{:strs [eventType content selectionStart - selectionEnd]} (js->clj (oops/oget event "nativeEvent")) - full-text (:input-text (rf/sub [:chats/current-chat-input]))] - (on-menu-item-touched {:first-level? first-level? - :event-type eventType - :content content - :selection-start selectionStart - :selection-end selectionEnd - :text-input @input-ref - :text-input-handle (rn/find-node-handle @input-ref) - :full-text full-text - :menu-items menu-items - :selection-event selection-event}))) diff --git a/src/status_im/contexts/chat/messenger/composer/style.cljs b/src/status_im/contexts/chat/messenger/composer/style.cljs index 007e264718..720b373e9d 100644 --- a/src/status_im/contexts/chat/messenger/composer/style.cljs +++ b/src/status_im/contexts/chat/messenger/composer/style.cljs @@ -1,27 +1,7 @@ (ns status-im.contexts.chat.messenger.composer.style (:require [quo.foundations.colors :as colors] - [quo.foundations.typography :as typography] - [react-native.reanimated :as reanimated] - [status-im.contexts.chat.messenger.composer.constants :as constants])) - -(def border-top-radius 20) - -(def bar-container - {:height constants/bar-container-height - :left 0 - :right 0 - :top 0 - :z-index 1 - :justify-content :center - :align-items :center}) - -(defn bar - [theme] - {:width 32 - :height 4 - :border-radius 100 - :background-color (colors/theme-colors colors/neutral-100-opa-5 colors/white-opa-10 theme)}) + [quo.foundations.typography :as typography])) (defn input-text [theme] @@ -31,15 +11,3 @@ :top 0 :left 0 :max-height 150)) - -(defn shell-button - [translate-y opacity] - (reanimated/apply-animations-to-style - {:transform [{:translate-y translate-y}] - :opacity opacity} - {})) - -(def scroll-to-bottom-button - {:position :absolute - :right 0 - :left 0}) diff --git a/src/status_im/contexts/chat/messenger/composer/utils.cljs b/src/status_im/contexts/chat/messenger/composer/utils.cljs index 2a019afb13..a82199d623 100644 --- a/src/status_im/contexts/chat/messenger/composer/utils.cljs +++ b/src/status_im/contexts/chat/messenger/composer/utils.cljs @@ -1,21 +1,8 @@ (ns status-im.contexts.chat.messenger.composer.utils (:require - [status-im.contexts.chat.messenger.composer.constants :as constants] [utils.number] [utils.re-frame :as rf])) -(defn calc-top-content-height - [reply? edit?] - (cond-> 0 - reply? (+ constants/reply-container-height) - edit? (+ constants/edit-container-height))) - -(defn calc-bottom-content-height - [images link-previews?] - (cond-> 0 - (seq images) (+ constants/images-container-height) - link-previews? (+ constants/links-container-height))) - (defn blur-input [input-ref] (when @input-ref @@ -38,26 +25,3 @@ 100) (.setNativeProps ^js @input-ref (clj->js {:text ""})) (rf/dispatch [:chat.ui/cancel-message-edit])) - -(defn calc-suggestions-position - [cursor-pos max-height size - {:keys [maximized?]} - {:keys [insets curr-height window-height keyboard-height reply edit]} - images - link-previews?] - (let [base (+ constants/composer-default-height (:bottom insets) 8) - base (+ base (- curr-height constants/input-height)) - base (+ base (calc-top-content-height reply edit)) - view-height (- window-height keyboard-height (:top insets)) - container-height (utils.number/value-in-range - (* (/ constants/mentions-max-height 4) size) - (/ constants/mentions-max-height 4) - constants/mentions-max-height)] - (if @maximized? - (if (< (+ cursor-pos container-height) max-height) - (+ constants/actions-container-height (:bottom insets)) - (+ constants/actions-container-height (:bottom insets) (- max-height cursor-pos) 18)) - (if (< (+ base container-height) view-height) - (let [bottom-content-height (calc-bottom-content-height images link-previews?)] - (+ base bottom-content-height)) - (+ constants/actions-container-height (:bottom insets) (- curr-height cursor-pos) 18))))) diff --git a/src/status_im/contexts/chat/messenger/messages/constants.cljs b/src/status_im/contexts/chat/messenger/messages/constants.cljs index ffcc6d4604..edd58c4c2a 100644 --- a/src/status_im/contexts/chat/messenger/messages/constants.cljs +++ b/src/status_im/contexts/chat/messenger/messages/constants.cljs @@ -3,4 +3,3 @@ ;;;; Navigation (def ^:const top-bar-height 56) (def ^:const pinned-banner-height 40) -(def ^:const header-container-radius 20) diff --git a/src/status_im/contexts/chat/messenger/messages/content/audio/style.cljs b/src/status_im/contexts/chat/messenger/messages/content/audio/style.cljs index 4abf63943d..e5001d8bbc 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/audio/style.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/audio/style.cljs @@ -16,10 +16,6 @@ :border-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme) :background-color (colors/theme-colors colors/neutral-5 colors/neutral-80-opa-40 theme)}) -(def play-pause-slider-container - {:flex-direction :row - :align-items :center}) - (def slider-container {:position :absolute :left 60 diff --git a/src/status_im/contexts/chat/messenger/messages/content/pin/style.cljs b/src/status_im/contexts/chat/messenger/messages/content/pin/style.cljs index f1c52b2ea6..5fce92ffe3 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/pin/style.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/pin/style.cljs @@ -2,9 +2,6 @@ (:require [quo.foundations.colors :as colors])) -(def system-message-default-size 34) -(def system-message-margin-right 8) - (def pin-indicator-container {:padding-left 42 :margin-bottom 2 @@ -14,28 +11,3 @@ (def pin-author-text {:color colors/primary-50 :margin-left 2}) - -(defn pinned-message-text - [theme] - {:color (colors/theme-colors colors/neutral-100 colors/white theme) - :margin-left 4}) - -(def system-message-container - {:flex-direction :row :margin-vertical 8}) - -(def system-message-inner-container - {:width system-message-default-size - :height system-message-default-size - :border-radius system-message-default-size - :margin-right system-message-margin-right - :justify-content :center - :align-items :center - :background-color colors/primary-50-opa-10}) - -(def system-message-author-container - {:flex-direction :row - :align-items :baseline}) - -(def system-message-timestamp-container - {:padding-left 8 - :color colors/neutral-50}) diff --git a/src/status_im/contexts/chat/messenger/messages/delete_message/events.cljs b/src/status_im/contexts/chat/messenger/messages/delete_message/events.cljs index 23a9e2a837..50e5b90384 100644 --- a/src/status_im/contexts/chat/messenger/messages/delete_message/events.cljs +++ b/src/status_im/contexts/chat/messenger/messages/delete_message/events.cljs @@ -158,7 +158,7 @@ (rf/defn delete-and-send {:events [:chat.ui/delete-message-and-send]} [{:keys [db]} {:keys [message-id chat-id]} force?] - (when-let [message (get-in db [:messages chat-id message-id])] + (when (get-in db [:messages chat-id message-id]) (when (or force? (check-before-delete-and-send db chat-id message-id)) (let [unpin-locally? ;; this only check against local client data generally msg is already unpinned at delete diff --git a/src/status_im/contexts/chat/messenger/messages/delete_message_for_me/events.cljs b/src/status_im/contexts/chat/messenger/messages/delete_message_for_me/events.cljs index 05b8f1195a..6faba23a13 100644 --- a/src/status_im/contexts/chat/messenger/messages/delete_message_for_me/events.cljs +++ b/src/status_im/contexts/chat/messenger/messages/delete_message_for_me/events.cljs @@ -104,7 +104,7 @@ (rf/defn delete-and-sync {:events [:chat.ui/delete-message-for-me-and-sync]} [{:keys [db]} {:keys [message-id chat-id]} force?] - (when-let [message (get-in db [:messages chat-id message-id])] + (when-let [_message (get-in db [:messages chat-id message-id])] (when (or force? (check-before-delete-and-sync db chat-id message-id)) {:db (update-db-clear-undo-timer db chat-id message-id) :json-rpc/call [{:method "wakuext_deleteMessageForMeAndSync" diff --git a/src/status_im/contexts/chat/messenger/messages/drawers/view.cljs b/src/status_im/contexts/chat/messenger/messages/drawers/view.cljs index 99e595da8c..5f6a37213f 100644 --- a/src/status_im/contexts/chat/messenger/messages/drawers/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/drawers/view.cljs @@ -186,13 +186,6 @@ :icon :i/delete :id :delete-for-all})))) -(defn extract-id - [reactions id] - (->> reactions - (filter (fn [{:keys [emoji-id]}] (= emoji-id id))) - first - :emoji-reaction-id)) - (defn reactions [{:keys [chat-id message-id]}] (let [msg-reactions (rf/sub [:chats/message-reactions message-id chat-id]) diff --git a/src/status_im/contexts/chat/messenger/messages/list/events_test.cljs b/src/status_im/contexts/chat/messenger/messages/list/events_test.cljs index 976ece2ec1..5c386769cb 100644 --- a/src/status_im/contexts/chat/messenger/messages/list/events_test.cljs +++ b/src/status_im/contexts/chat/messenger/messages/list/events_test.cljs @@ -51,23 +51,6 @@ (is (:last-in-group? actual-m2)) (is (:last-in-group? actual-m3)))))) -(def ascending-range - (mapv - #(let [i (+ 100000 %)] - {:clock-value i - :whisper-timestamp i - :timestamp i - :message-id (str i)}) - (range 2000))) - -(def descending-range (reverse ascending-range)) - -(def random-range (shuffle ascending-range)) - -(defnp build-message-list - [messages] - (s/add-many nil messages)) - (defnp append-to-message-list [l message] (s/add l message)) diff --git a/src/status_im/contexts/chat/messenger/messages/list/view.cljs b/src/status_im/contexts/chat/messenger/messages/list/view.cljs index 5b6002405c..e0c969fd6d 100644 --- a/src/status_im/contexts/chat/messenger/messages/list/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/list/view.cljs @@ -10,13 +10,10 @@ [react-native.hooks :as hooks] [react-native.platform :as platform] [react-native.reanimated :as reanimated] - [status-im.common.home.actions.view :as home.actions] [status-im.constants :as constants] - [status-im.contexts.chat.messenger.composer.constants :as composer.constants] [status-im.contexts.chat.messenger.messages.content.view :as message] [status-im.contexts.chat.messenger.messages.list.state :as state] [status-im.contexts.chat.messenger.messages.list.style :as style] - [utils.i18n :as i18n] [utils.re-frame :as rf] [utils.worklets.chat.messenger.messages :as worklets])) @@ -66,62 +63,6 @@ :parent-height parent-height :animated? false}])) -(defn header-height - [{:keys [insets able-to-send-message? images reply edit link-previews? input-content-height]}] - (if able-to-send-message? - (cond-> composer.constants/composer-default-height - (seq images) - (+ composer.constants/images-container-height) - - reply - (+ composer.constants/reply-container-height) - - edit - (+ composer.constants/edit-container-height) - - link-previews? - (+ composer.constants/links-container-height) - - (and input-content-height (not= input-content-height composer.constants/input-height)) - (+ composer.constants/input-height) - - true - (+ (:bottom insets))) - (- 70 (:bottom insets)))) - -(defn actions - [chat-id cover-bg-color] - (let [latest-pin-text (rf/sub [:chats/last-pinned-message-text chat-id]) - pins-count (rf/sub [:chats/pin-messages-count chat-id]) - {:keys [muted muted-till chat-type]} (rf/sub [:chats/chat-by-id chat-id]) - community-channel? (= constants/community-chat-type chat-type) - muted? (and muted (some? muted-till)) - mute-chat-label (if community-channel? :t/mute-channel :t/mute-chat) - unmute-chat-label (if community-channel? :t/unmute-channel :t/unmute-chat)] - [quo/channel-actions - {:actions - [{:accessibility-label :action-button-pinned - :big? true - :label (if (pos? pins-count) latest-pin-text (i18n/label :t/no-pinned-messages)) - :customization-color cover-bg-color - :icon :i/pin - :counter-value pins-count - :on-press (fn [] - (rf/dispatch [:pin-message/show-pins-bottom-sheet - chat-id]))} - {:accessibility-label :action-button-mute - :label (i18n/label (if muted - unmute-chat-label - mute-chat-label)) - :customization-color cover-bg-color - :icon (if muted? :i/activity-center :i/muted) - :on-press (fn [] - (if muted? - (home.actions/unmute-chat-action chat-id) - (home.actions/mute-chat-action chat-id - chat-type - muted?)))}]}])) - (defn more-messages-loader [{:keys [chat-id] :as props}] (let [loading-messages? (rf/sub [:chats/loading-messages? chat-id]) diff --git a/src/status_im/contexts/chat/messenger/messages/pin/events.cljs b/src/status_im/contexts/chat/messenger/messages/pin/events.cljs index 39f585d5b5..db3e60def1 100644 --- a/src/status_im/contexts/chat/messenger/messages/pin/events.cljs +++ b/src/status_im/contexts/chat/messenger/messages/pin/events.cljs @@ -97,7 +97,7 @@ (rf/defn send-pin-message "Pin message, rebuild pinned messages list" {:events [:pin-message/send-pin-message]} - [{:keys [db] :as cofx} {:keys [chat-id message-id pinned remote-only?] :as pin-message}] + [cofx {:keys [remote-only?] :as pin-message}] (rf/merge cofx (when-not remote-only? (send-pin-message-locally pin-message)) (data-store.pin-messages/send-pin-message {:chat-id (pin-message :chat-id) diff --git a/src/status_im/contexts/chat/messenger/messages/transport/events.cljs b/src/status_im/contexts/chat/messenger/messages/transport/events.cljs index 3b59417737..f96d9c535d 100644 --- a/src/status_im/contexts/chat/messenger/messages/transport/events.cljs +++ b/src/status_im/contexts/chat/messenger/messages/transport/events.cljs @@ -34,7 +34,7 @@ (rf/defn process-response {:events [:process-response]} - [{:keys [db] :as cofx} ^js response-js process-async] + [cofx ^js response-js process-async] (let [^js communities (.-communities response-js) ^js requests-to-join-community (.-requestsToJoinCommunity response-js) ^js chats (.-chats response-js) @@ -291,7 +291,7 @@ [{:keys [db] :as cofx} ^js response-js process-async] (when response-js (let [current-chat-id (:current-chat-id db) - {:keys [db messages transactions chats statuses]} + {:keys [db messages transactions statuses]} (reduce group-by-and-update-unviewed-counts {:db db :chats #{} @@ -343,7 +343,7 @@ [{:keys [db] :as cofx} message-id status] (if-let [{:keys [chat-id]} (get-in db [:transport/message-envelopes message-id])] - (when-let [{:keys [from]} (get-in db [:messages chat-id message-id])] + (when-let [{:keys [_from]} (get-in db [:messages chat-id message-id])] (check-confirmations cofx status chat-id message-id)) ;; We don't have a message-envelope for this, might be that the confirmation came too early {:db (update-in db [:transport/message-confirmations message-id] conj status)})) diff --git a/src/status_im/contexts/chat/messenger/photo_selector/events.cljs b/src/status_im/contexts/chat/messenger/photo_selector/events.cljs index 2b8357fe4a..5af1decbf4 100644 --- a/src/status_im/contexts/chat/messenger/photo_selector/events.cljs +++ b/src/status_im/contexts/chat/messenger/photo_selector/events.cljs @@ -14,8 +14,8 @@ (rf/defn get-photos-count-ios {:events [:on-camera-roll-get-images-count-ios]} - [{:keys [db]} count] - {:db (assoc db :camera-roll/ios-images-count count)}) + [{:keys [db]} cnt] + {:db (assoc db :camera-roll/ios-images-count cnt)}) (rf/defn camera-roll-get-albums {:events [:photo-selector/camera-roll-get-albums]} diff --git a/src/status_im/contexts/chat/messenger/photo_selector/style.cljs b/src/status_im/contexts/chat/messenger/photo_selector/style.cljs index 6bffc473bb..794e38d879 100644 --- a/src/status_im/contexts/chat/messenger/photo_selector/style.cljs +++ b/src/status_im/contexts/chat/messenger/photo_selector/style.cljs @@ -24,37 +24,6 @@ {:position :absolute :right 20}) -(defn close-button-container - [theme] - {:background-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme) - :width 32 - :height 32 - :border-radius 10 - :justify-content :center - :align-items :center - :position :absolute - :left 20}) - -(defn title-container - [theme] - {:flex-direction :row - :background-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme) - :border-radius 10 - :padding-horizontal 12 - :padding-vertical 5 - :align-self :center}) - -(defn chevron-container - [theme] - {:background-color (colors/theme-colors colors/neutral-30 colors/neutral-100 theme) - :width 14 - :height 14 - :border-radius 7 - :justify-content :center - :align-items :center - :margin-left 7 - :margin-top 4}) - (defn image [window-width index] {:width (- (/ window-width 3) 0.67) diff --git a/src/status_im/contexts/communities/actions/accounts_selection/events_test.cljs b/src/status_im/contexts/communities/actions/accounts_selection/events_test.cljs index 94f0d33674..31a0d24beb 100644 --- a/src/status_im/contexts/communities/actions/accounts_selection/events_test.cljs +++ b/src/status_im/contexts/communities/actions/accounts_selection/events_test.cljs @@ -29,20 +29,6 @@ :color :pink :emoji "๐Ÿฆฉ"}}) -(def permissioned-accounts - [{:address "0xB" - :position 0 - :color :blue - :emoji "๐Ÿˆ" - :airdrop-address? true - :reveal? true} - {:address "0xC" - :position 1 - :color :orange - :emoji "๐Ÿ›๏ธ" - :airdrop-address? false - :reveal? false}]) - (deftest initialize-permission-addresses-test (testing "fetches revealed accounts when joined" (let [cofx {:db {:communities {community-id {:joined true}}}}] diff --git a/src/status_im/contexts/communities/actions/share_community_channel/style.cljs b/src/status_im/contexts/communities/actions/share_community_channel/style.cljs index e1d620502c..df81455e99 100644 --- a/src/status_im/contexts/communities/actions/share_community_channel/style.cljs +++ b/src/status_im/contexts/communities/actions/share_community_channel/style.cljs @@ -20,18 +20,3 @@ :margin-top 8 :align-items :center}) -(def gradient-cover-padding 20) -(def qr-code-padding 12) - -(defn qr-code-size - [total-width] - (- total-width (* gradient-cover-padding 2) (* qr-code-padding 2))) - -(defn gradient-cover-size - [total-width] - (- total-width (* gradient-cover-padding 2))) - -(defn gradient-cover-wrapper - [width] - {:width (gradient-cover-size width) - :border-radius 12}) diff --git a/src/status_im/contexts/communities/events.cljs b/src/status_im/contexts/communities/events.cljs index ebde6f3ab4..1edfd26cee 100644 --- a/src/status_im/contexts/communities/events.cljs +++ b/src/status_im/contexts/communities/events.cljs @@ -71,7 +71,7 @@ (rf/defn handle-communities {:events [:community/fetch-success]} - [{:keys [db]} communities-js] + [_ communities-js] {:fx (map (fn [c] [:dispatch [:communities/handle-community c]]) communities-js)}) diff --git a/src/status_im/contexts/communities/home/style.cljs b/src/status_im/contexts/communities/home/style.cljs deleted file mode 100644 index 241030ed39..0000000000 --- a/src/status_im/contexts/communities/home/style.cljs +++ /dev/null @@ -1,64 +0,0 @@ -(ns status-im.contexts.communities.home.style - (:require - [quo.foundations.colors :as colors] - [react-native.platform :as platform] - [react-native.reanimated :as reanimated] - [react-native.safe-area :as safe-area])) - -(def tabs - {:padding-horizontal 20 - :padding-top 8 - :padding-bottom 12}) - -(def blur - {:position :absolute - :top 0 - :right 0 - :left 0 - :bottom 0}) - -(def empty-state-placeholder - {:height 120 - :width 120 - :background-color colors/danger-50}) - -(defn blur-banner-layer - [animated-translation-y] - (let [fixed-height (+ (safe-area/get-top) 244)] - (reanimated/apply-animations-to-style - {:transform [{:translate-y animated-translation-y}]} - {:overflow (if platform/ios? :visible :hidden) - :z-index 1 - :position :absolute - :top 0 - :right 0 - :left 0 - :height fixed-height}))) - -(defn hiding-banner-layer - [] - {:z-index 2 - :position :absolute - :top 0 - :right 0 - :left 0 - :padding-top (safe-area/get-top)}) - -(defn tabs-banner-layer - [animated-translation-y] - (let [top-offset (+ (safe-area/get-top) 192)] - (reanimated/apply-animations-to-style - {:transform [{:translate-y animated-translation-y}]} - {:z-index 3 - :position :absolute - :top top-offset - :right 0 - :left 0}))) - -(def animated-card-container {:overflow :hidden}) - -(defn animated-card - [opacity translate-y] - (reanimated/apply-animations-to-style {:opacity opacity - :transform [{:translate-y translate-y}]} - {})) diff --git a/src/status_im/contexts/communities/overview/utils.cljs b/src/status_im/contexts/communities/overview/utils.cljs deleted file mode 100644 index bf105b84a7..0000000000 --- a/src/status_im/contexts/communities/overview/utils.cljs +++ /dev/null @@ -1,22 +0,0 @@ -(ns status-im.contexts.communities.overview.utils - (:require - [clojure.string :as string] - [utils.i18n :as i18n])) - -(defn join-existing-users-string - [user-list] - (let [users-count (count user-list) - first-two (->> user-list - (take 2) - (map #(string/split (:full-name %) #" ")) - (map first))] - (case users-count - 0 "" - 1 (i18n/label :t/join-one-user {:user (first first-two)}) - 2 (i18n/label :t/join-two-users - {:user1 (first first-two) - :user2 (second first-two)}) - (i18n/label :t/join-more-users - {:user1 (first first-two) - :user2 (second first-two) - :left-count (- users-count 2)})))) diff --git a/src/status_im/contexts/onboarding/create_password/style.cljs b/src/status_im/contexts/onboarding/create_password/style.cljs index 67b5d599fd..7efe438b97 100644 --- a/src/status_im/contexts/onboarding/create_password/style.cljs +++ b/src/status_im/contexts/onboarding/create_password/style.cljs @@ -7,9 +7,6 @@ (def heading-subtitle {:color colors/white}) (def heading-title (assoc heading-subtitle :margin-bottom 8)) -(def info-message - {:margin-top 8}) - (def space-between-inputs {:height 16}) (def password-tips diff --git a/src/status_im/contexts/onboarding/identifiers/profile_card/style.cljs b/src/status_im/contexts/onboarding/identifiers/profile_card/style.cljs new file mode 100644 index 0000000000..c64f7bd086 --- /dev/null +++ b/src/status_im/contexts/onboarding/identifiers/profile_card/style.cljs @@ -0,0 +1,66 @@ +(ns status-im.contexts.onboarding.identifiers.profile-card.style + (:require + [quo.foundations.colors :as colors] + [quo.foundations.typography :as typography] + [react-native.reanimated :as reanimated])) + +(def card-view + {:margin-horizontal 20 + :margin-bottom :auto + :flex-direction :row}) + +(defn card-container + [background-color] + (reanimated/apply-animations-to-style + {:background-color background-color} + {:padding-horizontal 12 + :padding-top 12 + :padding-bottom 12 + :flex 1 + :border-radius 16})) + +(def card-header + {:flex-direction :row + :justify-content :space-between}) + +(defn avatar + [opacity] + (reanimated/apply-animations-to-style + {:opacity opacity} + {})) + +(defn mask-view + [opacity] + (reanimated/apply-animations-to-style + {:opacity opacity} + {:width 48 + :background-color :transparent + :height 48 + :border-color :black + :border-width 2 + :border-radius 44})) + +(defn user-name-container + [opacity] + (reanimated/apply-animations-to-style + {:opacity opacity} + {:flex-direction :row + :margin-top 8 + :align-items :center + :padding-right 12})) + +(def user-name + {:color colors/white}) + +(defn user-hash + [user-hash-color user-hash-opacity] + (reanimated/apply-animations-to-style + {:color user-hash-color + :opacity user-hash-opacity} + (merge typography/monospace + typography/paragraph-1 + {:margin-top 2}))) + +(def emoji-hash + {:margin-top 12 + :line-height 20.5}) diff --git a/src/status_im/contexts/onboarding/share_usage/style.cljs b/src/status_im/contexts/onboarding/share_usage/style.cljs index 1f8d4012c8..556034e2de 100644 --- a/src/status_im/contexts/onboarding/share_usage/style.cljs +++ b/src/status_im/contexts/onboarding/share_usage/style.cljs @@ -1,11 +1,6 @@ (ns status-im.contexts.onboarding.share-usage.style (:require [quo.foundations.colors :as colors])) -(def title-container - {:margin-horizontal 20 - :padding-bottom 20 - :padding-top 12}) - (defn page-illustration [width] {:flex 1 diff --git a/src/status_im/contexts/onboarding/sign_in/style.cljs b/src/status_im/contexts/onboarding/sign_in/style.cljs deleted file mode 100644 index 71171f6bb1..0000000000 --- a/src/status_im/contexts/onboarding/sign_in/style.cljs +++ /dev/null @@ -1,95 +0,0 @@ -(ns status-im.contexts.onboarding.sign-in.style - (:require - [quo.foundations.colors :as colors])) - -(def screen-padding 20) - -(def flex-spacer {:flex 1}) - -(def absolute-fill - {:position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0}) - -(defn root-container - [padding-top] - {:flex 1 - :padding-top padding-top}) - -(def header-container - {:flex-direction :row - :justify-content :space-between - :padding-horizontal screen-padding - :margin-vertical 12}) - -(def header-text - {:padding-horizontal screen-padding - :padding-top 12 - :padding-bottom 8 - :color colors/white}) - -(def header-sub-text - {:padding-horizontal screen-padding - :color colors/white}) - -(def tabs-container - {:padding-horizontal screen-padding - :margin-top 20}) - -(def scan-qr-code-container - {:margin-top 19}) - -(def qr-view-finder - {:margin-horizontal screen-padding - :height 1 - :display :flex}) - -(defn viewfinder-container - [viewfinder] - {:position :absolute - :left (:x viewfinder) - :top (:y viewfinder)}) - -(def viewfinder-text - {:color colors/white-opa-70 - :text-align :center - :padding-top 16}) - -(def camera-permission-container - {:height 335 - :margin-horizontal screen-padding - :background-color colors/white-opa-5 - :border-color colors/white-opa-10 - :border-radius 12 - :border-style :dashed - :border-width 1 - :align-items :center - :justify-content :center}) - -(def enable-camera-access-header - {:color colors/white}) - -(def enable-camera-access-sub-text - {:color colors/white-opa-70 - :margin-bottom 16}) - -(def enter-sync-code-container - {:margin-top 20 - :justify-content :center - :align-items :center}) - -(defn bottom-container - [padding-bottom] - {:padding-top 12 - :padding-bottom padding-bottom - :background-color colors/white-opa-5 - :border-top-left-radius 20 - :border-top-right-radius 20 - :align-items :center - :justify-content :center}) - -(def bottom-text - {:color colors/white - :padding-bottom 12}) diff --git a/src/status_im/contexts/preview/quo/preview.clj b/src/status_im/contexts/preview/quo/preview.clj deleted file mode 100644 index a8d9d7f46d..0000000000 --- a/src/status_im/contexts/preview/quo/preview.clj +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.contexts.preview.quo.preview) - -(defmacro list-comp - [[the-binding seq-expr & bindings] body-expr] - (cond (not the-binding) - `(list ~body-expr) - - :else - `(mapcat (fn [~the-binding] (list-comp ~bindings ~body-expr)) - ~seq-expr))) diff --git a/src/status_im/contexts/preview/quo/preview.cljs b/src/status_im/contexts/preview/quo/preview.cljs index f00afea65f..c63c67daef 100644 --- a/src/status_im/contexts/preview/quo/preview.cljs +++ b/src/status_im/contexts/preview/quo/preview.cljs @@ -14,8 +14,7 @@ [status-im.contexts.preview.quo.common :as common] [status-im.contexts.preview.quo.style :as style] utils.number - [utils.re-frame :as rf]) - (:require-macros status-im.contexts.preview.quo.preview)) + [utils.re-frame :as rf])) (defn- label-view [_ label theme] diff --git a/src/status_im/contexts/preview/quo/tabs/account_selector.cljs b/src/status_im/contexts/preview/quo/tabs/account_selector.cljs index b1efa83ef8..52826b948e 100644 --- a/src/status_im/contexts/preview/quo/tabs/account_selector.cljs +++ b/src/status_im/contexts/preview/quo/tabs/account_selector.cljs @@ -10,33 +10,6 @@ {:key :account-text :type :text} {:key :label-text :type :text}]) -;; keeping this unused data structure in the code for now -;; will reference them when I introduce multiple account support -;; and allow passing lists of accounts instead of just 1 account -(def single-account - [{:account-text "My Savings" - :account-emoji "๐Ÿ‘" - :label-text "Label"}]) - -(def two-accounts - [{:account-text "My Savings" - :account-emoji "๐Ÿ‘" - :label-text "Label"} - {:account-text "My Current" - :account-emoji "๐ŸŽ" - :label-text "Label 2"}]) - -(def many-accounts - [{:account-text "My Savings" - :account-emoji "๐Ÿ‘" - :label-text "Label"} - {:account-text "My Current" - :account-emoji "๐ŸŽ" - :label-text "Label 2"} - {:account-text "My Reimbursment" - :account-emoji "๐ŸŸ" - :label-text "Label 3"}]) - (defn view [] (let [state (reagent/atom {:show-label? true diff --git a/src/status_im/contexts/profile/push_notifications/events.cljs b/src/status_im/contexts/profile/push_notifications/events.cljs index f527b862db..ca301e0fd5 100644 --- a/src/status_im/contexts/profile/push_notifications/events.cljs +++ b/src/status_im/contexts/profile/push_notifications/events.cljs @@ -13,9 +13,6 @@ [utils.re-frame :as rf] [utils.transforms :as transforms])) -(def server-type-default 1) -(def server-type-custom 2) - (def apn-token-type 1) (def firebase-token-type 2) @@ -39,7 +36,7 @@ {:events [:push-notifications/registered-for-push-notifications]} [_ token] {:json-rpc/call [{:method "wakuext_registerForPushNotifications" - :params [token (if platform/ios? config/apn-topic) + :params [token (when platform/ios? config/apn-topic) (if platform/ios? apn-token-type firebase-token-type)] :on-success #(log/info "[push-notifications] register-success" %) :on-error #(log/info "[push-notifications] register-error" %)}]}) diff --git a/src/status_im/contexts/profile/settings/header/style.cljs b/src/status_im/contexts/profile/settings/header/style.cljs index eb1f510dff..2a2bff1b07 100644 --- a/src/status_im/contexts/profile/settings/header/style.cljs +++ b/src/status_im/contexts/profile/settings/header/style.cljs @@ -1,5 +1,4 @@ -(ns status-im.contexts.profile.settings.header.style - (:require [quo.foundations.colors :as colors])) +(ns status-im.contexts.profile.settings.header.style) (def avatar-row-wrapper {:display :flex @@ -22,14 +21,3 @@ {:opacity opacity-animation :flex-direction :row :justify-content :space-between}) - -(defn avatar-container - [theme scale-animation top-margin-animation side-margin-animation] - [{:transform [{:scale scale-animation}] - :margin-top top-margin-animation - :margin-left side-margin-animation - :margin-bottom side-margin-animation} - {:align-items :flex-start - :border-width 4 - :border-color (colors/theme-colors colors/border-avatar-light colors/neutral-80-opa-80 theme) - :border-radius 100}]) diff --git a/src/status_im/contexts/profile/settings/screens/password/change_password/style.cljs b/src/status_im/contexts/profile/settings/screens/password/change_password/style.cljs index ceee6c82b5..3754438f5a 100644 --- a/src/status_im/contexts/profile/settings/screens/password/change_password/style.cljs +++ b/src/status_im/contexts/profile/settings/screens/password/change_password/style.cljs @@ -15,9 +15,6 @@ (def heading-title (assoc heading-subtitle :margin-bottom 8)) -(def info-message - {:margin-top 8}) - (def space-between-inputs {:height 16}) (def error-container diff --git a/src/status_im/contexts/profile/settings/screens/password/style.cljs b/src/status_im/contexts/profile/settings/screens/password/style.cljs index f66a212dad..81f1340f80 100644 --- a/src/status_im/contexts/profile/settings/screens/password/style.cljs +++ b/src/status_im/contexts/profile/settings/screens/password/style.cljs @@ -1,10 +1 @@ (ns status-im.contexts.profile.settings.screens.password.style) - -(defn navigation - [top-inset] - {:padding-top top-inset}) - -(def header - {:padding-horizontal 20 - :padding-bottom 8 - :padding-top 12}) diff --git a/src/status_im/contexts/settings/wallet/network_settings/style.cljs b/src/status_im/contexts/settings/wallet/network_settings/style.cljs index c33de06704..f4b31906d3 100644 --- a/src/status_im/contexts/settings/wallet/network_settings/style.cljs +++ b/src/status_im/contexts/settings/wallet/network_settings/style.cljs @@ -1,5 +1,4 @@ -(ns status-im.contexts.settings.wallet.network-settings.style - (:require [quo.foundations.colors :as colors])) +(ns status-im.contexts.settings.wallet.network-settings.style) (def title-container {:flex 0 @@ -21,6 +20,3 @@ (def advanced-settings-container {:flex-shrink 0}) - -(def testnet-not-available - {:color colors/danger-60}) diff --git a/src/status_im/contexts/shell/activity_center/events.cljs b/src/status_im/contexts/shell/activity_center/events.cljs index d68f16bdd4..7bd5f0e58f 100644 --- a/src/status_im/contexts/shell/activity_center/events.cljs +++ b/src/status_im/contexts/shell/activity_center/events.cljs @@ -216,7 +216,7 @@ (rf/defn accept-notification {:events [:activity-center.notifications/accept]} - [{:keys [db]} notification-id] + [_ notification-id] {:json-rpc/call [{:method "wakuext_acceptActivityCenterNotifications" :params [[notification-id]] :on-success [:activity-center.notifications/accept-success notification-id] @@ -234,7 +234,7 @@ (rf/defn dismiss-notification {:events [:activity-center.notifications/dismiss]} - [{:keys [db]} notification-id] + [_ notification-id] {:json-rpc/call [{:method "wakuext_dismissActivityCenterNotifications" :params [[notification-id]] :on-success [:activity-center.notifications/dismiss-success notification-id] @@ -249,7 +249,7 @@ (rf/defn delete-notification {:events [:activity-center.notifications/delete]} - [{:keys [db]} notification-id] + [_ notification-id] {:json-rpc/call [{:method "wakuext_deleteActivityCenterNotifications" :params [[notification-id]] :on-success [:activity-center.notifications/delete-success notification-id] @@ -310,19 +310,10 @@ (and (some? cursor) (not= cursor start-or-end-cursor))) -(def ^:const status-unread 2) -(def ^:const status-all 3) (def ^:const read-type-read 1) (def ^:const read-type-unread 2) (def ^:const read-type-all 3) -(defn status - [filter-status] - (case filter-status - :unread status-unread - :all status-all - 99)) - (defn ->rpc-read-type [read-type] (case read-type @@ -528,7 +519,7 @@ {:events [:activity-center.notifications/show-toasts]} [{:keys [db]} new-notifications] (let [my-public-key (get-in db [:profile/profile :public-key])] - (reduce (fn [cofx {:keys [author chat-id type accepted dismissed message name] :as x}] + (reduce (fn [cofx {:keys [author chat-id type accepted dismissed message name]}] (let [user-avatar {:full-name name :status-indicator? true :online? nil diff --git a/src/status_im/contexts/shell/activity_center/events_test.cljs b/src/status_im/contexts/shell/activity_center/events_test.cljs index 32f8100fc1..6df16a4d86 100644 --- a/src/status_im/contexts/shell/activity_center/events_test.cljs +++ b/src/status_im/contexts/shell/activity_center/events_test.cljs @@ -2,7 +2,6 @@ (:require [cljs.test :refer [deftest is testing]] matcher-combinators.test - [status-im.constants :as constants] [status-im.contexts.shell.activity-center.events :as events] [status-im.contexts.shell.activity-center.notification-types :as types] [test-helpers.unit :as h])) @@ -161,49 +160,6 @@ ;;;; Contact verification -(def contact-verification-rpc-response - {:activityCenterNotifications - [{:accepted false - :author "0x04d03f" - :chatId "0x04d03f" - :contactVerificationStatus constants/contact-verification-status-pending - :dismissed false - :id notification-id - :message {} - :name "0x04d03f" - :read true - :timestamp 1666647286000 - :type types/contact-verification}]}) - -(def contact-verification-expected-notification - {:accepted false - :author "0x04d03f" - :chat-id "0x04d03f" - :contact-verification-status constants/contact-verification-status-pending - :dismissed false - :id notification-id - :last-message nil - :message {:command-parameters nil - :content {:chat-id nil - :ens-name nil - :image nil - :line-count nil - :links nil - :parsed-text nil - :response-to nil - :rtl? nil - :sticker nil - :text nil} - :outgoing false - :outgoing-status nil - :link-previews [] - :quoted-message nil} - :name "0x04d03f" - :read true - :reply-message nil - :timestamp 1666647286000 - :type types/contact-verification}) - (deftest contact-verification-decline-test (is (match? {:json-rpc/call [{:method "wakuext_declineContactVerificationRequest" diff --git a/src/status_im/contexts/shell/activity_center/notification/common/style.cljs b/src/status_im/contexts/shell/activity_center/notification/common/style.cljs index b1ce7a44da..f0613ffc1f 100644 --- a/src/status_im/contexts/shell/activity_center/notification/common/style.cljs +++ b/src/status_im/contexts/shell/activity_center/notification/common/style.cljs @@ -6,9 +6,6 @@ (def swipe-button-border-radius 16) (def swipe-button-margin 8) -(def user-avatar-tag - {:background-color colors/white-opa-10}) - (def user-avatar-tag-text {:color colors/white}) diff --git a/src/status_im/contexts/shell/activity_center/notification/mentions/style.cljs b/src/status_im/contexts/shell/activity_center/notification/mentions/style.cljs index 195eebb840..f1d2f95ae1 100644 --- a/src/status_im/contexts/shell/activity_center/notification/mentions/style.cljs +++ b/src/status_im/contexts/shell/activity_center/notification/mentions/style.cljs @@ -2,9 +2,6 @@ (:require [quo.foundations.colors :as colors])) -(def tag - {:background-color colors/white-opa-10}) - (def tag-text {:color colors/white}) diff --git a/src/status_im/contexts/shell/activity_center/notification/reply/style.cljs b/src/status_im/contexts/shell/activity_center/notification/reply/style.cljs index bee0c602c5..a61f5d3dae 100644 --- a/src/status_im/contexts/shell/activity_center/notification/reply/style.cljs +++ b/src/status_im/contexts/shell/activity_center/notification/reply/style.cljs @@ -2,9 +2,6 @@ (:require [quo.foundations.colors :as colors])) -(def tag - {:background-color colors/white-opa-10}) - (def tag-text {:color colors/white}) diff --git a/src/status_im/contexts/shell/activity_center/style.cljs b/src/status_im/contexts/shell/activity_center/style.cljs index eba8ab1177..168c8dd379 100644 --- a/src/status_im/contexts/shell/activity_center/style.cljs +++ b/src/status_im/contexts/shell/activity_center/style.cljs @@ -40,21 +40,3 @@ :flex 1 :justify-content :center :padding-bottom 20}) - -(def empty-title - {:padding-bottom 2 - :color colors/white}) - -(def empty-subtitle - {:color colors/white}) - -(def empty-rectangle-placeholder - {:width 120 - :height 120 - :background-color colors/danger-50 - :margin-bottom 20}) - -(def blur - {:style {:position :absolute :top 0 :left 0 :right 0 :bottom 0} - :overlayColor colors/neutral-80-opa-80-blur - :blur-amount 20}) diff --git a/src/status_im/contexts/shell/share/events.cljs b/src/status_im/contexts/shell/share/events.cljs index cce601a810..40fe18f689 100644 --- a/src/status_im/contexts/shell/share/events.cljs +++ b/src/status_im/contexts/shell/share/events.cljs @@ -5,7 +5,7 @@ (rf/defn copy-text-and-show-toast {:events [:share/copy-text-and-show-toast]} - [{:keys [db] :as cofx} {:keys [text-to-copy post-copy-message]}] + [cofx {:keys [text-to-copy post-copy-message]}] (rf/merge cofx {:copy-to-clipboard text-to-copy} (toasts/upsert diff --git a/src/status_im/contexts/shell/share/style.cljs b/src/status_im/contexts/shell/share/style.cljs index 0249da936f..64d38c7ae1 100644 --- a/src/status_im/contexts/shell/share/style.cljs +++ b/src/status_im/contexts/shell/share/style.cljs @@ -33,26 +33,9 @@ :justify-content :flex-start :align-items :flex-start}) -(def profile-address-column - {:flex-direction :column}) - (def emoji-address-column {:flex-direction :column}) -(def profile-address-label - {:color colors/white-opa-40 - :padding-top 10}) - -(def profile-address-content - {:color colors/white - :align-self :flex-start - :padding-top 2}) - -(def profile-address-container - {:flex-direction :row - :justify-content :flex-start - :margin-top 4}) - (def emoji-address-container {:flex-direction :row :justify-content :flex-start}) @@ -63,12 +46,6 @@ :padding-bottom (if platform/ios? 2 0) :padding-left 12}) - -(def share-button-container - {:position :absolute - :right 0 - :top 12}) - (def emoji-share-button-container {:position :absolute :right 0 @@ -87,6 +64,4 @@ :margin-top 8 :margin-bottom 16}) -(def wip-style - {:color colors/white - :text-align :center}) + diff --git a/src/status_im/contexts/syncing/enter_sync_code/style.cljs b/src/status_im/contexts/syncing/enter_sync_code/style.cljs index 783a542657..350484ef88 100644 --- a/src/status_im/contexts/syncing/enter_sync_code/style.cljs +++ b/src/status_im/contexts/syncing/enter_sync_code/style.cljs @@ -31,11 +31,6 @@ :color colors/white :text-align-vertical :top})) -(def label-texts-container - {:flex-direction :row - :height 18 - :margin-bottom 8}) - (def button-paste {:margin-top 8}) diff --git a/src/status_im/contexts/syncing/events.cljs b/src/status_im/contexts/syncing/events.cljs index 10d5f74a3f..2d388b5c0b 100644 --- a/src/status_im/contexts/syncing/events.cljs +++ b/src/status_im/contexts/syncing/events.cljs @@ -20,7 +20,7 @@ (rf/defn local-pairing-clear-states {:events [:syncing/clear-states]} - [{:keys [db]} role] + [{:keys [db]}] {:db (dissoc db :syncing)}) (defn- input-connection-string-callback @@ -82,7 +82,7 @@ (rf/defn initiate-local-pairing-with-connection-string {:events [:syncing/input-connection-string-for-bootstrapping]} - [{:keys [db]} connection-string] + [_ connection-string] (let [config-map (.stringify js/JSON (clj->js {:receiverConfig @@ -95,7 +95,7 @@ (rf/defn preparations-for-connection-string {:events [:syncing/get-connection-string]} - [{:keys [db] :as cofx} sha3-pwd on-valid-connection-string] + [{:keys [db]} sha3-pwd on-valid-connection-string] (let [error (get-in db [:profile/login :error]) handle-connection (fn [response] (when (sync-utils/valid-connection-string? response) diff --git a/src/status_im/contexts/syncing/setup_syncing/style.cljs b/src/status_im/contexts/syncing/setup_syncing/style.cljs index a176a465ce..de8b09300c 100644 --- a/src/status_im/contexts/syncing/setup_syncing/style.cljs +++ b/src/status_im/contexts/syncing/setup_syncing/style.cljs @@ -18,9 +18,6 @@ :align-items :center :justify-content :space-between}) -(def navigation-bar - {:height 56}) - (def sync-code {:margin-top 20}) diff --git a/src/status_im/contexts/syncing/syncing_devices_list/style.cljs b/src/status_im/contexts/syncing/syncing_devices_list/style.cljs index 185d5ad9bb..590e698197 100644 --- a/src/status_im/contexts/syncing/syncing_devices_list/style.cljs +++ b/src/status_im/contexts/syncing/syncing_devices_list/style.cljs @@ -2,12 +2,6 @@ (:require [quo.foundations.colors :as colors])) -(defn container-main - [top] - {:background-color colors/neutral-95 - :padding-top top - :flex 1}) - (def page-container {:flex 1 :padding-horizontal 20}) diff --git a/src/status_im/contexts/syncing/utils.cljs b/src/status_im/contexts/syncing/utils.cljs index 11910541e0..6d6171a432 100644 --- a/src/status_im/contexts/syncing/utils.cljs +++ b/src/status_im/contexts/syncing/utils.cljs @@ -1,8 +1,7 @@ (ns status-im.contexts.syncing.utils (:require [clojure.string :as string] - [native-module.core :as native-module] - [utils.transforms :as transforms])) + [native-module.core :as native-module])) (defn validate-connection-string [connection-string] @@ -14,10 +13,3 @@ (some-> connection-string validate-connection-string string/blank?)) - -(defn extract-error - [json-str] - (-> json-str - transforms/json->clj - (get :error "") - not-empty)) diff --git a/src/status_im/contexts/wallet/account/style.cljs b/src/status_im/contexts/wallet/account/style.cljs index 20d6acad85..b78b17499f 100644 --- a/src/status_im/contexts/wallet/account/style.cljs +++ b/src/status_im/contexts/wallet/account/style.cljs @@ -13,7 +13,3 @@ {:padding-top 60 :margin-bottom 12 :padding-horizontal 20}) - -(def shell-button - {:position :absolute - :bottom 12}) diff --git a/src/status_im/contexts/wallet/add_account/create_account/new_keypair/confirm_backup/style.cljs b/src/status_im/contexts/wallet/add_account/create_account/new_keypair/confirm_backup/style.cljs index 1bae808bb0..656683282a 100644 --- a/src/status_im/contexts/wallet/add_account/create_account/new_keypair/confirm_backup/style.cljs +++ b/src/status_im/contexts/wallet/add_account/create_account/new_keypair/confirm_backup/style.cljs @@ -1,9 +1,5 @@ (ns status-im.contexts.wallet.add-account.create-account.new-keypair.confirm-backup.style) -(def header-container - {:margin-horizontal 20 - :margin-vertical 12}) - (def buttons-container {:padding-horizontal 20 :padding-vertical 12 diff --git a/src/status_im/contexts/wallet/add_account/create_account/style.cljs b/src/status_im/contexts/wallet/add_account/create_account/style.cljs index 0af2fdfbf5..2784cff0df 100644 --- a/src/status_im/contexts/wallet/add_account/create_account/style.cljs +++ b/src/status_im/contexts/wallet/add_account/create_account/style.cljs @@ -26,8 +26,4 @@ :padding-bottom 4 :padding-horizontal 20}) -(def divider-line - {:margin-top 12 - :margin-bottom 8}) - (def slide-button-container {:z-index 1}) diff --git a/src/status_im/contexts/wallet/bridge/select_asset/style.cljs b/src/status_im/contexts/wallet/bridge/select_asset/style.cljs index 159c316f20..4de398e134 100644 --- a/src/status_im/contexts/wallet/bridge/select_asset/style.cljs +++ b/src/status_im/contexts/wallet/bridge/select_asset/style.cljs @@ -4,7 +4,3 @@ {:padding-horizontal 20 :padding-vertical 8}) -(def list-content-container - {:padding-horizontal 8 - :padding-top 4 - :padding-bottom 8}) diff --git a/src/status_im/contexts/wallet/common/activity_tab/constants.cljs b/src/status_im/contexts/wallet/common/activity_tab/constants.cljs index 1342c24f15..67da50f672 100644 --- a/src/status_im/contexts/wallet/common/activity_tab/constants.cljs +++ b/src/status_im/contexts/wallet/common/activity_tab/constants.cljs @@ -1,16 +1,9 @@ (ns status-im.contexts.wallet.common.activity-tab.constants) -(def ^:const wallet-activity-error-code-success 1) -(def ^:const wallet-activity-error-code-task-canceled 2) -(def ^:const wallet-activity-error-code-failed 3) - (def ^:const wallet-activity-type-send 0) (def ^:const wallet-activity-type-receive 1) -(def ^:const wallet-activity-type-buy 2) (def ^:const wallet-activity-type-swap 3) (def ^:const wallet-activity-type-bridge 4) -(def ^:const wallet-activity-type-contract-deployment 5) -(def ^:const wallet-activity-type-mint 6) (def ^:const wallet-activity-type-approval 7) (def ^:const wallet-activity-status-failed 0) @@ -18,47 +11,11 @@ (def ^:const wallet-activity-status-confirmed 2) (def ^:const wallet-activity-status-finalised 3) -(def ^:const wallet-activity-token-type-native 0) -(def ^:const wallet-activity-token-type-erc-20 1) (def ^:const wallet-activity-token-type-erc-721 2) (def ^:const wallet-activity-token-type-erc-1155 3) -(def ^:const wallet-activity-id->name - {wallet-activity-type-send :send - wallet-activity-type-receive :receive - wallet-activity-type-buy :buy - wallet-activity-type-swap :swap - wallet-activity-type-bridge :bridge - wallet-activity-type-contract-deployment :contract-deployment - wallet-activity-type-mint :mint}) - (def ^:const wallet-activity-status->name {wallet-activity-status-failed :failed wallet-activity-status-pending :pending wallet-activity-status-confirmed :confirmed wallet-activity-status-finalised :finalised}) - -(def ^:const second-tag-prefix - {wallet-activity-type-send :t/from - wallet-activity-type-receive :t/from - wallet-activity-type-buy :t/on - wallet-activity-type-swap :t/to - wallet-activity-type-bridge :t/from - wallet-activity-type-contract-deployment :t/via - wallet-activity-type-mint :t/at}) - -(def ^:const third-tag-prefix - {wallet-activity-type-send :t/to - wallet-activity-type-receive :t/to - wallet-activity-type-buy :t/to - wallet-activity-type-swap :t/on - wallet-activity-type-bridge :t/to - wallet-activity-type-contract-deployment :t/on - wallet-activity-type-mint :t/via}) - -(def ^:const fourth-tag-prefix - {wallet-activity-type-send :t/via - wallet-activity-type-receive :t/via - wallet-activity-type-buy :t/via - wallet-activity-type-swap :t/via - wallet-activity-type-bridge :t/in}) diff --git a/src/status_im/contexts/wallet/common/screen_base/create_or_edit_account/style.cljs b/src/status_im/contexts/wallet/common/screen_base/create_or_edit_account/style.cljs index de8ae531a7..7c86a3539b 100644 --- a/src/status_im/contexts/wallet/common/screen_base/create_or_edit_account/style.cljs +++ b/src/status_im/contexts/wallet/common/screen_base/create_or_edit_account/style.cljs @@ -1,10 +1,4 @@ -(ns status-im.contexts.wallet.common.screen-base.create-or-edit-account.style - (:require [quo.foundations.colors :as colors])) - -(defn root-container - [top] - {:flex 1 - :margin-top top}) +(ns status-im.contexts.wallet.common.screen-base.create-or-edit-account.style) (def account-avatar-container {:padding-horizontal 20 @@ -37,10 +31,3 @@ (def divider-2 {:margin-top 4 :margin-bottom 12}) - -(defn bottom-action - [{:keys [bottom theme]}] - {:padding-horizontal 20 - :padding-vertical 12 - :background-color (colors/theme-colors colors/white colors/neutral-100 theme) - :margin-bottom bottom}) diff --git a/src/status_im/contexts/wallet/common/utils.cljs b/src/status_im/contexts/wallet/common/utils.cljs index 69da2c00c7..496facc42d 100644 --- a/src/status_im/contexts/wallet/common/utils.cljs +++ b/src/status_im/contexts/wallet/common/utils.cljs @@ -1,11 +1,9 @@ (ns status-im.contexts.wallet.common.utils (:require [clojure.string :as string] - [native-module.core :as native-module] [quo.foundations.resources :as resources] [status-im.common.qr-codes.view :as qr-codes] [status-im.constants :as constants] [status-im.contexts.wallet.common.utils.networks :as network-utils] - [utils.hex :as utils.hex] [utils.money :as money] [utils.number :as number] [utils.string])) @@ -414,133 +412,6 @@ (let [priority #(get constants/token-sort-priority (:symbol %) ##Inf)] (sort-by (juxt (comp - :balance) priority) tokens))) -(defn- transaction-data - [{:keys [from-address to-address token-address route data eth-transfer?]}] - (let [{:keys [amount-in gas-amount gas-fees]} route - eip-1559-enabled? (:eip-1559-enabled gas-fees) - {:keys [gas-price max-fee-per-gas-medium - max-priority-fee-per-gas]} gas-fees] - (cond-> {:From from-address - :To (or token-address to-address) - :Gas (money/to-hex gas-amount) - :Value (when eth-transfer? amount-in) - :Nonce nil - :Input "" - :Data (or data "0x")} - eip-1559-enabled? (assoc - :TxType "0x02" - :MaxFeePerGas - (money/to-hex - (money/->wei - :gwei - max-fee-per-gas-medium)) - :MaxPriorityFeePerGas - (money/to-hex - (money/->wei - :gwei - max-priority-fee-per-gas))) - (not eip-1559-enabled?) (assoc :TxType "0x00" - :GasPrice - (money/to-hex - (money/->wei - :gwei - gas-price)))))) - -(defn approval-path - [{:keys [route from-address to-address token-address]}] - (let [{:keys [from]} route - from-chain-id (:chain-id from) - approval-amount-required (:approval-amount-required route) - approval-amount-required-sanitized (-> approval-amount-required - (utils.hex/normalize-hex) - (money/from-hex)) - approval-contract-address (:approval-contract-address route) - data (native-module/encode-function-call - constants/contract-function-signature-erc20-approve - [approval-contract-address - approval-amount-required-sanitized]) - tx-data (transaction-data {:from-address from-address - :to-address to-address - :token-address token-address - :route route - :data data - :eth-transfer? false})] - {:BridgeName constants/bridge-name-transfer - :ChainID from-chain-id - :TransferTx tx-data})) - -(defn transaction-path - [{:keys [from-address to-address token-id-from token-address token-id-to route data - slippage-percentage eth-transfer?]}] - (let [{:keys [bridge-name amount-in from - to]} route - tx-data (transaction-data {:from-address from-address - :to-address to-address - :token-address token-address - :route route - :data data - :eth-transfer? eth-transfer?}) - bonder-fees (-> route :bounder-fees money/to-string) - to-chain-id (:chain-id to) - from-chain-id (:chain-id from)] - (cond-> {:BridgeName bridge-name - :ChainID from-chain-id} - - (= bridge-name constants/bridge-name-erc-721-transfer) - (assoc :ERC721TransferTx - (assoc tx-data - :Recipient to-address - :TokenID token-id-from - :ChainID to-chain-id)) - - (= bridge-name constants/bridge-name-erc-1155-transfer) - (assoc :ERC1155TransferTx - (assoc tx-data - :Recipient to-address - :TokenID token-id-from - :ChainID to-chain-id - :Amount amount-in)) - - (= bridge-name constants/bridge-name-transfer) - (assoc :TransferTx tx-data) - - (= bridge-name constants/bridge-name-hop) - (assoc :HopTx - (assoc tx-data - :ChainID from-chain-id - :ChainIDTo to-chain-id - :Symbol token-id-from - :Recipient to-address - :Amount amount-in - :BonderFee bonder-fees)) - - (= bridge-name constants/bridge-name-paraswap) - (assoc :SwapTx - (assoc tx-data - :ChainID from-chain-id - :ChainIDTo to-chain-id - :TokenIDFrom token-id-from - :TokenIDTo token-id-to - :SlippagePercentage slippage-percentage)) - - (= bridge-name constants/bridge-name-celer) - (assoc :CbridgeTx - (assoc tx-data - :ChainID to-chain-id - :Symbol token-id-from - :Recipient to-address - :Amount amount-in))))) - -(defn multi-transaction-command - [{:keys [from-address to-address from-asset to-asset amount-out multi-transaction-type] - :or {multi-transaction-type constants/multi-transaction-type-unknown}}] - {:fromAddress from-address - :toAddress to-address - :fromAsset from-asset - :toAsset to-asset - :fromAmount amount-out - :type multi-transaction-type}) - (defn sort-tokens-by-name [tokens] (let [priority #(get constants/token-sort-priority (:symbol %) ##Inf)] diff --git a/src/status_im/contexts/wallet/item_types.cljs b/src/status_im/contexts/wallet/item_types.cljs index b7b7502dac..a8424ec59d 100644 --- a/src/status_im/contexts/wallet/item_types.cljs +++ b/src/status_im/contexts/wallet/item_types.cljs @@ -1,13 +1,5 @@ (ns status-im.contexts.wallet.item-types) -(def ^:const no-type 0) -(def ^:const account 1) (def ^:const saved-address 2) (def ^:const address 3) (def ^:const saved-contact-address 4) - -(def ^:const all-supported - #{account - saved-address - address - saved-contact-address}) diff --git a/src/status_im/contexts/wallet/send/select_address/style.cljs b/src/status_im/contexts/wallet/send/select_address/style.cljs index 3cc56aa08d..03445e643f 100644 --- a/src/status_im/contexts/wallet/send/select_address/style.cljs +++ b/src/status_im/contexts/wallet/send/select_address/style.cljs @@ -1,8 +1,5 @@ (ns status-im.contexts.wallet.send.select-address.style) -(def container - {:flex 1}) - (def tabs {:padding-top 20 :padding-bottom 12}) @@ -11,11 +8,6 @@ {:padding-left 20 :padding-right 8}) -(def button - {:justify-self :flex-end - :margin-bottom 20 - :margin-horizontal 20}) - (def network-text-container {:padding-horizontal 12 :padding-top 4}) diff --git a/src/status_im/contexts/wallet/send/select_asset/style.cljs b/src/status_im/contexts/wallet/send/select_asset/style.cljs index 0da8a3d3e5..3c89588f9f 100644 --- a/src/status_im/contexts/wallet/send/select_asset/style.cljs +++ b/src/status_im/contexts/wallet/send/select_asset/style.cljs @@ -6,16 +6,6 @@ {:flex 1 :padding-top (when platform/android? (navigation/status-bar-height))}) -(def title-container - {:margin-horizontal 20 - :margin-vertical 12}) - -(defn empty-container-style - [margin-bottom] - {:justify-content :center - :flex 1 - :margin-bottom margin-bottom}) - (def search-input-container {:padding-horizontal 20 :padding-vertical 8}) diff --git a/src/status_im/contexts/wallet/send/transaction_settings/style.cljs b/src/status_im/contexts/wallet/send/transaction_settings/style.cljs deleted file mode 100644 index 677bca664e..0000000000 --- a/src/status_im/contexts/wallet/send/transaction_settings/style.cljs +++ /dev/null @@ -1,14 +0,0 @@ -(ns status-im.contexts.wallet.send.transaction-settings.style - (:require - [quo.foundations.colors :as colors])) - -(defn prop-text - [theme] - {:color (colors/theme-colors colors/neutral-100 colors/white theme)}) - -(def content-line - {:flex-direction :row - :margin-top 2 - :align-items :center - :column-gap 4 - :justify-content :flex-start}) diff --git a/src/status_im/contexts/wallet/sheets/account_options/style.cljs b/src/status_im/contexts/wallet/sheets/account_options/style.cljs index d97fabcba7..6b6cd276c5 100644 --- a/src/status_im/contexts/wallet/sheets/account_options/style.cljs +++ b/src/status_im/contexts/wallet/sheets/account_options/style.cljs @@ -21,12 +21,6 @@ :left 0 :right 0}) -(def gradient-container - {:position :absolute - :top 0 - :left 0 - :right 0}) - (def divider-label {:margin-top 8}) diff --git a/src/status_im/contexts/wallet/swap/utils.cljs b/src/status_im/contexts/wallet/swap/utils.cljs index 2eb3b36d27..737f69ddd7 100644 --- a/src/status_im/contexts/wallet/swap/utils.cljs +++ b/src/status_im/contexts/wallet/swap/utils.cljs @@ -1,6 +1,5 @@ (ns status-im.contexts.wallet.swap.utils (:require [status-im.constants :as constants] - [status-im.contexts.wallet.common.utils :as utils] [status-im.contexts.wallet.common.utils.networks :as network-utils] [utils.i18n :as i18n])) @@ -54,18 +53,6 @@ token networks)))) -(defn select-default-asset-to-receive - "Selects an asset to receive if it was not provided explicitly. - The principle of how the asset is being selected is simple: we get the - whole list, remove the currently selected `asset-to-pay` from it, and choose - the first one of what's left." - [{:keys [wallet account test-networks-enabled? asset-to-pay]}] - (let [networks (-> (get-in wallet [:networks (if test-networks-enabled? :test :prod)]) - (network-utils/sorted-networks-with-details))] - (->> (utils/tokens-with-balance (:tokens account) networks nil) - (remove #(= (:symbol %) (:symbol asset-to-pay))) - first))) - (defn select-network "Chooses the network. Usually user needs to do the selection first and if the selection was done diff --git a/src/status_im/core.cljs b/src/status_im/core.cljs index a4f94ae769..5e0456bbae 100644 --- a/src/status_im/core.cljs +++ b/src/status_im/core.cljs @@ -42,6 +42,8 @@ [] (boolean (.-HermesInternal js/global))) +;; ignore warning: init used in shadow-cljs.edn +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (defn init [] (status-backend-client/init) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 3b1f2ee3c4..e1eee0fabf 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -8,7 +8,6 @@ status-im.common.image-crop-picker.events [status-im.common.json-rpc.events] status-im.common.log - status-im.common.password-authentication.events status-im.common.peer-stats.events status-im.common.shared-urls.events status-im.common.signals.events diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index 23cde910f0..1d175453fe 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -72,9 +72,3 @@ initial-flags (fn [] (reset! feature-flags-config initial-flags)))) - -(defn alert - [flag action] - (if (enabled? flag) - (action) - (js/alert (str flag " is currently feature flagged off")))) diff --git a/src/status_im/navigation/events.cljs b/src/status_im/navigation/events.cljs index ac0c66312f..bbfa7233d2 100644 --- a/src/status_im/navigation/events.cljs +++ b/src/status_im/navigation/events.cljs @@ -44,7 +44,7 @@ (rf/defn dismiss-modal {:events [:dismiss-modal]} - [{:keys [db]} comp-id] + [_ comp-id] {:dismiss-modal comp-id}) (rf/defn navigate-back @@ -57,7 +57,7 @@ (rf/defn navigate-back-to {:events [:navigate-back-to]} - [{:keys [db]} comp-id] + [_ comp-id] {:navigate-back-to comp-id}) (rf/defn pop-to-root @@ -103,7 +103,7 @@ (rf/defn show-next-bottom-sheet {:events [:show-next-bottom-sheet]} - [{:keys [db] :as cofx}] + [{:keys [db]}] {:show-bottom-sheet {:theme (:theme db)}}) (rf/defn show-bottom-sheet diff --git a/src/status_im/setup/hot_reload.cljs b/src/status_im/setup/hot_reload.cljs index 11f6c64f13..3c66b27649 100644 --- a/src/status_im/setup/hot_reload.cljs +++ b/src/status_im/setup/hot_reload.cljs @@ -13,6 +13,8 @@ (defonce visible (reagent/atom false)) (defonce label (reagent/atom "")) +;; ignore warning: reload used in shadow-cljs.edn +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (defn reload [] (js/setTimeout #(reset! visible false) 500) @@ -25,6 +27,8 @@ (schema.state/clear-errors) (swap! cnt inc)) +;; ignore warning: before-reload used in shadow-cljs.edn +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (defn before-reload [done] (when @reload-interval (js/clearInterval @reload-interval)) @@ -62,6 +66,8 @@ (reset! label "building") (reset! visible true)) +;; ignore warning: build-notify used in shadow-cljs.edn +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} (defn build-notify [{:keys [type info]}] (cond (= :build-start type) diff --git a/src/status_im/subs/chats.cljs b/src/status_im/subs/chats.cljs index 23df8a6b62..725a26b720 100644 --- a/src/status_im/subs/chats.cljs +++ b/src/status_im/subs/chats.cljs @@ -1,7 +1,6 @@ (ns status-im.subs.chats (:require [clojure.string :as string] - [legacy.status-im.group-chats.db :as group-chats.db] [re-frame.core :as re-frame] [status-im.constants :as constants] [status-im.contexts.chat.events :as chat.events] @@ -53,6 +52,11 @@ (fn [[{:keys [chats]}] [_ community-id chat-id]] (get chats (string/replace chat-id community-id "")))) +(defn member? + [public-key {:keys [members contacts users]}] + (let [members-list (into #{} (concat (keys users) contacts (map #(:id %) members)))] + (contains? members-list public-key))) + (re-frame/reg-sub :chats/home-list-chats :<- [:chats/chats] @@ -61,7 +65,7 @@ (fn [[chats active-chats my-public-key]] (reduce #(if-let [item (get chats %2)] (let [group-chat-member? (and (chat.events/group-chat? item) - (group-chats.db/member? my-public-key item))] + (member? my-public-key item))] (conj %1 (assoc item :group-chat-member? @@ -76,12 +80,6 @@ (fn [chats [_ chat-id]] (get chats chat-id))) -(re-frame/reg-sub - :chats/chat-members-by-id - :<- [:chats/chats] - (fn [chats [_ chat-id]] - (get-in chats [chat-id :members]))) - (re-frame/reg-sub :chats/muted (fn [[_ chat-id] _] @@ -137,7 +135,7 @@ (and (chat.events/group-chat? current-chat) - (group-chats.db/member? my-public-key current-chat)) + (member? my-public-key current-chat)) (assoc :able-to-send-message? true :member? true) @@ -291,13 +289,6 @@ (fn [{:keys [metadata]}] (:editing-message metadata))) -(re-frame/reg-sub - :chats/sending-audio - :<- [:chats/current-chat-id] - :<- [:chat/inputs] - (fn [[chat-id inputs]] - (get-in inputs [chat-id :audio]))) - (defn filter-selected-contacts [selected-contacts contacts] (filter #(:added? (contacts %)) selected-contacts)) @@ -309,12 +300,6 @@ (fn [[selected-contacts contacts]] (count (filter-selected-contacts selected-contacts contacts)))) -(re-frame/reg-sub - :selected-participants-count - :<- [:selected-participants] - (fn [selected-participants] - (count selected-participants))) - (defn filter-contacts [selected-contacts active-contacts] (filter #(selected-contacts (:public-key %)) active-contacts)) @@ -332,13 +317,6 @@ (fn [invitations [_ chat-id]] (filter #(= (:chat-id %) chat-id) (vals invitations)))) -(re-frame/reg-sub - :group-chat/pending-invitations-by-chat-id - (fn [[_ chat-id] _] - [(re-frame/subscribe [:group-chat/invitations-by-chat-id chat-id])]) - (fn [[invitations]] - (filter #(= constants/invitation-state-requested (:state %)) invitations))) - (re-frame/reg-sub :chat/mention-suggestions :<- [:chats/current-chat-id] @@ -352,24 +330,6 @@ (fn [previews] (get previews :unfurled))) -(re-frame/reg-sub - :chats/status-link-previews-unfurled - :<- [:chat/status-link-previews] - (fn [previews] - (:unfurled previews))) - -(re-frame/reg-sub - :chats/link-previews? - :<- [:chats/link-previews-unfurled] - (fn [previews] - (boolean (seq previews)))) - -(re-frame/reg-sub - :chats/status-link-previews? - :<- [:chats/status-link-previews-unfurled] - (fn [status-link-previews] - (boolean (seq status-link-previews)))) - (re-frame/reg-sub :camera-roll/total-photos-count-android (fn [{:keys [camera-roll/albums]}] diff --git a/src/status_im/subs/communities.cljs b/src/status_im/subs/communities.cljs index a7f197b2fd..09f3d46f99 100644 --- a/src/status_im/subs/communities.cljs +++ b/src/status_im/subs/communities.cljs @@ -252,20 +252,6 @@ (fn [requests [_ community-id]] (:id (get requests community-id)))) -(re-frame/reg-sub - :communities/has-pending-request-to-join? - (fn [[_ community-id]] - (re-frame/subscribe [:communities/my-pending-request-to-join community-id])) - (fn [request] - (boolean request))) - -(re-frame/reg-sub - :communities/edited-community - :<- [:communities] - :<- [:communities/community-id-input] - (fn [[communities community-id]] - (get communities community-id))) - (re-frame/reg-sub :communities/current-community :<- [:communities] diff --git a/src/status_im/subs/general.cljs b/src/status_im/subs/general.cljs index 50b1b01c52..787edd619c 100644 --- a/src/status_im/subs/general.cljs +++ b/src/status_im/subs/general.cljs @@ -45,12 +45,6 @@ (when-let [network (get networks current-network)] (assoc network :rpc-network? (get-in network [:config :UpstreamConfig :Enabled]))))) -(re-frame/reg-sub - :chain-keyword - :<- [:current-network] - (fn [network] - (chain/network->chain-keyword network))) - (re-frame/reg-sub :chain-name :<- [:current-network] @@ -63,12 +57,6 @@ (fn [network] (chain/network->chain-id network))) -(re-frame/reg-sub - :mainnet? - :<- [:chain-id] - (fn [chain-id] - (= 1 chain-id))) - (re-frame/reg-sub :network-name :<- [:current-network] @@ -98,12 +86,6 @@ (fn [[params view-id-db] [_ view-id]] (get params (or view-id view-id-db)))) -(re-frame/reg-sub - :wallet-legacy/search-recipient-filter - :<- [:ui/search] - (fn [search] - (get search :recipient-filter))) - (defn- node-version [web3-node-version] (or web3-node-version "N/A")) diff --git a/src/status_im/subs/profile.cljs b/src/status_im/subs/profile.cljs index abf449aecd..81fac798f0 100644 --- a/src/status_im/subs/profile.cljs +++ b/src/status_im/subs/profile.cljs @@ -100,18 +100,6 @@ (fn [{:keys [public-key]}] public-key)) -(re-frame/reg-sub - :profile/webview-debug - :<- [:profile/profile] - (fn [{:keys [webview-debug]}] - webview-debug)) - -(re-frame/reg-sub - :profile/light-client-enabled? - :<- [:profile/profile] - (fn [profile] - (get-in profile [:wakuv2-config :LightClient]))) - (re-frame/reg-sub :profile/store-confirmations-enabled? :<- [:profile/profile] @@ -130,18 +118,6 @@ (fn [profile] (:test-networks-enabled? profile))) -(re-frame/reg-sub - :profile/universal-profile-url - :<- [:profile/profile] - (fn [profile] - (:universal-profile-url profile))) - -(re-frame/reg-sub - :profile/peer-syncing-enabled? - :<- [:profile/profile] - (fn [profile] - (:peer-syncing-enabled? profile))) - (re-frame/reg-sub :profile/compressed-key :<- [:profile/profile] @@ -154,18 +130,6 @@ (fn [current-account] (select-keys current-account [:name :preferred-name :public-key :image :images]))) -(re-frame/reg-sub - :multiaccount/preferred-name - :<- [:profile/profile] - (fn [{:keys [preferred-name]}] - preferred-name)) - -(re-frame/reg-sub - :multiaccount/default-account - :<- [:wallet/accounts] - (fn [accounts] - (first accounts))) - (re-frame/reg-sub :sign-in-enabled? :<- [:profile/login] @@ -204,22 +168,6 @@ (fn [[accounts address]] (some #(when (= (:address %) address) %) accounts))) -(re-frame/reg-sub - :account-by-address - :<- [:profile/wallet-accounts] - (fn [accounts [_ address]] - (when (string? address) - (some #(when (= (string/lower-case (:address %)) - (string/lower-case address)) - %) - accounts)))) - -(re-frame/reg-sub - :accounts-without-watch-only - :<- [:profile/wallet-accounts] - (fn [accounts] - (filter #(not= (:type %) :watch) accounts))) - (re-frame/reg-sub :visible-accounts-without-watch-only :<- [:profile/wallet-accounts] @@ -270,11 +218,6 @@ (fn [{:keys [preview-privacy?]}] (boolean preview-privacy?))) -(re-frame/reg-sub :profile/installation-id - :<- [:profile/profile] - (fn [{:keys [installation-id]}] - installation-id)) - (defn- replace-multiaccount-image-uri [profile ens-names port font-file avatar-opts theme] (let [{:keys [key-uid ens-name? images @@ -343,35 +286,9 @@ (fn [[{:keys [key-uid]} profiles]] (get profiles key-uid))) -(re-frame/reg-sub - :profile/login-processing - :<- [:profile/login] - (fn [{:keys [processing]}] - processing)) - (re-frame/reg-sub :profile/recovery-phrase-backed-up? :<- [:profile/profile] (fn [profile] (not (boolean (seq (:mnemonic profile)))))) -;; LINK PREVIEW -;; ======================================================================================================== - -(re-frame/reg-sub - :link-preview/cache - :<- [:profile/profile] - (fn [multiaccount [_ link]] - (get-in multiaccount [:link-previews-cache link]))) - -(re-frame/reg-sub - :link-preview/enabled-sites - :<- [:profile/profile] - (fn [multiaccount] - (get multiaccount :link-previews-enabled-sites))) - -(re-frame/reg-sub - :link-preview/link-preview-request-enabled - :<- [:profile/profile] - (fn [multiaccount] - (get multiaccount :link-preview-request-enabled))) diff --git a/src/status_im/subs/wallet/buy.cljs b/src/status_im/subs/wallet/buy.cljs index 5adf82ba00..93b794ced3 100644 --- a/src/status_im/subs/wallet/buy.cljs +++ b/src/status_im/subs/wallet/buy.cljs @@ -20,13 +20,3 @@ :wallet/wallet-buy-crypto-provider :<- [:wallet/wallet-buy-crypto] :-> :provider) - -(rf/reg-sub - :wallet/wallet-buy-crypto-recurrent? - :<- [:wallet/wallet-buy-crypto] - :-> :recurrent?) - -(rf/reg-sub - :wallet/wallet-buy-crypto-network - :<- [:wallet/wallet-buy-crypto] - :-> :network) diff --git a/src/status_im/subs/wallet/collectibles.cljs b/src/status_im/subs/wallet/collectibles.cljs index dcc6670115..11178d09c9 100644 --- a/src/status_im/subs/wallet/collectibles.cljs +++ b/src/status_im/subs/wallet/collectibles.cljs @@ -116,15 +116,6 @@ (fn [collectible] (:gradient-color collectible :gradient-1))) -(re-frame/reg-sub - :wallet/collectible-details-owner - :<- [:wallet/accounts] - (fn [accounts [_ collectible]] - (let [owner-address (-> collectible :ownership first :address)] - (some #(when (= (:address %) owner-address) - %) - accounts)))) - (re-frame/reg-sub :wallet/total-owned-collectible :<- [:wallet/accounts-without-watched-accounts] diff --git a/src/status_im/subs/wallet/dapps/proposals_test.cljs b/src/status_im/subs/wallet/dapps/proposals_test.cljs index 374cfcf6ff..51c9301e2c 100644 --- a/src/status_im/subs/wallet/dapps/proposals_test.cljs +++ b/src/status_im/subs/wallet/dapps/proposals_test.cljs @@ -42,41 +42,6 @@ :origin "https://lab.web3modal.com" :isScam false}}}}) -(def sample-session-empty-name - {:session-proposal - {:id 1716798889093634 - :params - {:id 1716798889093634 - :pairingTopic "9b18e1348817a548bbc97f9b4a09278f4fdf7c984e4a61ddf461bd1f57710d33" - :expiryTimestamp 1716799189 - :requiredNamespaces {} - :optionalNamespaces {:eip155 - {:chains ["eip155:1" "eip155:42161" "eip155:137" "eip155:43114" "eip155:56" - "eip155:10" "eip155:100" - "eip155:324" "eip155:7777777" "eip155:8453" "eip155:42220" - "eip155:1313161554" "eip155:11155111" "eip155:11155420"] - :methods ["personal_sign" "eth_accounts" "eth_requestAccounts" - "eth_sendRawTransaction" "eth_sendTransaction" - "eth_sign" "eth_signTransaction" "eth_signTypedData" - "eth_signTypedData_v3" "eth_signTypedData_v4" - "wallet_addEthereumChain" "wallet_getCallsStatus" - "wallet_getCapabilities" "wallet_getPermissions" - "wallet_registerOnboarding" "wallet_requestPermissions" - "wallet_scanQRCode" "wallet_sendCalls" - "wallet_showCallsStatus" "wallet_switchEthereumChain" - "wallet_watchAsset"] - :events ["chainChanged" "accountsChanged"]}} - :relays [{:protocol "irn"}] - :proposer {:publicKey "cddea055b8974d93380e6c7e72110145506c06524047866f8034f3db0990137a" - :metadata {:name "" - :description "Web3Modal Laboratory" - :url "https://lab.web3modal.com" - :icons ["https://avatars.githubusercontent.com/u/37784886"]}}} - :verifyContext {:verified {:verifyUrl "https://verify.walletconnect.com" - :validation "VALID" - :origin "https://lab.web3modal.com" - :isScam false}}}}) - (h/deftest-sub :wallet-connect/session-proposer [sub-name] (testing "Return the session proposer public key and metadata" diff --git a/src/status_im/subs/wallet/send.cljs b/src/status_im/subs/wallet/send.cljs index 9ca943136d..69abd6ab28 100644 --- a/src/status_im/subs/wallet/send.cljs +++ b/src/status_im/subs/wallet/send.cljs @@ -29,11 +29,6 @@ :<- [:wallet/wallet-send] :-> :route) -(rf/reg-sub - :wallet/send-token - :<- [:wallet/wallet-send] - :-> :token) - (rf/reg-sub :wallet/send-token-symbol :<- [:wallet/wallet-send] @@ -44,11 +39,6 @@ :<- [:wallet/wallet-send] :-> :transaction-ids) -(rf/reg-sub - :wallet/just-completed-transaction - :<- [:wallet/wallet-send] - :-> :just-completed-transaction?) - (rf/reg-sub :wallet/send-amount :<- [:wallet/wallet-send] @@ -91,11 +81,6 @@ recipient))) (distinct))))) -(rf/reg-sub - :wallet/send-token-not-supported-in-receiver-networks? - :<- [:wallet/wallet-send] - :-> :token-not-supported-in-receiver-networks?) - (rf/reg-sub :wallet/bridge-from-networks :<- [:wallet/wallet-send] diff --git a/src/test_helpers/component.cljs b/src/test_helpers/component.cljs index 050f37b52d..7abe97c700 100644 --- a/src/test_helpers/component.cljs +++ b/src/test_helpers/component.cljs @@ -58,19 +58,6 @@ ([component theme] (rtl/render (reagent/as-element [quo.theme/provider theme component])))) -(def unmount - "Unmount rendered component. - Sometimes useful to be called in a REPL, but unnecessary when rendering - components with Jest, since components are automatically unmounted after each - test." - (with-node-or-screen :unmount)) - -(def debug - "Pretty-print to STDOUT the current component tree." - (with-node-or-screen :debug)) - -(def within rtl/within) - (defn wait-for ([condition] (wait-for condition {})) ([condition options] @@ -93,11 +80,8 @@ ;; For this reason, find-* functions only work within the Jest runtime, hence ;; using the wrapper function `with-node-or-screen` is unnecessary. -(def find-by-text (comp rtl/screen.findByText name)) - ;;; Queries that work with a REPL and with Jest -(def get-all-by-text (with-node-or-screen :get-all-by-text)) (def get-by-text (with-node-or-screen :get-by-text)) (def query-all-by-text (with-node-or-screen :query-all-by-text)) (def query-by-text (with-node-or-screen :query-by-text)) @@ -108,37 +92,7 @@ (def query-all-by-label-text (with-node-or-screen :query-all-by-label-text)) (def query-by-label-text (with-node-or-screen :query-by-label-text)) -(def get-all-by-display-value (with-node-or-screen :get-all-by-display-value)) -(def get-by-display-value (with-node-or-screen :get-by-display-value)) -(def query-all-by-display-value (with-node-or-screen :query-all-by-display-value)) -(def query-by-display-value (with-node-or-screen :query-by-display-value)) - -(def get-all-by-placeholder-text (with-node-or-screen :get-all-by-placeholder-text)) -(def get-by-placeholder-text (with-node-or-screen :get-by-placeholder-text)) -(def query-all-by-placeholder-text (with-node-or-screen :query-all-by-placeholder-text)) -(def query-by-placeholder-text (with-node-or-screen :query-by-placeholder-text)) - -(def get-all-by-role (with-node-or-screen :get-all-by-role)) -(def get-by-role (with-node-or-screen :get-by-role)) -(def query-all-by-role (with-node-or-screen :query-all-by-role)) -(def query-by-role (with-node-or-screen :query-by-role)) - -(def get-all-by-test-id (with-node-or-screen :get-all-by-test-id)) (def get-by-test-id (with-node-or-screen :get-by-test-id)) -(def query-all-by-test-id (with-node-or-screen :query-all-by-test-id)) -(def query-by-test-id (with-node-or-screen :query-by-test-id)) - -(defn get-all-by-translation-text - ([translation] - (get-all-by-translation-text rtl/screen translation nil)) - ([translation translation-opts] - (get-all-by-translation-text rtl/screen translation translation-opts)) - ([^js node translation translation-opts & args] - (apply (with-node-or-screen :get-all-by-text) - node - (i18n/label translation translation-opts) - args))) - (defn get-by-translation-text ([translation] (get-by-translation-text rtl/screen translation nil)) @@ -161,17 +115,6 @@ (i18n/label translation translation-opts) args))) -(defn query-all-by-translation-text - ([translation] - (query-all-by-translation-text rtl/screen translation nil)) - ([translation translation-opts] - (query-all-by-translation-text rtl/screen translation translation-opts)) - ([^js node translation translation-opts & args] - (apply (with-node-or-screen :query-all-by-text) - node - (i18n/label translation translation-opts) - args))) - ;;; Jest utilities (def ^:private jest? diff --git a/src/test_helpers/integration.cljs b/src/test_helpers/integration.cljs index 646db61716..9aad647e0e 100644 --- a/src/test_helpers/integration.cljs +++ b/src/test_helpers/integration.cljs @@ -6,7 +6,6 @@ [native-module.core :as native-module] [promesa.core :as promesa] [re-frame.core :as rf] - [re-frame.interop :as rf.interop] status-im.events status-im.navigation.core status-im.subs.root @@ -43,10 +42,6 @@ sleepy." (* 60 1000)) -(defn initialize-app! - [] - (rf/dispatch [:app-started])) - (defn create-multiaccount! [] (rf/dispatch [:profile.create/create-and-login @@ -77,21 +72,6 @@ [] (is (wallet-loaded?))) -(defn assert-community-created - [] - (is (= @(rf/subscribe [:communities/create]) constants/community))) - -(defn create-new-account! - [] - (rf/dispatch-sync [:wallet-legacy.accounts/start-adding-new-account {:type :generate}]) - (rf/dispatch-sync [:set-in [:add-account :account :name] constants/account-name]) - (rf/dispatch [:wallet-legacy.accounts/add-new-account (native-module/sha3 constants/password)])) - -(defn assert-new-account-created - [] - (is (true? (some #(= (:name %) constants/account-name) - @(rf/subscribe [:profile/wallet-accounts]))))) - (defn logout [] (log/info (str "==== before dispatch logout ====")) @@ -291,23 +271,4 @@ (done))))}) ([] (fixture-session [:new-account]))) -(defn fixture-silence-reframe - "Fixture to disable most re-frame messages. - Avoid using this fixture for non-dev purposes because in the CI output it's - desirable to have more data to debug, not less. - - Example messages disabled: - - - Warning about subscriptions being used in non-reactive contexts. - - Debug message \"Handling re-frame event: XYZ\". - - Usage: - - (use-fixtures :once (h/fixture-silence-re-frame)) - " - [] - {:before (fn [] - (set! rf.interop/debug-enabled? false)) - :after (fn [] - (set! rf.interop/debug-enabled? true))}) diff --git a/src/test_helpers/matchers.cljs b/src/test_helpers/matchers.cljs index 313424a0e6..7144ea3d6f 100644 --- a/src/test_helpers/matchers.cljs +++ b/src/test_helpers/matchers.cljs @@ -2,23 +2,14 @@ "Some vars in this namespace solely exist to support the matchers.clj file." (:require-macros test-helpers.matchers) (:require - [cljs.test :as t] [matcher-combinators.parser] [matcher-combinators.printer :as printer] [matcher-combinators.result :as result])) (defrecord Mismatch [summary match-result]) -(defn tagged-for-pretty-printing - [actual-summary result] - (->Mismatch actual-summary result)) - (extend-protocol IPrintWithWriter Mismatch (-pr-writer [this writer _] (-write writer (printer/as-string (-> this :match-result ::result/value))))) -(defn with-file+line-info - [report] - (merge (t/file-and-line (js/Error.) 4) - report)) diff --git a/src/test_helpers/unit.clj b/src/test_helpers/unit.clj index 60472f78a8..2fe0438c5f 100644 --- a/src/test_helpers/unit.clj +++ b/src/test_helpers/unit.clj @@ -2,7 +2,7 @@ (:require [clojure.spec.alpha :as s] [clojure.string :as string] - [clojure.walk :as walk])) + [clojure.walk])) (defn- keyword->test-name [sub-name] diff --git a/src/test_helpers/unit.cljs b/src/test_helpers/unit.cljs index c6081afe17..5157b769ea 100644 --- a/src/test_helpers/unit.cljs +++ b/src/test_helpers/unit.cljs @@ -24,17 +24,6 @@ [] @rf-db/app-db) -(defn register-helper-events - "Register utility events for testing. - - Note that re-frame-test removes such events if they're declared in the scope - of the macro `day8.re-frame.test/run-test-sync` (or the async variant)." - [] - (rf/reg-event-db - :test/assoc-in - (fn [app-db [_ path value]] - (assoc-in app-db path value)))) - (defn spy-event-fx "Re-register event effect using id `id`, but conj to `state` the event arguments before calling the original handler. diff --git a/src/tests/contract_test/wallet_test.cljs b/src/tests/contract_test/wallet_test.cljs index 73efc1b401..c67a3e0ae0 100644 --- a/src/tests/contract_test/wallet_test.cljs +++ b/src/tests/contract_test/wallet_test.cljs @@ -108,10 +108,6 @@ ens-address)] (assert-address-details response))))) -(defn assert-search-ens - [expected-result actual-result] - (is (= expected-result actual-result))) - #_(deftest wallet-search-ens-test (h/test-async :wallet/search-ens (fn [] diff --git a/src/tests/integration_test/constants.cljs b/src/tests/integration_test/constants.cljs index 822e0b5980..7142f8760c 100644 --- a/src/tests/integration_test/constants.cljs +++ b/src/tests/integration_test/constants.cljs @@ -2,8 +2,6 @@ (def password "testabc") -(def community {:membership 1 :name "foo" :description "bar"}) - (def account-name "account-abc") (def derivation-path "m/43'/60'/1581'/0'/0") diff --git a/src/utils/address.cljs b/src/utils/address.cljs index 14d7a0957c..b1ddc381ac 100644 --- a/src/utils/address.cljs +++ b/src/utils/address.cljs @@ -2,7 +2,6 @@ (:require [clojure.string :as string] [native-module.core :as native-module] - [utils.ethereum.eip.eip55 :as eip55] [utils.ethereum.eip.eip681 :as eip681])) @@ -20,11 +19,6 @@ hex (str hex-prefix hex)))) -(defn naked-address - [s] - (when s - (string/replace s hex-prefix ""))) - (defn address? [address] (native-module/address? address)) @@ -43,11 +37,6 @@ (when value (str (subs value 0 6) "\u2026" (subs value (- (count value) 3) (count value))))) -(defn get-shortened-checksum-address - [address] - (when address - (get-shortened-key (eip55/address->checksum (normalized-hex address))))) - (defn get-abbreviated-profile-url "The goal here is to generate a string that begins with status.app/u/ joined with the 1st 5 characters of the encoded data followed by an ellipsis diff --git a/src/utils/collection.cljs b/src/utils/collection.cljs index d7c34186a5..4e556d0d25 100644 --- a/src/utils/collection.cljs +++ b/src/utils/collection.cljs @@ -20,8 +20,3 @@ [k coll] (let [groups (group-by k coll)] (map #(first (groups %)) (distinct (map k coll))))) - -(defn map-keys - [f m] - (->> (map (fn [[k v]] [(f k) v]) m) - (into {}))) diff --git a/src/utils/collection_test.cljs b/src/utils/collection_test.cljs new file mode 100644 index 0000000000..8d7c60b6a4 --- /dev/null +++ b/src/utils/collection_test.cljs @@ -0,0 +1,12 @@ +(ns utils.collection-test + (:require + [cljs.test :refer-macros [deftest is]] + [utils.collection :as c])) + +(deftest first-index-test + (is (= 2 + (c/first-index (partial = :test) + '(:a :b :test :c :test)))) + (is (= nil + (c/first-index (partial = :test) + '(:a :b :c))))) diff --git a/src/utils/datetime.cljs b/src/utils/datetime.cljs index ffca333637..e82976d270 100644 --- a/src/utils/datetime.cljs +++ b/src/utils/datetime.cljs @@ -82,7 +82,6 @@ "h:mm:ss a")) ;;;; Date formats -(defn- short-date-format [_] "dd MMM") (defn- short-date-format-with-time [_] "dd MMM h:mm a") (defn- datetime-within-one-week-format @@ -118,7 +117,6 @@ (def date-time-fmt (get-formatter-fn medium-date-time-format)) (def date-fmt (get-formatter-fn medium-date-format)) (def time-fmt (get-formatter-fn short-time-format)) -(def short-date-fmt (get-formatter-fn short-date-format)) (def short-date-with-time-fmt (get-formatter-fn short-date-format-with-time)) (def datetime-within-one-week-fmt (get-formatter-fn datetime-within-one-week-format)) @@ -223,13 +221,6 @@ timestamp->relative full-date->short-date)) -(defn timestamp->mini-date - [ms] - (.format ^js (short-date-fmt) - (-> ms - t.coerce/from-long - (t/plus time-zone-offset)))) - (defn timestamp->time [ms] (.format ^js (time-fmt) @@ -237,13 +228,6 @@ t.coerce/from-long (t/plus time-zone-offset)))) -(defn timestamp->date-key - [ms] - (keyword (t.format/unparse (t.format/formatter "YYYYMMDD") - (-> ms - t.coerce/from-long - (t/plus time-zone-offset))))) - (defn timestamp->long-date [ms] (.format ^js (date-time-fmt) @@ -251,15 +235,6 @@ t.coerce/from-long (t/plus time-zone-offset)))) -(defn format-time-ago - [diff unit] - (let [name (i18n/label-pluralize diff (:name unit))] - (if (= :t/datetime-second-short (:name unit)) - (i18n/label :t/now) - (i18n/label :t/datetime-ago-format-short - {:ago (i18n/label :t/datetime-ago) - :number diff - :time-intervals name})))) (defn seconds-ago [date-time] (let [time-now (t/now)] @@ -267,17 +242,6 @@ (t/in-seconds (t/interval date-time time-now)) 0))) -(defn time-ago - [date-time] - (let [diff (seconds-ago date-time) - unit (first (drop-while #(and (>= diff (:limit %)) - (:limit %)) - default-units))] - (-> (/ diff (:in-second unit)) - Math/floor - int - (format-time-ago unit)))) - (defn time-ago-long ([date-time units] (let [time-ago-seconds (seconds-ago date-time) diff --git a/src/utils/datetime_test.cljs b/src/utils/datetime_test.cljs index 07f0b99bd5..78021bf103 100644 --- a/src/utils/datetime_test.cljs +++ b/src/utils/datetime_test.cljs @@ -24,8 +24,6 @@ (def epoch 0) ;; 1970-01-03 00:00:00 UTC (def epoch-plus-3d 172800000) -(def mock-current-time-epoch 1655731506000) - (deftest is-24-hour-locale-en-test (is (false? (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "en"))))) diff --git a/src/utils/ens/core.cljs b/src/utils/ens/core.cljs index 9e8a12a51f..a97d2889fe 100644 --- a/src/utils/ens/core.cljs +++ b/src/utils/ens/core.cljs @@ -9,15 +9,6 @@ (def default-address "0x0000000000000000000000000000000000000000") (def default-key "0x0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") -(def default-hash "0x0000000000000000000000000000000000000000000000000000000000000000") - -(defn valid-eth-name-prefix? - [prefix] - (not - (or (string/blank? prefix) - (string/ends-with? prefix ".") - (string/includes? prefix "..")))) - (defn is-valid-eth-name? [ens-name] (and ens-name diff --git a/src/utils/ethereum/chain.cljs b/src/utils/ethereum/chain.cljs index ae3bdc8de2..05eafb0c60 100644 --- a/src/utils/ethereum/chain.cljs +++ b/src/utils/ethereum/chain.cljs @@ -20,27 +20,10 @@ (or (some #(when (= i (:id (val %))) (key %)) chains) :custom)) -(defn chain-id->chain-name - [i] - (or (some #(when (= i (:id (val %))) (:name (val %))) chains) - :custom)) - (defn chain-keyword->chain-id [k] (get-in chains [k :id])) -(defn chain-keyword->snt-symbol - [k] - (case k - :mainnet :SNT - :STT)) - -(defn testnet? - [id] - (contains? #{(chain-keyword->chain-id :sepolia) - (chain-keyword->chain-id :bsc-testnet)} - id)) - (defn network->chain-id [network] (get-in network [:config :NetworkId])) diff --git a/src/utils/ethereum/eip/eip681_test.cljs b/src/utils/ethereum/eip/eip681_test.cljs index 832247c3f7..6b53a00b01 100644 --- a/src/utils/ethereum/eip/eip681_test.cljs +++ b/src/utils/ethereum/eip/eip681_test.cljs @@ -105,19 +105,6 @@ :function-name "transfer" :function-arguments {:address "gimme.eth" :uint256 "1"}}))) -(def all-tokens - {:mainnet {"0x744d70fdbe2ba4cf95131626614a1763df805b9e" {:address - "0x744d70fdbe2ba4cf95131626614a1763df805b9e" - :name "Status Network Token" - :symbol :SNT - :decimals 18}} - :sepolia {"0xE452027cdEF746c7Cd3DB31CB700428b16cD8E51" - {:address - "0xE452027cdEF746c7Cd3DB31CB700428b16cD8E51" - :name "Status Test Token" - :symbol :STT - :decimals 18}}}) - (deftest generate-uri-test (is (= nil (eip681/generate-uri nil nil))) (is (= "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" diff --git a/src/utils/i18n.cljs b/src/utils/i18n.cljs index 479e59bb85..f2e1164339 100644 --- a/src/utils/i18n.cljs +++ b/src/utils/i18n.cljs @@ -1,8 +1,7 @@ (ns utils.i18n (:require ["i18n-js" :as i18n] - [clojure.string :as string] - [utils.i18n-goog :as i18n-goog])) + [clojure.string :as string])) (defn setup [default-device-language translations-by-locale] @@ -69,5 +68,3 @@ (def locale (.-locale i18n)) - -(def format-currency i18n-goog/format-currency) diff --git a/src/utils/i18n_goog.cljs b/src/utils/i18n_goog.cljs index 57014dae8e..0df05a8025 100644 --- a/src/utils/i18n_goog.cljs +++ b/src/utils/i18n_goog.cljs @@ -366,79 +366,3 @@ [locale format-fn] (let [locsym (locale-symbols locale)] (goog.i18n.DateTimeFormat. (format-fn locsym) locsym))) - -(defn format-currency - "Formats an amount of a currency based on the currency pattern - If currency-symbol? is false, the currency symbol is excluded from the - formatting" - [value currency-code] - (.addTier2Support ^js goog.i18n.currency) - (let [currency-code-to-nfs-map {"ZAR" ^js goog.i18n.NumberFormatSymbols_af - "ETB" ^js goog.i18n.NumberFormatSymbols_am - "EGP" ^js goog.i18n.NumberFormatSymbols_ar - "DZD" ^js goog.i18n.NumberFormatSymbols_ar_DZ - "AZN" ^js goog.i18n.NumberFormatSymbols_az - "BYN" ^js goog.i18n.NumberFormatSymbols_be - "BGN" ^js goog.i18n.NumberFormatSymbols_bg - "BDT" ^js goog.i18n.NumberFormatSymbols_bn - "EUR" ^js goog.i18n.NumberFormatSymbols_br - "BAM" ^js goog.i18n.NumberFormatSymbols_bs - "USD" ^js goog.i18n.NumberFormatSymbols_en - "CZK" ^js goog.i18n.NumberFormatSymbols_cs - "GBP" ^js goog.i18n.NumberFormatSymbols_cy - "DKK" ^js goog.i18n.NumberFormatSymbols_da - "CHF" ^js goog.i18n.NumberFormatSymbols_de_CH - "AUD" ^js goog.i18n.NumberFormatSymbols_en_AU - "CAD" ^js goog.i18n.NumberFormatSymbols_en_CA - "INR" ^js goog.i18n.NumberFormatSymbols_en_IN - "SGD" ^js goog.i18n.NumberFormatSymbols_en_SG - "MXN" ^js goog.i18n.NumberFormatSymbols_es_419 - "IRR" ^js goog.i18n.NumberFormatSymbols_fa - "PHP" ^js goog.i18n.NumberFormatSymbols_fil - "ILS" ^js goog.i18n.NumberFormatSymbols_he - "HRK" ^js goog.i18n.NumberFormatSymbols_hr - "HUF" ^js goog.i18n.NumberFormatSymbols_hu - "AMD" ^js goog.i18n.NumberFormatSymbols_hy - "IDR" ^js goog.i18n.NumberFormatSymbols_id - "ISK" ^js goog.i18n.NumberFormatSymbols_is - "JPY" ^js goog.i18n.NumberFormatSymbols_ja - "GEL" ^js goog.i18n.NumberFormatSymbols_ka - "KZT" ^js goog.i18n.NumberFormatSymbols_kk - "KHR" ^js goog.i18n.NumberFormatSymbols_km - "KRW" ^js goog.i18n.NumberFormatSymbols_ko - "KGS" ^js goog.i18n.NumberFormatSymbols_ky - "CDF" ^js goog.i18n.NumberFormatSymbols_ln - "LAK" ^js goog.i18n.NumberFormatSymbols_lo - "MKD" ^js goog.i18n.NumberFormatSymbols_mk - "MNT" ^js goog.i18n.NumberFormatSymbols_mn - "MDL" ^js goog.i18n.NumberFormatSymbols_mo - "MYR" ^js goog.i18n.NumberFormatSymbols_ms - "MMK" ^js goog.i18n.NumberFormatSymbols_my - "NOK" ^js goog.i18n.NumberFormatSymbols_nb - "NPR" ^js goog.i18n.NumberFormatSymbols_ne - "PLN" ^js goog.i18n.NumberFormatSymbols_pl - "BRL" ^js goog.i18n.NumberFormatSymbols_pt - "RON" ^js goog.i18n.NumberFormatSymbols_ro - "RUB" ^js goog.i18n.NumberFormatSymbols_ru - "RSD" ^js goog.i18n.NumberFormatSymbols_sh - "LKR" ^js goog.i18n.NumberFormatSymbols_si - "ALL" ^js goog.i18n.NumberFormatSymbols_sq - "SEK" ^js goog.i18n.NumberFormatSymbols_sv - "TZS" ^js goog.i18n.NumberFormatSymbols_sw - "THB" ^js goog.i18n.NumberFormatSymbols_th - "TRY" ^js goog.i18n.NumberFormatSymbols_tr - "UAH" ^js goog.i18n.NumberFormatSymbols_uk - "PKR" ^js goog.i18n.NumberFormatSymbols_ur - "UZS" ^js goog.i18n.NumberFormatSymbols_uz - "VND" ^js goog.i18n.NumberFormatSymbols_vi - "CNY" ^js goog.i18n.NumberFormatSymbols_zh - "HKD" ^js goog.i18n.NumberFormatSymbols_zh_HK - "TWD" ^js goog.i18n.NumberFormatSymbols_zh_TW} - nfs (or (get currency-code-to-nfs-map currency-code) - ^js goog.i18n.NumberFormatSymbols_en)] - (.format - ^js - (new ^js goog.i18n.NumberFormat - (let [pattern (.-CURRENCY_PATTERN ^js nfs)] - (string/replace pattern #"\s*ยค\s*" ""))) - value))) diff --git a/src/utils/money.cljs b/src/utils/money.cljs index 033ff7d370..5351ad31b8 100644 --- a/src/utils/money.cljs +++ b/src/utils/money.cljs @@ -134,11 +134,6 @@ (when bn (.toFixed bn b)))) -(defn to-number - [^js bn] - (when (bignumber? bn) - (.toNumber bn))) - (defn to-string ([^js bn] (to-string bn 10)) @@ -156,11 +151,6 @@ (new BigNumber hex-str 16) (catch :default _ nil))) -(defn wei->str - ([unit n display-unit] - (str (to-fixed (wei-> unit n)) " " display-unit)) - ([unit n] (wei->str unit n (string/upper-case (name unit))))) - (defn wei->ether [n] (wei-> :eth n)) @@ -173,64 +163,12 @@ [n] (->wei :gwei n)) -(defn ether->wei - [^js bn] - (when (bignumber? bn) - (.times bn ^js (bignumber 1e18)))) - (defn token->unit [n decimals] (when-let [^js bn (bignumber n)] (when-let [d (from-decimal decimals)] (.dividedBy bn ^js (bignumber d))))) -(defn unit->token - [n decimals] - (when-let [^js bn (bignumber n)] - (when-let [d (from-decimal decimals)] - (.times bn ^js (bignumber d))))) - -;;NOTE(goranjovic) - We have two basic representations of values that refer to cryptocurrency amounts: -;;formatted and -;; internal. Formatted representation is the one we show on screens and include in reports, whereas -;; internal -;; representation is the one that we pass on to ethereum network for execution, transfer, etc. -;; The difference between the two depends on the number of decimals, i.e. internal representation is -;; expressed in terms -;; of a whole number of smallest divisible parts of the formatted value. -;; -;; E.g. for Ether, it's smallest part is wei or 10^(-18) of 1 ether -;; for arbitrary ERC20 token the smallest part is 10^(-decimals) of 1 token -;; -;; Different tokens can have different number of allowed decimals, so it's necessary to include the -;; decimals parameter -;; to get the amount scale right. - -(defn formatted->internal - [n sym decimals] - (if (= :ETH sym) - (ether->wei n) - (unit->token n decimals))) - -(defn internal->formatted - [n sym decimals] - (if (= :ETH sym) - (wei->ether n) - (token->unit n decimals))) - -(defn fee-value - [gas gas-price] - (.times ^js (bignumber gas) ^js (bignumber gas-price))) - -(defn percent-change - [from to] - (let [^js bnf (bignumber from) - ^js bnt (bignumber to)] - (when (and bnf bnt) - (-> ^js (.dividedBy bnf bnt) - ^js (.minus 1) - ^js (.times 100))))) - (defn with-precision [n decimals] (when-let [^js bn (bignumber n)] @@ -256,15 +194,6 @@ (when (and amount balance) (greater-than-or-equals balance amount))) -(defn fiat-amount-value - [amount-str from to prices] - (-> amount-str - (js/parseFloat) - bignumber - (crypto->fiat (get-in prices [from to] ^js (bignumber 0))) - (with-precision 2) - str)) - (defn- add* [bn1 n2] (.add ^js bn1 n2)) @@ -281,10 +210,6 @@ "Multiply with defaults, this version is able to receive `nil` and takes them as 0." (fnil mul* (bignumber 0) (bignumber 0))) -(defn mul-and-round - [bn1 bn2] - (.round (.mul ^js bn1 bn2) 0)) - (defn- div* [bn1 bn2] (.dividedBy ^js bn1 bn2)) @@ -293,10 +218,6 @@ "Divides with defaults, this version is able to receive `nil` and takes them as 0." (fnil div* (bignumber 0) (bignumber 1))) -(defn div-and-round - [bn1 bn2] - (.round (.dividedBy ^js bn1 bn2) 0)) - (defn fiat->crypto [crypto fiat-price] (when-let [crypto-bn (bignumber crypto)] diff --git a/src/utils/network/core.cljs b/src/utils/network/core.cljs index f8cdaeb17f..0c85eddee9 100644 --- a/src/utils/network/core.cljs +++ b/src/utils/network/core.cljs @@ -40,8 +40,3 @@ vals (map :error) (not-any? identity))) - -(defn chain-id-available? - [current-networks network] - (let [chain-id (get-in network [:config :NetworkId])] - (every? #(not= chain-id (get-in % [1 :config :NetworkId])) current-networks))) diff --git a/src/utils/number.cljs b/src/utils/number.cljs index 1499e74fb6..14df6d1daf 100644 --- a/src/utils/number.cljs +++ b/src/utils/number.cljs @@ -2,7 +2,6 @@ (:require [clojure.string :as string] [native-module.core :as native-module] [utils.hex :as utils.hex] - [utils.money :as utils.money] [utils.money :as money])) (defn naive-round @@ -80,7 +79,7 @@ (defn to-fixed [num decimals] (-> num - (utils.money/to-fixed decimals) + (money/to-fixed decimals) remove-trailing-zeroes)) (defn small-number-threshold diff --git a/src/utils/re_frame.clj b/src/utils/re_frame.clj index 852a22a932..8c255c81d1 100644 --- a/src/utils/re_frame.clj +++ b/src/utils/re_frame.clj @@ -28,9 +28,9 @@ event keywords under which the function will be registered - TODO: add suport for `prepost-map?` (don't forget to add it to arglist) - TODO: add validation of macro parameters" - {:arglists '([name doc-string? attr-map? [params*] body]) - :deprecated true - :superseded-by "utils.re-frame/reg-event-fx"} + #_{:arglists '([name doc-string? attr-map? [params*] body]) + :deprecated true + :superseded-by "utils.re-frame/reg-event-fx"} [name & fdecl] (let [m (if (string? (first fdecl)) {:doc (first fdecl)} diff --git a/src/utils/re_frame_test.cljs b/src/utils/re_frame_test.cljs index 57f1f93a35..df9d8fedd0 100644 --- a/src/utils/re_frame_test.cljs +++ b/src/utils/re_frame_test.cljs @@ -15,7 +15,7 @@ (rf/defn hello3 {:doc "lol lazy function does nothing"} - [{:keys [db]} b] + [_ _] (identity nil)) (rf/defn hello4 @@ -27,13 +27,13 @@ (rf/defn hello5 "lol lazy function does nothing" {:events [:test]} - [{:keys [db]} b] + [_ _] (identity nil)) (rf/defn hello6 "lol lazy function does nothing" {:events [:test2]} - [{:keys [db]} {:keys [a b]}] + [_ {:keys [a b]}] {:db {:a (identity a) :b b}}) diff --git a/src/utils/string.cljs b/src/utils/string.cljs index d09833b393..fc97ceb479 100644 --- a/src/utils/string.cljs +++ b/src/utils/string.cljs @@ -3,25 +3,6 @@ [clojure.string :as string] [utils.transforms :as transforms])) -(defn truncate-str-memo - "Given string and max threshold, trims the string to threshold length with `...` - appended to end or in the middle if length of the string exceeds max threshold, - returns the same string if threshold is not exceeded" - [s threshold & [middle?]] - (if (and s (< threshold (count s))) - (if middle? - (let [str-len (count s) - max-len (- threshold 3) - start-len (Math/ceil (/ max-len 2)) - end-len (Math/floor (/ max-len 2)) - start (subs s 0 start-len) - end (subs s (- str-len end-len) str-len)] - (str start "..." end)) - (str (subs s 0 (- threshold 3)) "...")) - s)) - -(def truncate-str (memoize truncate-str-memo)) - (defn has-lower-case? [s] (some? (re-find #"[a-z]" s))) diff --git a/src/utils/transforms.cljs b/src/utils/transforms.cljs index 3a08c0092a..be9be7e898 100644 --- a/src/utils/transforms.cljs +++ b/src/utils/transforms.cljs @@ -53,13 +53,6 @@ [data] (.parse js/JSON data)) -(defn js-dissoc - [js-object & ks] - (let [object-copy (.assign js/Object #js {} js-object)] - (doseq [js-key ks] - (js-delete object-copy (name js-key))) - object-copy)) - (defn json->clj [json] (when-not (= json "undefined") diff --git a/src/utils/worklets/bottom_sheet.cljs b/src/utils/worklets/bottom_sheet.cljs deleted file mode 100644 index fdb8918b98..0000000000 --- a/src/utils/worklets/bottom_sheet.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns utils.worklets.bottom-sheet) - -(def bottom-sheet-js (js/require "../src/js/worklets/bottom_sheet.js")) - -(defn use-translate-y - [window-height bottom-sheet-dy pan-y] - (.useTranslateY ^js bottom-sheet-js window-height bottom-sheet-dy pan-y)) - -(defn use-background-opacity - [translate-y bg-height window-height opacity] - (.useBackgroundOpacity ^js bottom-sheet-js translate-y bg-height window-height opacity)) diff --git a/src/utils/worklets/scroll_view.cljs b/src/utils/worklets/scroll_view.cljs deleted file mode 100644 index dc98271802..0000000000 --- a/src/utils/worklets/scroll_view.cljs +++ /dev/null @@ -1,7 +0,0 @@ -(ns utils.worklets.scroll-view) - -(def scroll-worklet-js (js/require "../src/js/worklets/scroll_view.js")) - -(defn use-animated-scroll-handler - [scroll-y] - (.useAnimatedScrollHandlerWorklet ^js scroll-worklet-js scroll-y))