Compare commits

...
Author SHA1 Message Date
Dario Gabriel Lipicar 78767a764e update go version 2024-10-23 16:34:46 -03:00
Sean Hagstrom 65cdb0dfe7 chore: refactor screens definitions and add more navigation events for screens (#21328)
This change refactors the navigation-screens namespace to organise each screen definition into a group based on the app features. It also adds some metrics tracking to all the of the screens defined in the navigation-screens namespace. 

Additionally, in this change we've introduced a new build configuration for shadow-cljs which allows us to conditionally include code for certain shadow-cljs builds. In this case, we've decided to only exclude the metrics re-frame interceptor from being required when running the component-tests build. This is due to a complication with the metrics interceptor depending on the navigation-screens namespace, which would eventually require many other third-party dependencies that do not have mocks defined for the component tests. To avoid defining more mocks, we've avoided requiring the metrics interceptor for now.
2024-10-23 08:28:41 -07:00
Mohsen ea18966f33 [#21439] fix: close swap flow after confirmation (#21466)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-10-23 11:41:36 -03:00
Icaro Motta e1abe5c6e2 feat(onboarding): Present Terms to users upgrading from v1 or those who need to accept updated Terms (#21487)
Cherry-pick https://github.com/status-im/status-mobile/commit/d45eb5ec20ae7757cd99554920e466eabac0bfb1.

Fixes https://github.com/status-im/status-mobile/issues/21113

Related status-go PR: https://github.com/status-im/status-go/pull/5977
2024-10-23 11:26:29 -03:00
Siddarth Kumar cac96b589f chore(ci)_: bump universal apk size limit to 125MB (#21486) 2024-10-23 12:45:59 +05:30
Volodymyr Kozieiev f8d4f56d2d collectible metrics (#21280) 2024-10-22 16:10:14 +01:00
Mohamed Javid 0957fb6e0a fix(wallet)_: Activity tab is selected on navigating back from the swap flow (#21474)
This commit fixes activity tab is selected when navigating back from the swap flow

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-10-22 18:55:19 +05:30
Lungu Cristian 5118a5095d Fix networks on select asset screen (#21403)
* fix: filter tokens by balance on select asset

* feat: added network-list-with-positive-balance

* fix: swaps error when using networks with balance

* fix: hide send/bridge/swap when no token balance
2024-10-22 15:55:37 +03:00
Andrey Bocharnikov 01c5cf2498 fix: client should pass a list with "Symbol" and without "ChainID-" prefix to wallet_fetchMarketValues, wallet_fetchPrices (#21453)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-10-22 09:15:47 -03:00
Parvesh Monu fae4b34863 fix Group Admin has no option to Edit a Group Chat (#21457) 2024-10-21 22:01:31 +05:30
Parvesh Monu 020d5cc1c1 fix public chat deletion and name display issues post-migration (#21469) 2024-10-21 16:51:41 +05:30
59 changed files with 1339 additions and 805 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
import groovy.json.JsonBuilder
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
agent { label 'linux' }
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
agent { label 'macos' }
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
agent { label params.AGENT_LABEL }
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
agent { label 'linux' }
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.12'
library 'status-jenkins-lib@v1.9.13'
pipeline {
agent {
@@ -253,6 +253,11 @@ class AccountManager(private val reactContext: ReactApplicationContext) : ReactC
utils.executeRunnableStatusGoMethod({ Statusgo.initializeApplication(request) }, callback)
}
@ReactMethod
private fun acceptTerms(callback: Callback) {
Log.d(TAG, "acceptTerms")
utils.executeRunnableStatusGoMethod({ Statusgo.acceptTerms() }, callback)
}
@ReactMethod
fun logout() {
@@ -204,6 +204,14 @@ RCT_EXPORT_METHOD(initializeApplication:(NSString *)request
callback(@[result]);
}
RCT_EXPORT_METHOD(acceptTerms:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"acceptTerms() method called");
#endif
NSString *result = StatusgoAcceptTerms();
callback(@[result]);
}
RCT_EXPORT_METHOD(openAccounts:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"OpenAccounts() method called");
@@ -761,6 +761,26 @@ void _Logout(const FunctionCallbackInfo<Value>& args) {
}
void _AcceptTerms(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
if (args.Length() != 0) {
// Throw an Error that is passed back to JavaScript
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for AcceptTerms")));
return;
}
// Check the argument types
// Call exported Go function, which returns a C string
char *c = AcceptTerms();
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
args.GetReturnValue().Set(ret);
delete c;
}
void _HashMessage(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
@@ -1998,6 +2018,7 @@ void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "multiAccountStoreAccount", _MultiAccountStoreAccount);
NODE_SET_METHOD(exports, "initKeystore", _InitKeystore);
NODE_SET_METHOD(exports, "initializeApplication", _InitializeApplication);
NODE_SET_METHOD(exports, "acceptTerms", _AcceptTerms);
NODE_SET_METHOD(exports, "fleets", _Fleets);
NODE_SET_METHOD(exports, "stopCPUProfiling", _StopCPUProfiling);
NODE_SET_METHOD(exports, "encodeTransfer", _EncodeTransfer);
+10 -7
View File
@@ -95,7 +95,8 @@
;; otherwise sometimes you'll get weird errors when
;; instrumenting functions.
:static-fns false
:infer-externs true}
:infer-externs true
:reader-features #{:mobile}}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
;; it will use the right interface
@@ -129,7 +130,8 @@
:static-fns true
:fn-invoke-direct true
:optimizations :advanced
:js-options {:js-provider :closure}}}}
:js-options {:js-provider :closure}
:reader-features #{:mobile}}}}
;; the tests are ran with node, react-native dependencies are mocked
;; by using node --require override.js, which uses the node-library
;; produced by the target :mocks below and redefines node require
@@ -169,12 +171,13 @@
{;; needed because we override require and it
;; messes with source-map which reports callstack
;; exceeded exceptions instead of real issues
:source-map false
:source-map false
;; needed because we use deref in tests
:static-fns false
:optimizations :simple
:warnings {:fn-deprecated false}
:infer-externs true}}
:static-fns false
:optimizations :simple
:warnings {:fn-deprecated false}
:infer-externs true
:reader-features #{:mobile}}}
;; mock.js-dependencies is mocking the react-native libraries
;; we build it as a node library so that it can be required by
+6
View File
@@ -79,6 +79,12 @@
(types/clj->json request)
#(callback (types/json->clj %))))
(defn accept-terms
([]
(native-utils/promisify-native-module-call accept-terms))
([callback]
(.acceptTerms ^js (account-manager) callback)))
(defn prepare-dir-and-update-config
[key-uid config callback]
(log/debug "[native-module] prepare-dir-and-update-config")
@@ -5,6 +5,7 @@
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.common.confirmation-drawer.style :as style]
[status-im.constants :as constants]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -35,11 +36,12 @@
close-button-text]}]
(let [extra-action-selected? (reagent/atom false)]
(fn []
(let [{:keys [group-chat chat-id public-key color
(let [{:keys [group-chat chat-id public-key color chat-type
profile-picture name]} context
id (or chat-id public-key)
theme (quo.theme/use-theme)
[primary-name _] (when-not group-chat
[primary-name _] (when-not (or group-chat
(= chat-type constants/public-chat-type))
(rf/sub [:contacts/contact-two-names-by-identity id]))
display-name (cond
(= primary-name "Unknown")
+20 -16
View File
@@ -232,12 +232,11 @@
:sub-label nil
:chevron? false})))
;; TODO(OmarBasem): Requires design input.
(defn edit-name-image-entry
[]
[chat-id]
(entry {:icon :i/edit
:label (i18n/label :t/edit-name-and-image)
:on-press #(js/alert "TODO: to be implemented, requires design input")
:on-press #(rf/dispatch [:open-modal :screen/group-update chat-id])
:danger? false
:accessibility-label :edit-name-and-image
:sub-label nil
@@ -359,7 +358,7 @@
(rf/dispatch [:chats-list/load-chat chat-id])
(rf/dispatch [:pin-message/load-pin-messages chat-id])
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:navigate-to :group-details chat-id]))
(rf/dispatch [:navigate-to :screen/group-details chat-id]))
:danger? false
:accessibility-label :group-details
:sub-label nil
@@ -369,18 +368,17 @@
[chat-id admin?]
(entry {:icon :i/add-user
:label (i18n/label (if admin? :t/manage-members :t/add-members))
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
:on-press #(rf/dispatch [:open-modal :screen/group-add-manage-members chat-id])
:danger? false
:accessibility-label :manage-members
:sub-label nil
:chevron? false}))
;; TODO(OmarBasem): to be implemented.
(defn edit-group-entry
[]
[chat-id]
(entry {:icon :i/edit
:label (i18n/label :t/edit-name-and-image)
:on-press #(js/alert "TODO: to be implemented")
:on-press #(rf/dispatch [:open-modal :screen/group-update chat-id])
:danger? false
:accessibility-label :edit-group
:sub-label nil
@@ -398,10 +396,11 @@
:chevron? false}))
(defn destructive-actions
[{:keys [group-chat] :as item} inside-chat?]
[{:keys [group-chat chat-type] :as item} inside-chat?]
[(when (not group-chat)
(close-chat-entry item inside-chat? (not group-chat)))
(clear-history-entry item group-chat)
(close-chat-entry item inside-chat? (not= chat-type constants/public-chat-type)))
(when-not (= chat-type constants/public-chat-type)
(clear-history-entry item group-chat))
(when group-chat
(leave-group-entry item nil))])
@@ -425,8 +424,7 @@
(when inside-chat?
(add-manage-members-entry chat-id admin?))
(when (and admin? inside-chat?)
(when config/show-not-implemented-features?
(edit-group-entry)))
(edit-group-entry chat-id))
(when (and admin? inside-chat?)
(when config/show-not-implemented-features?
(group-privacy-entry)))]))
@@ -438,6 +436,11 @@
(notification-actions item inside-chat? true)
(destructive-actions item inside-chat?)]])
(defn public-chat-actions
[item inside-chat?]
[quo/action-drawer
[(destructive-actions item inside-chat?)]])
(defn private-group-chat-actions
[item inside-chat?]
[quo/action-drawer
@@ -473,6 +476,8 @@
[one-to-one-actions chat inside-chat?]
constants/private-group-chat-type
[private-group-chat-actions chat inside-chat?]
constants/public-chat-type
[public-chat-actions chat inside-chat?]
constants/community-chat-type
[communities-chat-actions/actions chat inside-chat? hide-show-members?]
nil))
@@ -480,13 +485,12 @@
(chat-actions chat inside-chat? nil)))
(defn group-details-actions
[{:keys [admins] :as group}]
[{:keys [chat-id admins] :as group}]
(let [current-pub-key (rf/sub [:multiaccount/public-key])
admin? (get admins current-pub-key)]
[quo/action-drawer
[(when admin?
[(when config/show-not-implemented-features?
(edit-name-image-entry))])
[(edit-name-image-entry chat-id)])
[(when config/show-not-implemented-features?
(notifications-entry admin?))]
(destructive-actions group false)]]))
+1
View File
@@ -566,6 +566,7 @@
(def ^:const bridge-name-erc-1155-transfer "ERC1155Transfer")
(def ^:const bridge-name-hop "Hop")
(def ^:const bridge-name-paraswap "Paraswap")
(def ^:const bridge-name-celer "CBridge")
(def ^:const bridge-assets #{"ETH" "USDT" "USDC" "DAI"})
@@ -14,10 +14,13 @@
(defn centralized-metrics-interceptor
[context]
(when-let [event (tracking/tracked-event (interceptor/get-coeffect context :event))]
(log/debug "tracking event" event)
(when (push-event? (interceptor/get-coeffect context :db))
(native-module/add-centralized-metric event)))
(when (push-event? (interceptor/get-coeffect context :db))
(when-let [event (tracking/metrics-event (interceptor/get-coeffect context :event))]
(log/debug "tracking event" event)
(if (or (seq? event) (vector? event))
(doseq [e event]
(native-module/add-centralized-metric e))
(native-module/add-centralized-metric event))))
context)
(def interceptor
@@ -15,7 +15,7 @@
(deftest centralized-metrics-interceptor-test
(testing "processes context correctly"
(with-redefs [tracking/tracked-event (fn [_] {:metric "mocked-event"})
(with-redefs [tracking/metrics-event (fn [_] {:metric "mocked-event"})
events/push-event? (fn [_] true)]
(let [context {:coeffects {:event [:some-event]
:db {:centralized-metrics/enabled? true}}}]
@@ -1,7 +1,9 @@
(ns status-im.contexts.centralized-metrics.tracking
(:require
[clojure.string]
[legacy.status-im.utils.build :as build]
[react-native.platform :as platform]))
[react-native.platform :as platform]
[status-im.navigation.screens :as screens]))
(defn key-value-event
[event-name event-value]
@@ -19,47 +21,54 @@
[view-id]
(key-value-event "navigation" {:viewId view-id}))
(defn screen-event
[screen event-data]
(let [screen-id (:name screen)
view-id (get-in screen [:metrics :alias-id] screen-id)]
{:metric
{:eventName "navigation"
:platform platform/os
:appVersion build/app-short-version
:eventValue (assoc event-data :viewId (name view-id))}}))
(def ^:const app-started-event "app-started")
(def ^:const view-ids-to-track
#{;; Tabs
:communities-stack
:chats-stack
:wallet-stack
;; Onboarding
:screen/onboarding.intro
:screen/onboarding.new-to-status
:screen/onboarding.sync-or-recover-profile
:screen/onboarding.enter-seed-phrase
:screen/onboarding.create-profile
:screen/onboarding.create-profile-password
:screen/onboarding.enable-biometrics
:screen/onboarding.generating-keys
:screen/onboarding.enable-notifications
:screen/onboarding.preparing-status
:screen/onboarding.sign-in-intro
:screen/onboarding.sign-in
:screen/onboarding.syncing-progress
:screen/onboarding.syncing-progress-intro
:screen/onboarding.syncing-results
:screen/onboarding.welcome})
:wallet-stack})
(defn track-view-id-event
[view-id]
(when (contains? view-ids-to-track view-id)
(navigation-event (name view-id))))
(if-let [screen (get screens/screens-by-name view-id)]
(when (get-in screen [:metrics :track?])
(screen-event screen {}))
(when (contains? view-ids-to-track view-id)
(navigation-event (name view-id)))))
(defn tracked-event
[[event-name second-parameter]]
(case event-name
(defn navigated-to-collectibles-tab-event
[location]
(key-value-event "navigated-to-collectibles-tab" {:location location}))
(defn metrics-event
[[rf-event-name rf-event-parameter]]
(case rf-event-name
:profile/get-profiles-overview-success
(user-journey-event app-started-event)
:centralized-metrics/toggle-centralized-metrics
(key-value-event "events.metrics-enabled" {:enabled second-parameter})
(key-value-event "events.metrics-enabled" {:enabled rf-event-parameter})
:set-view-id
(track-view-id-event second-parameter)
(track-view-id-event rf-event-parameter)
:wallet/select-account-tab
(when (= rf-event-parameter :collectibles)
(navigated-to-collectibles-tab-event :account))
:wallet/select-home-tab
(when (= rf-event-parameter :collectibles)
(navigated-to-collectibles-tab-event :home))
nil))
@@ -52,7 +52,7 @@
{:eventName "navigation"
:platform platform-os
:appVersion app-version
:eventValue {:viewId "onboarding.create-profile"}}}
:eventValue {:viewId "onboarding.create-profile-info"}}}
(tracking/track-view-id-event :screen/onboarding.create-profile)))
(is (nil? (tracking/track-view-id-event :unknown-stack)))))
@@ -63,17 +63,23 @@
:platform platform-os
:appVersion app-version
:eventValue {:action tracking/app-started-event}}}
(tracking/tracked-event [:profile/get-profiles-overview-success])))
(tracking/metrics-event [:profile/get-profiles-overview-success])))
(is (= {:metric
{:eventName "events.metrics-enabled"
:platform platform-os
:appVersion app-version
:eventValue {:enabled true}}}
(tracking/tracked-event [:centralized-metrics/toggle-centralized-metrics true])))
(tracking/metrics-event [:centralized-metrics/toggle-centralized-metrics true])))
(is (= {:metric
{:eventName "navigation"
:platform platform-os
:appVersion app-version
:eventValue {:viewId "wallet-stack"}}}
(tracking/tracked-event [:set-view-id :wallet-stack])))
(is (nil? (tracking/tracked-event [:unknown-event])))))
(tracking/metrics-event [:set-view-id :wallet-stack])))
(is (nil? (tracking/metrics-event [:unknown-event])))
(is (= {:metric
{:eventName "navigation"
:platform platform-os
:appVersion app-version
:eventValue {:viewId "onboarding.intro"}}}
(tracking/metrics-event [:set-view-id :screen/onboarding.intro])))))
+4 -4
View File
@@ -9,7 +9,7 @@
[status-im.constants :as constants]
[status-im.contexts.chat.contacts.events :as contacts-store]
status-im.contexts.chat.effects
status-im.contexts.chat.group-create.events
status-im.contexts.chat.group.events
[status-im.contexts.chat.messenger.composer.link-preview.events :as link-preview]
status-im.contexts.chat.messenger.messages.content.reactions.events
[status-im.contexts.chat.messenger.messages.delete-message-for-me.events :as delete-for-me]
@@ -33,8 +33,8 @@
(multi-user-chat? (get-chat cofx chat-id))))
(defn public-chat?
([chat]
(:public? chat))
([{:keys [chat-type]}]
(= chat-type constants/public-chat-type))
([cofx chat-id]
(public-chat? (get-chat cofx chat-id))))
@@ -52,7 +52,7 @@
(defn group-chat?
([chat]
(and (multi-user-chat? chat)
(not (public-chat? chat))))
(not (:public? chat))))
([cofx chat-id]
(group-chat? (get-chat cofx chat-id))))
@@ -1,13 +1,11 @@
(ns status-im.contexts.chat.group-create.view
(:require [clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
(ns status-im.contexts.chat.group.common.group-edit
(:require [quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[status-im.common.avatar-picture-picker.view :as avatar-picture-picker]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.constants :as constants]
[status-im.contexts.chat.group-create.style :as style]
[status-im.contexts.chat.group.common.style :as style]
[status-im.contexts.profile.utils :as profile.utils]
[utils.debounce :as debounce]
utils.emojilib
@@ -41,35 +39,28 @@
:i/camera]]))
(defn view
[]
[{:keys [default-group-name default-group-color default-group-image contacts
submit-button-label submit-event back-button-icon chat-id close on-success editing-group?]}]
(let [theme (quo.theme/use-theme)
{window-width :width} (rn/get-window)
profile (rf/sub [:profile/profile-with-image])
contacts (rf/sub [:selected-group-contacts])
contacts-count (count contacts)
default-value (rn/use-memo
(fn []
(let [contact-string (string/join ", "
(map
profile.utils/displayed-name
contacts))]
(subs contact-string
0
(min (count contact-string)
constants/max-group-chat-name-length))))
[])
[group-name set-group-name] (rn/use-state default-value)
[group-name set-group-name] (rn/use-state default-group-name)
[error-message
set-error-message] (rn/use-state nil)
group-name-empty? (not (and (string? group-name) (not-empty group-name)))
[group-color set-group-color] (rn/use-state (rand-nth colors/account-colors))
[group-image set-group-image] (rn/use-state nil)
create-group-on-press (rn/use-callback #(debounce/throttle-and-dispatch
[:group-chat/create group-name group-color
group-image]
[group-color set-group-color] (rn/use-state default-group-color)
[group-image set-group-image] (rn/use-state default-group-image)
on-submit (rn/use-callback #(debounce/throttle-and-dispatch
[submit-event
{:group-name group-name
:group-color group-color
:group-image (when (not= group-image
default-group-image)
group-image)
:chat-id chat-id
:on-success on-success}]
300)
[group-name group-color group-image])
back-on-press (rn/use-callback #(rf/dispatch [:navigate-back]))
on-change-text (rn/use-callback
(fn [text]
(if (boolean (re-find utils.emojilib/emoji-regex text))
@@ -77,7 +68,13 @@
{:check (i18n/label
:t/emojis)}))
(set-error-message nil))
(set-group-name text)))]
(set-group-name text)))
disabled? (or group-name-empty?
error-message
(and editing-group?
(= group-name default-group-name)
(= group-color default-group-color)
(= group-image default-group-image)))]
[floating-button-page/view
{:customization-color group-color
:gradient-cover? true
@@ -85,13 +82,13 @@
:header [quo/page-nav
{:background :photo
:type :no-title
:icon-name :i/arrow-left
:on-press back-on-press}]
:icon-name back-button-icon
:on-press close}]
:footer [quo/button
{:customization-color group-color
:disabled? (boolean (or group-name-empty? error-message))
:on-press create-group-on-press}
(i18n/label :t/create-group-chat)]}
:disabled? disabled?
:on-press on-submit}
submit-button-label]}
[:<>
[avatar
{:customization-color group-color
@@ -99,7 +96,7 @@
:set-group-image set-group-image}]
[quo/title-input
{:on-change-text on-change-text
:default-value default-value
:default-value default-group-name
:container-style {:padding-horizontal 20 :padding-top 12 :padding-bottom (if error-message 0 16)}
:placeholder (i18n/label :t/name-your-group)
:max-length constants/max-group-chat-name-length}]
@@ -126,9 +123,9 @@
:padding-left (responsiveness/iphone-11-Pro-20-pixel-from-width
window-width)}}]]
[quo/divider-label
(i18n/label :t/n-m-people {:n (inc contacts-count) :m constants/max-group-chat-participants})]
(i18n/label :t/n-m-people {:n contacts-count :m constants/max-group-chat-participants})]
[rn/view {:style style/tags}
(for [contact (conj contacts profile)]
(for [contact contacts]
^{:key contact}
[quo/context-tag
{:container-style style/tag
@@ -1,4 +1,4 @@
(ns status-im.contexts.chat.group-create.style
(ns status-im.contexts.chat.group.common.style
(:require [quo.foundations.colors :as colors]))
(def avatar {:width 88 :margin-top 12 :margin-left 20})
@@ -0,0 +1,27 @@
(ns status-im.contexts.chat.group.create.view
(:require
[clojure.string :as string]
[quo.foundations.colors :as colors]
[status-im.constants :as constants]
[status-im.contexts.chat.group.common.group-edit :as group-edit]
[status-im.contexts.profile.utils :as profile.utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn view
[{:keys [close]}]
(let [contacts (rf/sub [:selected-group-contacts])
contact-string (string/join ", " (map profile.utils/displayed-name contacts))
default-group-name (subs contact-string
0
(min (count contact-string) constants/max-group-chat-name-length))
profile (rf/sub [:profile/profile-with-image])
contacts (conj contacts profile)]
[group-edit/view
{:default-group-name default-group-name
:default-group-color (rand-nth colors/account-colors)
:contacts contacts
:submit-button-label (i18n/label :t/create-group-chat)
:submit-event :group-chat/create
:back-button-icon :i/arrow-left
:close close}]))
@@ -1,4 +1,4 @@
(ns status-im.contexts.chat.group-details.style
(ns status-im.contexts.chat.group.details.style
(:require
[quo.foundations.colors :as colors]))
@@ -1,4 +1,4 @@
(ns status-im.contexts.chat.group-details.view
(ns status-im.contexts.chat.group.details.view
(:require
[quo.core :as quo]
[quo.foundations.colors :as colors]
@@ -11,7 +11,7 @@
[status-im.common.contact-list.view :as contact-list]
[status-im.common.home.actions.view :as actions]
[status-im.constants :as constants]
[status-im.contexts.chat.group-details.style :as style]
[status-im.contexts.chat.group.details.style :as style]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@@ -54,7 +54,7 @@
(let [theme (quo.theme/use-theme)
selected-participants (rf/sub [:group-chat/selected-participants])
deselected-members (rf/sub [:group-chat/deselected-members])
chat-id (rf/sub [:get-screen-params :group-add-manage-members])
chat-id (rf/sub [:get-screen-params :screen/group-add-manage-members])
{:keys [admins] :as group} (rf/sub [:chats/chat-by-id chat-id])
current-pk (rf/sub [:multiaccount/public-key])
admin? (get admins current-pk)]
@@ -123,9 +123,9 @@
[_]
[rn/view {:style {:height 8}}])
(defn group-details
(defn view
[]
(let [chat-id (rf/sub [:get-screen-params :group-details])
(let [chat-id (rf/sub [:get-screen-params :screen/group-details])
{:keys [admins chat-id chat-name color muted contacts image]
:as group} (rf/sub [:chats/chat-by-id chat-id])
members (rf/sub [:contacts/group-members-sections chat-id])
@@ -176,7 +176,8 @@
:icon :i/add-user
:label (i18n/label (if admin? :t/manage-members :t/add-members))
:counter-value (count contacts)
:on-press #(rf/dispatch [:open-modal :group-add-manage-members
:on-press #(rf/dispatch [:open-modal
:screen/group-add-manage-members
chat-id])}]}]
[rn/section-list
{:key-fn :title
@@ -1,12 +1,12 @@
(ns status-im.contexts.chat.group-create.events
(ns status-im.contexts.chat.group.events
(:require [clojure.string :as string]
[legacy.status-im.data-store.chats :as data-store.chats]
[oops.core :as oops]
[re-frame.core :as rf]
[status-im.common.avatar-picture-picker.view :as avatar-picture-picker]))
[status-im.common.avatar-picture-picker.view :as avatar-picture-picker]
[taoensso.timbre :as log]))
(rf/reg-event-fx :group-chat/create
(fn [{:keys [db]} [group-name color image]]
(fn [{:keys [db]} [{:keys [group-name group-color group-image]}]]
(let [selected-contacts (:group/selected-contacts db)]
{:json-rpc/call [{:method "wakuext_createGroupChatWithMembers"
:params [nil group-name (into [] selected-contacts)]
@@ -17,25 +17,23 @@
(oops/oget :id))]
(rf/dispatch [:chat-updated response])
(rf/dispatch [:group-chat/edit
{:chat-id chat-id
:group-name group-name
:color color
:image image}])))}]})))
(rf/reg-event-fx :group-chat/edit-success
(fn [{:keys [db]} [{:keys [chat-id name color image]}]]
(let [new-chat {:name name :color color :image image}]
{:db (update-in db [:chats chat-id] #(merge % new-chat))})))
{:chat-id chat-id
:group-name group-name
:group-color group-color
:group-image group-image}])))}]})))
(rf/reg-event-fx :group-chat/edit
(fn [_ [{:keys [chat-id group-name color image]}]]
(fn [_ [{:keys [chat-id group-name group-color group-image on-success]}]]
{:json-rpc/call [{:method "chat_editChat"
:params ["" chat-id group-name (name color)
{:imagePath (when image (string/replace-first image #"file://" ""))
:params ["" chat-id group-name (name group-color)
{:imagePath (when group-image
(string/replace-first group-image #"file://" ""))
:x 0
:y 0
:width avatar-picture-picker/crop-size
:height avatar-picture-picker/crop-size}]
:js-response true
:on-success #(rf/dispatch [:group-chat/edit-success
(data-store.chats/<-rpc-js %)])}]}))
:on-error #(log/error "failed to edit group" {:error %})
:on-success (fn [response]
(rf/dispatch [:chat-updated response true])
(when on-success (on-success)))}]}))
@@ -0,0 +1,23 @@
(ns status-im.contexts.chat.group.update.view
(:require
[status-im.contexts.chat.group.common.group-edit :as group-edit]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn view
[{:keys [close]}]
(let [chat-id (rf/sub [:get-screen-params :screen/group-update])
{:keys [chat-name color image]} (rf/sub [:chats/chat-by-id chat-id])
contacts (rf/sub [:contacts/contacts-by-chat chat-id])]
[group-edit/view
{:default-group-name chat-name
:default-group-color color
:default-group-image image
:contacts contacts
:submit-button-label (i18n/label :t/update-group-chat)
:submit-event :group-chat/edit
:back-button-icon :i/close
:chat-id chat-id
:close close
:on-success close
:editing-group? true}]))
@@ -237,11 +237,17 @@
(defn chat-item
[{:keys [chat-id group-chat color name last-message timestamp muted image
unviewed-messages-count]
chat-type unviewed-messages-count]
:as item}]
(let [[primary-name secondary-name]
(if group-chat
(cond
group-chat
[name ""]
(= chat-type constants/public-chat-type)
[(str "#" name) ""]
:else
(rf/sub [:contacts/contact-two-names-by-identity chat-id]))
{:keys [ens-verified added?] :as contact} (when-not group-chat
(rf/sub [:contacts/contact-by-address chat-id]))
@@ -149,7 +149,7 @@
:on-press (fn []
(if one-contact-selected?
(rf/dispatch [:chat.ui/start-chat public-key])
(rf/dispatch [:open-modal :group-create])))}
(rf/dispatch [:open-modal :screen/group-create])))}
(if one-contact-selected?
(i18n/label :t/chat-with {:selected-user primary-name})
(i18n/label :t/setup-group-chat))]])]))
@@ -12,10 +12,13 @@
(defn view
[{:keys [contact-id]}]
(let [customization-color (rf/sub [:profile/customization-color])
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity contact-id])
{:keys [contact-request-state
community-id]} (rf/sub [:chats/current-chat-chat-view])
community-id
chat-name]} (rf/sub [:chats/current-chat-chat-view])
chat-type (rf/sub [:chats/chat-type])
[primary-name _] (if (= chat-type :public-chat)
[(str "#" chat-name) ""]
(rf/sub [:contacts/contact-two-names-by-identity contact-id]))
community-chat? (= chat-type :community-chat)
joined (when community-chat?
(rf/sub [:communities/community-joined community-id]))
@@ -11,66 +11,93 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn- show-terms-of-use
[]
(rf/dispatch [:show-bottom-sheet {:content terms/terms-of-use :shell? true}]))
(defn- show-privacy-policy
[]
(rf/dispatch [:show-bottom-sheet {:content privacy/privacy-statement :shell? true}]))
(defn- terms
[terms-accepted? set-terms-accepted?]
[rn/view {:style style/terms-privacy-container}
[rn/view
{:accessibility-label :terms-privacy-checkbox-container}
[quo/selectors
{:type :checkbox
:blur? true
:checked? terms-accepted?
:on-change #(set-terms-accepted? not)}]]
[rn/view {:style style/text-container}
[quo/text
{:style style/plain-text
:size :paragraph-2}
(str (i18n/label :t/accept-status-tos-prefix) " ")]
[quo/text
{:on-press show-terms-of-use
:style style/highlighted-text
:size :paragraph-2
:weight :medium}
(i18n/label :t/terms-of-service)]
[quo/text
{:style style/plain-text
:size :paragraph-2}
" " (i18n/label :t/and) " "]
[quo/text
{:on-press show-privacy-policy
:style style/highlighted-text
:size :paragraph-2
:weight :medium}
(i18n/label :t/intro-privacy-policy)]]])
(defn- explore-new-status
[]
(rf/dispatch [:profile/explore-new-status]))
(defn- sync-or-recover-profile
[]
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch [:open-modal :screen/onboarding.sync-or-recover-profile]))
(defn- create-profile
[]
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch [:open-modal :screen/onboarding.new-to-status]))
(defn view
[]
(let [[terms-accepted? set-terms-accepted?] (rn/use-state false)]
(let [[terms-accepted? set-terms-accepted?] (rn/use-state false)
has-profiles-and-unaccepted-terms? (rf/sub [:profile/has-profiles-and-unaccepted-terms?])]
[rn/view {:style style/page-container}
[background/view false]
[quo/bottom-actions
{:container-style (style/bottom-actions-container (safe-area/get-bottom))
:actions :two-vertical-actions
:description :top
:description-top-text [rn/view
{:style style/terms-privacy-container}
[rn/view
{:accessibility-label :terms-privacy-checkbox-container}
[quo/selectors
{:type :checkbox
:blur? true
:checked? terms-accepted?
:on-change #(set-terms-accepted? not)}]]
[rn/view {:style style/text-container}
[quo/text
{:style style/plain-text
:size :paragraph-2}
(str (i18n/label :t/accept-status-tos-prefix) " ")]
[quo/text
{:on-press #(rf/dispatch [:show-bottom-sheet
{:content terms/terms-of-use
:shell? true}])
:style style/highlighted-text
:size :paragraph-2
:weight :medium}
(i18n/label :t/terms-of-service)]
[quo/text
{:style style/plain-text
:size :paragraph-2}
" " (i18n/label :t/and) " "]
[quo/text
{:on-press #(rf/dispatch [:show-bottom-sheet
{:content privacy/privacy-statement
:shell? true}])
:style style/highlighted-text
:size :paragraph-2
:weight :medium}
(i18n/label :t/intro-privacy-policy)]]]
:button-one-label (i18n/label :t/sync-or-recover-profile)
:button-one-props {:type :dark-grey
:disabled? (not terms-accepted?)
:accessibility-label :already-use-status-button
:on-press (fn []
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch
[:open-modal
:screen/onboarding.sync-or-recover-profile]))}
:button-two-label (i18n/label :t/create-profile)
:button-two-props {:accessibility-label :new-to-status-button
:disabled? (not terms-accepted?)
:on-press
(fn []
(when-let [blur-show-fn @overlay/blur-show-fn-atom]
(blur-show-fn))
(rf/dispatch
[:open-modal :screen/onboarding.new-to-status]))}}]
(cond->
{:container-style (style/bottom-actions-container (safe-area/get-bottom))
:actions :two-vertical-actions
:description :top
:description-top-text [terms terms-accepted? set-terms-accepted?]}
has-profiles-and-unaccepted-terms?
(assoc
:actions :one-action
:button-one-label (i18n/label :t/explore-the-new-status)
:button-one-props {:disabled? (not terms-accepted?)
:accessibility-label :explore-new-status
:on-press explore-new-status})
(not has-profiles-and-unaccepted-terms?)
(assoc
:actions :two-vertical-actions
:button-one-label (i18n/label :t/sync-or-recover-profile)
:button-one-props {:type :dark-grey
:disabled? (not terms-accepted?)
:accessibility-label :already-use-status-button
:on-press sync-or-recover-profile}
:button-two-label (i18n/label :t/create-profile)
:button-two-props {:accessibility-label :new-to-status-button
:disabled? (not terms-accepted?)
:on-press create-profile}))]
[overlay/view]]))
@@ -0,0 +1,5 @@
(ns status-im.contexts.profile.data-store)
(defn accepted-terms?
[accounts]
(some :hasAcceptedTerms accounts))
@@ -0,0 +1,14 @@
(ns status-im.contexts.profile.effects
(:require
[native-module.core :as native-module]
[promesa.core :as promesa]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(rf/reg-fx :effects.profile/accept-terms
(fn [{:keys [on-success]}]
(-> (native-module/accept-terms)
(promesa/then (fn []
(rf/call-continuation on-success)))
(promesa/catch (fn [error]
(log/error "Failed to accept terms" {:error error}))))))
+28 -20
View File
@@ -4,10 +4,12 @@
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[native-module.core :as native-module]
[status-im.config :as config]
[status-im.contexts.profile.data-store :as profile.data-store]
[status-im.contexts.profile.edit.accent-colour.events]
[status-im.contexts.profile.edit.bio.events]
[status-im.contexts.profile.edit.header.events]
[status-im.contexts.profile.edit.name.events]
status-im.contexts.profile.effects
status-im.contexts.profile.login.events
[status-im.contexts.profile.rpc :as profile.rpc]
[utils.re-frame :as rf]))
@@ -42,26 +44,27 @@
(rf/reg-event-fx
:profile/get-profiles-overview-success
(fn [{:keys [db]} [{:keys [accounts] {:keys [userConfirmed enabled]} :centralizedMetricsInfo}]]
(let [db-with-settings (assoc db
:centralized-metrics/user-confirmed? userConfirmed
:centralized-metrics/enabled? enabled)]
(if (seq accounts)
(let [profiles (reduce-profiles accounts)
{:keys [key-uid]} (first (sort-by :timestamp > (vals profiles)))]
{:db (if key-uid
(-> db-with-settings
(assoc :profile/profiles-overview profiles)
(update :profile/login #(select-profile % key-uid)))
db-with-settings)
:fx [[:dispatch [:update-theme-and-init-root :screen/profile.profiles]]
(when (and key-uid userConfirmed)
[:effects.biometric/check-if-available
{:key-uid key-uid
:on-success (fn [auth-method]
(rf/dispatch [:profile.login/check-biometric-success key-uid
auth-method]))}])]})
{:db db-with-settings
:fx [[:dispatch [:update-theme-and-init-root :screen/onboarding.intro]]]}))))
(let [db-with-settings (assoc db
:centralized-metrics/user-confirmed? userConfirmed
:centralized-metrics/enabled? enabled)
profiles (reduce-profiles accounts)
{:keys [key-uid]} (first (sort-by :timestamp > (vals profiles)))
new-db (cond-> db-with-settings
(seq profiles)
(assoc :profile/profiles-overview profiles)
key-uid
(update :profile/login #(select-profile % key-uid)))]
{:db new-db
:fx (if (profile.data-store/accepted-terms? accounts)
[[:dispatch [:update-theme-and-init-root :screen/profile.profiles]]
(when (and key-uid userConfirmed)
[:effects.biometric/check-if-available
{:key-uid key-uid
:on-success (fn [auth-method]
(rf/dispatch [:profile.login/check-biometric-success key-uid
auth-method]))}])]
[[:dispatch [:update-theme-and-init-root :screen/onboarding.intro]]])})))
(rf/reg-event-fx
:profile/update-setting-from-backup
@@ -82,3 +85,8 @@
:messages-from-contacts-only
(not (get-in db [:profile/profile :messages-from-contacts-only]))
{})))
(rf/reg-event-fx :profile/explore-new-status
(fn []
{:fx [[:effects.profile/accept-terms
{:on-success [:navigate-to :screen/profile.profiles]}]]}))
@@ -43,10 +43,18 @@
(defn flush-collectibles
[{:keys [db]}]
(let [collectibles-per-account (get-in db [:wallet :ui :collectibles :fetched])]
(let [collectibles-per-account (get-in db [:wallet :ui :collectibles :fetched])
updated-accounts (move-collectibles-to-accounts (get-in db [:wallet :accounts])
collectibles-per-account)
has-collectibles? (some (fn [account]
(pos? (count (:collectibles account))))
(vals updated-accounts))]
{:db (-> db
(update-in [:wallet :ui :collectibles] dissoc :pending-requests :fetched)
(update-in [:wallet :accounts] move-collectibles-to-accounts collectibles-per-account))}))
(assoc-in [:wallet :accounts] updated-accounts))
:fx [[:dispatch
[:centralized-metrics/track :metric/wallet-collectibles-fetched
{:has-collectibles? has-collectibles?}]]]}))
(rf/reg-event-fx :wallet/flush-collectibles-fetched flush-collectibles)
@@ -77,12 +77,13 @@
(defn token-value-drawer
[token watch-only? entry-point]
(let [token-symbol (:token token)
token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered
{:query token-symbol}]))
token-data (rf/sub [:wallet/token-by-symbol token-symbol])
selected-account (rf/sub [:wallet/current-viewing-account-address])
token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol])
testnet-mode? (rf/sub [:profile/test-networks-enabled?])
account-owns-token? (rf/sub [:wallet/current-account-owns-token token-symbol])
receive-token-symbol (if (= token-symbol "SNT") "ETH" "SNT")
token-owned? (if selected-account account-owns-token? (seq token-owners))
asset-to-receive (rf/sub [:wallet/token-by-symbol receive-token-symbol])
params (cond-> {:start-flow? true
:owners token-owners
@@ -103,11 +104,12 @@
(action-hide))]
(not watch-only?)
(concat [(action-buy)
(when (seq token-owners)
(when token-owned?
(action-send params entry-point))
(action-receive selected-account)
(action-swap params)
(when (seq token-owners)
(when token-owned?
(action-swap params))
(when token-owned?
(action-bridge (assoc params
:bridge-disabled?
(send-utils/bridge-disabled? token-symbol))))]))]]))
@@ -495,9 +495,7 @@
:TokenIDTo token-id-to
:SlippagePercentage slippage-percentage))
(not (or (= bridge-name constants/bridge-name-erc-721-transfer)
(= bridge-name constants/bridge-name-transfer)
(= bridge-name constants/bridge-name-hop)))
(= bridge-name constants/bridge-name-celer)
(assoc :CbridgeTx
(assoc tx-data
:ChainID to-chain-id
@@ -1,8 +1,10 @@
(ns status-im.contexts.wallet.common.utils.networks
(:require [clojure.string :as string]
[quo.foundations.resources :as resources]
[status-im.constants :as constants]
[utils.number]))
(:require
[clojure.string :as string]
[quo.foundations.resources :as resources]
[status-im.constants :as constants]
[utils.money :as money]
[utils.number]))
(def ^:private last-comma-followed-by-text-to-end-regex #",\s(?=[^,]+$)")
@@ -63,12 +65,21 @@
(defn network-list
[{:keys [balances-per-chain]} networks]
(into #{}
(mapv (fn [chain-id]
(first (filter #(or (= (:chain-id %) chain-id)
(= (:related-chain-id %) chain-id))
networks)))
(keys balances-per-chain))))
(->> balances-per-chain
keys
(map (fn [chain-id]
(first (filter #(or (= (:chain-id %) chain-id)
(= (:related-chain-id %) chain-id))
networks))))
set))
(defn network-list-with-positive-balance
"Same as `network-list`, but only returns the networks that have a positive token balance"
[{:keys [balances-per-chain] :as token} networks]
(as-> balances-per-chain $
(filter #(-> % second :raw-balance (money/greater-than 0)) $)
(assoc token :balances-per-chain $)
(network-list $ networks)))
(defn get-default-chain-ids-by-mode
[{:keys [test-networks-enabled? is-goerli-enabled?]}]
+2 -1
View File
@@ -10,4 +10,5 @@
;; Note: we set it to nil by default to differentiate when the user logs
;; in and the device is offline, versus re-fetching when offline and
;; tokens already exist in the app-db.
:tokens-loading nil}})
:tokens-loading nil
:active-tab :assets}})
@@ -59,6 +59,10 @@
(fn [{:keys [db]} [tab]]
{:db (assoc-in db [:wallet :ui :account-page :active-tab] tab)}))
(rf/reg-event-fx :wallet/select-home-tab
(fn [{:keys [db]} [tab]]
{:db (assoc-in db [:wallet :ui :active-tab] tab)}))
(rf/reg-event-fx :wallet/clear-account-tab
(fn [{:keys [db]}]
{:db (assoc-in db [:wallet :ui :account-page :active-tab] nil)}))
+12 -10
View File
@@ -41,6 +41,8 @@
(when (ff/enabled? ::ff/wallet.home-activity)
{:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab})])
(defn- change-tab [id] (rf/dispatch [:wallet/select-home-tab id]))
(defn- render-cards
[cards ref]
[rn/flat-list
@@ -64,15 +66,15 @@
(defn view
[]
(let [[selected-tab set-selected-tab] (rn/use-state (:id (first tabs-data)))
account-list-ref (rn/use-ref-atom nil)
tokens-loading? (rf/sub [:wallet/home-tokens-loading?])
networks (rf/sub [:wallet/selected-network-details])
account-cards-data (rf/sub [:wallet/account-cards-data])
cards (conj account-cards-data (new-account-card-data))
[init-loaded? set-init-loaded] (rn/use-state false)
{:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance])
theme (quo.theme/use-theme)]
(let [selected-tab (rf/sub [:wallet/home-tab])
account-list-ref (rn/use-ref-atom nil)
tokens-loading? (rf/sub [:wallet/home-tokens-loading?])
networks (rf/sub [:wallet/selected-network-details])
account-cards-data (rf/sub [:wallet/account-cards-data])
cards (conj account-cards-data (new-account-card-data))
[init-loaded? set-init-loaded] (rn/use-state false)
{:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance])
theme (quo.theme/use-theme)]
(rn/use-effect (fn []
(when (and @account-list-ref (pos? (count cards)))
(.scrollToOffset ^js @account-list-ref
@@ -104,7 +106,7 @@
(when (ff/enabled? ::ff/wallet.graph)
[quo/wallet-graph {:time-frame :empty}])
[render-cards cards account-list-ref]
[render-tabs tabs-data set-selected-tab selected-tab]]
[render-tabs tabs-data change-tab selected-tab]]
:content-container-style style/list-container
:sticky-header-indices [0]
:data []
+14 -8
View File
@@ -17,6 +17,7 @@
(fn [{:keys [db]} [{:keys [network asset-to-receive open-new-screen?] :as data}]]
(let [{:keys [wallet]} db
test-networks-enabled? (get-in db [:profile/profile :test-networks-enabled?])
view-id (:view-id db)
account (swap-utils/wallet-account wallet)
asset-to-pay (if (get-in data [:asset-to-pay :networks])
(:asset-to-pay data)
@@ -30,12 +31,13 @@
{:db (-> db
(assoc-in [:wallet :ui :swap :asset-to-pay] asset-to-pay)
(assoc-in [:wallet :ui :swap :asset-to-receive] asset-to-receive)
(assoc-in [:wallet :ui :swap :network] network'))
(assoc-in [:wallet :ui :swap :network] network')
(assoc-in [:wallet :ui :swap :launch-screen] view-id))
:fx (if network'
[[:dispatch [:wallet/switch-current-viewing-account (:address account)]]
[:dispatch
(if open-new-screen?
[:navigate-to :screen/wallet.setup-swap]
[:open-modal :screen/wallet.setup-swap]
[:navigate-to-within-stack
[:screen/wallet.setup-swap :screen/wallet.swap-select-asset-to-pay]])]
[:dispatch [:wallet.swap/set-default-slippage]]]
@@ -204,12 +206,6 @@
(fn [{:keys [db]}]
{:db (update-in db [:wallet :ui] dissoc :swap)}))
(rf/reg-event-fx
:wallet/on-swap-done
(fn [_]
{:fx [[:dispatch [:wallet/select-account-tab :activity]]
[:dispatch [:wallet/clean-swap]]]}))
(rf/reg-event-fx :wallet/swap-transaction
(fn [{:keys [db]} [sha3-pwd]]
(let [wallet-address (get-in db
@@ -299,6 +295,7 @@
:screen/wallet.swap-set-spending-cap
:screen/wallet.swap-confirmation)])
(when-not approval-required?
(rf/dispatch [:wallet/end-swap-flow])
(debounce/debounce-and-dispatch
[:toasts/upsert
{:id :swap-transaction-pending
@@ -424,3 +421,12 @@
:last-request-uuid
:approved-amount
:approval-transaction-id)))})))
(rf/reg-event-fx :wallet/end-swap-flow
(fn [{:keys [db]}]
(let [launch-screen (get-in db [:wallet :ui :swap :launch-screen])
address (get-in db [:wallet :current-viewing-account-address])]
{:fx [(when (= launch-screen :wallet-stack)
[:dispatch [:wallet/navigate-to-account-within-stack address]])
[:dispatch [:wallet/fetch-activities-for-current-account]]
[:dispatch [:wallet/select-account-tab :activity]]]})))
@@ -26,7 +26,7 @@
(let [pay-token-symbol (:symbol token)
asset-to-receive (if (= pay-token-symbol "SNT") eth-token snt-token)]
(rf/dispatch [:wallet.swap/start
{:asset-to-pay token
{:asset-to-pay {:symbol pay-token-symbol}
:asset-to-receive asset-to-receive
:open-new-screen? false}])))]
[:<>
@@ -156,7 +156,7 @@
:valid-input? valid-pay-input?
:clean-approval-transaction? true}))
[pay-input-amount])]
(rn/use-unmount #(rf/dispatch [:wallet/on-swap-done]))
(rn/use-unmount #(rf/dispatch [:wallet/clean-swap]))
(rn/use-effect
(fn []
(request-fetch-swap-proposal))
@@ -50,8 +50,10 @@
data)
symbols (->> tokens
:by-symbol
keys
(remove utils.address/address?))]
vals
(map :symbol)
set
vec)]
{:fx [[:effects.wallet.tokens/fetch-market-values
{:symbols symbols
:currency constants/profile-default-currency
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,10 @@
(ns status-im.setup.interceptor-metrics
(:require
#?@(:mobile
[[re-frame.core :as re-frame]
[status-im.contexts.centralized-metrics.events :as centralized-metrics]])))
(defn setup-centralized-metrics-interceptor
[]
#?(:mobile
(re-frame/reg-global-interceptor centralized-metrics/interceptor)))
+2 -2
View File
@@ -2,13 +2,13 @@
(:require
[re-frame.core :as re-frame]
[re-frame.std-interceptors :as std-interceptors]
[status-im.contexts.centralized-metrics.events :as centralized-metrics]
[status-im.setup.interceptor-metrics :as interceptor-metrics]
[utils.re-frame :as rf]))
(defn register-global-interceptors
[]
(re-frame/reg-global-interceptor rf/debug-handlers-names)
(re-frame/reg-global-interceptor centralized-metrics/interceptor)
(interceptor-metrics/setup-centralized-metrics-interceptor)
(re-frame/reg-global-interceptor (re-frame/inject-cofx :now))
;; Interceptor `trim-v` removes the first element of the event vector.
+6 -1
View File
@@ -125,7 +125,8 @@
:<- [:contacts/blocked-set]
:<- [:contacts/contacts-raw]
:<- [:chat/inputs]
(fn [[{:keys [group-chat chat-id] :as current-chat} my-public-key community blocked-users-set contacts
(fn [[{:keys [group-chat chat-id chat-name name] :as current-chat} my-public-key community
blocked-users-set contacts
inputs]]
(when current-chat
(cond-> current-chat
@@ -140,6 +141,9 @@
(assoc :able-to-send-message? true
:member? true)
(not chat-name)
(assoc :chat-name name)
(not group-chat)
(assoc
:contact-request-state (get-in contacts [chat-id :contact-request-state])
@@ -164,6 +168,7 @@
(condp apply [current-chat]
chat.events/community-chat? :community-chat
chat.events/group-chat? :group-chat
chat.events/public-chat? :public-chat
:chat)))
(re-frame/reg-sub
+10
View File
@@ -8,6 +8,7 @@
[re-frame.core :as re-frame]
[status-im.common.pixel-ratio :as pixel-ratio]
[status-im.constants :as constants]
[status-im.contexts.profile.data-store :as profile.data-store]
[status-im.contexts.profile.utils :as profile.utils]
[utils.security.core :as security]))
@@ -17,6 +18,15 @@
(fn [{:keys [customization-color]}]
(or customization-color constants/profile-default-color)))
;; A profile can only be created without accepting terms in Status v1. In Status
;; v2, the terms may be unaccepted because we intentionally created a migration
;; resetting the flag in case the privacy policy changed.
(re-frame/reg-sub :profile/has-profiles-and-unaccepted-terms?
:<- [:profile/profiles-overview]
(fn [profiles-overview]
(and (seq profiles-overview)
(not (profile.data-store/accepted-terms? (vals profiles-overview))))))
(re-frame/reg-sub
:profile/currency
:<- [:profile/profile]
+26 -10
View File
@@ -450,17 +450,19 @@
(map
(fn [token]
(assoc token
:bridge-disabled? (and (= tx-type :tx/bridge)
(send-utils/bridge-disabled? (:symbol
token)))
:networks (cond->> (network-utils/network-list token
networks)
chain-ids
(filter #(some #{(:chain-id %)} chain-ids)))
:bridge-disabled? (and (= tx-type :tx/bridge)
(send-utils/bridge-disabled? (:symbol
token)))
:networks (cond->>
(network-utils/network-list-with-positive-balance
token
networks)
chain-ids
(filter #(some #{(:chain-id %)} chain-ids)))
:available-balance (utils/calculate-total-token-balance token)
:total-balance (utils/calculate-total-token-balance
token
chain-ids))))
:total-balance (utils/calculate-total-token-balance
token
chain-ids))))
(filter (fn [{:keys [networks]}]
(pos? (count networks))))
(remove #(when hide-token-fn (hide-token-fn constants/swap-tokens-my %))))
@@ -575,12 +577,26 @@
tokens))
addresses-tokens)))
(rf/reg-sub
:wallet/current-account-owns-token
(fn [[_ token-symbol]]
[(rf/subscribe [:wallet/current-viewing-account-address])
(rf/subscribe [:wallet/operable-addresses-with-token-symbol token-symbol])])
(fn [[address addresses-with-token]]
(-> addresses-with-token set (contains? address))))
(rf/reg-sub
:wallet/account-tab
:<- [:wallet/ui]
(fn [ui]
(get-in ui [:account-page :active-tab])))
(rf/reg-sub
:wallet/home-tab
:<- [:wallet/ui]
(fn [ui]
(:active-tab ui)))
(rf/reg-sub
:wallet/aggregated-tokens
:<- [:wallet/accounts-without-watched-accounts]
+3
View File
@@ -70,6 +70,9 @@
{:initializeApplication
(fn [request callback]
(callback (.initializeApplication native-status request)))
:acceptTerms
(fn [callback]
(callback (.acceptTerms native-status)))
:createAccountAndLogin
(fn [request] (.createAccountAndLogin native-status request))
:restoreAccountAndLogin
+3 -3
View File
@@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v3.3.0",
"commit-sha1": "43659f0c7e1a64102e7f8e38bd532b72714c5819",
"src-sha256": "01fpviw1g22f4ni3li2wnhyz0l517jfipvnyfysckds6yi94l0hf"
"version": "feat/cached-eth-client",
"commit-sha1": "1ff81a2f757eb981e234201e4e5028b7933eaa2a",
"src-sha256": "0hqyhddh08mhz9z8y3s17wgvzc7yfafydj60sjsfxb364ajhhb2q"
}
+2
View File
@@ -1002,6 +1002,7 @@
"expand-all": "Expand all",
"experienced-web3": "Experienced in Web3?",
"explore-the-decentralized-web": "Explore and interact with the decentralized web",
"explore-the-new-status": "Explore the new Status",
"export-account": "Export account",
"export-key": "Export private key",
"external-link": "External link",
@@ -2646,6 +2647,7 @@
"untrustworthy": "Untrustworthy",
"update": "Update",
"update-account-name": "Update account name",
"update-group-chat": "Update group chat",
"update-nickname-title": "Update nickname",
"update-to-listen-audio": "Update to latest version to listen to an audio message here!",
"update-to-see-image": "Update to latest version to see a nice image here!",