huge cleanup

This commit is contained in:
Volodymyr Kozieiev 2024-12-24 20:11:43 +00:00
parent c1b0f3ae98
commit d357d7d669
No known key found for this signature in database
GPG Key ID: 82B04968DF4C0535
274 changed files with 308 additions and 7441 deletions

View File

@ -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

View File

@ -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

View File

@ -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]}

View File

@ -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"))))))))))))

View File

@ -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

View File

@ -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")))))))))))

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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)

View File

@ -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))))

View File

@ -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

View File

@ -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]]]}))

View File

@ -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

View File

@ -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]

View File

@ -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))))

View File

@ -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

View File

@ -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)

View File

@ -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 []

View File

@ -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])))))))))

View File

@ -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]))})

View File

@ -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))

View File

@ -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)))

View File

@ -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}]

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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]

View File

@ -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})))

View File

@ -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]

View File

@ -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

View File

@ -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))))

View File

@ -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)]))))

View File

@ -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

View File

@ -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]))

View File

@ -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))

View File

@ -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)]))

View File

@ -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}]])]))

View File

@ -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})

View File

@ -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})

View File

@ -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)}])])

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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]]]))})))

View File

@ -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)

View File

@ -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]])

View File

@ -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]]))

View File

@ -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"}])

View File

@ -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))

View File

@ -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))}])

View File

@ -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))))

View File

@ -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)]))

View File

@ -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})

View File

@ -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))}])]]))))

View File

@ -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))

View File

@ -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))))}])))

View File

@ -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)))

View File

@ -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]]]])

View File

@ -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

View File

@ -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]]]))})))

View File

@ -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})

View File

@ -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)

View File

@ -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?

View File

@ -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])])

View File

@ -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)]]]]))

View File

@ -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)]]]]))

View File

@ -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})

View File

@ -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]

View File

@ -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 []

View File

@ -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})

View File

@ -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]]

View File

@ -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])))

View File

@ -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))]}]]))))

View File

@ -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})

View File

@ -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})

View File

@ -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}

View File

@ -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})

View File

@ -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)]}]])))

View File

@ -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})

View File

@ -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})

View File

@ -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)]]]))

View File

@ -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})

View File

@ -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}}]

View File

@ -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})

View File

@ -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])}])]))

View File

@ -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})

View File

@ -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})

View File

@ -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)

View File

@ -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]))

View File

@ -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]]

View File

@ -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}}

View File

@ -17,7 +17,3 @@
(def node-item-name-text
{:font-size 17})
(def switch-container
{:height 50
:padding-left 15})

View File

@ -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/<! queue)]
(run-task task-fn)
(recur (async/<! queue)))
queue))
;; ---------------------------------------------------------------------------
;; Periodic background job
;; ---------------------------------------------------------------------------
(defn async-periodic-run!
([async-periodic-chan]
(async-periodic-run! async-periodic-chan true))
([async-periodic-chan worker-fn]
(async/put! async-periodic-chan worker-fn)))
(defn async-periodic-stop!
[async-periodic-chan]
(async/close! async-periodic-chan))

View File

@ -1,29 +1,9 @@
(ns legacy.status-im.utils.build
(:require
[cljs.analyzer :as analyzer]
[clojure.java.io :as io]
[clojure.java.shell :as shell]
[clojure.string :as string]))
;; Some warnings are unavoidable due to dependencies. For example, reagent 0.6.0
;; has a warning in its util.cljs namespace. Adjust this as is necessary and
;; unavoidable warnings arise.
(def acceptable-warning?
#{"Protocol IFn implements method -invoke with variadic signature (&)"}) ;; reagent 0.6.0 reagent/impl/util.cljs:61
(defn nil-acceptable-warning
[s]
(when-not (acceptable-warning? s)
s))
(defn warning-handler
[warning-type env extra]
(when (warning-type analyzer/*cljs-warnings*)
(when-let [s (nil-acceptable-warning (analyzer/error-message warning-type extra))]
(binding [*out* *err*]
(println (analyzer/message env (str "\u001B[31mWARNING\u001B[0m: " s))))
(System/exit 1))))
(defmacro get-build-no
[]
(-> (shell/sh "bash" "./scripts/version/build_no.sh")

View File

@ -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)))

View File

@ -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)))

Some files were not shown because too many files have changed in this diff Show More