Compare commits

...
Author SHA1 Message Date
Mohamed Javid 223fba428c Added Request To Leave RPC call 2023-04-28 00:14:03 +05:30
Mohamed Javid 16c94d8419 Status Go Update 2023-04-28 00:13:58 +05:30
Omar Basem 3e9d5dde54 Reimplement composer: add reply (#15736)
* feat: add composer reply
2023-04-27 20:20:00 +04:00
Siddarth Kumar 2eed30be8f (chore) : Improve QR code quo2 component (#15755)
This PR adds the ability to :

- Generate a QR by passing any url.
- See different error correction levels.
- Shows the media server url for that specific QR code.
- Moved media server URI generation logic to `image_server.cljs`
2023-04-27 19:25:49 +05:30
Parvesh Monu 8e49a06dbe fix UI freeze issue (#15761) 2023-04-27 17:26:33 +05:30
Roman Volosovskyi fb326bbf4e [#15741] Fix error on tapping pinned message 2023-04-27 10:23:16 +02:00
Jamie Caprani 52c6687608 feat: add identifiers screen to onboarding-flow (#15684) 2023-04-26 21:26:32 -07:00
frank cfefef6b75 fix [#15616] Sometimes mentions list does not appear after typing @ in chat input filed (#15622) 2023-04-27 11:37:01 +08:00
flexsurfer e6ba40ac17 fix quo hotreload (#15760) 2023-04-26 18:14:58 +02:00
flexsurfer efbf93f6e2 move status native module (#15749) 2023-04-26 18:14:14 +02:00
Mohamed Javid 6eb2029c51 Show "Kicked from community" notification in Activity Center (#15734)
* [Feature] Implement Community Kicked notification

* Status Go Update
2023-04-26 19:56:33 +05:30
Parvesh Monu 55bab9454a fix status bar font color (#15744) 2023-04-26 19:35:51 +05:30
flexsurferandChurikova Tetiana 0ca6ee3934 Request to join community screen is not scrollable on Android #15748 (#15750)
Co-authored-by: Churikova Tetiana <tatiana@status.im>
2023-04-26 13:33:00 +02:00
Parvesh Monu 0649c66dde fix device theme change listener in ios (#15724) 2023-04-26 16:41:11 +05:30
Roman Volosovskyi 1b0374a156 [#15655] Resolve messages with markdown on Jump To screen 2023-04-26 11:55:45 +02:00
105 changed files with 1097 additions and 745 deletions
+5 -5
View File
@@ -12,11 +12,11 @@ status-im.chat.models.message-content/actions
status-im.chat.models.message-content/blank-string
status-im.chat.models.message-content/sorted-ranges
status-im.ethereum.mnemonic/words->passphrase
status-im.native-module.core/listener
status-im.native-module.core/multiaccount-reset
status-im.native-module.core/extract-group-membership-signatures
status-im.native-module.core/sign-group-membership
status-im.native-module.core/update-mailservers
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
status-im.ethereum.abi-spec/bytes-to-hex
status-im.android.core/init
status-im.chat.models.message/transport-keys
Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 913 B

+2 -2
View File
@@ -18,11 +18,11 @@ export function stackOpacity (stackId, selectedStackId) {
);
}
export function stackPointer (stackId, selectedStackId) {
export function stackZIndex (stackId, selectedStackId) {
return useDerivedValue(
function () {
'worklet'
return selectedStackId.value == stackId ? "auto" : "none";
return selectedStackId.value == stackId ? 10 : 9;
}
);
}
@@ -1,19 +1,19 @@
(ns status-im.native-module.core
(ns native-module.core
(:require ["react-native" :as react-native]
[re-frame.core :as re-frame]
[status-im2.utils.validators :as validators]
[status-im.utils.platform :as platform]
[status-im.utils.react-native :as react-native-utils]
[status-im.utils.types :as types]
[utils.validators :as validators]
[taoensso.timbre :as log]
[status-im2.constants :as constants]))
[react-native.platform :as platform]
[react-native.core :as rn]
[utils.transforms :as types]))
(defn status
[]
(when (exists? (.-NativeModules react-native))
(.-Status ^js (.-NativeModules react-native))))
(def adjust-resize 16)
(defn init
[handler]
(.addListener ^js rn/device-event-emitter "gethEvent" #(handler (.-jsonEvent ^js %))))
(defn clear-web-data
[]
@@ -72,15 +72,6 @@
accounts-data
chat-key)))
(defn login
"NOTE: beware, the password has to be sha3 hashed"
[key-uid account-data hashed-password]
(log/debug "[native-module] login")
(clear-web-data)
(init-keystore
key-uid
#(.login ^js (status) account-data hashed-password)))
(defn login-with-config
"NOTE: beware, the password has to be sha3 hashed"
[key-uid account-data hashed-password config]
@@ -123,11 +114,6 @@
(clear-web-data)
(.logout ^js (status)))
(defonce listener
(.addListener ^js react-native-utils/device-event-emitter
"gethEvent"
#(re-frame/dispatch [:signals/signal-received (.-jsonEvent ^js %)])))
(defn multiaccount-load-account
"NOTE: beware, the password has to be sha3 hashed
@@ -141,14 +127,6 @@
:password hashed-password})
callback))
(defn multiaccount-reset
"TODO: this function is not used anywhere
if usage isn't planned, remove"
[callback]
(log/debug "[native-module] multiaccount-reset")
(.multiAccountReset ^js (status)
callback))
(defn multiaccount-derive-addresses
"NOTE: this should be named derive-accounts
this only derive addresses, they still need to be stored
@@ -298,43 +276,13 @@
:key key})
(.deserializeAndCompressKey ^js (status) key callback))
(defn public-key->compressed-key
"Provides public key to status-go and gets back a compressed key via serialization"
[public-key callback]
(let [serialization-key constants/serialization-key
multi-code-prefix constants/multi-code-prefix
multi-code-key (str multi-code-prefix (subs public-key 2))]
(log/info "[native-module] Serializing public key"
{:fn :public-key->compressed-key
:public-key public-key
:multi-code-key multi-code-key})
(.multiformatSerializePublicKey ^js (status) multi-code-key serialization-key callback)))
(defn compressed-key->public-key
"Provides compressed key to status-go and gets back the uncompressed public key via deserialization"
[public-key callback]
(let [deserialization-key constants/deserialization-key]
(log/info "[native-module] Deserializing compressed key"
{:fn :compressed-key->public-key
:public-key public-key})
(.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback)))
(defn decompress-public-key
"Provides compressed key to status-go and gets back the uncompressed public key"
[public-key callback]
(log/info "[native-module] Decompressing public key"
{:fn :decompress-public-key
[public-key deserialization-key callback]
(log/info "[native-module] Deserializing compressed key"
{:fn :compressed-key->public-key
:public-key public-key})
(.decompressPublicKey ^js (status) public-key callback))
(defn compress-public-key
"Provides a public key to status-go and gets back a 33bit compressed key back"
[public-key callback]
(log/info "[native-module] Compressing public key"
{:fn :compress-public-key
:public-key public-key})
(.compressPublicKey ^js (status) public-key callback))
(.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback))
(defn hash-typed-data
"used for keycard"
@@ -388,11 +336,6 @@
(log/debug "[native-module] send-logs")
(.sendLogs ^js (status) dbJson js-logs callback))
(defn add-peer
[enode on-result]
(log/debug "[native-module] add-peer")
(.addPeer ^js (status) enode on-result))
(defn close-application
[]
(log/debug "[native-module] close-application")
@@ -408,11 +351,6 @@
(log/debug "[native-module] app-state-change")
(.appStateChange ^js (status) state))
(defn stop-local-notifications
[]
(log/debug "[native-module] stop-local-notifications")
(.stopLocalNotifications ^js (status)))
(defn start-local-notifications
[]
(log/debug "[native-module] start-local-notifications")
@@ -433,26 +371,11 @@
:build-id (.-buildId status)
:device-id (.-deviceId status)}))
(defn extract-group-membership-signatures
[signature-pairs callback]
(log/debug "[native-module] extract-group-membership-signatures")
(.extractGroupMembershipSignatures ^js (status) signature-pairs callback))
(defn sign-group-membership
[content callback]
(log/debug "[native-module] sign-group-membership")
(.signGroupMembership ^js (status) content callback))
(defn get-node-config
[callback]
(log/debug "[native-module] get-node-config")
(.getNodeConfig ^js (status) callback))
(defn update-mailservers
[enodes on-result]
(log/debug "[native-module] update-mailservers")
(.updateMailservers ^js (status) enodes on-result))
(defn toggle-webview-debug
[on]
(log/debug "[native-module] toggle-webview-debug" on)
@@ -483,12 +406,6 @@
(when (validators/valid-public-key? public-key)
(.generateAlias ^js (status) public-key)))
(defn generate-gfycat-async
"Generate a 3 words random name based on the user public-key, asynchronously"
[public-key callback]
(when (validators/valid-public-key? public-key)
(.generateAliasAsync ^js (status) public-key callback)))
(defn identicon
"Generate a icon based on a string, synchronously"
[seed]
@@ -500,11 +417,6 @@
(log/debug "[native-module] encode-transfer")
(.encodeTransfer ^js (status) to-norm amount-hex))
(defn encode-function-call
[method params]
(log/debug "[native-module] encode-function-call")
(.encodeFunctionCall ^js (status) method (types/clj->json params)))
(defn decode-parameters
[bytes-string types]
(log/debug "[native-module] decode-parameters")
@@ -555,11 +467,6 @@
(log/debug "[native-module] to-checksum-address")
(.toChecksumAddress ^js (status) address))
(defn identicon-async
"Generate a icon based on a string, asynchronously"
[seed callback]
(.identiconAsync ^js (status) seed callback))
(defn gfycat-identicon-async
"Generate an icon based on a string and 3 words random name asynchronously"
[seed callback]
@@ -585,16 +492,6 @@
(log/debug "[native-module] delete-imported-key")
(.deleteImportedKey ^js (status) key-uid address hashed-password callback))
(defn activate-keep-awake
[]
(log/debug "[native-module] activateKeepAwake")
(.activateKeepAwake ^js (status)))
(defn deactivate-keep-awake
[]
(log/debug "[native-module] deactivateKeepAwake")
(.deactivateKeepAwake ^js (status)))
(defn reset-keyboard-input
[input selection]
(log/debug "[native-module] resetKeyboardInput")
@@ -1,10 +1,10 @@
(ns status-im.native-module.core-test
(ns native-module.core-test
(:require [cljs.test :refer [deftest is testing]]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
(deftest identicon-test
(testing "check if identicon test works"
(is
(=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAjklEQVR4nOzXsQmAMBQGYRV3cUAdQwd0Gm2sJIWSBI6f+0oR8XjwSKYhhCE0htAYQmMITUzI/PXF49yv0vN12cYWP1L7/ZiJGEJjCE31xvm7bXptv5iJGEJjCE31WasVz1oPQ2gMoWlyuyvpfaN8i5mIITSG0BhCYwiNIeokZiKG0BhCYwiNITR3AAAA//+A3RtWaKqXgQAAAABJRU5ErkJggg=="
(status/identicon "a")))))
(native-module/identicon "a")))))
@@ -30,7 +30,7 @@
[customization-color blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-100 colors/white override-theme)
(colors/custom-color customization-color (if (or (= :dark override-theme) colors/dark?) 60 50))))
(colors/custom-color customization-color (if (or (= :dark override-theme) (colors/dark?)) 60 50))))
(def text-input-container {:flex 1})
+2
View File
@@ -37,6 +37,8 @@
(def dismiss-keyboard! #(.dismiss keyboard))
(def device-event-emitter (.-DeviceEventEmitter ^js react-native))
(defn hide-splash-screen
[]
(.hide ^js (-> react-native .-NativeModules .-SplashScreen)))
+4
View File
@@ -41,6 +41,10 @@
[comp]
(.catch (.dismissOverlay Navigation comp) #()))
(defn dissmiss-all-overlays
[]
(.catch (.dismissAllOverlays Navigation) #()))
(defn reg-app-launched-listener
[handler]
(.registerAppLaunchedListener ^js (.events ^js Navigation) handler))
+1 -1
View File
@@ -1,7 +1,7 @@
(ns status-im.add-new.db
(:require [cljs.spec.alpha :as spec]
[status-im.ethereum.ens :as ens]
[status-im2.utils.validators :as validators]))
[utils.validators :as validators]))
(defn own-public-key?
[{:keys [multiaccount]} public-key]
+3 -3
View File
@@ -13,7 +13,7 @@
[status-im.ethereum.ens :as ens]
[utils.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.signing.core :as signing]
[status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf]
@@ -537,7 +537,7 @@
(re-frame/reg-fx
:browser/call-rpc
(fn [[payload callback]]
(status/call-rpc
(native-module/call-rpc
(types/clj->json payload)
(fn [response]
(if (= "" response)
@@ -559,7 +559,7 @@
(re-frame/reg-fx
:browser/clear-web-data
(fn []
(status/clear-web-data)))
(native-module/clear-web-data)))
(defn share-link
[url]
-6
View File
@@ -51,12 +51,6 @@
(let [current-chat-id (or chat-id (:current-chat-id db))]
{:db (assoc-in db [:chat/inputs current-chat-id :input-maximized?] maximized?)}))
(rf/defn set-input-refocus
{:events [:chat.ui/set-input-refocus]}
[{db :db} refocus? chat-id]
(let [current-chat-id (or chat-id (:current-chat-id db))]
{:db (assoc-in db [:chat/inputs current-chat-id :input-refocus?] refocus?)}))
(rf/defn select-mention
{:events [:chat.ui/select-mention]}
[{:keys [db] :as cofx} text-input-ref {:keys [primary-name searched-text match public-key] :as user}]
+28 -70
View File
@@ -4,9 +4,8 @@
[quo.react-native :as rn]
[re-frame.core :as re-frame]
[utils.re-frame :as rf]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
(defn- transfer-input-segments
[segments]
@@ -56,8 +55,8 @@
:ensVerified :ens-verified
:added :added?
:displayName :display-name
:searchedText :searched-text
})))
:searchedText :searched-text})))
{}
mentionable-users))
(defn- transfer-mention-result
@@ -91,38 +90,29 @@
(assoc-in [:chats/mentions chat-id :mentions] state)
(assoc-in [:chat/inputs-with-mentions chat-id] input-segments))}))
(rf/defn on-text-input
{:events [:mention/on-text-input]}
[{:keys [db]} {:keys [previous-text start end] :as args}]
(let [previous-text
;; NOTE(rasom): on iOS `previous-text` contains entire input's text. To
;; get only removed part of text we have cut it.
(if platform/android?
previous-text
(subs previous-text start end))
chat-id (:current-chat-id db)
state (merge args {:previous-text previous-text})
state (set/rename-keys state
{:previous-text :PreviousText
:new-text :NewText
:start :Start
:end :End})
params [chat-id state]
method "wakuext_chatMentionOnTextInput"]
(log/debug "[mentions] on-text-input" {:params params})
(rf/defn on-change-text
{:events [:mention/on-change-text]}
[{:keys [db]} text]
(let [chat-id (:current-chat-id db)
params [chat-id text]
method "wakuext_chatMentionOnChangeText"]
(log/debug "[mentions] on-change-text" {:params params})
{:json-rpc/call [{:method method
:params [chat-id state]
:on-success #(rf/dispatch [:mention/on-text-input-success %])
:params params
:on-success #(rf/dispatch [:mention/on-change-text-success %])
:on-error #(rf/dispatch [:mention/on-error
{:method method
:params params} %])}]}))
(rf/defn on-text-input-success
{:events [:mention/on-text-input-success]}
(rf/defn on-change-text-success
{:events [:mention/on-change-text-success]}
[{:keys [db]} result]
(log/debug "[mentions] on-text-input-success" {:result result})
(let [{:keys [state chat-id]} (transfer-mention-result result)]
{:db (assoc-in db [:chats/mentions chat-id :mentions] state)}))
(let [{:keys [state chat-id mentionable-users input-segments]} (transfer-mention-result result)]
{:db (-> db
(assoc-in [:chats/mention-suggestions chat-id] mentionable-users)
(assoc-in [:chats/mentions chat-id :mentions] state)
(assoc-in [:chat/inputs-with-mentions chat-id] input-segments))}))
(rf/defn recheck-at-idxs
[{:keys [db]} public-key]
@@ -175,16 +165,6 @@
;; programmatic change. By calling `reset-text-input-cursor` we force the
;; keyboard's cursor position to be changed before the next input.
(reset-text-input-cursor text-input-ref cursor)
;; NOTE(roman): on-text-input event is not dispatched when we change input
;; programmatically, so we have to call `on-text-input` manually
(on-text-input
(let [match-len (count match)
start (inc at-sign-idx)
end (+ start match-len)]
{:new-text match
:previous-text searched-text
:start start
:end end}))
(recheck-at-idxs public-key))))
(rf/defn clear-suggestions
@@ -220,7 +200,7 @@
(when text
(log/debug "[mentions] check-selection" {:params params})
{:json-rpc/call [{:method method
:params [chat-id text start end]
:params params
:on-success #(rf/dispatch [:mention/on-handle-selection-change-success %])
:on-error #(rf/dispatch [:mention/on-error
{:method method
@@ -230,38 +210,16 @@
{:events [:mention/on-handle-selection-change-success]}
[{:keys [db]} result]
(log/debug "[mentions] on-check-selection-success" {:result result})
(let [{:keys [state chat-id]} (transfer-mention-result result)]
{:db (assoc-in db [:chats/mentions chat-id :mentions] (rename-state state))}))
(re-frame/reg-fx
::reset-text-input-cursor
(fn [[ref cursor]]
(when ref
(status/reset-keyboard-input
(rn/find-node-handle (react/current-ref ref))
cursor))))
(rf/defn calculate-suggestions
{:events [:mention/calculate-suggestions]}
[{:keys [db]}]
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
params [chat-id text]
method "wakuext_chatMentionCalculateSuggestions"]
(log/debug "[mentions] calculate-suggestions" {:params params})
{:json-rpc/call [{:method method
:params [chat-id text]
:on-success #(rf/dispatch [:mention/on-calculate-suggestions-success %])
:on-error #(rf/dispatch [:mention/on-error
{:method method
:params params} %])}]}))
(rf/defn on-calculate-suggestions-success
{:events [:mention/on-calculate-suggestions-success]}
[{:keys [db]} result]
(log/debug "[mentions] on-calculate-suggestions-success" {:result result})
(let [{:keys [state chat-id mentionable-users input-segments]} (transfer-mention-result result)]
{:db (-> db
(assoc-in [:chats/mention-suggestions chat-id] mentionable-users)
(assoc-in [:chats/mentions chat-id :mentions] state)
(assoc-in [:chat/inputs-with-mentions chat-id] input-segments))}))
(re-frame/reg-fx
::reset-text-input-cursor
(fn [[ref cursor]]
(when ref
(native-module/reset-keyboard-input
(rn/find-node-handle (react/current-ref ref))
cursor))))
+21
View File
@@ -273,6 +273,27 @@
community-id)
(re-frame/dispatch [::failed-to-leave]))}]}))
(rf/defn request-to-leave-success
{:events [:communities/request-to-leave-success]}
[{:keys [db] :as cofx} community-id]
(let [community-name (get-in db [:communities community-id :name])]
(rf/merge cofx
(toasts/upsert {:icon :i/correct
:icon-color (:positive-01 @colors/theme)
:text (i18n/label :t/request-to-leave-community
{:community community-name})}))))
(rf/defn request-to-leave
{:events [:communities/request-to-leave]}
[{:keys [db]} community-id]
{:json-rpc/call [{:method "wakuext_requestToLeaveCommunity"
:params [community-id]
:on-success #(re-frame/dispatch [:communities/request-to-leave-success community-id])
:on-error #(log/info
"failed to request to leave community"
{:error %
:event :communities/request-to-leave})}]})
(rf/defn status-tag-pressed
{:events [:communities/status-tag-pressed]}
[{:keys [db] :as cofx} community-id literal]
+5 -5
View File
@@ -1,23 +1,23 @@
(ns status-im.ethereum.core
(:require [clojure.string :as string]
[status-im.ethereum.eip55 :as eip55]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
(defn sha3
[s]
(when s
(status/sha3 (str s))))
(native-module/sha3 (str s))))
(defn utf8-to-hex
[s]
(let [hex (status/utf8-to-hex (str s))]
(let [hex (native-module/utf8-to-hex (str s))]
(if (empty? hex)
nil
hex)))
(defn hex-to-utf8
[s]
(let [utf8 (status/hex-to-utf8 s)]
(let [utf8 (native-module/hex-to-utf8 s)]
(if (empty? utf8)
nil
utf8)))
@@ -118,7 +118,7 @@
(defn address?
[s]
(when s
(status/address? s)))
(native-module/address? s)))
(defn network->chain-id
[network]
+3 -3
View File
@@ -5,7 +5,7 @@
e.g. 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
(:require [clojure.string :as string]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
(def hex-prefix "0x")
@@ -13,7 +13,7 @@
"Converts an arbitrary case address to one with correct checksum case."
[address]
(when address
(status/to-checksum-address
(native-module/to-checksum-address
(if (string/starts-with? address hex-prefix)
address
(str hex-prefix address)))))
@@ -21,4 +21,4 @@
(defn valid-address-checksum?
"Checks address checksum validity."
[address]
(status/check-address-checksum address))
(native-module/check-address-checksum address))
+2 -2
View File
@@ -1,6 +1,6 @@
(ns status-im.ethereum.encode
(:require [status-im.native-module.core :as status]))
(:require [native-module.core :as native-module]))
(defn uint
[x]
(str "0x" (status/number-to-hex x)))
(str "0x" (native-module/number-to-hex x)))
+2 -2
View File
@@ -1,6 +1,6 @@
(ns status-im.ethereum.ens
(:require [clojure.string :as string]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im2.common.json-rpc.events :as json-rpc]))
;; this is the addresses of ens registries for the different networks
@@ -66,7 +66,7 @@
:params [chain-id ens-name]
:on-success
;;NOTE: returns a timestamp in s and we want ms
#(cb (* (js/Number (status/hex-to-number %)) 1000))}))
#(cb (* (js/Number (native-module/hex-to-number %)) 1000))}))
(defn register-prepare-tx
[chain-id from ens-name pubkey cb]
+10 -3
View File
@@ -30,7 +30,7 @@
status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model]
status-im.multiaccounts.update.core
[status-im.native-module.core :as status]
[native-module.core :as native-module]
status-im.network.net-info
status-im.pairing.core
status-im.profile.core
@@ -60,6 +60,9 @@
status-im2.contexts.onboarding.events
status-im.chat.models.gaps
[status-im2.navigation.events :as navigation]
[status-im2.common.theme.core :as theme]
[react-native.core :as rn]
[react-native.platform :as platform]
status-im2.contexts.chat.home.events))
(re-frame/reg-fx
@@ -85,12 +88,16 @@
(re-frame/reg-fx
:ui/close-application
(fn [_]
(status/close-application)))
(native-module/close-application)))
(re-frame/reg-fx
::app-state-change-fx
(fn [state]
(status/app-state-change state)))
(when (and platform/ios? (= state "active"))
;; Change the app theme if the ios device theme was updated when the app was in the background
;; https://github.com/status-im/status-mobile/issues/15708
(theme/change-device-theme (rn/get-color-scheme)))
(native-module/app-state-change state)))
(re-frame/reg-fx
:ui/listen-to-window-dimensions-change
+2 -2
View File
@@ -3,7 +3,7 @@
["react-native" :refer (BackHandler)]
[re-frame.core :as re-frame]
[status-im.keycard.card :as card]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
@@ -202,7 +202,7 @@
(re-frame/reg-fx
:keycard/generate-name-and-photo
(fn [{:keys [public-key on-success]}]
(status/gfycat-identicon-async
(native-module/gfycat-identicon-async
public-key
(fn [whisper-name photo-path]
(re-frame/dispatch
+5 -5
View File
@@ -4,7 +4,7 @@
[clojure.string :as string]
[status-im.ethereum.core :as ethereum]
[status-im.keycard.keycard :as keycard]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
@@ -296,7 +296,7 @@
(defn save-multiaccount-and-login
[{:keys [key-uid multiaccount-data password settings node-config accounts-data chat-key]}]
(status/save-multiaccount-and-login-with-keycard
(native-module/save-multiaccount-and-login-with-keycard
key-uid
(types/clj->json multiaccount-data)
password
@@ -307,15 +307,15 @@
(defn login
[args]
(status/login-with-keycard args))
(native-module/login-with-keycard args))
(defn send-transaction-with-signature
[{:keys [transaction signature on-completed]}]
(status/send-transaction-with-signature transaction signature on-completed))
(native-module/send-transaction-with-signature transaction signature on-completed))
(defn delete-multiaccount-before-migration
[{:keys [key-uid on-success on-error]}]
(status/delete-multiaccount
(native-module/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
+3 -3
View File
@@ -10,7 +10,7 @@
status-im.keycard.fx
[status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.popover.core :as popover]
[utils.re-frame :as rf]
[utils.datetime :as datetime]
@@ -250,14 +250,14 @@
(re-frame/reg-fx
::finish-migration
(fn [[account settings password encryption-pass login-params]]
(status/convert-to-keycard-account
(native-module/convert-to-keycard-account
account
settings
password
encryption-pass
#(let [{:keys [error]} (types/json->clj %)]
(if (string/blank? error)
(status/login-with-keycard login-params)
(native-module/login-with-keycard login-params)
(throw
(js/Error.
"Please shake the phone to report this error and restart the app. Migration failed unexpectedly.")))))))
+15 -15
View File
@@ -7,7 +7,7 @@
[utils.i18n :as i18n]
[status-im.keycard.keycard :as keycard]
[status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.node.core :as node]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
@@ -249,14 +249,14 @@
[{:keys [password on-success]}]
(when (and (not @initialization)
(not @derived-acc))
(status/multiaccount-import-mnemonic
(native-module/multiaccount-import-mnemonic
"night fortune spider version version armed amused winner matter tonight cave flag"
nil
(fn [result]
(let [{:keys [id] :as root-data}
(multiaccounts.create/normalize-multiaccount-data-keys
(types/json->clj result))]
(status-im.native-module.core/multiaccount-derive-addresses
(native-module.core/multiaccount-derive-addresses
id
[constants/path-wallet-root
constants/path-eip1581
@@ -266,7 +266,7 @@
(let [derived-data (multiaccounts.create/normalize-derived-data-keys
(types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async
(native-module/gfycat-identicon-async
public-key
(fn [name photo-path]
(let [derived-data-extended
@@ -294,7 +294,7 @@
(if delete-multiaccount?
(fn [on-deletion-success]
(js/alert "OH SHEET")
(status/delete-multiaccount
(native-module/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
@@ -304,7 +304,7 @@
(fn [cb] (cb)))]
(deletion-wrapper
(fn []
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
(:key-uid response)
[constants/path-wallet-root
@@ -398,14 +398,14 @@
path-num (inc (get-in @re-frame.db/app-db
[:multiaccount :latest-derived-path]))
path (str "m/" path-num)]
(status/multiaccount-load-account
(native-module/multiaccount-load-account
wallet-root-address
hashed-password
(fn [value]
(let [{:keys [id error]} (types/json->clj value)]
(if error
(re-frame/dispatch [::new-account-error :password-error error])
(status/multiaccount-derive-addresses
(native-module/multiaccount-derive-addresses
id
[path]
(fn [derived]
@@ -413,7 +413,7 @@
(if (some (fn [a] (= derived-address (get a :address))) accounts)
(re-frame/dispatch [::new-account-error :account-error
(i18n/label :t/account-exists-title)])
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
key-uid
[path]
@@ -436,7 +436,7 @@
(swap! state assoc-in
[:application-info :key-uid]
(:key-uid keys))
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
(:key-uid keys)
[constants/path-wallet-root
@@ -473,7 +473,7 @@
{:account address
:password password
:data (or data (str "0x" hash))})]
(status/sign-message
(native-module/sign-message
params
(fn [res]
(let [signature (-> res
@@ -481,7 +481,7 @@
:result
ethereum/normalized-hex)]
(on-success signature)))))
(status/sign-typed-data
(native-module/sign-typed-data
data
address
password
@@ -498,7 +498,7 @@
(defn save-multiaccount-and-login
[{:keys [key-uid multiaccount-data password settings node-config accounts-data]}]
(status/save-account-and-login
(native-module/save-account-and-login
key-uid
(types/clj->json multiaccount-data)
password
@@ -508,11 +508,11 @@
(defn login
[{:keys [key-uid multiaccount-data password]}]
(status/login-with-config key-uid multiaccount-data password node/login-node-config))
(native-module/login-with-config key-uid multiaccount-data password node/login-node-config))
(defn send-transaction-with-signature
[{:keys [transaction on-completed]}]
(status/send-transaction transaction account-password on-completed))
(native-module/send-transaction transaction account-password on-completed))
(defn delete-multiaccount-before-migration
[{:keys [on-success]}]
@@ -3,7 +3,7 @@
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.popover.core :as popover]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
@@ -17,7 +17,7 @@
;;; android blacklist based on device info:
(def deviceinfo (status/get-device-model-info))
(def deviceinfo (native-module/get-device-model-info))
;; {:model ?
;; :brand "Xiaomi"
+2 -1
View File
@@ -4,7 +4,7 @@
[re-frame.core :as re-frame]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as native-module]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[quo2.foundations.colors :as colors]
[status-im2.constants :as constants]
@@ -150,6 +150,7 @@
(re-frame/dispatch [:change-shell-status-bar-style
(if (shell.animation/home-stack-open?) status-bar-theme :light)])
(when reload-ui?
(rf/dispatch [:dissmiss-all-overlays])
(hot-reload/reload)
(when-not (= view-id :shell-stack)
(re-frame/dispatch [:change-shell-nav-bar-color nav-bar-color]))))))
+5 -5
View File
@@ -6,7 +6,7 @@
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[utils.i18n :as i18n]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.node.core :as node]
[status-im2.config :as config]
[utils.re-frame :as rf]
@@ -44,7 +44,7 @@
(re-frame/reg-fx
::store-multiaccount
(fn [[id key-uid hashed-password callback]]
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
key-uid
[constants/path-wallet-root
@@ -69,7 +69,7 @@
(fn [result]
(let [derived-data (normalize-derived-data-keys (types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async
(native-module/gfycat-identicon-async
public-key
(fn [name identicon]
(let [derived-whisper (derived-data constants/path-whisper-keyword)
@@ -81,7 +81,7 @@
(re-frame/reg-fx
:multiaccount-generate-and-derive-addresses
(fn []
(status/multiaccount-generate-and-derive-addresses
(native-module/multiaccount-generate-and-derive-addresses
5
12
[constants/path-whisper
@@ -127,7 +127,7 @@
(re-frame/reg-fx
::save-account-and-login
(fn [[key-uid multiaccount-data hashed-password settings config accounts-data]]
(status/save-account-and-login
(native-module/save-account-and-login
key-uid
multiaccount-data
hashed-password
@@ -11,7 +11,7 @@
[status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.native-module.core :as native-module]
[native-module.core :as native-module]
[status-im.popover.core :as popover]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
+6 -6
View File
@@ -20,7 +20,7 @@
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.node.core :as node]
[status-im.notifications.core :as notifications]
[status-im.popover.core :as popover]
@@ -58,22 +58,22 @@
(re-frame/reg-fx
::login
(fn [[key-uid account-data hashed-password]]
(status/login-with-config key-uid account-data hashed-password node/login-node-config)))
(native-module/login-with-config key-uid account-data hashed-password node/login-node-config)))
(re-frame/reg-fx
::export-db
(fn [[key-uid account-data hashed-password callback]]
(status/export-db key-uid account-data hashed-password callback)))
(native-module/export-db key-uid account-data hashed-password callback)))
(re-frame/reg-fx
::import-db
(fn [[key-uid account-data hashed-password]]
(status/import-db key-uid account-data hashed-password)))
(native-module/import-db key-uid account-data hashed-password)))
(re-frame/reg-fx
::enable-local-notifications
(fn []
(status/start-local-notifications)))
(native-module/start-local-notifications)))
(re-frame/reg-fx
::initialize-wallet-connect
@@ -363,7 +363,7 @@
(rf/defn get-node-config
[_]
(status/get-node-config #(re-frame/dispatch [::get-node-config-callback %])))
(native-module/get-node-config #(re-frame/dispatch [::get-node-config-callback %])))
(rf/defn redirect-to-root
"Decides which root should be initialised depending on user and app state"
+2 -2
View File
@@ -2,7 +2,7 @@
(:require [re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.notifications.core :as notifications]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
@@ -62,4 +62,4 @@
(re-frame/reg-fx
::logout
(fn []
(status/logout)))
(native-module/logout)))
@@ -9,7 +9,7 @@
[status-im.keycard.nfc :as nfc]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.popover.core :as popover]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
@@ -89,14 +89,14 @@
::import-multiaccount
(fn [{:keys [passphrase password success-event]}]
(log/debug "[recover] ::import-multiaccount")
(status/multiaccount-import-mnemonic
(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))]
(status-im.native-module.core/multiaccount-derive-addresses
(native-module.core/multiaccount-derive-addresses
id
[constants/path-wallet-root
constants/path-eip1581
@@ -106,7 +106,7 @@
(let [derived-data (multiaccounts.create/normalize-derived-data-keys
(types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async
(native-module/gfycat-identicon-async
public-key
(fn [name identicon]
(let [derived-data-extended
@@ -2,7 +2,7 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.popover.core :as popover]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
@@ -59,7 +59,7 @@
(re-frame/reg-fx
::change-db-password
(fn [[key-uid {:keys [current-password new-password]}]]
(status/reset-password
(native-module/reset-password
key-uid
(ethereum/sha3 (security/safe-unmask-data current-password))
(ethereum/sha3 (security/safe-unmask-data new-password))
@@ -88,9 +88,9 @@
::validate-current-password-and-reset
(fn [{:keys [address current-password] :as form-vals}]
(let [hashed-pass (ethereum/sha3 (security/safe-unmask-data current-password))]
(status/verify address
hashed-pass
(partial handle-verification form-vals)))))
(native-module/verify address
hashed-pass
(partial handle-verification form-vals)))))
(rf/defn reset
{:events [::reset]}
+2 -2
View File
@@ -2,7 +2,7 @@
(:require ["@react-native-community/netinfo" :default net-info]
[re-frame.core :as re-frame]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[status-im.wallet.core :as wallet]
[taoensso.timbre :as log]))
@@ -59,4 +59,4 @@
(re-frame/reg-fx
:network/notify-status-go
(fn [[network-type expensive?]]
(status/connection-change network-type expensive?)))
(native-module/connection-change network-type expensive?)))
+2 -2
View File
@@ -1,6 +1,6 @@
(ns status-im.node.core
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im2.config :as config]
[utils.re-frame :as rf]
[status-im.utils.platform :as utils.platform]
@@ -221,4 +221,4 @@ app-db"
(re-frame/reg-fx
::prepare-new-config
(fn [[key-uid config callback]]
(status/prepare-dir-and-update-config key-uid config callback)))
(native-module/prepare-dir-and-update-config key-uid config callback)))
+3 -3
View File
@@ -11,9 +11,9 @@
[status-im.notifications.android :as pn-android]
[utils.re-frame :as rf]
[status-im.utils.money :as money]
[status-im.utils.react-native :as react-native-utils]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]))
[status-im.utils.utils :as utils]
[react-native.core :as rn]))
(def default-erc20-token
{:symbol :ERC20
@@ -56,7 +56,7 @@
(fn [notification]
(handle-notification-press {:userInfo (bean/bean (.getData ^js
notification))})))
(.addListener ^js react-native-utils/device-event-emitter
(.addListener ^js rn/device-event-emitter
notification-event-android
(fn [^js data]
(when (and data (.-dataJSON data))
+4 -3
View File
@@ -9,9 +9,9 @@
[status-im.ethereum.eip681 :as eip681]
[status-im.ethereum.ens :as ens]
[status-im.utils.types :as types]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.ethereum.stateofus :as stateofus]
[status-im2.utils.validators :as validators]
[utils.validators :as validators]
[status-im.utils.http :as http]
[status-im.utils.wallet-connect :as wallet-connect]
[taoensso.timbre :as log]
@@ -83,8 +83,9 @@
:ens-name ens-name})
valid-compressed-key?
(status/compressed-key->public-key
(native-module/compressed-key->public-key
user-id
constants/deserialization-key
(fn [response]
(let [{:keys [error]} (types/json->clj response)]
(when-not error
+22 -22
View File
@@ -9,7 +9,7 @@
[utils.i18n :as i18n]
[status-im.keycard.card :as keycard.card]
[status-im.keycard.common :as keycard.common]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.signing.eip1559 :as eip1559]
[status-im.signing.keycard :as signing.keycard]
[utils.re-frame :as rf]
@@ -26,9 +26,9 @@
(re-frame/reg-fx
:signing/send-transaction-fx
(fn [{:keys [tx-obj hashed-password cb]}]
(status/send-transaction (types/clj->json tx-obj)
hashed-password
cb)))
(native-module/send-transaction (types/clj->json tx-obj)
hashed-password
cb)))
(re-frame/reg-fx
:signing/show-transaction-error
@@ -43,21 +43,21 @@
(re-frame/reg-fx
:signing.fx/sign-message
(fn [{:keys [params on-completed]}]
(status/sign-message (types/clj->json params)
on-completed)))
(native-module/sign-message (types/clj->json params)
on-completed)))
(re-frame/reg-fx
:signing.fx/recover-message
(fn [{:keys [params on-completed]}]
(status/recover-message (types/clj->json params)
on-completed)))
(native-module/recover-message (types/clj->json params)
on-completed)))
(re-frame/reg-fx
:signing.fx/sign-typed-data
(fn [{:keys [v4 data account on-completed hashed-password]}]
(if v4
(status/sign-typed-data-v4 data account hashed-password on-completed)
(status/sign-typed-data data account hashed-password on-completed))))
(native-module/sign-typed-data-v4 data account hashed-password on-completed)
(native-module/sign-typed-data data account hashed-password on-completed))))
(defn get-contact
[db to]
@@ -109,18 +109,18 @@
(sign-message cofx)
(let [tx-obj-to-send (merge tx-obj
(when gas
{:gas (str "0x" (status/number-to-hex gas))})
{:gas (str "0x" (native-module/number-to-hex gas))})
(when gasPrice
{:gasPrice (str "0x" (status/number-to-hex gasPrice))})
{:gasPrice (str "0x" (native-module/number-to-hex gasPrice))})
(when nonce
{:nonce (str "0x" (status/number-to-hex nonce))})
{:nonce (str "0x" (native-module/number-to-hex nonce))})
(when maxPriorityFeePerGas
{:maxPriorityFeePerGas (str "0x"
(status/number-to-hex
(native-module/number-to-hex
(js/parseInt maxPriorityFeePerGas)))})
(when maxFeePerGas
{:maxFeePerGas (str "0x"
(status/number-to-hex
(native-module/number-to-hex
(js/parseInt maxFeePerGas)))}))]
(when-not in-progress?
{:db (update db :signing/sign assoc :error nil :in-progress? true)
@@ -184,7 +184,7 @@
(let [{:keys [symbol decimals] :as token} (tokens/address->token (:wallet/all-tokens db) to)]
(when (and token data (string? data))
(when-let [type (get-method-type data)]
(let [[address value _] (status/decode-parameters
(let [[address value _] (native-module/decode-parameters
(str "0x" (subs data 10))
(if (= type :approve-and-call)
["address" "uint256" "bytes"]
@@ -476,7 +476,7 @@
{:events [:wallet.ui/sign-transaction-button-clicked-from-chat]}
[{:keys [db] :as cofx} {:keys [to amount from token]}]
(let [{:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount))
amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from)
identity (:current-chat-id db)
@@ -495,7 +495,7 @@
:from from-address
:chat-id identity
:command? true
:data (status/encode-transfer to-norm amount-hex)})}))
:data (native-module/encode-transfer to-norm amount-hex)})}))
{:db db
:json-rpc/call
[{:method "wakuext_requestAddressForTransaction"
@@ -512,7 +512,7 @@
[{:keys [db] :as cofx} {:keys [amount from token]}]
(let [{:keys [request-parameters chat-id]} (:wallet/prepare-transaction db)
{:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount))
amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (:address request-parameters)
from-address (:address from)]
(rf/merge cofx
@@ -532,13 +532,13 @@
:command? true
:message-id (:id request-parameters)
:chat-id chat-id
:data (status/encode-transfer to-norm amount-hex)})})))))
:data (native-module/encode-transfer to-norm amount-hex)})})))))
(rf/defn sign-transaction-button-clicked
{:events [:wallet.ui/sign-transaction-button-clicked]}
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice maxFeePerGas maxPriorityFeePerGas]}]
(let [{:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount))
amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from)]
(rf/merge cofx
@@ -558,7 +558,7 @@
{:to to-norm
:value amount-hex}
{:to (ethereum/normalized-hex address)
:data (status/encode-transfer to-norm amount-hex)}))}))))
:data (native-module/encode-transfer to-norm amount-hex)}))}))))
(re-frame/reg-fx
:signing/get-transaction-by-hash-fx
+4 -4
View File
@@ -1,15 +1,15 @@
(ns status-im.signing.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.signing.core :as signing]))
(deftest signing-test
(testing "showing sheet"
(let [to "0x2f88d65f3cb52605a54a833ae118fb1363acccd2"
contract "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
amount1-hex (str "0x" (status/number-to-hex "10000000000000000000"))
amount2-hex (str "0x" (status/number-to-hex "100000000000000000000"))
data (status/encode-transfer to amount2-hex)
amount1-hex (str "0x" (native-module/number-to-hex "10000000000000000000"))
amount2-hex (str "0x" (native-module/number-to-hex "100000000000000000000"))
data (native-module/encode-transfer to amount2-hex)
first-tx {:tx-obj {:to to
:from nil
:value amount1-hex}}
+9 -9
View File
@@ -1,7 +1,7 @@
(ns status-im.signing.keycard
(:require [re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
@@ -9,19 +9,19 @@
(re-frame/reg-fx
::hash-transaction
(fn [{:keys [transaction on-completed]}]
(status/hash-transaction (types/clj->json transaction) on-completed)))
(native-module/hash-transaction (types/clj->json transaction) on-completed)))
(re-frame/reg-fx
::hash-message
(fn [{:keys [message on-completed]}]
(status/hash-message message on-completed)))
(native-module/hash-message message on-completed)))
(re-frame/reg-fx
::hash-typed-data
(fn [{:keys [v4 data on-completed]}]
(if v4
(status/hash-typed-data-v4 data on-completed)
(status/hash-typed-data data on-completed))))
(native-module/hash-typed-data-v4 data on-completed)
(native-module/hash-typed-data data on-completed))))
(defn prepare-transaction
[{:keys [gas gasPrice data nonce tx-obj] :as params}]
@@ -37,17 +37,17 @@
maxPriorityFeePerGas
(assoc :maxPriorityFeePerGas
(str "0x"
(status/number-to-hex
(native-module/number-to-hex
(js/parseInt maxPriorityFeePerGas))))
maxFeePerGas
(assoc :maxFeePerGas
(str "0x"
(status/number-to-hex
(native-module/number-to-hex
(js/parseInt maxFeePerGas))))
gas
(assoc :gas (str "0x" (status/number-to-hex gas)))
(assoc :gas (str "0x" (native-module/number-to-hex gas)))
gasPrice
(assoc :gasPrice (str "0x" (status/number-to-hex gasPrice)))
(assoc :gasPrice (str "0x" (native-module/number-to-hex gasPrice)))
data
(assoc :data data)
nonce
@@ -20,7 +20,7 @@
[status-im.ui.components.react :as react]
[status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.chat.photos :as photos]
[status-im2.utils.validators :as validators]
[utils.validators :as validators]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im.utils.utils :as utils]
@@ -198,11 +198,7 @@
(when platform/android?
(reset! last-text-change (js/Date.now)))
(on-text-change text chat-id)
;; NOTE(rasom): on iOS `on-change` is dispatched after `on-text-input`,
;; that's why mention suggestions are calculated on `on-change`
(when platform/ios?
(re-frame/dispatch [:mention/calculate-suggestions]))))
(on-text-change text chat-id)))
(rf/defn set-input-text
"Set input text for current-chat. Takes db and input text and cofx
@@ -220,26 +216,10 @@
(defn on-text-input
[chat-id args]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)
previous-text (.-previousText ^js native-event)
range (.-range ^js native-event)
start (.-start ^js range)
end (.-end ^js range)]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)]
(when (and (not (get @mentions-enabled chat-id)) (string/index-of text "@"))
(swap! mentions-enabled assoc chat-id true))
(re-frame/dispatch
[:mention/on-text-input
{:new-text text
:previous-text previous-text
:start start
:end end}])
;; NOTE(rasom): on Android `on-text-input` is dispatched after
;; `on-change`, that's why mention suggestions are calculated
;; on `on-change`
(when platform/android?
(re-frame/dispatch [:mention/calculate-suggestions]))))
(swap! mentions-enabled assoc chat-id true))))
(defn text-input
[{:keys [set-active-panel refs chat-id sending-image]}]
@@ -2,7 +2,7 @@
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.ethereum.decode :as decode]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.ui.components.react :as react]
[status-im2.common.json-rpc.events :as json-rpc]
[utils.datetime :as datetime]))
@@ -36,7 +36,7 @@
(reset! latest-block res)
(get-block
(str "0x"
(status/number-to-hex
(native-module/number-to-hex
(last-loaded-block-number)))
(fn [res]
(reset! last-loaded-block res))))))]
@@ -3,7 +3,7 @@
[re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[utils.i18n :as i18n]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
@@ -21,7 +21,7 @@
(-> masked-password
security/safe-unmask-data
ethereum/sha3)]
(status/verify
(native-module/verify
address
hashed-password
(fn [result]
@@ -29,7 +29,7 @@
(log/info "[delete-profile] verify-password" result error)
(if-not (safe-blank? error)
(callback :wrong-password nil)
(status/delete-multiaccount
(native-module/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
@@ -141,33 +141,15 @@
(reset! last-text-change (js/Date.now)))
(on-text-change text chat-id)
;; NOTE(rasom): on iOS `on-change` is dispatched after `on-text-input`,
;; that's why mention suggestions are calculated on `on-change`
(when platform/ios?
(rf/dispatch [:mention/calculate-suggestions]))))
(rf/dispatch [:mention/on-change-text text])))
(defn on-text-input
[chat-id args]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)
previous-text (.-previousText ^js native-event)
range (.-range ^js native-event)
start (.-start ^js range)
end (.-end ^js range)]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)]
(when (and (not (get @mentions-enabled? chat-id)) (string/index-of text "@"))
(swap! mentions-enabled? assoc chat-id true))
(rf/dispatch
[:mention/on-text-input
{:new-text text
:previous-text previous-text
:start start
:end end}])
;; NOTE(rasom): on Android `on-text-input` is dispatched after
;; `on-change`, that's why mention suggestions are calculated
;; on `on-change`
(when platform/android?
(rf/dispatch [:mention/calculate-suggestions]))))
(swap! mentions-enabled? assoc chat-id true))))
(defn text-input-style
[chat-id]
+1 -12
View File
@@ -1,6 +1,5 @@
(ns status-im.utils.gfycat.core
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as native-module]))
(:require [native-module.core :as native-module]))
(def unknown-gfy "Unknown")
@@ -12,13 +11,3 @@
(native-module/generate-gfycat public-key)))
(def generate-gfy (memoize build-gfy))
(re-frame/reg-fx
:insert-gfycats
(fn [key-path-seq]
(for [key-path key-path-seq]
(let [public-key (first key-path)
path-for-gfycat (second key-path)]
(native-module/generate-gfycat-async public-key
#(re-frame/dispatch [:gfycat-generated path-for-gfycat
%]))))))
+1 -12
View File
@@ -1,15 +1,4 @@
(ns status-im.utils.identicon
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as native-module]))
(:require [native-module.core :as native-module]))
(def identicon (memoize native-module/identicon))
(def identicon-async native-module/identicon-async)
(re-frame/reg-fx
:insert-identicons
(fn [key-path-seq]
(for [key-path key-path-seq]
(let [public-key (first key-path)
path-for-identicon (second key-path)]
(identicon-async public-key #(re-frame/dispatch [:identicon-generated path-for-identicon %]))))))
+2 -2
View File
@@ -2,7 +2,7 @@
(:require ["react-native-keychain" :as react-native-keychain]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
@@ -63,7 +63,7 @@
;; Android only
(defn- device-not-rooted?
[callback]
(status/rooted-device? (fn [rooted?] (callback (not rooted?)))))
(native-module/rooted-device? (fn [rooted?] (callback (not rooted?)))))
;; Android only
(defn- secure-hardware-available?
+2 -2
View File
@@ -5,7 +5,7 @@
[react-native.mail :as react-native-mail]
[status-im.bottom-sheet.events :as bottom-sheet]
[utils.i18n :as i18n]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.transport.utils :as transport.utils]
[status-im.ui.components.react :as react]
[status-im.utils.build :as build]
@@ -20,7 +20,7 @@
(re-frame/reg-fx
:logs/archive-logs
(fn [[db-json callback-handler]]
(status/send-logs
(native-module/send-logs
db-json
(string/join "\n" (log/get-logs-queue))
#(re-frame/dispatch [callback-handler %]))))
-8
View File
@@ -1,8 +0,0 @@
(ns status-im.utils.react-native
(:require ["react-native" :as react-native]))
; Moved from status-im.ui.components.react(let's short for R), so status-im.native-module.core(short for
; N) don't need to have a dependency to R.
; We should keep N's dependencies as simple as possible, otherwise we may see issue like:
; Circular dependency detected: N -> R -> status-im.utils.utils -> status-im.ethereum.eip55 -> N
(def device-event-emitter (.-DeviceEventEmitter react-native))
@@ -15,7 +15,7 @@
[status-im.wallet.choose-recipient.core :as choose-recipient]
[status-im2.navigation.events :as navigation]
[taoensso.timbre :as log]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
;; TODO(yenda) investigate why `handle-universal-link` event is
;; dispatched 7 times for the same link
@@ -88,7 +88,7 @@
(rf/defn handle-desktop-community
[cofx {:keys [community-id]}]
(status/deserialize-and-compress-key
(native-module/deserialize-and-compress-key
community-id
(fn [deserialized-key]
(rf/dispatch [:handle-navigation-to-desktop-community-from-mobile cofx (str deserialized-key)]))))
+8 -8
View File
@@ -14,7 +14,7 @@
[status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.key-storage.core :as key-storage]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf]
[status-im.utils.hex :as hex]
@@ -74,7 +74,7 @@
(let [{:keys [id error]} (types/json->clj value)]
(if error
(re-frame/dispatch [::new-account-error :password-error error])
(status/multiaccount-derive-addresses
(native-module/multiaccount-derive-addresses
id
[path]
(fn [derived]
@@ -82,7 +82,7 @@
(if (some #(= derived-address (get % :address)) accounts)
(re-frame/dispatch [::new-account-error :account-error
(i18n/label :t/account-exists-title)])
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
key-uid
[path]
@@ -110,7 +110,7 @@
(re-frame/dispatch [::new-account-error
(if (= error pass-error) :password-error :account-error)
error])
(status/multiaccount-store-account
(native-module/multiaccount-store-account
id
key-uid
hashed-password
@@ -119,7 +119,7 @@
(re-frame/reg-fx
::verify-password
(fn [{:keys [address hashed-password]}]
(status/verify
(native-module/verify
address
hashed-password
#(re-frame/dispatch [:wallet.accounts/add-new-account-password-verifyied % hashed-password]))))
@@ -128,7 +128,7 @@
::generate-account
(fn [{:keys [derivation-info hashed-password accounts key-uid]}]
(let [{:keys [address path]} derivation-info]
(status/multiaccount-load-account
(native-module/multiaccount-load-account
address
hashed-password
(derive-and-store-account key-uid path hashed-password :generated accounts)))))
@@ -136,7 +136,7 @@
(re-frame/reg-fx
::import-account-seed
(fn [{:keys [passphrase hashed-password accounts key-uid]}]
(status/multiaccount-import-mnemonic
(native-module/multiaccount-import-mnemonic
(mnemonic/sanitize-passphrase (security/unmask passphrase))
""
(derive-and-store-account key-uid constants/path-default-wallet hashed-password :seed accounts))))
@@ -144,7 +144,7 @@
(re-frame/reg-fx
::import-account-private-key
(fn [{:keys [private-key hashed-password key-uid]}]
(status/multiaccount-import-private-key
(native-module/multiaccount-import-private-key
(string/trim (security/unmask private-key))
(store-account key-uid constants/path-default-wallet hashed-password :key))))
+2 -2
View File
@@ -2,7 +2,7 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[react-native.background-timer :as background-timer]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[taoensso.timbre :as log]
[utils.transforms :as transforms]))
@@ -29,7 +29,7 @@
on-error (or on-error
(on-error-retry call arg)
#(log/warn :json-rpc/error method :error % :params params))]
(status/call-private-rpc
(native-module/call-private-rpc
(transforms/clj->json {:jsonrpc "2.0"
:id 1
:method method
+19 -8
View File
@@ -1,18 +1,29 @@
(ns status-im2.common.theme.core
(:require [quo.theme :as quo]
[quo2.theme :as quo2]
[react-native.core :as rn]))
[utils.re-frame :as rf]
[oops.core :refer [oget]]
[react-native.core :as rn]
[react-native.platform :as platform]))
(def device-theme (atom (rn/get-color-scheme)))
;; Note - don't use value returned by change listener
;; https://github.com/facebook/react-native/issues/28525
(defn change-device-theme
[theme]
(when-not (= theme @device-theme)
(reset! device-theme theme)
(rf/dispatch [:system-theme-mode-changed (keyword theme)])))
;; Appearance change listener fires false events in ios when the app is in the background
;; So, we are ignoring those events and when the device returns form the background,
;; we are manually checking the device theme, in ::app-state-change-fx
;; https://github.com/status-im/status-mobile/issues/15708
(defn add-device-theme-change-listener
[callback]
(rn/appearance-add-change-listener #(let [theme (rn/get-color-scheme)]
(when-not (= theme @device-theme)
(reset! device-theme theme)
(callback (keyword theme))))))
[]
(rn/appearance-add-change-listener
#(when (or platform/android?
(not= (oget rn/app-state "currentState") "background"))
(change-device-theme (oget % "colorScheme")))))
(defn device-theme-dark?
[]
+2
View File
@@ -158,3 +158,5 @@
["enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"]})
(def default-kdf-iterations 3200)
(def ^:const new-composer-enabled? false)
@@ -0,0 +1,37 @@
(ns status-im2.contexts.activity-center.notification.community-kicked.view
(:require [quo2.core :as quo]
[status-im2.contexts.activity-center.notification.common.style :as common-style]
[status-im2.contexts.activity-center.notification.common.view :as common]
[utils.datetime :as datetime]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- swipeable
[{:keys [active-swipeable extra-fn]} child]
[common/swipeable
{:left-button common/swipe-button-read-or-unread
:left-on-press common/swipe-on-press-toggle-read
:right-button common/swipe-button-delete
:right-on-press common/swipe-on-press-delete
:active-swipeable active-swipeable
:extra-fn extra-fn}
child])
(defn view
[{:keys [notification set-swipeable-height] :as props}]
(let [{:keys [community-id read
timestamp]} notification
community (rf/sub [:communities/community community-id])
community-name (:name community)
community-image (get-in community [:images :thumbnail :uri])]
[swipeable props
[quo/activity-log
{:title (i18n/label :t/community-kicked-heading)
:icon :i/placeholder
:on-layout set-swipeable-height
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [[quo/text {:style common-style/user-avatar-tag-text}
(i18n/label :t/community-kicked-body)]
[quo/context-tag common/tag-params {:uri community-image}
community-name]]}]]))
@@ -8,6 +8,7 @@
(def ^:const contact-request 5)
(def ^:const community-request 7)
(def ^:const admin 8)
(def ^:const community-kicked 9)
(def ^:const contact-verification 10)
(def ^:const all-supported
@@ -18,6 +19,7 @@
contact-request
community-request
admin
community-kicked
contact-verification})
;; TODO: Replace with correct enum values once status-go implements them.
@@ -29,4 +31,5 @@
it doesn't have a corresponding type in the backend. Think of the collection
as a composite key of actual types."
#{private-group-chat
community-request})
community-request
community-kicked})
@@ -14,6 +14,8 @@
[status-im2.contexts.activity-center.notification.reply.view :as reply]
[status-im2.contexts.activity-center.notification.community-request.view :as
community-request]
[status-im2.contexts.activity-center.notification.community-kicked.view :as
community-kicked]
[status-im2.contexts.activity-center.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
@@ -203,6 +205,8 @@
types/community-request [community-request/view props]
types/community-kicked [community-kicked/view props]
nil)
:else
@@ -6,11 +6,12 @@
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens]
[status-im.ethereum.stateofus :as stateofus]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im2.navigation.events :as navigation]
[status-im2.utils.validators :as validators]
[utils.validators :as validators]
[status-im2.contexts.contacts.events :as data-store.contacts]
[status-im.utils.utils :as utils]))
[status-im.utils.utils :as utils]
[status-im2.constants :as constants]))
(defn init-contact
"Create a new contact (persisted to app-db as [:contacts/new-identity]).
@@ -124,8 +125,9 @@
(re-frame/reg-fx
:contacts/decompress-public-key
(fn [{:keys [compressed-key on-success on-error]}]
(status/compressed-key->public-key
(native-module/compressed-key->public-key
compressed-key
constants/deserialization-key
(fn [resp]
(let [{:keys [error]} (types/json->clj resp)]
(if error
@@ -88,17 +88,13 @@
(defn open-photo-selector
[{:keys [input-ref]}
{:keys [focused?]}
{:keys [height]}
insets]
(permissions/request-permissions
{:permissions [:read-external-storage :write-external-storage]
:on-allowed (fn []
(when platform/android?
(when @focused?
(rf/dispatch [:chat.ui/set-input-refocus true]))
(when @input-ref
(.blur ^js @input-ref)))
(when (and platform/android? @input-ref)
(.blur ^js @input-ref))
(rf/dispatch [:chat.ui/set-input-content-height
(reanimated/get-shared-value height)])
(rf/dispatch [:open-modal :photo-selector {:insets insets}]))
@@ -108,9 +104,9 @@
:t/external-storage-denied)))}))
(defn image-button
[props state animations insets]
[props animations insets]
[quo/button
{:on-press #(open-photo-selector props state animations insets)
{:on-press #(open-photo-selector props animations insets)
:icon true
:type :outline
:size 32
@@ -141,7 +137,7 @@
[rn/view {:style style/actions-container}
[rn/view {:style {:flex-direction :row}}
[camera-button]
[image-button props state animations insets]
[image-button props animations insets]
[reaction-button]
[format-button]]
[send-button props state animations window-height images?]
@@ -17,6 +17,8 @@
(def ^:const images-container-height 76)
(def ^:const reply-container-height 32)
(def ^:const extra-content-offset (if platform/ios? 6 0))
(def ^:const content-change-threshold 10)
@@ -5,7 +5,6 @@
[react-native.reanimated :as reanimated]
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]
[status-im2.contexts.chat.bottom-sheet-composer.keyboard :as kb]
[utils.re-frame :as rf]
[utils.number :as utils.number]))
(defn reenter-screen-effect
@@ -29,13 +28,6 @@
(reanimated/set-shared-value saved-height max-height)
(reanimated/set-shared-value last-height max-height)))
(defn refocus-effect
[{:keys [input-ref]}
{:keys [input-refocus?]}]
(when (and input-refocus? @input-ref)
(.focus ^js @input-ref)
(rf/dispatch [:chat.ui/set-input-refocus false])))
(defn layout-effect
[{:keys [lock-layout?]}]
(when-not @lock-layout?
@@ -56,17 +48,29 @@
(reanimated/set-shared-value background-y 0)
(reanimated/animate opacity 1)))
(defn images-effect
(defn images-or-reply-effect
[{:keys [container-opacity]}
images?]
(when images?
(reanimated/animate container-opacity 1)))
{:keys [replying? sending-images? input-ref]}
images? reply?]
(when (or images? reply?)
(reanimated/animate container-opacity 1))
(when (and (not @sending-images?) images? @input-ref)
(.focus ^js @input-ref)
(reset! sending-images? true))
(when (and (not @replying?) reply? @input-ref)
(.focus ^js @input-ref)
(reset! replying? true))
(when-not images?
(reset! sending-images? false))
(when-not reply?
(reset! replying? false)))
(defn empty-effect
[{:keys [text-value maximized? focused?]}
{:keys [container-opacity]}
images?]
(when (and (empty? @text-value) (not images?) (not @maximized?) (not @focused?))
images?
reply?]
(when (and (empty? @text-value) (not images?) (not reply?) (not @maximized?) (not @focused?))
(reanimated/animate-delay container-opacity constants/empty-opacity 200)))
(defn component-will-unmount
@@ -76,17 +80,16 @@
(.remove ^js @keyboard-frame-listener))
(defn initialize
[props state animations {:keys [max-height] :as dimensions} chat-input keyboard-height images?]
[props state animations {:keys [max-height] :as dimensions} chat-input keyboard-height images? reply?]
(rn/use-effect
(fn []
(maximized-effect state animations dimensions chat-input)
(refocus-effect props chat-input)
(reenter-screen-effect state dimensions chat-input)
(layout-effect state)
(kb-default-height-effect state)
(background-effect state animations dimensions chat-input)
(images-effect animations images?)
(empty-effect state animations images?)
(images-or-reply-effect animations props images? reply?)
(empty-effect state animations images? reply?)
(kb/add-kb-listeners props state animations dimensions keyboard-height)
#(component-will-unmount props))
[max-height]))
@@ -34,7 +34,8 @@
maximized?]}
{:keys [height saved-height last-height gradient-opacity container-opacity opacity background-y]}
{:keys [lines content-height max-height window-height]}
images]
images
reply]
(let [min-height (utils/get-min-height lines)
reopen-height (utils/calc-reopen-height text-value min-height content-height saved-height)]
(reset! focused? false)
@@ -43,7 +44,7 @@
(reanimated/set-shared-value saved-height min-height)
(reanimated/animate opacity 0)
(js/setTimeout #(reanimated/set-shared-value background-y (- window-height)) 300)
(when (and (empty? @text-value) (empty? images))
(when (utils/empty-input? @text-value images reply)
(reanimated/animate container-opacity constants/empty-opacity))
(reanimated/animate gradient-opacity 0)
(reset! lock-selection? true)
@@ -0,0 +1,41 @@
(ns status-im2.contexts.chat.bottom-sheet-composer.reply.style)
(defn reply-content
[pin?]
{:padding-right (when-not pin? 10)
:flex 1
:flex-direction :row})
(defn quoted-message
[pin?]
(merge {:flex-direction :row
:flex 1
:align-items :center}
(when-not pin?
{:left 22
:margin-right 22})))
(def reply-from
{:flex-direction :row
:align-items :center})
(def message-author-text
{:margin-left 4})
(def message-text
{:text-transform :none
:margin-left 4
:margin-top 2
:flex 1})
(def gradient
{:position :absolute
:right 0
:top 0
:bottom 0
:width "50%"})
(def reply-deleted-message
{:text-transform :none
:margin-left 4
:margin-top 2})
@@ -0,0 +1,152 @@
(ns status-im2.contexts.chat.bottom-sheet-composer.reply.view
(:require [clojure.string :as string]
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]
[utils.i18n :as i18n]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[status-im2.constants :as constant]
[status-im.ethereum.stateofus :as stateofus]
[utils.re-frame :as rf]
[status-im2.contexts.chat.bottom-sheet-composer.reply.style :as style]
[react-native.linear-gradient :as linear-gradient]))
(defn get-quoted-text-with-mentions
[parsed-text]
(string/join
(mapv (fn [{:keys [type literal children]}]
(cond
(= type "paragraph")
(get-quoted-text-with-mentions children)
(= type "mention")
(rf/sub [:messages/resolve-mention literal])
(seq children)
(get-quoted-text-with-mentions children)
:else
literal))
parsed-text)))
(defn format-author
[contact-name]
(let [author (if (or (= (first contact-name) "@")
;; in case of replies
(= (second contact-name) "@"))
(or (stateofus/username contact-name)
(subs contact-name 0 81))
contact-name)]
author))
(defn format-reply-author
[from username current-public-key]
(or (and (= from current-public-key)
(i18n/label :t/You))
(when username (format-author username))))
(defn reply-deleted-message
[]
[rn/view
{:style {:flex-direction :row
:align-items :center}}
[quo/icon :i/sad-face {:size 16}]
[quo/text
{:number-of-lines 1
:size :label
:weight :regular
:accessibility-label :quoted-message
:style style/reply-deleted-message}
(i18n/label :t/message-deleted)]])
(defn reply-from
[{:keys [from contact-name current-public-key]}]
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity from]))
contact (rf/sub [:contacts/contact-by-address from])
photo-path (when-not (empty? (:images contact)) (rf/sub [:chats/photo-path from]))]
[rn/view {:style style/reply-from}
[quo/user-avatar
{:full-name display-name
:profile-picture photo-path
:status-indicator? false
:size :xxxs}]
[quo/text
{:weight :semi-bold
:size :paragraph-2
:number-of-lines 1
:style style/message-author-text}
(format-reply-author from contact-name current-public-key)]]))
(defn reply-message
[{:keys [from identicon content-type contentType parsed-text content deleted? deleted-for-me?
album-images-count]}
in-chat-input? pin? recording-audio?]
(let [contact-name (rf/sub [:contacts/contact-name-by-identity from])
current-public-key (rf/sub [:multiaccount/public-key])
content-type (or content-type contentType)]
[rn/view
{:style {:flex-direction :row
:height (when-not pin? 24)
:accessibility-label :reply-message}}
[rn/view {:style (style/reply-content pin?)}
(when-not pin?
[quo/icon :i/connector
{:size 16
:color (colors/theme-colors colors/neutral-40 colors/neutral-60)
:container-style {:position :absolute :left 0 :bottom -4 :width 16 :height 16}}])
(if (or deleted? deleted-for-me?)
[rn/view {:style (style/quoted-message pin?)}
[reply-deleted-message]]
[rn/view {:style (style/quoted-message pin?)}
[reply-from
{:from from
:identicon identicon
:contact-name contact-name
:current-public-key current-public-key}]
[quo/text
{:number-of-lines 1
:size :label
:weight :regular
:accessibility-label :quoted-message
:ellipsize-mode :tail
:style (merge
style/message-text
(when (or (= constant/content-type-image content-type)
(= constant/content-type-sticker content-type)
(= constant/content-type-audio content-type))
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40)}))}
(case (or content-type contentType)
constant/content-type-image (if album-images-count
(i18n/label :t/images-albums-count
{:album-images-count album-images-count})
(i18n/label :t/image))
constant/content-type-sticker (i18n/label :t/sticker)
constant/content-type-audio (i18n/label :t/audio)
(get-quoted-text-with-mentions (or parsed-text (:parsed-text content))))]])]
(when (and in-chat-input? (not recording-audio?))
[quo/button
{:icon true
:type :outline
:size 24
:on-press #(rf/dispatch [:chat.ui/cancel-message-reply])}
:i/close])
(when (and in-chat-input? recording-audio?)
[linear-gradient/linear-gradient
{:colors [(colors/theme-colors colors/white-opa-0 colors/neutral-90-opa-0)
(colors/theme-colors colors/white colors/neutral-90)]
:start {:x 0 :y 0}
:end {:x 0.7 :y 0}
:style style/gradient}])]))
(defn- f-view
[]
(let [reply (rf/sub [:chats/reply-message])
height (reanimated/use-shared-value (if reply constants/reply-container-height 0))]
(rn/use-effect #(reanimated/animate height (if reply constants/reply-container-height 0)) [reply])
[reanimated/view {:style (reanimated/apply-animations-to-style {:height height} {})}
(when reply [reply-message reply true false false])]))
(defn view
[]
[:f> f-view])
@@ -6,16 +6,16 @@
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]))
(defn shadow
[lines]
[elevation?]
(if platform/ios?
{:shadow-radius 20
:shadow-opacity (colors/theme-colors 0.1 0.7)
:shadow-color colors/neutral-100
:shadow-offset {:width 0 :height (colors/theme-colors -4 -8)}}
{:elevation (if (> lines 1) 10 0)}))
{:elevation (if elevation? 10 0)}))
(defn sheet-container
[insets opacity lines]
[insets opacity elevation?]
(reanimated/apply-animations-to-style
{:opacity opacity}
(merge
@@ -29,7 +29,7 @@
:background-color (colors/theme-colors colors/white colors/neutral-95)
:z-index 3
:padding-bottom (:bottom insets)}
(shadow lines))))
(shadow elevation?))))
(def bar-container
{:height constants/bar-container-height
@@ -60,17 +60,21 @@
(if platform/ios? lines (dec lines))))
(defn calc-max-height
[window-height kb-height insets images]
[window-height kb-height insets images? reply?]
(let [margin-top (if platform/ios? (:top insets) (+ 10 (:top insets)))
max-height (- window-height
margin-top
kb-height
constants/bar-container-height
constants/actions-container-height)]
(if (seq images)
(- max-height constants/images-container-height)
max-height)))
constants/actions-container-height)
max-height (if images? (- max-height constants/images-container-height) max-height)
max-height (if reply? (- max-height constants/reply-container-height) max-height)]
max-height))
(defn empty-input?
[input-text images]
(and (nil? input-text) (empty? images)))
[text images reply?]
(and (empty? text) (empty? images) (not reply?)))
(defn android-elevation?
[lines images reply?]
(or (> lines 1) (seq images) reply?))
@@ -9,6 +9,7 @@
[utils.i18n :as i18n]
[status-im2.contexts.chat.bottom-sheet-composer.style :as style]
[status-im2.contexts.chat.bottom-sheet-composer.images.view :as images]
[status-im2.contexts.chat.bottom-sheet-composer.reply.view :as reply]
[utils.re-frame :as rf]
[status-im2.contexts.chat.bottom-sheet-composer.utils :as utils]
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]
@@ -29,7 +30,9 @@
:keyboard-frame-listener (atom nil)
:keyboard-hide-listener (atom nil)
:emoji-kb-extra-height (atom nil)
:saved-emoji-kb-extra-height (atom nil)}
:saved-emoji-kb-extra-height (atom nil)
:replying? (atom nil)
:sending-images? (atom nil)}
state {:text-value (reagent/atom "")
:cursor-position (reagent/atom 0)
:saved-cursor-position (reagent/atom 0)
@@ -43,6 +46,7 @@
[:f>
(fn []
(let [images (rf/sub [:chats/sending-image])
reply (rf/sub [:chats/reply-message])
{:keys [input-text input-content-height]
:as chat-input} (rf/sub [:chats/current-chat-input])
content-height (reagent/atom (or input-content-height
@@ -53,7 +57,8 @@
max-height (utils/calc-max-height window-height
kb-height
insets
images)
(seq images)
reply)
lines (utils/calc-lines @content-height)
max-lines (utils/calc-lines max-height)
initial-height (if (> lines 1)
@@ -64,7 +69,8 @@
:container-opacity (reanimated/use-shared-value
(if (utils/empty-input?
input-text
images)
images
reply)
0.7
1))
:height (reanimated/use-shared-value
@@ -83,20 +89,25 @@
:window-height window-height
:lines lines
:max-lines max-lines}
show-bottom-gradient? (utils/show-bottom-gradient? state dimensions)]
show-bottom-gradient? (utils/show-bottom-gradient? state dimensions)
android-elevation? (utils/android-elevation? lines images reply)]
(effects/initialize props
state
animations
dimensions
chat-input
keyboard-height
(seq images))
(seq images)
reply)
[gesture/gesture-detector
{:gesture (drag-gesture/drag-gesture props state animations dimensions keyboard-shown)}
[reanimated/view
{:style (style/sheet-container insets (:container-opacity animations) lines)
{:style (style/sheet-container insets
(:container-opacity animations)
android-elevation?)
:on-layout #(handler/layout % state blur-height)}
[sub-view/bar]
[reply/view]
[reanimated/touchable-opacity
{:active-opacity 1
:on-press (when @(:input-ref props) #(.focus ^js @(:input-ref props)))
@@ -106,7 +117,7 @@
{:ref #(reset! (:input-ref props) %)
:default-value @(:text-value state)
:on-focus #(handler/focus props state animations dimensions)
:on-blur #(handler/blur state animations dimensions images)
:on-blur #(handler/blur state animations dimensions images reply)
:on-content-size-change #(handler/content-size-change %
state
animations
@@ -17,7 +17,7 @@
;; TODO (flexsurfer) probably we don't want reactions here
(if (or deleted? deleted-for-me?)
[content.deleted/deleted-message message context]
[message/message-with-reactions message context]))
[message/message-with-reactions message context (atom false)]))
(defn pinned-messages
[chat-id]
@@ -150,22 +150,27 @@
{:position :absolute
:bottom (+ (:bottom insets) composer.constants/composer-default-height 6)}]])))
(defn use-keyboard-visibility
[]
(let [show-listener (atom nil)
hide-listener (atom nil)
shown? (atom nil)]
(rn/use-effect
(fn []
(reset! show-listener
(.addListener rn/keyboard "keyboardWillShow" #(reset! shown? true)))
(reset! hide-listener
(.addListener rn/keyboard "keyboardWillHide" #(reset! shown? false)))
(fn []
(.remove ^js @show-listener)
(.remove ^js @hide-listener))))
{:shown? shown?}))
(defn- f-messages-list
[chat insets]
(let [{keyboard-shown? :shown?} (use-keyboard-visibility)]
[messages-list-content chat insets keyboard-shown?]))
(defn messages-list
[chat insets]
[:f>
(fn []
(let [keyboard-show-listener (atom nil)
keyboard-hide-listener (atom nil)
keyboard-shown (atom false)]
(rn/use-effect
(fn []
(reset! keyboard-show-listener (.addListener rn/keyboard
"keyboardWillShow"
#(reset! keyboard-shown true)))
(reset! keyboard-hide-listener (.addListener rn/keyboard
"keyboardWillHide"
#(reset! keyboard-shown false)))
(fn []
(.remove ^js @keyboard-show-listener)
(.remove ^js @keyboard-hide-listener))))
[messages-list-content chat insets keyboard-shown]))])
[:f> f-messages-list chat insets])
@@ -1,29 +1,8 @@
(ns status-im2.contexts.chat.messages.pin.banner.view
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn resolve-message
[parsed-text]
(reduce
(fn [acc {:keys [type literal destination] :as some-text}]
(str acc
(case type
"paragraph"
(resolve-message (:children some-text))
"mention"
(rf/sub [:messages/resolve-mention literal])
"status-tag"
(str "#" literal)
"link"
destination
literal)))
""
parsed-text))
[utils.re-frame :as rf]
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
(defn banner
[chat-id]
@@ -35,7 +14,7 @@
latest-pin-text
(cond deleted? (i18n/label :t/message-deleted-for-everyone)
deleted-for-me? (i18n/label :t/message-deleted-for-you)
:else (resolve-message latest-pin-text))]
:else (resolver/resolve-message latest-pin-text))]
[quo/banner
{:latest-pin-text latest-pin-text
:pins-count pins-count
@@ -0,0 +1,24 @@
(ns status-im2.contexts.chat.messages.resolver.message-resolver
(:require [utils.re-frame :as rf]))
(defn resolve-message
[parsed-text]
(reduce
(fn [acc {:keys [type literal destination] :as some-text}]
(str acc
(case type
"paragraph"
(resolve-message (:children some-text))
"mention"
(rf/sub [:messages/resolve-mention literal])
"status-tag"
(str "#" literal)
"link"
destination
literal)))
""
parsed-text))
@@ -1,5 +1,5 @@
(ns status-im2.contexts.chat.messages.pin.banner.view-test
(:require [status-im2.contexts.chat.messages.pin.banner.view :as view]
(ns status-im2.contexts.chat.messages.resolver.message-resolver-test
(:require [status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]
[cljs.test :as t]
[utils.re-frame :as rf]))
@@ -29,6 +29,6 @@
(t/deftest test-resolve-message
(with-redefs [rf/sub sub]
(t/testing ""
(let [text (view/resolve-message parsed-text)]
(let [text (resolver/resolve-message parsed-text)]
(t/is (= text
"foobar i just mention you here to debug this issue https://foo.bar , no worries"))))))
@@ -4,11 +4,14 @@
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im2.config :as config]
[status-im2.constants :as constants]
[status-im2.contexts.chat.bottom-sheet-composer.view :as bottom-sheet-composer]
[status-im2.contexts.chat.messages.composer.view :as composer]
[status-im2.contexts.chat.messages.contact-requests.bottom-drawer :as
contact-requests.bottom-drawer]
[status-im2.contexts.chat.messages.list.view :as messages.list]
[status-im2.contexts.chat.messages.list.new-temp-view :as messages.list.new]
[status-im2.contexts.chat.messages.pin.banner.view :as pin.banner]
[status-im2.navigation.state :as navigation.state]
[utils.debounce :as debounce]
@@ -75,10 +78,15 @@
:keyboardVerticalOffset (- (:bottom insets))}
[page-nav]
[pin.banner/banner chat-id]
[messages.list/messages-list chat insets]
(if config/new-composer-enabled?
[messages.list.new/messages-list chat insets]
[messages.list/messages-list chat insets])
(if-not able-to-send-message?
[contact-requests.bottom-drawer/view chat-id contact-request-state group-chat]
[:f> composer/f-composer chat-id insets])]))
(if config/new-composer-enabled?
[bottom-sheet-composer/bottom-sheet-composer insets]
[:f> composer/f-composer chat-id insets]))]))
(defn chat
[]
@@ -22,6 +22,10 @@
:size :paragraph-1
:style style/text}
(i18n/label :t/leave-community-message)]
[quo/text
{:size :paragraph-1
:style style/text}
(i18n/label :t/leave-community-note)]
[rn/view
{:style style/button-container}
[quo/button
@@ -30,7 +34,7 @@
:style style/cancel-button}
(i18n/label :t/cancel)]
[quo/button
{:on-press #(hide-sheet-and-dispatch [:communities/leave id])
{:on-press #(hide-sheet-and-dispatch [:communities/request-to-leave id])
:style style/action-button}
(i18n/label :t/leave-community)]]]])
@@ -6,7 +6,8 @@
[quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.requests :as requests]))
[utils.requests :as requests]
[react-native.gesture :as gesture]))
(defn request-to-join-text
[is-open?]
@@ -28,7 +29,7 @@
pending? (rf/sub [:communities/my-pending-request-to-join id])
is-open? (not= 3 (:access permissions))]
[rn/view {:flex 1 :margin-top 40}
[rn/scroll-view {:style {:flex 1}}
[gesture/scroll-view {:style {:flex 1}}
[rn/view style/page-container
[rn/view
{:style style/title-container}
@@ -1,17 +1,58 @@
(ns status-im2.contexts.onboarding.common.background.view
(:require [react-native.core :as rn]
[react-native.blur :as blur]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.common.carousel.view :as carousel]
[status-im2.contexts.onboarding.common.background.style :as style]
[react-native.reanimated :as reanimated]
[status-im2.contexts.onboarding.common.carousel.animation :as carousel.animation]))
(def header-text
[{:text (i18n/label :t/join-decentralised-communities)
:sub-text (i18n/label :t/participate-in-the-metaverse)}
{:text (i18n/label :t/chat-with-friends)
:sub-text (i18n/label :t/with-full-encryption)}
{:text (i18n/label :t/own-your-crypto)
:sub-text (i18n/label :t/use-the-multichain-wallet)}
{:text (i18n/label :t/discover-web3)
:sub-text (i18n/label :t/explore-the-decentralized-web)}])
(defn background-image
[content-width]
[rn/image
{:style {:resize-mode :stretch
:width content-width}
:source (resources/get-image :onboarding-illustration)}])
(defonce progress (atom nil))
(defonce paused (atom nil))
(defn f-view
[dark-overlay?]
(let [animate? (not dark-overlay?)]
(when animate? (carousel.animation/initialize-animation))
(let [view-id (rf/sub [:view-id])
animate? (not dark-overlay?)
window-width (rf/sub [:dimensions/window-width])]
(when animate?
(carousel.animation/use-initialize-animation progress paused animate?))
(rn/use-effect
(fn []
(reanimated/set-shared-value @paused (not= view-id :intro))
(fn []
(when (= view-id :generating-keys)
(carousel.animation/cleanup-animation progress paused))))
[view-id])
[rn/view
{:style style/background-container}
[:f> carousel/f-view animate?]
[carousel/view
{:animate? animate?
:progress progress
:header-text header-text
:header-background true
:background [background-image (* 4 window-width)]}]
(when dark-overlay?
[blur/view
{:style style/background-blur-overlay
@@ -20,6 +61,5 @@
:blur-type :transparent
:overlay-color :transparent}])]))
(defn view
[dark-overlay?]
[:f> f-view dark-overlay?])
(defn view [dark-overlay?] [:f> f-view dark-overlay?])
@@ -1,11 +1,9 @@
(ns status-im2.contexts.onboarding.common.carousel.animation
(:require
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[utils.worklets.onboarding-carousel :as worklets.onboarding-carousel]))
(def progress (atom nil))
(def paused (atom nil))
(def ^:const progress-bar-animation-delay 300)
(def ^:const progress-bar-animation-duration 4000)
@@ -33,14 +31,23 @@
-1)
paused)))
(defn initialize-animation
[]
(defn use-initialize-animation
[progress paused animate?]
(reset! progress (reanimated/use-shared-value 0))
(reset! paused (reanimated/use-shared-value false))
(animate-progress @progress @paused))
(rn/use-effect
(fn []
(animate-progress @progress @paused))
[animate?]))
(defn cleanup-animation
[progress paused]
(fn []
(reanimated/cancel-animation @progress)
(reanimated/cancel-animation @paused)))
(defn carousel-left-position
[window-width animate?]
[window-width animate? progress]
(if animate?
(worklets.onboarding-carousel/carousel-left-position window-width @progress)
(-> (or (reanimated/get-shared-value @progress) 0)
@@ -48,7 +55,7 @@
(* window-width))))
(defn dynamic-progress-bar-width
[progress-bar-width animate?]
[progress-bar-width animate? progress]
(if animate?
(worklets.onboarding-carousel/dynamic-progress-bar-width progress-bar-width @progress)
(-> (or (reanimated/get-shared-value @progress) 0)
@@ -4,7 +4,7 @@
[react-native.reanimated :as reanimated]))
(defn header-container
[status-bar-height content-width index]
[status-bar-height content-width index header-background]
{:position :absolute
:top 0
:left (* content-width index)
@@ -12,7 +12,7 @@
:width content-width
:height (+ 96 status-bar-height)
:flex-direction :row
:background-color colors/onboarding-header-black})
:background-color (when header-background colors/onboarding-header-black)})
(defn header-text-view
[window-width]
@@ -27,11 +27,6 @@
{:color colors/white
:margin-top 2})
(defn background-image
[content-width]
{:resize-mode :stretch
:width content-width})
(defn progress-bar-item
[static? end?]
{:height 2
@@ -1,26 +1,14 @@
(ns status-im2.contexts.onboarding.common.carousel.view
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[react-native.core :as rn]
[react-native.navigation :as navigation]
[react-native.reanimated :as reanimated]
[status-im2.common.resources :as resources]
[status-im2.contexts.onboarding.common.carousel.style :as style]
[status-im2.contexts.onboarding.common.carousel.animation :as animation]))
(def header-text
[{:text (i18n/label :t/join-decentralised-communities)
:sub-text (i18n/label :t/participate-in-the-metaverse)}
{:text (i18n/label :t/chat-with-friends)
:sub-text (i18n/label :t/with-full-encryption)}
{:text (i18n/label :t/own-your-crypto)
:sub-text (i18n/label :t/use-the-multichain-wallet)}
{:text (i18n/label :t/discover-web3)
:sub-text (i18n/label :t/explore-the-decentralized-web)}])
(defn header-text-view
[index window-width]
[index window-width header-text]
[rn/view {:style (style/header-text-view window-width)}
[quo/text
{:style style/carousel-text
@@ -33,16 +21,14 @@
(get-in header-text [index :sub-text])]])
(defn content-view
[{:keys [window-width status-bar-height index]}]
[{:keys [window-width status-bar-height index header-text header-background]} content]
(let [content-width (* 4 window-width)]
[:<>
[rn/image
{:style (style/background-image content-width)
:source (resources/get-image :onboarding-illustration)}]
[rn/view {:style (style/header-container status-bar-height content-width index)}
(when content content)
[rn/view {:style (style/header-container status-bar-height content-width index header-background)}
(for [index (range 4)]
^{:key index}
[header-text-view index window-width])]]))
[header-text-view index window-width header-text])]]))
(defn progress-bar
[{:keys [static? progress-bar-width]}]
@@ -54,8 +40,8 @@
[rn/view {:style (style/progress-bar-item static? true)}]])
(defn f-dynamic-progress-bar
[progress-bar-width animate?]
(let [width (animation/dynamic-progress-bar-width progress-bar-width animate?)
[{:keys [progress-bar-width animate? progress]}]
(let [width (animation/dynamic-progress-bar-width progress-bar-width animate? progress)
container-view (if animate? reanimated/view rn/view)]
[container-view {:style (style/dynamic-progress-bar width animate?)}
[progress-bar
@@ -63,18 +49,12 @@
:progress-bar-width progress-bar-width}]]))
(defn f-view
[animate?]
[{:keys [animate? progress header-text background header-background]}]
(let [window-width (rf/sub [:dimensions/window-width])
view-id (rf/sub [:view-id])
status-bar-height (:status-bar-height @navigation/constants)
progress-bar-width (- window-width 40)
carousel-left (animation/carousel-left-position window-width animate?)
carousel-left (animation/carousel-left-position window-width animate? progress)
container-view (if animate? reanimated/view rn/view)]
(when animate?
(rn/use-effect
(fn []
(reanimated/set-shared-value @animation/paused (not= view-id :intro)))
[view-id]))
[:<>
[container-view {:style (style/carousel-container carousel-left animate?)}
(for [index (range 2)]
@@ -82,7 +62,10 @@
[content-view
{:window-width window-width
:status-bar-height status-bar-height
:index index}])]
:index index
:header-text header-text
:header-background header-background}
(when background background)])]
[rn/view
{:style (style/progress-bar-container
progress-bar-width
@@ -90,4 +73,10 @@
[progress-bar
{:static? true
:progress-bar-width progress-bar-width}]
[:f> f-dynamic-progress-bar progress-bar-width animate?]]]))
[:f> f-dynamic-progress-bar
{:progress-bar-width progress-bar-width
:animate? animate?
:progress progress}]]]))
(defn view [props] [:f> f-view props])
@@ -8,7 +8,7 @@
[clojure.string :as string]
[utils.i18n :as i18n]
[utils.security.core :as security]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.ethereum.core :as ethereum]
[status-im2.constants :as constants]
[status-im2.contexts.onboarding.profiles.view :as profiles.view]))
@@ -16,12 +16,12 @@
(re-frame/reg-fx
:multiaccount/create-account-and-login
(fn [request]
(status/create-account-and-login request)))
(native-module/create-account-and-login request)))
(re-frame/reg-fx
:multiaccount/validate-mnemonic
(fn [[mnemonic on-success on-error]]
(status/validate-mnemonic
(native-module/validate-mnemonic
(security/safe-unmask-data mnemonic)
(fn [result]
(let [{:keys [error keyUID]} (types/json->clj result)]
@@ -32,7 +32,7 @@
(re-frame/reg-fx
:multiaccount/restore-account-and-login
(fn [request]
(status/restore-account-and-login request)))
(native-module/restore-account-and-login request)))
(rf/defn profile-data-set
{:events [:onboarding-2/profile-data-set]}
@@ -86,14 +86,14 @@
(security/safe-unmask-data seed-phrase))
:imagePath (strip-file-prefix image-path)
:customizationColor color
:backupDisabledDataDir (status/backup-disabled-data-dir)
:rootKeystoreDir (status/keystore-dir)
:backupDisabledDataDir (native-module/backup-disabled-data-dir)
:rootKeystoreDir (native-module/keystore-dir)
;; Temporary fix until https://github.com/status-im/status-go/issues/3024 is
;; resolved
:wakuV2Nameserver "1.1.1.1"
:logLevel (when log-enabled? config/log-level)
:logEnabled log-enabled?
:logFilePath (status/log-file-directory)
:logFilePath (native-module/log-file-directory)
:openseaAPIKey config/opensea-api-key
:verifyTransactionURL config/verify-transaction-url
:verifyENSURL config/verify-ens-url
@@ -166,7 +166,7 @@
constants/auth-method-biometric
(get-in db [:onboarding-2/profile :auth-method]))]
(cond-> {:dispatch [:navigate-to :enable-notifications]}
(cond-> {:dispatch [:navigate-to :identifiers]}
biometric-enabled?
(assoc :biometric/enable-and-save-password
{:key-uid key-uid
@@ -0,0 +1,20 @@
(ns status-im2.contexts.onboarding.identifiers.style)
(def page-container
{:flex 1})
(def content-container
{:position :absolute
:top 160
:bottom 0
:left 0
:right 0})
(def card-style
{:margin-horizontal 20
:margin-bottom :auto})
(def button
{:justify-self :flex-end
:margin-bottom 46
:margin-horizontal 20})
@@ -0,0 +1,61 @@
(ns status-im2.contexts.onboarding.identifiers.view
(:require [react-native.core :as rn]
[clojure.string :as string]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[quo2.core :as quo]
[quo2.foundations.colors :as colors]
[status-im2.contexts.onboarding.identifiers.style :as style]
[status-im2.contexts.onboarding.common.background.view :as background]
[status-im2.contexts.onboarding.common.carousel.view :as carousel]
[status-im2.contexts.onboarding.common.carousel.animation :as carousel.animation]))
(def header-text
[{:text (i18n/label :t/unique-identifiers)
:sub-text (i18n/label :t/your-identifiers)}
{:text (i18n/label :t/identicon-ring)
:sub-text (i18n/label :t/identicon-ring-explanation)}
{:text (i18n/label :t/chat-key-title)
:sub-text (i18n/label :t/chat-key-description)}
{:text (i18n/label :t/emojihash)
:sub-text (i18n/label :t/emojihash-description)}])
(defn f-view
[]
(let [progress (atom nil)
paused (atom nil)
{:keys [emoji-hash display-name compressed-key
public-key]} (rf/sub [:multiaccount])
{:keys [color]} (rf/sub [:onboarding-2/profile])
photo-path (rf/sub [:chats/photo-path public-key])
emoji-string (string/join emoji-hash)]
(carousel.animation/use-initialize-animation progress paused true)
(rn/use-effect
(fn []
(carousel.animation/cleanup-animation progress paused))
[])
[:<>
[background/view true]
[rn/view {:style style/page-container}
[carousel/view
{:animate? true
:progress progress
:header-text header-text}]
[rn/view {:style style/content-container}
[quo/profile-card
{:profile-picture photo-path
:name display-name
:hash compressed-key
:customization-color color
:emoji-hash emoji-string
:show-emoji-hash? true
:show-user-hash? true
:card-style style/card-style}]
[quo/button
{:accessibility-label :skip-identifiers
:on-press #(rf/dispatch [:navigate-to :enable-notifications])
:override-background-color colors/white-opa-5
:style style/button}
(i18n/label :t/skip)]]]]))
(defn view [props] [:f> f-view props])
@@ -7,7 +7,7 @@
[react-native.core :as rn]
[utils.transforms :as types]
[utils.security.core :as security]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im2.contexts.onboarding.profiles.style :as style]
[status-im2.common.confirmation-drawer.view :as confirmation-drawer]
[status-im2.contexts.onboarding.common.background.view :as background]))
@@ -45,7 +45,7 @@
:close-button-text (i18n/label :t/cancel)
:on-press #(do
(rf/dispatch [:hide-bottom-sheet])
(status/delete-multiaccount
(native-module/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
+84 -81
View File
@@ -92,247 +92,250 @@
(def screens-categories
{:foundations [{:name :shadows
:insets {:top false}
:options {:topBar {:visible true}}
:component shadows/preview-shadows}]
:animated-list [{:name :animated-header-list
:options {:topBar {:visible false}}
:component animated-header-list/mock-screen}]
:avatar [{:name :group-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component group-avatar/preview-group-avatar}
{:name :icon-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component icon-avatar/preview-icon-avatar}
{:name :user-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component user-avatar/preview-user-avatar}
{:name :wallet-user-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component wallet-user-avatar/preview-wallet-user-avatar}
{:name :channel-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component channel-avatar/preview-channel-avatar}
{:name :account-avatar
:insets {:top false}
:options {:topBar {:visible true}}
:component account-avatar/preview-account-avatar}]
:banner [{:name :banner
:insets {:top false}
:options {:topBar {:visible true}}
:component banner/preview-banner}]
:buttons [{:name :button
:insets {:top false}
:options {:topBar {:visible true}}
:component button/preview-button}
{:name :dynamic-button
:insets {:top false}
:options {:topBar {:visible true}}
:component dynamic-button/preview-dynamic-button}]
:code [{:name :snippet
:insets {:top false}
:options {:topBar {:visible true}}
:component code-snippet/preview-code-snippet}]
:colors [{:name :color-picker
:insets {:top false}
:options {:topBar {:visible true}}
:component color-picker/preview-color-picker}]
:community [{:name :community-card-view
:insets {:top false}
:options {:topBar {:visible true}}
:component community-card/preview-community-card}
{:name :community-list-view
:insets {:top false}
:options {:topBar {:visible true}}
:component community-list-view/preview-community-list-view}
{:name :community-membership-list-view
:insets {:top false}
:options {:topBar {:visible true}}
:component community-membership-list-view/preview-community-list-view}
{:name :discover-card
:insets {:top false}
:options {:topBar {:visible true}}
:component discover-card/preview-discoverd-card}
{:name :token-gating
:insets {:top false}
:options {:topBar {:visible true}}
:component token-gating/preview-token-gating}]
:counter [{:name :counter
:insets {:top false}
:options {:topBar {:visible true}}
:component counter/preview-counter}
{:name :step
:insets {:top false}
:options {:topBar {:visible true}}
:component step/preview-step}]
:dividers [{:name :divider-label
:inset {:top false}
:options {:topBar {:visible true}}
:component divider-label/preview-divider-label}
{:name :new-messages
:insets {:top false}
:options {:topBar {:visible true}}
:component new-messages/preview-new-messages}
{:name :divider-date
:insets {:top false}
:options {:topBar {:visible true}}
:component divider-date/preview-divider-date}
{:name :strength-divider
:insets {:top false}
:options {:topBar {:visible true}}
:component strength-divider/preview-strength-divider}]
:drawers [{:name :action-drawers
:insets {:top false}
:options {:topBar {:visible true}}
:component action-drawers/preview-action-drawers}
{:name :drawer-buttons
:insets {:top false}
:options {:topBar {:visible true}}
:component drawer-buttons/preview-drawer-buttons}
{:name :permission-drawers
:insets {:top false}
:options {:topBar {:visible true}}
:component permission-drawers/preview-permission-drawers}]
:dropdowns [{:name :dropdown
:insets {:top false}
:options {:topBar {:visible true}}
:component dropdown/preview-dropdown}]
:info [{:name :info-message
:insets {:top false}
:options {:topBar {:visible true}}
:component info-message/preview-info-message}
{:name :information-box
:insets {:top false}
:options {:topBar {:visible true}}
:component information-box/preview-information-box}]
:inputs [{:name :input
:insets {:top false}
:options {:topBar {:visible true}}
:component input/preview-input}
{:name :profile-input
:insets {:top false}
:options {:topBar {:visible true}}
:component profile-input/preview-profile-input}
{:name :recovery-phrase-input
:insets {:top false}
:options {:topBar {:visible true}}
:component recovery-phrase-input/preview-recovery-phrase-input}
{:name :search-input
:insets {:top false}
:options {:topBar {:visible true}}
:component search-input/preview-search-input}
{:name :title-input
:insets {:top false}
:options {:topBar {:visible true}}
:component title-input/preview-title-input}]
:links [{:name :url-preview
:options {:insets {:top? true}}
:options {:insets {:top? true}
:topBar {:visible true}}
:component url-preview/preview}
{:name :url-preview-list
:options {:insets {:top? true}}
:options {:insets {:top? true}
:topBar {:visible true}}
:component url-preview-list/preview}
{:name :link-preview
:options {:insets {:top? true}}
:options {:insets {:top? true}
:topBar {:visible true}}
:component link-preview/preview}]
:list-items [{:name :channel
:insets {:top false}
:options {:topBar {:visible true}}
:component channel/preview-channel}
{:name :preview-lists
:insets {:top false}
:options {:topBar {:visible true}}
:component preview-lists/preview-preview-lists}
{:name :user-list
:insets {:top false}
:options {:topBar {:visible true}}
:component user-list/preview-user-list}]
:markdown [{:name :texts
:insets {:top false}
:options {:topBar {:visible true}}
:component text/preview-text}]
:messages [{:name :gap
:insets {:top false}
:options {:topBar {:visible true}}
:component messages-gap/preview-messages-gap}
{:name :system-messages
:insets {:top false}
:options {:topBar {:visible true}}
:component system-message/preview-system-message}
{:name :author
:insets {:top false}
:options {:topBar {:visible true}}
:component messages-author/preview-author}]
:navigation [{:name :bottom-nav-tab
:insets {:top false}
:options {:topBar {:visible true}}
:component bottom-nav-tab/preview-bottom-nav-tab}
{:name :top-nav
:insets {:top false}
:options {:topBar {:visible true}}
:component top-nav/preview-top-nav}
{:name :page-nav
:insets {:top false}
:options {:topBar {:visible true}}
:component page-nav/preview-page-nav}
{:name :floating-shell-button
:insets {:top false}
:options {:topBar {:visible true}}
:component floating-shell-button/preview-floating-shell-button}]
:notifications [{:name :activity-logs
:insets {:top false}
:options {:topBar {:visible true}}
:component activity-logs/preview-activity-logs}
{:name :toast
:insets {:top false}
:options {:topBar {:visible true}}
:component toast/preview-toasts}
{:name :notification
:insets {:top false}
:options {:topBar {:visible true}}
:component notification/preview-notification}]
:onboarding [{:name :small-option-card
:insets {:top false}
:options {:topBar {:visible true}}
:component small-option-card/preview-small-option-card}]
:posts-and-attachments [{:name :messages-skeleton
:insets {:top false}
:options {:topBar {:visible true}}
:component messages-skeleton/preview-messages-skeleton}]
:password [{:name :tips
:insets {:top false}
:options {:topBar {:visible true}}
:component tips/preview-tips}]
:profile [{:name :profile-card
:insets {:top false}
:options {:topBar {:visible true}}
:component profile-card/preview-profile-card}
{:name :collectible
:insets {:top false}
:options {:topBar {:visible true}}
:component collectible/preview-collectible}
{:name :select-profile
:insets {:top false}
:options {:topBar {:visible true}}
:component select-profile/preview-select-profile}]
:reactions [{:name :react
:insets {:top false}
:options {:topBar {:visible true}}
:component react/preview-react}]
:record-audio [{:name :record-audio
:insets {:top false}
:options {:topBar {:visible true}}
:component record-audio/preview-record-audio}]
:switcher [{:name :switcher-cards
:insets {:top false}
:options {:topBar {:visible true}}
:component switcher-cards/preview-switcher-cards}]
:selectors [{:name :disclaimer
:insets {:top false}
:options {:topBar {:visible true}}
:component disclaimer/preview-disclaimer}
{:name :filter
:insets {:top false}
:options {:topBar {:visible true}}
:component filter/preview}
{:name :selectors
:insets {:top false}
:options {:topBar {:visible true}}
:component selectors/preview-selectors}]
:settings [{:name :privacy-option
:insets {:top false}
:options {:topBar {:visible true}}
:component privacy-option/preview-options}
{:name :accounts
:insets {:top false}
:options {:topBar {:visible true}}
:component accounts/preview-accounts}]
:share [{:name :qr-code
:insets {:top false}
:options {:topBar {:visible true}}
:component qr-code/preview-qr-code}
{:name :share-qr-code
:insets {:top false}
:options {:topBar {:visible true}}
:component share-qr-code/preview-share-qr-code}]
:tabs [{:name :segmented
:insets {:top false}
:options {:topBar {:visible true}}
:component segmented/preview-segmented}
{:name :tabs
:insets {:top false}
:options {:topBar {:visible true}}
:component tabs/preview-tabs}
{:name :account-selector
:insets {:top false}
:options {:topBar {:visible true}}
:component account-selector/preview-this}]
:tags [{:name :context-tags
:insets {:top false}
:options {:topBar {:visible true}}
:component context-tags/preview-context-tags}
{:name :tags
:insets {:top false}
:options {:topBar {:visible true}}
:component tags/preview-tags}
{:name :permission-tag
:insets {:top false}
:options {:topBar {:visible true}}
:component permission-tag/preview-permission-tag}
{:name :status-tags
:insets {:top false}
:options {:topBar {:visible true}}
:component status-tags/preview-status-tags}
{:name :token-tag
:insets {:top false}
:options {:topBar {:visible true}}
:component token-tag/preview-token-tag}]
:text-combinations [{:name :title
:insets {:top false}
:options {:topBar {:visible true}}
:component title/preview-title}]
:wallet [{:name :lowest-price
:insets {:top false}
:options {:topBar {:visible true}}
:component lowest-price/preview-lowest-price}
{:name :token-overview
:insets {:top false}
:options {:topBar {:visible true}}
:component token-overview/preview-token-overview}
{:name :network-breakdown
:insets {:top false}
:options {:topBar {:visible true}}
:component network-breakdown/preview-network-breakdown}
{:name :network-amount
:insets {:top false}
:options {:topBar {:visible true}}
:component network-amount/preview}]})
(def screens (flatten (map val screens-categories)))
@@ -374,5 +377,5 @@
(def main-screens
[{:name :quo2-preview
:insets {:top false}
:options {:topBar {:visible true}}
:component main-screen}])
@@ -2,22 +2,57 @@
(:require [quo2.foundations.colors :as colors]
[react-native.core :as rn]
[quo2.core :as quo]
[status-im2.common.resources :as resources]))
[utils.image-server :as image-server]
[utils.re-frame :as rf]
[reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview]))
(def descriptor
[{:label "URL For QR"
:key :text
:type :text}
{:label "Error Correction Level:"
:key :error-correction-level
:type :select
:options [{:key :low
:value "Low"}
{:key :medium
:value "Medium"}
{:key :quart
:value "Quart"}
{:key :highest
:value "Highest"}]}])
(defn cool-preview
[]
(fn []
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
[rn/view {:style {:padding-bottom 150}}
[rn/view {:style {:flex 1}}]
[rn/view
{:style {:padding-vertical 60
:flex-direction :row
:justify-content :center}}
[quo/qr-code
{:source (resources/get-mock-image :qr-code)
:height 250
:width 250}]]]]))
(let [state (reagent/atom {:text "https://status.im"
:error-correction-level :highest})
text (reagent/cursor state [:text])
error-correction-level (reagent/cursor state [:error-correction-level])
media-server-uri (reagent/atom "")]
(fn []
(reset! media-server-uri (image-server/get-qr-image-uri-for-any-url
{:url @text
:port (rf/sub [:mediaserver/port])
:error-level @error-correction-level
:qr-size 250}))
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
[rn/view {:style {:padding-bottom 150}}
[preview/customizer state descriptor]
[rn/view {:style {:flex 1}}]
[rn/view
{:style {:padding-vertical 60
:flex-direction :row
:justify-content :center}}
[rn/view
[quo/qr-code
{:source {:uri @media-server-uri}
:height 250
:width 250}]
[rn/view
[rn/text {:style {:padding 20 :flex-shrink 1}} "Media server url -> "
@media-server-uri]]]]]])))
(defn preview-qr-code
[]
+3 -3
View File
@@ -93,13 +93,13 @@
(fn [acc id]
(let [tabs-icon-color-keyword (get shell.constants/tabs-icon-color-keywords id)
stack-opacity-keyword (get shell.constants/stacks-opacity-keywords id)
stack-pointer-keyword (get shell.constants/stacks-pointer-keywords id)]
stack-z-index-keyword (get shell.constants/stacks-z-index-keywords id)]
(assoc
acc
stack-opacity-keyword
(worklets.shell/stack-opacity (name id) selected-stack-id-sv)
stack-pointer-keyword
(worklets.shell/stack-pointer (name id) selected-stack-id-sv)
stack-z-index-keyword
(worklets.shell/stack-z-index (name id) selected-stack-id-sv)
tabs-icon-color-keyword
(worklets.shell/bottom-tab-icon-color
(name id)
+11 -6
View File
@@ -7,10 +7,14 @@
[react-native.fast-image :as fast-image]
[status-im2.constants :as constants]
[status-im2.contexts.shell.cards.style :as style]
[status-im2.contexts.shell.constants :as shell.constants]))
[status-im2.contexts.shell.constants :as shell.constants]
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
(defn content-container
[type {:keys [content-type data new-notifications? color-50 community-info community-channel]}]
[type
{:keys [content-type data new-notifications? color-50 community-info
community-channel]
{:keys [text parsed-text source]} :data}]
[rn/view {:style (style/content-container new-notifications?)}
(case type
shell.constants/community-card
@@ -52,7 +56,9 @@
:number-of-lines 1
:ellipsize-mode :tail
:style style/last-message-text}
data]
(if parsed-text
(resolver/resolve-message parsed-text)
text)]
constants/content-type-image
[quo/preview-list
@@ -63,13 +69,12 @@
constants/content-type-sticker
[fast-image/fast-image
{:source (:source data)
{:source source
:style style/sticker}]
constants/content-type-gif
[fast-image/fast-image
{:source (:source data)
{:source source
:style style/gif}]
constants/content-type-audio
+6 -6
View File
@@ -36,18 +36,18 @@
:wallet-stack :wallet-stack-opacity
:browser-stack :browser-stack-opacity})
(def stacks-pointer-keywords
{:communities-stack :communities-stack-pointer
:chats-stack :chats-stack-pointer
:wallet-stack :wallet-stack-pointer
:browser-stack :browser-stack-pointer})
(def tabs-icon-color-keywords
{:communities-stack :communities-tab-icon-color
:chats-stack :chats-tab-icon-opacity
:wallet-stack :wallet-tab-icon-opacity
:browser-stack :browser-tab-icon-opacity})
(def stacks-z-index-keywords
{:communities-stack :communities-stack-z-index
:chats-stack :chats-stack-z-index
:wallet-stack :wallet-stack-z-index
:browser-stack :browser-stack-z-index})
;; Home stack states
(def ^:const close-with-animation 0)
+13 -10
View File
@@ -18,14 +18,12 @@
(defn- f-stack-view
[stack-id shared-values]
;; TODO lazy loading doesn't work with functional components with hoocks (when (load-stack? stack-id))
;; Error: Rendered more hooks than during the previous render.
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity (get shared-values
(get shell.constants/stacks-opacity-keywords stack-id))
:pointer-events (get shared-values
(get shell.constants/stacks-pointer-keywords stack-id))}
{:opacity (get shared-values
(get shell.constants/stacks-opacity-keywords stack-id))
:z-index (get shared-values
(get shell.constants/stacks-z-index-keywords stack-id))}
{:position :absolute
:top 0
:bottom 0
@@ -38,6 +36,11 @@
:wallet-stack [wallet.accounts/accounts-overview]
:browser-stack [browser.stack/browser-stack])])
(defn lazy-screen
[stack-id shared-values]
(when (load-stack? stack-id)
[:f> f-stack-view stack-id shared-values]))
(defn f-home-stack
[]
(let [shared-values @animation/shared-values-atom
@@ -50,7 +53,7 @@
:transform [{:scale (:home-stack-scale shared-values)}]}
home-stack-original-style)]
[reanimated/view {:style home-stack-animated-style}
[:f> f-stack-view :communities-stack shared-values]
[:f> f-stack-view :chats-stack shared-values]
[:f> f-stack-view :browser-stack shared-values]
[:f> f-stack-view :wallet-stack shared-values]]))
[lazy-screen :communities-stack shared-values]
[lazy-screen :chats-stack shared-values]
[lazy-screen :browser-stack shared-values]
[lazy-screen :wallet-stack shared-values]]))
+5 -5
View File
@@ -1,5 +1,5 @@
(ns status-im2.contexts.syncing.events
(:require [status-im.native-module.core :as status]
(:require [native-module.core :as native-module]
[taoensso.timbre :as log]
[utils.re-frame :as rf]
[utils.security.core :as security]
@@ -51,13 +51,13 @@
:settingCurrentNetwork config/default-network
:deviceType utils.platform/os}}))]
(rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver])
(status/input-connection-string-for-bootstrapping
(native-module/input-connection-string-for-bootstrapping
connection-string
config-map
#(log/info "Initiated local pairing"
{:response %
:event :syncing/input-connection-string-for-bootstrapping}))))]
(status/prepare-dir-and-update-config "" default-node-config-string callback)))
(native-module/prepare-dir-and-update-config "" default-node-config-string callback)))
(rf/defn preparations-for-connection-string
{:events [:syncing/get-connection-string-for-bootstrapping-another-device]}
@@ -68,7 +68,7 @@
(rf/dispatch [:syncing/update-role constants/local-pairing-role-sender])
(rf/dispatch [:bottom-sheet/hide]))]
(if valid-password?
(let [sha3-pwd (status/sha3 (str (security/safe-unmask-data entered-password)))
(let [sha3-pwd (native-module/sha3 (str (security/safe-unmask-data entered-password)))
key-uid (get-in db [:multiaccount :key-uid])
config-map (.stringify js/JSON
(clj->js {:senderConfig {:keyUID key-uid
@@ -76,7 +76,7 @@
:password sha3-pwd
:deviceType utils.platform/os}
:serverConfig {:timeout 0}}))]
(status/get-connection-string-for-bootstrapping-another-device
(native-module/get-connection-string-for-bootstrapping-another-device
config-map
#(show-sheet %)))
(show-sheet ""))))
+6 -3
View File
@@ -15,7 +15,7 @@
[status-im2.setup.global-error :as global-error]
[status-im2.common.log :as log]
[status-im.async-storage.core :as async-storage]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.notifications.local :as notifications]
[status-im.utils.universal-links.core :as utils.universal-links]
status-im.events
@@ -27,12 +27,15 @@
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(def adjust-resize 16)
(defn init
[]
(native-module/init #(re-frame/dispatch [:signals/signal-received %]))
(when platform/android?
(native-module/set-soft-input-mode adjust-resize))
(log/setup config/log-level)
(global-error/register-handler)
(when platform/android?
(status/set-soft-input-mode status/adjust-resize))
(notifications/listen-notifications)
(.addEventListener rn/app-state "change" #(re-frame/dispatch [:app-state-change %]))
(react-native-languages/add-change-listener #(fn [lang]
+3 -4
View File
@@ -2,7 +2,7 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[status-im.utils.keychain.core :as keychain]
[status-im2.common.json-rpc.events]
[status-im2.common.theme.core :as theme]
@@ -25,13 +25,12 @@
(re-frame/reg-fx
:setup/open-multiaccounts
(fn [callback]
(status/open-accounts callback)))
(native-module/open-accounts callback)))
(re-frame/reg-fx
:setup/init-theme
(fn []
(theme/add-device-theme-change-listener
#(re-frame/dispatch [:system-theme-mode-changed %]))))
(theme/add-device-theme-change-listener)))
(rf/defn initialize-views
{:events [:setup/initialize-view]}
+4
View File
@@ -160,6 +160,8 @@
;; OVERLAY
(def dissmiss-overlay navigation/dissmiss-overlay)
(def dissmiss-all-overlays navigation/dissmiss-all-overlays)
(defn show-overlay
([comp] (show-overlay comp {}))
([comp opts]
@@ -173,6 +175,8 @@
:overlay {:interceptTouchOutside true}}
opts)}})))
(re-frame/reg-fx :dissmiss-all-overlays-fx dissmiss-all-overlays)
;; toast
(navigation/register-component "toasts" (fn [] views/toasts) js/undefined)
+9 -1
View File
@@ -70,7 +70,6 @@
{:events [:hide-bottom-sheet]}
[{:keys [db]}]
(let [{:keys [hide? sheets]} (:bottom-sheet db)]
(println :hide-bottom-sheet (not hide?) (seq sheets))
(when (and (not hide?) (seq sheets))
{:db (assoc-in db [:bottom-sheet :hide?] true)})))
@@ -140,3 +139,12 @@
key-uid
:keycard-pairing]))]
{:set-root (if keycard-account? :multiaccounts-keycard :multiaccounts)}))
(rf/defn dismiss-all-overlays
{:events [:dissmiss-all-overlays]}
[{:keys [db]}]
{:dissmiss-all-overlays-fx nil
:db (-> db
(dissoc :popover/popover)
(dissoc :visibility-status-popover/popover)
(assoc-in [:bottom-sheet :hide?] true))})
+2 -2
View File
@@ -31,12 +31,12 @@
(defn navbar
([dark?]
{:navigationBar {:backgroundColor (if (or dark? colors/dark?) colors/neutral-100 colors/white)}})
{:navigationBar {:backgroundColor (if (or dark? (colors/dark?)) colors/neutral-100 colors/white)}})
([] (navbar nil)))
(defn statusbar
([dark?]
(let [style (if (or dark? colors/dark?) :light :dark)]
(let [style (if (or dark? (colors/dark?)) :light :dark)]
(if platform/android?
{:statusBar {:translucent true
:backgroundColor :transparent
+7
View File
@@ -14,6 +14,7 @@
[status-im2.contexts.onboarding.create-profile.view :as create-profile]
[status-im2.contexts.onboarding.enable-biometrics.view :as enable-biometrics]
[status-im2.contexts.onboarding.enable-notifications.view :as enable-notifications]
[status-im2.contexts.onboarding.identifiers.view :as identifiers]
[status-im2.contexts.onboarding.welcome.view :as welcome]
[status-im2.contexts.onboarding.new-to-status.view :as new-to-status]
[status-im2.contexts.onboarding.sign-in.view :as sign-in]
@@ -120,6 +121,12 @@
:popStackOnPress false}}
:component enable-notifications/enable-notifications}
{:name :identifiers
:component identifiers/view
:options {:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}}
{:name :sign-in
:component sign-in/view}
+7 -7
View File
@@ -51,13 +51,13 @@
(defn screen
[key]
(let [{:keys [component options]}
(get (if js/goog.DEBUG (get-screens) screens) (keyword key)) ;; needed for hot reload
{:keys [insets sheet?]} options
background-color (or (get-in options [:layout :backgroundColor])
(when sheet? :transparent))]
(reagent.core/reactify-component
(fn []
(reagent.core/reactify-component
(fn []
(let [{:keys [component options]}
(get (if js/goog.DEBUG (get-screens) screens) (keyword key)) ;; needed for hot reload
{:keys [insets sheet?]} options
background-color (or (get-in options [:layout :backgroundColor])
(when sheet? :transparent))]
^{:key (str "root" key @reloader/cnt)}
[:<>
[rn/view
+1 -1
View File
@@ -21,7 +21,7 @@
(constants/content-type-text
constants/content-type-emoji)
{:content-type constants/content-type-text
:data (get-in last-message [:content :text])}
:data (get last-message :content)}
;; Currently mock image is used as placeholder,
;; as last-message don't have image
+53
View File
@@ -5,6 +5,8 @@
(def ^:const identicons-action "/messages/identicons")
(def ^:const account-images-action "/accountImages")
(def ^:const contact-images-action "/contactImages")
(def ^:const generate-qr-action "/GenerateQRCode")
(def ^:const status-profile-base-url "https://join.status.im/u/")
(defn timestamp [] (datetime/timestamp))
@@ -14,6 +16,15 @@
:light 1
:dark 2))
(defn correction-level->index
[level]
(case (keyword level)
:low 1
:medium 2
:quart 3
:highest 4
4))
(defn get-identicons-uri
[port public-key theme]
(str image-server-uri-prefix
@@ -58,3 +69,45 @@
"&clock="
clock
"&addRing=1"))
(defn get-account-qr-image-uri
[{:keys [key-uid public-key port qr-size]}]
(let [profile-qr-url (str status-profile-base-url public-key)
base-64-qr-url (js/btoa profile-qr-url)
profile-image-type "large"
error-correction-level (correction-level->index :highest)
superimpose-profile? true
media-server-url (str image-server-uri-prefix
port
generate-qr-action
"?level="
error-correction-level
"&url="
base-64-qr-url
"&keyUid="
key-uid
"&allowProfileImage="
superimpose-profile?
"&size="
qr-size
"&imageName="
profile-image-type)]
media-server-url))
(defn get-qr-image-uri-for-any-url
[{:keys [url port qr-size error-level]}]
(let [qr-url-base64 (js/btoa url)
error-correction-level (correction-level->index error-level)
superimpose-profile? false
media-server-url (str image-server-uri-prefix
port
generate-qr-action
"?level="
error-correction-level
"&url="
qr-url-base64
"&allowProfileImage="
superimpose-profile?
"&size="
qr-size)]
media-server-url))
@@ -1,4 +1,4 @@
(ns status-im2.utils.validators)
(ns utils.validators)
(defn valid-public-key?
[s]
@@ -1,6 +1,6 @@
(ns status-im2.utils.validators-test
(ns utils.validators-test
(:require [cljs.test :refer-macros [deftest testing is]]
[status-im2.utils.validators :refer [valid-compressed-key?]]))
[utils.validators :refer [valid-compressed-key?]]))
(deftest test-valid-compressed-key
(testing "valid"

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