Compare commits

..
Author SHA1 Message Date
Omar Basem f357e67529 lint 2023-04-26 13:38:53 +04:00
Omar Basem a7b27a0ef3 updates 2023-04-26 13:29:57 +04:00
Omar Basem 88aeb0ccfb updates 2023-04-26 13:29:57 +04:00
Omar Basem b54d8ad5f3 udpates 2023-04-26 13:29:57 +04:00
Omar Basem 7666026764 updates 2023-04-26 13:29:56 +04:00
Omar Basem 963745ecb6 updates 2023-04-26 13:29:56 +04:00
Omar Basem c689b81e01 udpates 2023-04-26 13:29:56 +04:00
Omar Basem b0f0e29706 review 2023-04-26 13:29:55 +04:00
Omar Basem b035c4621b lint 2023-04-26 13:29:55 +04:00
Omar Basem 10eb4330e6 review 2023-04-26 13:29:55 +04:00
Omar Basem c5d472ab9b revert pod 2023-04-26 13:29:55 +04:00
Omar Basem 1ae8dae700 lint 2023-04-26 13:29:54 +04:00
Omar Basem 35fb6354c6 composer reply 2023-04-26 13:29:54 +04:00
103 changed files with 822 additions and 848 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
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.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
status-im.ethereum.abi-spec/bytes-to-hex
status-im.android.core/init
status-im.chat.models.message/transport-keys
Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

+2 -2
View File
@@ -18,11 +18,11 @@ export function stackOpacity (stackId, selectedStackId) {
);
}
export function stackZIndex (stackId, selectedStackId) {
export function stackPointer (stackId, selectedStackId) {
return useDerivedValue(
function () {
'worklet'
return selectedStackId.value == stackId ? 10 : 9;
return selectedStackId.value == stackId ? "auto" : "none";
}
);
}
@@ -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,8 +37,6 @@
(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,10 +41,6 @@
[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]
[utils.validators :as validators]))
[status-im2.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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/call-rpc
(status/call-rpc
(types/clj->json payload)
(fn [response]
(if (= "" response)
@@ -559,7 +559,7 @@
(re-frame/reg-fx
:browser/clear-web-data
(fn []
(native-module/clear-web-data)))
(status/clear-web-data)))
(defn share-link
[url]
+20 -18
View File
@@ -6,6 +6,7 @@
[status-im.chat.models.mentions :as mentions]
[status-im.chat.models.message :as chat.message]
[status-im.chat.models.message-content :as message-content]
[status-im2.config :as config]
[status-im2.constants :as constants]
[utils.re-frame :as rf]
[utils.i18n :as i18n]
@@ -100,7 +101,8 @@
(update-in [:chat/inputs current-chat-id :metadata]
dissoc
:sending-image))}
(input/set-input-text text current-chat-id))))
(when-not config/new-composer-enabled?
(input/set-input-text text current-chat-id)))))
(rf/defn show-contact-request-input
"Sets reference to previous chat message and focuses on input"
@@ -175,7 +177,8 @@
[{:keys [db] :as cofx}]
(let [current-chat-id (:current-chat-id db)]
(rf/merge cofx
{:set-text-input-value [current-chat-id ""]}
(when-not config/new-composer-enabled?
{:set-text-input-value [current-chat-id ""]})
(clean-input current-chat-id)
(mentions/clear-mentions))))
@@ -219,22 +222,21 @@
(rf/defn send-edited-message
[{:keys [db] :as cofx} text {:keys [message-id quoted-message chat-id]}]
(let [pinned-message (get-in db [:pin-messages chat-id message-id])]
(rf/merge
cofx
{:json-rpc/call [{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text :response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
(cancel-message-edit))))
(rf/merge
cofx
{:json-rpc/call [{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text :response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
(cancel-message-edit)))
(rf/defn send-current-message
"Sends message from current chat input"
+68 -26
View File
@@ -4,8 +4,9 @@
[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]
[native-module.core :as native-module]))
[status-im.native-module.core :as status]))
(defn- transfer-input-segments
[segments]
@@ -55,8 +56,8 @@
:ensVerified :ens-verified
:added :added?
:displayName :display-name
:searchedText :searched-text})))
:searchedText :searched-text
})))
{}
mentionable-users))
(defn- transfer-mention-result
@@ -90,29 +91,38 @@
(assoc-in [:chats/mentions chat-id :mentions] state)
(assoc-in [:chat/inputs-with-mentions chat-id] input-segments))}))
(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})
(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})
{:json-rpc/call [{:method method
:params params
:on-success #(rf/dispatch [:mention/on-change-text-success %])
:params [chat-id state]
:on-success #(rf/dispatch [:mention/on-text-input-success %])
:on-error #(rf/dispatch [:mention/on-error
{:method method
:params params} %])}]}))
(rf/defn on-change-text-success
{:events [:mention/on-change-text-success]}
(rf/defn on-text-input-success
{:events [:mention/on-text-input-success]}
[{:keys [db]} result]
(log/debug "[mentions] on-text-input-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))}))
(let [{:keys [state chat-id]} (transfer-mention-result result)]
{:db (assoc-in db [:chats/mentions chat-id :mentions] state)}))
(rf/defn recheck-at-idxs
[{:keys [db]} public-key]
@@ -165,6 +175,16 @@
;; 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
@@ -200,7 +220,7 @@
(when text
(log/debug "[mentions] check-selection" {:params params})
{:json-rpc/call [{:method method
:params params
:params [chat-id text start end]
:on-success #(rf/dispatch [:mention/on-handle-selection-change-success %])
:on-error #(rf/dispatch [:mention/on-error
{:method method
@@ -210,16 +230,38 @@
{:events [:mention/on-handle-selection-change-success]}
[{:keys [db]} result]
(log/debug "[mentions] on-check-selection-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))}))
(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
(native-module/reset-keyboard-input
(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))}))
-21
View File
@@ -273,27 +273,6 @@
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]
[native-module.core :as native-module]))
[status-im.native-module.core :as status]))
(defn sha3
[s]
(when s
(native-module/sha3 (str s))))
(status/sha3 (str s))))
(defn utf8-to-hex
[s]
(let [hex (native-module/utf8-to-hex (str s))]
(let [hex (status/utf8-to-hex (str s))]
(if (empty? hex)
nil
hex)))
(defn hex-to-utf8
[s]
(let [utf8 (native-module/hex-to-utf8 s)]
(let [utf8 (status/hex-to-utf8 s)]
(if (empty? utf8)
nil
utf8)))
@@ -118,7 +118,7 @@
(defn address?
[s]
(when s
(native-module/address? s)))
(status/address? s)))
(defn network->chain-id
[network]
+3 -3
View File
@@ -5,7 +5,7 @@
e.g. 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
(:require [clojure.string :as string]
[native-module.core :as native-module]))
[status-im.native-module.core :as status]))
(def hex-prefix "0x")
@@ -13,7 +13,7 @@
"Converts an arbitrary case address to one with correct checksum case."
[address]
(when address
(native-module/to-checksum-address
(status/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]
(native-module/check-address-checksum address))
(status/check-address-checksum address))
+2 -2
View File
@@ -1,6 +1,6 @@
(ns status-im.ethereum.encode
(:require [native-module.core :as native-module]))
(:require [status-im.native-module.core :as status]))
(defn uint
[x]
(str "0x" (native-module/number-to-hex x)))
(str "0x" (status/number-to-hex x)))
+2 -2
View File
@@ -1,6 +1,6 @@
(ns status-im.ethereum.ens
(:require [clojure.string :as string]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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 (native-module/hex-to-number %)) 1000))}))
#(cb (* (js/Number (status/hex-to-number %)) 1000))}))
(defn register-prepare-tx
[chain-id from ens-name pubkey cb]
+3 -10
View File
@@ -30,7 +30,7 @@
status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model]
status-im.multiaccounts.update.core
[native-module.core :as native-module]
[status-im.native-module.core :as status]
status-im.network.net-info
status-im.pairing.core
status-im.profile.core
@@ -60,9 +60,6 @@
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
@@ -88,16 +85,12 @@
(re-frame/reg-fx
:ui/close-application
(fn [_]
(native-module/close-application)))
(status/close-application)))
(re-frame/reg-fx
::app-state-change-fx
(fn [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)))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]}]
(native-module/gfycat-identicon-async
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]}]
(native-module/save-multiaccount-and-login-with-keycard
(status/save-multiaccount-and-login-with-keycard
key-uid
(types/clj->json multiaccount-data)
password
@@ -307,15 +307,15 @@
(defn login
[args]
(native-module/login-with-keycard args))
(status/login-with-keycard args))
(defn send-transaction-with-signature
[{:keys [transaction signature on-completed]}]
(native-module/send-transaction-with-signature transaction signature on-completed))
(status/send-transaction-with-signature transaction signature on-completed))
(defn delete-multiaccount-before-migration
[{:keys [key-uid on-success on-error]}]
(native-module/delete-multiaccount
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/convert-to-keycard-account
(status/convert-to-keycard-account
account
settings
password
encryption-pass
#(let [{:keys [error]} (types/json->clj %)]
(if (string/blank? error)
(native-module/login-with-keycard login-params)
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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))
(native-module/multiaccount-import-mnemonic
(status/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))]
(native-module.core/multiaccount-derive-addresses
(status-im.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])]
(native-module/gfycat-identicon-async
(status/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")
(native-module/delete-multiaccount
(status/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
@@ -304,7 +304,7 @@
(fn [cb] (cb)))]
(deletion-wrapper
(fn []
(native-module/multiaccount-store-derived
(status/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)]
(native-module/multiaccount-load-account
(status/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])
(native-module/multiaccount-derive-addresses
(status/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)])
(native-module/multiaccount-store-derived
(status/multiaccount-store-derived
id
key-uid
[path]
@@ -436,7 +436,7 @@
(swap! state assoc-in
[:application-info :key-uid]
(:key-uid keys))
(native-module/multiaccount-store-derived
(status/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))})]
(native-module/sign-message
(status/sign-message
params
(fn [res]
(let [signature (-> res
@@ -481,7 +481,7 @@
:result
ethereum/normalized-hex)]
(on-success signature)))))
(native-module/sign-typed-data
(status/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]}]
(native-module/save-account-and-login
(status/save-account-and-login
key-uid
(types/clj->json multiaccount-data)
password
@@ -508,11 +508,11 @@
(defn login
[{:keys [key-uid multiaccount-data password]}]
(native-module/login-with-config key-uid multiaccount-data password node/login-node-config))
(status/login-with-config key-uid multiaccount-data password node/login-node-config))
(defn send-transaction-with-signature
[{:keys [transaction on-completed]}]
(native-module/send-transaction transaction account-password on-completed))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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 (native-module/get-device-model-info))
(def deviceinfo (status/get-device-model-info))
;; {:model ?
;; :brand "Xiaomi"
+1 -2
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]
[native-module.core :as native-module]
[status-im.native-module.core :as native-module]
[utils.re-frame :as rf]
[quo2.foundations.colors :as colors]
[status-im2.constants :as constants]
@@ -150,7 +150,6 @@
(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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/multiaccount-store-derived
(status/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])]
(native-module/gfycat-identicon-async
(status/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 []
(native-module/multiaccount-generate-and-derive-addresses
(status/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]]
(native-module/save-account-and-login
(status/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]
[native-module.core :as native-module]
[status-im.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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/login-with-config key-uid account-data hashed-password node/login-node-config)))
(status/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]]
(native-module/export-db key-uid account-data hashed-password callback)))
(status/export-db key-uid account-data hashed-password callback)))
(re-frame/reg-fx
::import-db
(fn [[key-uid account-data hashed-password]]
(native-module/import-db key-uid account-data hashed-password)))
(status/import-db key-uid account-data hashed-password)))
(re-frame/reg-fx
::enable-local-notifications
(fn []
(native-module/start-local-notifications)))
(status/start-local-notifications)))
(re-frame/reg-fx
::initialize-wallet-connect
@@ -363,7 +363,7 @@
(rf/defn get-node-config
[_]
(native-module/get-node-config #(re-frame/dispatch [::get-node-config-callback %])))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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 []
(native-module/logout)))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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")
(native-module/multiaccount-import-mnemonic
(status/multiaccount-import-mnemonic
passphrase
password
(fn [result]
(let [{:keys [id] :as root-data}
(multiaccounts.create/normalize-multiaccount-data-keys
(types/json->clj result))]
(native-module.core/multiaccount-derive-addresses
(status-im.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])]
(native-module/gfycat-identicon-async
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]}]]
(native-module/reset-password
(status/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))]
(native-module/verify address
hashed-pass
(partial handle-verification form-vals)))))
(status/verify address
hashed-pass
(partial handle-verification form-vals)))))
(rf/defn reset
{:events [::reset]}
@@ -1,19 +1,19 @@
(ns native-module.core
(ns status-im.native-module.core
(:require ["react-native" :as react-native]
[utils.validators :as validators]
[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]
[taoensso.timbre :as log]
[react-native.platform :as platform]
[react-native.core :as rn]
[utils.transforms :as types]))
[status-im2.constants :as constants]))
(defn status
[]
(when (exists? (.-NativeModules react-native))
(.-Status ^js (.-NativeModules react-native))))
(defn init
[handler]
(.addListener ^js rn/device-event-emitter "gethEvent" #(handler (.-jsonEvent ^js %))))
(def adjust-resize 16)
(defn clear-web-data
[]
@@ -72,6 +72,15 @@
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]
@@ -114,6 +123,11 @@
(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
@@ -127,6 +141,14 @@
: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
@@ -276,13 +298,43 @@
: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 deserialization-key callback]
(log/info "[native-module] Deserializing compressed key"
{:fn :compressed-key->public-key
[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 public-key})
(.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback))
(.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))
(defn hash-typed-data
"used for keycard"
@@ -336,6 +388,11 @@
(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")
@@ -351,6 +408,11 @@
(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")
@@ -371,11 +433,26 @@
: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)
@@ -406,6 +483,12 @@
(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]
@@ -417,6 +500,11 @@
(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")
@@ -467,6 +555,11 @@
(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]
@@ -492,6 +585,16 @@
(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 native-module.core-test
(ns status-im.native-module.core-test
(:require [cljs.test :refer [deftest is testing]]
[native-module.core :as native-module]))
[status-im.native-module.core :as status]))
(deftest identicon-test
(testing "check if identicon test works"
(is
(=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAjklEQVR4nOzXsQmAMBQGYRV3cUAdQwd0Gm2sJIWSBI6f+0oR8XjwSKYhhCE0htAYQmMITUzI/PXF49yv0vN12cYWP1L7/ZiJGEJjCE31xvm7bXptv5iJGEJjCE31WasVz1oPQ2gMoWlyuyvpfaN8i5mIITSG0BhCYwiNIeokZiKG0BhCYwiNITR3AAAA//+A3RtWaKqXgQAAAABJRU5ErkJggg=="
(native-module/identicon "a")))))
(status/identicon "a")))))
+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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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?]]
(native-module/connection-change network-type expensive?)))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/prepare-dir-and-update-config key-uid config callback)))
(status/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]
[react-native.core :as rn]))
[status-im.utils.utils :as utils]))
(def default-erc20-token
{:symbol :ERC20
@@ -56,7 +56,7 @@
(fn [notification]
(handle-notification-press {:userInfo (bean/bean (.getData ^js
notification))})))
(.addListener ^js rn/device-event-emitter
(.addListener ^js react-native-utils/device-event-emitter
notification-event-android
(fn [^js data]
(when (and data (.-dataJSON data))
+3 -4
View File
@@ -9,9 +9,9 @@
[status-im.ethereum.eip681 :as eip681]
[status-im.ethereum.ens :as ens]
[status-im.utils.types :as types]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[status-im.ethereum.stateofus :as stateofus]
[utils.validators :as validators]
[status-im2.utils.validators :as validators]
[status-im.utils.http :as http]
[status-im.utils.wallet-connect :as wallet-connect]
[taoensso.timbre :as log]
@@ -83,9 +83,8 @@
:ens-name ens-name})
valid-compressed-key?
(native-module/compressed-key->public-key
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]}]
(native-module/send-transaction (types/clj->json tx-obj)
hashed-password
cb)))
(status/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]}]
(native-module/sign-message (types/clj->json params)
on-completed)))
(status/sign-message (types/clj->json params)
on-completed)))
(re-frame/reg-fx
:signing.fx/recover-message
(fn [{:keys [params on-completed]}]
(native-module/recover-message (types/clj->json params)
on-completed)))
(status/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
(native-module/sign-typed-data-v4 data account hashed-password on-completed)
(native-module/sign-typed-data data account hashed-password on-completed))))
(status/sign-typed-data-v4 data account hashed-password on-completed)
(status/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" (native-module/number-to-hex gas))})
{:gas (str "0x" (status/number-to-hex gas))})
(when gasPrice
{:gasPrice (str "0x" (native-module/number-to-hex gasPrice))})
{:gasPrice (str "0x" (status/number-to-hex gasPrice))})
(when nonce
{:nonce (str "0x" (native-module/number-to-hex nonce))})
{:nonce (str "0x" (status/number-to-hex nonce))})
(when maxPriorityFeePerGas
{:maxPriorityFeePerGas (str "0x"
(native-module/number-to-hex
(status/number-to-hex
(js/parseInt maxPriorityFeePerGas)))})
(when maxFeePerGas
{:maxFeePerGas (str "0x"
(native-module/number-to-hex
(status/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 _] (native-module/decode-parameters
(let [[address value _] (status/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" (native-module/number-to-hex amount))
amount-hex (str "0x" (status/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 (native-module/encode-transfer to-norm amount-hex)})}))
:data (status/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" (native-module/number-to-hex amount))
amount-hex (str "0x" (status/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 (native-module/encode-transfer to-norm amount-hex)})})))))
:data (status/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" (native-module/number-to-hex amount))
amount-hex (str "0x" (status/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 (native-module/encode-transfer to-norm amount-hex)}))}))))
:data (status/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]]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[status-im.signing.core :as signing]))
(deftest signing-test
(testing "showing sheet"
(let [to "0x2f88d65f3cb52605a54a833ae118fb1363acccd2"
contract "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
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)
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)
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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]}]
(native-module/hash-transaction (types/clj->json transaction) on-completed)))
(status/hash-transaction (types/clj->json transaction) on-completed)))
(re-frame/reg-fx
::hash-message
(fn [{:keys [message on-completed]}]
(native-module/hash-message message on-completed)))
(status/hash-message message on-completed)))
(re-frame/reg-fx
::hash-typed-data
(fn [{:keys [v4 data on-completed]}]
(if v4
(native-module/hash-typed-data-v4 data on-completed)
(native-module/hash-typed-data data on-completed))))
(status/hash-typed-data-v4 data on-completed)
(status/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"
(native-module/number-to-hex
(status/number-to-hex
(js/parseInt maxPriorityFeePerGas))))
maxFeePerGas
(assoc :maxFeePerGas
(str "0x"
(native-module/number-to-hex
(status/number-to-hex
(js/parseInt maxFeePerGas))))
gas
(assoc :gas (str "0x" (native-module/number-to-hex gas)))
(assoc :gas (str "0x" (status/number-to-hex gas)))
gasPrice
(assoc :gasPrice (str "0x" (native-module/number-to-hex gasPrice)))
(assoc :gasPrice (str "0x" (status/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]
[utils.validators :as validators]
[status-im2.utils.validators :as validators]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im.utils.utils :as utils]
@@ -198,7 +198,11 @@
(when platform/android?
(reset! last-text-change (js/Date.now)))
(on-text-change text chat-id)))
(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]))))
(rf/defn set-input-text
"Set input text for current-chat. Takes db and input text and cofx
@@ -216,10 +220,26 @@
(defn on-text-input
[chat-id args]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)]
(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)]
(when (and (not (get @mentions-enabled chat-id)) (string/index-of text "@"))
(swap! mentions-enabled assoc chat-id true))))
(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]))))
(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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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"
(native-module/number-to-hex
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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)]
(native-module/verify
(status/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)
(native-module/delete-multiaccount
(status/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
@@ -141,15 +141,33 @@
(reset! last-text-change (js/Date.now)))
(on-text-change text chat-id)
(rf/dispatch [:mention/on-change-text text])))
;; 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]))))
(defn on-text-input
[chat-id args]
(let [native-event (.-nativeEvent ^js args)
text (.-text ^js native-event)]
(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)]
(when (and (not (get @mentions-enabled? chat-id)) (string/index-of text "@"))
(swap! mentions-enabled? assoc chat-id true))))
(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]))))
(defn text-input-style
[chat-id]
+12 -1
View File
@@ -1,5 +1,6 @@
(ns status-im.utils.gfycat.core
(:require [native-module.core :as native-module]))
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as native-module]))
(def unknown-gfy "Unknown")
@@ -11,3 +12,13 @@
(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
%]))))))
+12 -1
View File
@@ -1,4 +1,15 @@
(ns status-im.utils.identicon
(:require [native-module.core :as native-module]))
(:require [re-frame.core :as re-frame]
[status-im.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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]
(native-module/rooted-device? (fn [rooted?] (callback (not rooted?)))))
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]]
(native-module/send-logs
(status/send-logs
db-json
(string/join "\n" (log/get-logs-queue))
#(re-frame/dispatch [callback-handler %]))))
+8
View File
@@ -0,0 +1,8 @@
(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]
[native-module.core :as native-module]))
[status-im.native-module.core :as status]))
;; 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]}]
(native-module/deserialize-and-compress-key
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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])
(native-module/multiaccount-derive-addresses
(status/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)])
(native-module/multiaccount-store-derived
(status/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])
(native-module/multiaccount-store-account
(status/multiaccount-store-account
id
key-uid
hashed-password
@@ -119,7 +119,7 @@
(re-frame/reg-fx
::verify-password
(fn [{:keys [address hashed-password]}]
(native-module/verify
(status/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]
(native-module/multiaccount-load-account
(status/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]}]
(native-module/multiaccount-import-mnemonic
(status/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]}]
(native-module/multiaccount-import-private-key
(status/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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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))]
(native-module/call-private-rpc
(status/call-private-rpc
(transforms/clj->json {:jsonrpc "2.0"
:id 1
:method method
+8 -19
View File
@@ -1,29 +1,18 @@
(ns status-im2.common.theme.core
(:require [quo.theme :as quo]
[quo2.theme :as quo2]
[utils.re-frame :as rf]
[oops.core :refer [oget]]
[react-native.core :as rn]
[react-native.platform :as platform]))
[react-native.core :as rn]))
(def device-theme (atom (rn/get-color-scheme)))
(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
;; Note - don't use value returned by change listener
;; https://github.com/facebook/react-native/issues/28525
(defn add-device-theme-change-listener
[]
(rn/appearance-add-change-listener
#(when (or platform/android?
(not= (oget rn/app-state "currentState") "background"))
(change-device-theme (oget % "colorScheme")))))
[callback]
(rn/appearance-add-change-listener #(let [theme (rn/get-color-scheme)]
(when-not (= theme @device-theme)
(reset! device-theme theme)
(callback (keyword theme))))))
(defn device-theme-dark?
[]
+1 -1
View File
@@ -159,4 +159,4 @@
(def default-kdf-iterations 3200)
(def ^:const new-composer-enabled? false)
(def ^:const new-composer-enabled? true)
@@ -1,37 +0,0 @@
(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,7 +8,6 @@
(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
@@ -19,7 +18,6 @@
contact-request
community-request
admin
community-kicked
contact-verification})
;; TODO: Replace with correct enum values once status-go implements them.
@@ -31,5 +29,4 @@
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-kicked})
community-request})
@@ -14,8 +14,6 @@
[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]
@@ -205,8 +203,6 @@
types/community-request [community-request/view props]
types/community-kicked [community-kicked/view props]
nil)
:else
@@ -6,12 +6,11 @@
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens]
[status-im.ethereum.stateofus :as stateofus]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[status-im2.navigation.events :as navigation]
[utils.validators :as validators]
[status-im2.utils.validators :as validators]
[status-im2.contexts.contacts.events :as data-store.contacts]
[status-im.utils.utils :as utils]
[status-im2.constants :as constants]))
[status-im.utils.utils :as utils]))
(defn init-contact
"Create a new contact (persisted to app-db as [:contacts/new-identity]).
@@ -125,9 +124,8 @@
(re-frame/reg-fx
:contacts/decompress-public-key
(fn [{:keys [compressed-key on-success on-error]}]
(native-module/compressed-key->public-key
(status/compressed-key->public-key
compressed-key
constants/deserialization-key
(fn [resp]
(let [{:keys [error]} (types/json->clj resp)]
(if error
@@ -14,8 +14,7 @@
[status-im2.contexts.chat.bottom-sheet-composer.actions.style :as style]))
(defn send-message
[{:keys [input-ref]}
{:keys [text-value focused? maximized?]}
[{:keys [text-value focused? maximized?]}
{:keys [height saved-height last-height opacity background-y container-opacity]}
window-height]
(reanimated/animate height constants/input-height)
@@ -33,13 +32,10 @@
(rf/dispatch [:chat.ui/set-chat-input-text nil])
(reset! maximized? false)
(reset! text-value "")
(when @input-ref
(.clear ^js @input-ref))
(messages.list/scroll-to-bottom))
(defn send-button
[props
{:keys [text-value] :as state}
[{:keys [text-value] :as state}
animations
window-height
images?]
@@ -64,7 +60,7 @@
{:icon true
:size 32
:accessibility-label :send-message-button
:on-press #(send-message props state animations window-height)}
:on-press #(send-message state animations window-height)}
:i/arrow-up]])]))])
(defn audio-button
@@ -140,5 +136,5 @@
[image-button props animations insets]
[reaction-button]
[format-button]]
[send-button props state animations window-height images?]
[send-button state animations window-height images?]
[audio-button]])
@@ -19,6 +19,8 @@
(def ^:const reply-container-height 32)
(def ^:const edit-container-height 32)
(def ^:const extra-content-offset (if platform/ios? 6 0))
(def ^:const content-change-threshold 10)
@@ -0,0 +1,23 @@
(ns status-im2.contexts.chat.bottom-sheet-composer.edit.style)
(def container
{:flex-direction :row
:height 24})
(def content-container
{:flex 1
:flex-direction :row})
(def icon-container
{:position :absolute
:left 0
:bottom -4
:width 16
:height 16})
(def text-container
{:position :absolute
:left 24
:top 3
:flex-direction :row
:align-items :center})
@@ -0,0 +1,49 @@
(ns status-im2.contexts.chat.bottom-sheet-composer.edit.view
(:require
[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]
[re-frame.core :as rf]
[react-native.core :as rn]
[status-im2.contexts.chat.bottom-sheet-composer.edit.style :as style]))
(defn edit-message
[cancel]
[rn/view
{:style style/container
:accessibility-label :edit-message}
[rn/view {:style style/content-container}
[quo/icon
:i/connector-dotted
{:size 16
:color (colors/theme-colors colors/neutral-40 colors/neutral-60)
:container-style style/icon-container}]
[rn/view {:style style/text-container}
[quo/text
{:weight :medium
:size :paragraph-2}
(i18n/label :t/editing-message)]]]
[quo/button
{:width 24
:size 24
:accessibility-label :reply-cancel-button
:on-press #(do
(cancel)
(rf/dispatch [:chat.ui/cancel-message-edit]))
:type :outline}
[quo/icon :i/close
{:size 16
:color (colors/theme-colors colors/neutral-100 colors/neutral-40)}]]])
(defn- f-view
[edit cancel]
(let [height (reanimated/use-shared-value (if edit constants/edit-container-height 0))]
(rn/use-effect #(reanimated/animate height (if edit constants/edit-container-height 0)) [edit])
[reanimated/view {:style (reanimated/apply-animations-to-style {:height height} {})}
(when edit [edit-message cancel])]))
(defn view
[edit cancel]
[:f> f-view edit cancel])
@@ -65,6 +65,19 @@
(when-not reply?
(reset! replying? false)))
(defn edit-effect
[{:keys [text-value saved-cursor-position]}
{:keys [editing? input-ref]}
edit]
(let [edit-text (get-in edit [:content :text])]
(when (and (not @editing?) edit @input-ref)
(.focus ^js @input-ref)
(reset! editing? true)
(reset! text-value edit-text)
(reset! saved-cursor-position (count edit-text)))
(when-not edit-text
(reset! editing? false))))
(defn empty-effect
[{:keys [text-value maximized? focused?]}
{:keys [container-opacity]}
@@ -80,7 +93,8 @@
(.remove ^js @keyboard-frame-listener))
(defn initialize
[props state animations {:keys [max-height] :as dimensions} chat-input keyboard-height images? reply?]
[props state animations {:keys [max-height] :as dimensions} chat-input keyboard-height images? reply?
edit]
(rn/use-effect
(fn []
(maximized-effect state animations dimensions chat-input)
@@ -89,6 +103,7 @@
(kb-default-height-effect state)
(background-effect state animations dimensions chat-input)
(images-or-reply-effect animations props images? reply?)
(edit-effect state props edit)
(empty-effect state animations images? reply?)
(kb/add-kb-listeners props state animations dimensions keyboard-height)
#(component-will-unmount props))
@@ -59,6 +59,7 @@
{:keys [height saved-height opacity background-y]}
{:keys [content-height window-height max-height]}
keyboard-shown]
(println "qqq" (oops/oget event "nativeEvent.contentSize.height") keyboard-shown)
(when keyboard-shown
(let [content-size (+ (oops/oget event "nativeEvent.contentSize.height")
constants/extra-content-offset)
@@ -140,13 +140,12 @@
: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))]
[reply]
(let [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])
[reply]
[:f> f-view reply])
@@ -3,7 +3,8 @@
[oops.core :as oops]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]))
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]
[utils.re-frame :as rf]))
(defn bounded-val
[val min-val max-val]
@@ -60,7 +61,7 @@
(if platform/ios? lines (dec lines))))
(defn calc-max-height
[window-height kb-height insets images? reply?]
[window-height kb-height insets images? reply? edit?]
(let [margin-top (if platform/ios? (:top insets) (+ 10 (:top insets)))
max-height (- window-height
margin-top
@@ -68,7 +69,8 @@
constants/bar-container-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 (if reply? (- max-height constants/reply-container-height) max-height)
max-height (if edit? (- max-height constants/edit-container-height) max-height)]
max-height))
(defn empty-input?
@@ -76,5 +78,14 @@
(and (empty? text) (empty? images) (not reply?)))
(defn android-elevation?
[lines images reply?]
(or (> lines 1) (seq images) reply?))
[lines images reply? edit?]
(or (> lines 1) (seq images) reply? edit?))
(defn cancel-edit-message
[{:keys [text-value]}
{:keys [height saved-height last-height]}]
(reanimated/animate height constants/input-height)
(reanimated/set-shared-value saved-height constants/input-height)
(reanimated/set-shared-value last-height constants/input-height)
(reset! text-value "")
(rf/dispatch [:chat.ui/set-input-content-height constants/input-height]))
@@ -11,6 +11,7 @@
[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.edit.view :as edit]
[status-im2.contexts.chat.bottom-sheet-composer.utils :as utils]
[status-im2.contexts.chat.bottom-sheet-composer.constants :as constants]
[status-im2.contexts.chat.bottom-sheet-composer.actions.view :as actions]
@@ -32,7 +33,8 @@
:emoji-kb-extra-height (atom nil)
:saved-emoji-kb-extra-height (atom nil)
:replying? (atom nil)
:sending-images? (atom nil)}
:sending-images? (atom nil)
:editing? (atom nil)}
state {:text-value (reagent/atom "")
:cursor-position (reagent/atom 0)
:saved-cursor-position (reagent/atom 0)
@@ -47,6 +49,7 @@
(fn []
(let [images (rf/sub [:chats/sending-image])
reply (rf/sub [:chats/reply-message])
edit (rf/sub [:chats/edit-message])
{:keys [input-text input-content-height]
:as chat-input} (rf/sub [:chats/current-chat-input])
content-height (reagent/atom (or input-content-height
@@ -58,7 +61,8 @@
kb-height
insets
(seq images)
reply)
reply
edit)
lines (utils/calc-lines @content-height)
max-lines (utils/calc-lines max-height)
initial-height (if (> lines 1)
@@ -90,7 +94,10 @@
:lines lines
:max-lines max-lines}
show-bottom-gradient? (utils/show-bottom-gradient? state dimensions)
android-elevation? (utils/android-elevation? lines images reply)]
android-elevation? (utils/android-elevation? lines
images
reply
edit)]
(effects/initialize props
state
animations
@@ -98,7 +105,8 @@
chat-input
keyboard-height
(seq images)
reply)
reply
edit)
[gesture/gesture-detector
{:gesture (drag-gesture/drag-gesture props state animations dimensions keyboard-shown)}
[reanimated/view
@@ -107,7 +115,8 @@
android-elevation?)
:on-layout #(handler/layout % state blur-height)}
[sub-view/bar]
[reply/view]
[reply/view reply]
[edit/view edit #(utils/cancel-edit-message state animations)]
[reanimated/touchable-opacity
{:active-opacity 1
:on-press (when @(:input-ref props) #(.focus ^js @(:input-ref props)))
@@ -122,7 +131,7 @@
state
animations
dimensions
keyboard-shown)
(or keyboard-shown edit))
:on-scroll #(handler/scroll % state animations dimensions)
:on-change-text #(handler/change-text % props state)
:on-selection-change #(handler/selection-change % state)
@@ -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 (atom false)]))
[message/message-with-reactions message context]))
(defn pinned-messages
[chat-id]
@@ -1,8 +1,29 @@
(ns status-im2.contexts.chat.messages.pin.banner.view
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
[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))
(defn banner
[chat-id]
@@ -14,7 +35,7 @@
latest-pin-text
(cond deleted? (i18n/label :t/message-deleted-for-everyone)
deleted-for-me? (i18n/label :t/message-deleted-for-you)
:else (resolver/resolve-message latest-pin-text))]
:else (resolve-message latest-pin-text))]
[quo/banner
{:latest-pin-text latest-pin-text
:pins-count pins-count
@@ -1,5 +1,5 @@
(ns status-im2.contexts.chat.messages.resolver.message-resolver-test
(:require [status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]
(ns status-im2.contexts.chat.messages.pin.banner.view-test
(:require [status-im2.contexts.chat.messages.pin.banner.view :as view]
[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 (resolver/resolve-message parsed-text)]
(let [text (view/resolve-message parsed-text)]
(t/is (= text
"foobar i just mention you here to debug this issue https://foo.bar , no worries"))))))
@@ -1,24 +0,0 @@
(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))
@@ -22,10 +22,6 @@
: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
@@ -34,7 +30,7 @@
:style style/cancel-button}
(i18n/label :t/cancel)]
[quo/button
{:on-press #(hide-sheet-and-dispatch [:communities/request-to-leave id])
{:on-press #(hide-sheet-and-dispatch [:communities/leave id])
:style style/action-button}
(i18n/label :t/leave-community)]]]])
@@ -6,8 +6,7 @@
[quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.requests :as requests]
[react-native.gesture :as gesture]))
[utils.requests :as requests]))
(defn request-to-join-text
[is-open?]
@@ -29,7 +28,7 @@
pending? (rf/sub [:communities/my-pending-request-to-join id])
is-open? (not= 3 (:access permissions))]
[rn/view {:flex 1 :margin-top 40}
[gesture/scroll-view {:style {:flex 1}}
[rn/scroll-view {:style {:flex 1}}
[rn/view style/page-container
[rn/view
{:style style/title-container}
@@ -1,58 +1,17 @@
(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 [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])
(let [animate? (not dark-overlay?)]
(when animate? (carousel.animation/initialize-animation))
[rn/view
{:style style/background-container}
[carousel/view
{:animate? animate?
:progress progress
:header-text header-text
:header-background true
:background [background-image (* 4 window-width)]}]
[:f> carousel/f-view animate?]
(when dark-overlay?
[blur/view
{:style style/background-blur-overlay
@@ -61,5 +20,6 @@
: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,9 +1,11 @@
(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)
@@ -31,23 +33,14 @@
-1)
paused)))
(defn use-initialize-animation
[progress paused animate?]
(defn initialize-animation
[]
(reset! progress (reanimated/use-shared-value 0))
(reset! paused (reanimated/use-shared-value false))
(rn/use-effect
(fn []
(animate-progress @progress @paused))
[animate?]))
(defn cleanup-animation
[progress paused]
(fn []
(reanimated/cancel-animation @progress)
(reanimated/cancel-animation @paused)))
(animate-progress @progress @paused))
(defn carousel-left-position
[window-width animate? progress]
[window-width animate?]
(if animate?
(worklets.onboarding-carousel/carousel-left-position window-width @progress)
(-> (or (reanimated/get-shared-value @progress) 0)
@@ -55,7 +48,7 @@
(* window-width))))
(defn dynamic-progress-bar-width
[progress-bar-width animate? progress]
[progress-bar-width animate?]
(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 header-background]
[status-bar-height content-width index]
{: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 (when header-background colors/onboarding-header-black)})
:background-color colors/onboarding-header-black})
(defn header-text-view
[window-width]
@@ -27,6 +27,11 @@
{: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,14 +1,26 @@
(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 header-text]
[index window-width]
[rn/view {:style (style/header-text-view window-width)}
[quo/text
{:style style/carousel-text
@@ -21,14 +33,16 @@
(get-in header-text [index :sub-text])]])
(defn content-view
[{:keys [window-width status-bar-height index header-text header-background]} content]
[{:keys [window-width status-bar-height index]}]
(let [content-width (* 4 window-width)]
[:<>
(when content content)
[rn/view {:style (style/header-container status-bar-height content-width index header-background)}
[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)}
(for [index (range 4)]
^{:key index}
[header-text-view index window-width header-text])]]))
[header-text-view index window-width])]]))
(defn progress-bar
[{:keys [static? progress-bar-width]}]
@@ -40,8 +54,8 @@
[rn/view {:style (style/progress-bar-item static? true)}]])
(defn f-dynamic-progress-bar
[{:keys [progress-bar-width animate? progress]}]
(let [width (animation/dynamic-progress-bar-width progress-bar-width animate? progress)
[progress-bar-width animate?]
(let [width (animation/dynamic-progress-bar-width progress-bar-width animate?)
container-view (if animate? reanimated/view rn/view)]
[container-view {:style (style/dynamic-progress-bar width animate?)}
[progress-bar
@@ -49,12 +63,18 @@
:progress-bar-width progress-bar-width}]]))
(defn f-view
[{:keys [animate? progress header-text background header-background]}]
[animate?]
(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? progress)
carousel-left (animation/carousel-left-position window-width animate?)
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)]
@@ -62,10 +82,7 @@
[content-view
{:window-width window-width
:status-bar-height status-bar-height
:index index
:header-text header-text
:header-background header-background}
(when background background)])]
:index index}])]
[rn/view
{:style (style/progress-bar-container
progress-bar-width
@@ -73,10 +90,4 @@
[progress-bar
{:static? true
:progress-bar-width progress-bar-width}]
[:f> f-dynamic-progress-bar
{:progress-bar-width progress-bar-width
:animate? animate?
:progress progress}]]]))
(defn view [props] [:f> f-view props])
[:f> f-dynamic-progress-bar progress-bar-width animate?]]]))
@@ -8,7 +8,7 @@
[clojure.string :as string]
[utils.i18n :as i18n]
[utils.security.core :as security]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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]
(native-module/create-account-and-login request)))
(status/create-account-and-login request)))
(re-frame/reg-fx
:multiaccount/validate-mnemonic
(fn [[mnemonic on-success on-error]]
(native-module/validate-mnemonic
(status/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]
(native-module/restore-account-and-login request)))
(status/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 (native-module/backup-disabled-data-dir)
:rootKeystoreDir (native-module/keystore-dir)
:backupDisabledDataDir (status/backup-disabled-data-dir)
:rootKeystoreDir (status/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 (native-module/log-file-directory)
:logFilePath (status/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 :identifiers]}
(cond-> {:dispatch [:navigate-to :enable-notifications]}
biometric-enabled?
(assoc :biometric/enable-and-save-password
{:key-uid key-uid
@@ -1,20 +0,0 @@
(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})
@@ -1,61 +0,0 @@
(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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[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])
(native-module/delete-multiaccount
(status/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]
+81 -84
View File
@@ -92,250 +92,247 @@
(def screens-categories
{:foundations [{:name :shadows
:options {:topBar {:visible true}}
:insets {:top false}
:component shadows/preview-shadows}]
:animated-list [{:name :animated-header-list
:options {:topBar {:visible false}}
:component animated-header-list/mock-screen}]
:avatar [{:name :group-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component group-avatar/preview-group-avatar}
{:name :icon-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component icon-avatar/preview-icon-avatar}
{:name :user-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component user-avatar/preview-user-avatar}
{:name :wallet-user-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component wallet-user-avatar/preview-wallet-user-avatar}
{:name :channel-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component channel-avatar/preview-channel-avatar}
{:name :account-avatar
:options {:topBar {:visible true}}
:insets {:top false}
:component account-avatar/preview-account-avatar}]
:banner [{:name :banner
:options {:topBar {:visible true}}
:insets {:top false}
:component banner/preview-banner}]
:buttons [{:name :button
:options {:topBar {:visible true}}
:insets {:top false}
:component button/preview-button}
{:name :dynamic-button
:options {:topBar {:visible true}}
:insets {:top false}
:component dynamic-button/preview-dynamic-button}]
:code [{:name :snippet
:options {:topBar {:visible true}}
:insets {:top false}
:component code-snippet/preview-code-snippet}]
:colors [{:name :color-picker
:options {:topBar {:visible true}}
:insets {:top false}
:component color-picker/preview-color-picker}]
:community [{:name :community-card-view
:options {:topBar {:visible true}}
:insets {:top false}
:component community-card/preview-community-card}
{:name :community-list-view
:options {:topBar {:visible true}}
:insets {:top false}
:component community-list-view/preview-community-list-view}
{:name :community-membership-list-view
:options {:topBar {:visible true}}
:insets {:top false}
:component community-membership-list-view/preview-community-list-view}
{:name :discover-card
:options {:topBar {:visible true}}
:insets {:top false}
:component discover-card/preview-discoverd-card}
{:name :token-gating
:options {:topBar {:visible true}}
:insets {:top false}
:component token-gating/preview-token-gating}]
:counter [{:name :counter
:options {:topBar {:visible true}}
:insets {:top false}
:component counter/preview-counter}
{:name :step
:options {:topBar {:visible true}}
:insets {:top false}
:component step/preview-step}]
:dividers [{:name :divider-label
:options {:topBar {:visible true}}
:inset {:top false}
:component divider-label/preview-divider-label}
{:name :new-messages
:options {:topBar {:visible true}}
:insets {:top false}
:component new-messages/preview-new-messages}
{:name :divider-date
:options {:topBar {:visible true}}
:insets {:top false}
:component divider-date/preview-divider-date}
{:name :strength-divider
:options {:topBar {:visible true}}
:insets {:top false}
:component strength-divider/preview-strength-divider}]
:drawers [{:name :action-drawers
:options {:topBar {:visible true}}
:insets {:top false}
:component action-drawers/preview-action-drawers}
{:name :drawer-buttons
:options {:topBar {:visible true}}
:insets {:top false}
:component drawer-buttons/preview-drawer-buttons}
{:name :permission-drawers
:options {:topBar {:visible true}}
:insets {:top false}
:component permission-drawers/preview-permission-drawers}]
:dropdowns [{:name :dropdown
:options {:topBar {:visible true}}
:insets {:top false}
:component dropdown/preview-dropdown}]
:info [{:name :info-message
:options {:topBar {:visible true}}
:insets {:top false}
:component info-message/preview-info-message}
{:name :information-box
:options {:topBar {:visible true}}
:insets {:top false}
:component information-box/preview-information-box}]
:inputs [{:name :input
:options {:topBar {:visible true}}
:insets {:top false}
:component input/preview-input}
{:name :profile-input
:options {:topBar {:visible true}}
:insets {:top false}
:component profile-input/preview-profile-input}
{:name :recovery-phrase-input
:options {:topBar {:visible true}}
:insets {:top false}
:component recovery-phrase-input/preview-recovery-phrase-input}
{:name :search-input
:options {:topBar {:visible true}}
:insets {:top false}
:component search-input/preview-search-input}
{:name :title-input
:options {:topBar {:visible true}}
:insets {:top false}
:component title-input/preview-title-input}]
:links [{:name :url-preview
:options {:insets {:top? true}
:topBar {:visible true}}
:options {:insets {:top? true}}
:component url-preview/preview}
{:name :url-preview-list
:options {:insets {:top? true}
:topBar {:visible true}}
:options {:insets {:top? true}}
:component url-preview-list/preview}
{:name :link-preview
:options {:insets {:top? true}
:topBar {:visible true}}
:options {:insets {:top? true}}
:component link-preview/preview}]
:list-items [{:name :channel
:options {:topBar {:visible true}}
:insets {:top false}
:component channel/preview-channel}
{:name :preview-lists
:options {:topBar {:visible true}}
:insets {:top false}
:component preview-lists/preview-preview-lists}
{:name :user-list
:options {:topBar {:visible true}}
:insets {:top false}
:component user-list/preview-user-list}]
:markdown [{:name :texts
:options {:topBar {:visible true}}
:insets {:top false}
:component text/preview-text}]
:messages [{:name :gap
:options {:topBar {:visible true}}
:insets {:top false}
:component messages-gap/preview-messages-gap}
{:name :system-messages
:options {:topBar {:visible true}}
:insets {:top false}
:component system-message/preview-system-message}
{:name :author
:options {:topBar {:visible true}}
:insets {:top false}
:component messages-author/preview-author}]
:navigation [{:name :bottom-nav-tab
:options {:topBar {:visible true}}
:insets {:top false}
:component bottom-nav-tab/preview-bottom-nav-tab}
{:name :top-nav
:options {:topBar {:visible true}}
:insets {:top false}
:component top-nav/preview-top-nav}
{:name :page-nav
:options {:topBar {:visible true}}
:insets {:top false}
:component page-nav/preview-page-nav}
{:name :floating-shell-button
:options {:topBar {:visible true}}
:insets {:top false}
:component floating-shell-button/preview-floating-shell-button}]
:notifications [{:name :activity-logs
:options {:topBar {:visible true}}
:insets {:top false}
:component activity-logs/preview-activity-logs}
{:name :toast
:options {:topBar {:visible true}}
:insets {:top false}
:component toast/preview-toasts}
{:name :notification
:options {:topBar {:visible true}}
:insets {:top false}
:component notification/preview-notification}]
:onboarding [{:name :small-option-card
:options {:topBar {:visible true}}
:insets {:top false}
:component small-option-card/preview-small-option-card}]
:posts-and-attachments [{:name :messages-skeleton
:options {:topBar {:visible true}}
:insets {:top false}
:component messages-skeleton/preview-messages-skeleton}]
:password [{:name :tips
:options {:topBar {:visible true}}
:insets {:top false}
:component tips/preview-tips}]
:profile [{:name :profile-card
:options {:topBar {:visible true}}
:insets {:top false}
:component profile-card/preview-profile-card}
{:name :collectible
:options {:topBar {:visible true}}
:insets {:top false}
:component collectible/preview-collectible}
{:name :select-profile
:options {:topBar {:visible true}}
:insets {:top false}
:component select-profile/preview-select-profile}]
:reactions [{:name :react
:options {:topBar {:visible true}}
:insets {:top false}
:component react/preview-react}]
:record-audio [{:name :record-audio
:options {:topBar {:visible true}}
:insets {:top false}
:component record-audio/preview-record-audio}]
:switcher [{:name :switcher-cards
:options {:topBar {:visible true}}
:insets {:top false}
:component switcher-cards/preview-switcher-cards}]
:selectors [{:name :disclaimer
:options {:topBar {:visible true}}
:insets {:top false}
:component disclaimer/preview-disclaimer}
{:name :filter
:options {:topBar {:visible true}}
:insets {:top false}
:component filter/preview}
{:name :selectors
:options {:topBar {:visible true}}
:insets {:top false}
:component selectors/preview-selectors}]
:settings [{:name :privacy-option
:options {:topBar {:visible true}}
:insets {:top false}
:component privacy-option/preview-options}
{:name :accounts
:options {:topBar {:visible true}}
:insets {:top false}
:component accounts/preview-accounts}]
:share [{:name :qr-code
:options {:topBar {:visible true}}
:insets {:top false}
:component qr-code/preview-qr-code}
{:name :share-qr-code
:options {:topBar {:visible true}}
:insets {:top false}
:component share-qr-code/preview-share-qr-code}]
:tabs [{:name :segmented
:options {:topBar {:visible true}}
:insets {:top false}
:component segmented/preview-segmented}
{:name :tabs
:options {:topBar {:visible true}}
:insets {:top false}
:component tabs/preview-tabs}
{:name :account-selector
:options {:topBar {:visible true}}
:insets {:top false}
:component account-selector/preview-this}]
:tags [{:name :context-tags
:options {:topBar {:visible true}}
:insets {:top false}
:component context-tags/preview-context-tags}
{:name :tags
:options {:topBar {:visible true}}
:insets {:top false}
:component tags/preview-tags}
{:name :permission-tag
:options {:topBar {:visible true}}
:insets {:top false}
:component permission-tag/preview-permission-tag}
{:name :status-tags
:options {:topBar {:visible true}}
:insets {:top false}
:component status-tags/preview-status-tags}
{:name :token-tag
:options {:topBar {:visible true}}
:insets {:top false}
:component token-tag/preview-token-tag}]
:text-combinations [{:name :title
:options {:topBar {:visible true}}
:insets {:top false}
:component title/preview-title}]
:wallet [{:name :lowest-price
:options {:topBar {:visible true}}
:insets {:top false}
:component lowest-price/preview-lowest-price}
{:name :token-overview
:options {:topBar {:visible true}}
:insets {:top false}
:component token-overview/preview-token-overview}
{:name :network-breakdown
:options {:topBar {:visible true}}
:insets {:top false}
:component network-breakdown/preview-network-breakdown}
{:name :network-amount
:options {:topBar {:visible true}}
:insets {:top false}
:component network-amount/preview}]})
(def screens (flatten (map val screens-categories)))
@@ -377,5 +374,5 @@
(def main-screens
[{:name :quo2-preview
:options {:topBar {:visible true}}
:insets {:top false}
:component main-screen}])
@@ -2,57 +2,22 @@
(:require [quo2.foundations.colors :as colors]
[react-native.core :as rn]
[quo2.core :as quo]
[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"}]}])
[status-im2.common.resources :as resources]))
(defn cool-preview
[]
(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]]]]]])))
(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}]]]]))
(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-z-index-keyword (get shell.constants/stacks-z-index-keywords id)]
stack-pointer-keyword (get shell.constants/stacks-pointer-keywords id)]
(assoc
acc
stack-opacity-keyword
(worklets.shell/stack-opacity (name id) selected-stack-id-sv)
stack-z-index-keyword
(worklets.shell/stack-z-index (name id) selected-stack-id-sv)
stack-pointer-keyword
(worklets.shell/stack-pointer (name id) selected-stack-id-sv)
tabs-icon-color-keyword
(worklets.shell/bottom-tab-icon-color
(name id)
+6 -11
View File
@@ -7,14 +7,10 @@
[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.chat.messages.resolver.message-resolver :as resolver]))
[status-im2.contexts.shell.constants :as shell.constants]))
(defn content-container
[type
{:keys [content-type data new-notifications? color-50 community-info
community-channel]
{:keys [text parsed-text source]} :data}]
[type {:keys [content-type data new-notifications? color-50 community-info community-channel]}]
[rn/view {:style (style/content-container new-notifications?)}
(case type
shell.constants/community-card
@@ -56,9 +52,7 @@
:number-of-lines 1
:ellipsize-mode :tail
:style style/last-message-text}
(if parsed-text
(resolver/resolve-message parsed-text)
text)]
data]
constants/content-type-image
[quo/preview-list
@@ -69,12 +63,13 @@
constants/content-type-sticker
[fast-image/fast-image
{:source source
{:source (:source data)
:style style/sticker}]
constants/content-type-gif
[fast-image/fast-image
{:source source
{:source (:source data)
: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)
+10 -13
View File
@@ -18,12 +18,14 @@
(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))
:z-index (get shared-values
(get shell.constants/stacks-z-index-keywords stack-id))}
{: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))}
{:position :absolute
:top 0
:bottom 0
@@ -36,11 +38,6 @@
: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
@@ -53,7 +50,7 @@
:transform [{:scale (:home-stack-scale shared-values)}]}
home-stack-original-style)]
[reanimated/view {:style home-stack-animated-style}
[lazy-screen :communities-stack shared-values]
[lazy-screen :chats-stack shared-values]
[lazy-screen :browser-stack shared-values]
[lazy-screen :wallet-stack shared-values]]))
[: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]]))
+5 -5
View File
@@ -1,5 +1,5 @@
(ns status-im2.contexts.syncing.events
(:require [native-module.core :as native-module]
(:require [status-im.native-module.core :as status]
[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])
(native-module/input-connection-string-for-bootstrapping
(status/input-connection-string-for-bootstrapping
connection-string
config-map
#(log/info "Initiated local pairing"
{:response %
:event :syncing/input-connection-string-for-bootstrapping}))))]
(native-module/prepare-dir-and-update-config "" default-node-config-string callback)))
(status/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 (native-module/sha3 (str (security/safe-unmask-data entered-password)))
(let [sha3-pwd (status/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}}))]
(native-module/get-connection-string-for-bootstrapping-another-device
(status/get-connection-string-for-bootstrapping-another-device
config-map
#(show-sheet %)))
(show-sheet ""))))
+3 -6
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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[status-im.notifications.local :as notifications]
[status-im.utils.universal-links.core :as utils.universal-links]
status-im.events
@@ -27,15 +27,12 @@
(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]
+4 -3
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]
[native-module.core :as native-module]
[status-im.native-module.core :as status]
[status-im.utils.keychain.core :as keychain]
[status-im2.common.json-rpc.events]
[status-im2.common.theme.core :as theme]
@@ -25,12 +25,13 @@
(re-frame/reg-fx
:setup/open-multiaccounts
(fn [callback]
(native-module/open-accounts callback)))
(status/open-accounts callback)))
(re-frame/reg-fx
:setup/init-theme
(fn []
(theme/add-device-theme-change-listener)))
(theme/add-device-theme-change-listener
#(re-frame/dispatch [:system-theme-mode-changed %]))))
(rf/defn initialize-views
{:events [:setup/initialize-view]}
-4
View File
@@ -160,8 +160,6 @@
;; OVERLAY
(def dissmiss-overlay navigation/dissmiss-overlay)
(def dissmiss-all-overlays navigation/dissmiss-all-overlays)
(defn show-overlay
([comp] (show-overlay comp {}))
([comp opts]
@@ -175,8 +173,6 @@
: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)
+1 -9
View File
@@ -70,6 +70,7 @@
{: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)})))
@@ -139,12 +140,3 @@
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,7 +14,6 @@
[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]
@@ -121,12 +120,6 @@
: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]
(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))]
(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 []
^{: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 last-message :content)}
:data (get-in last-message [:content :text])}
;; Currently mock image is used as placeholder,
;; as last-message don't have image
@@ -1,4 +1,4 @@
(ns utils.validators)
(ns status-im2.utils.validators)
(defn valid-public-key?
[s]
@@ -1,6 +1,6 @@
(ns utils.validators-test
(ns status-im2.utils.validators-test
(:require [cljs.test :refer-macros [deftest testing is]]
[utils.validators :refer [valid-compressed-key?]]))
[status-im2.utils.validators :refer [valid-compressed-key?]]))
(deftest test-valid-compressed-key
(testing "valid"
-53
View File
@@ -5,8 +5,6 @@
(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))
@@ -16,15 +14,6 @@
: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
@@ -69,45 +58,3 @@
"&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))
+2 -2
View File
@@ -6,9 +6,9 @@
[id selected-stack-id]
(.stackOpacity ^js shell-worklets id selected-stack-id))
(defn stack-z-index
(defn stack-pointer
[id selected-stack-id]
(.stackZIndex ^js shell-worklets id selected-stack-id))
(.stackPointer ^js shell-worklets id selected-stack-id))
(defn bottom-tabs-height
[home-stack-state-sv container-height extended-container-height]
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "fix/remove-member-on-cancel-request",
"commit-sha1": "207d77e31bb02f41e133d92ab61ddebbec1e0603",
"src-sha256": "1zpbzbakqzh4m6cv8pzmxw600s9jvyak4xiiipi914f8q8bv1fcf"
"version": "v0.147.1",
"commit-sha1": "213dc463bcc1ae449bc78b6cf7c598c4f68830c5",
"src-sha256": "1q00agdsqc4p16l8d5cv88gwfnpnl7bb61mayc3520c82hw93q3r"
}

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