[#9986] Allow to disable fetching of tx history on mobile network
This commit is contained in:
parent
d22a87b77c
commit
c2277cbbe5
|
@ -21,3 +21,4 @@ STATUS_GO_ENABLE_NIMBUS=0
|
||||||
KEYCARD_TEST_MENU=0
|
KEYCARD_TEST_MENU=0
|
||||||
ENABLE_ROOT_ALERT=1
|
ENABLE_ROOT_ALERT=1
|
||||||
ENABLE_REFERRAL_INVITE=1
|
ENABLE_REFERRAL_INVITE=1
|
||||||
|
DISABLE_WALLET_ON_MOBILE_NETWORK=1
|
||||||
|
|
|
@ -1099,6 +1099,18 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
Statusgo.appStateChange(type);
|
Statusgo.appStateChange(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void stopWallet() {
|
||||||
|
Log.d(TAG, "StopWallet");
|
||||||
|
Statusgo.stopWallet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void startWallet() {
|
||||||
|
Log.d(TAG, "StartWallet");
|
||||||
|
Statusgo.startWallet();
|
||||||
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void setBlankPreviewFlag(final Boolean blankPreview) {
|
public void setBlankPreviewFlag(final Boolean blankPreview) {
|
||||||
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
|
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
|
||||||
|
|
|
@ -740,6 +740,20 @@ RCT_EXPORT_METHOD(appStateChange:(NSString *)type) {
|
||||||
StatusgoAppStateChange(type);
|
StatusgoAppStateChange(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_METHOD(stopWallet) {
|
||||||
|
#if DEBUG
|
||||||
|
NSLog(@"StopWallet() method called");
|
||||||
|
#endif
|
||||||
|
StatusgoStopWallet();
|
||||||
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_METHOD(startWallet) {
|
||||||
|
#if DEBUG
|
||||||
|
NSLog(@"StartWallet() method called");
|
||||||
|
#endif
|
||||||
|
StatusgoStartWallet();
|
||||||
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(setBlankPreviewFlag:(BOOL *)newValue)
|
RCT_EXPORT_METHOD(setBlankPreviewFlag:(BOOL *)newValue)
|
||||||
{
|
{
|
||||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.ethereum.subscriptions
|
(ns status-im.ethereum.subscriptions
|
||||||
(:require [status-im.ethereum.eip55 :as eip55]
|
(:require [status-im.ethereum.eip55 :as eip55]
|
||||||
[status-im.wallet.db :as wallet]
|
[status-im.wallet.db :as wallet]
|
||||||
|
[status-im.wallet.core :as wallet.core]
|
||||||
[status-im.ethereum.transactions.core :as transactions]
|
[status-im.ethereum.transactions.core :as transactions]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
@ -59,6 +60,8 @@
|
||||||
(log/debug "[wallet-subs] recent-history-fetching-ended"
|
(log/debug "[wallet-subs] recent-history-fetching-ended"
|
||||||
"accounts" accounts
|
"accounts" accounts
|
||||||
"block" blockNumber)
|
"block" blockNumber)
|
||||||
|
(fx/merge
|
||||||
|
cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(update-in [:wallet :accounts]
|
(update-in [:wallet :accounts]
|
||||||
wallet/remove-transactions-since-block blockNumber)
|
wallet/remove-transactions-since-block blockNumber)
|
||||||
|
@ -76,7 +79,8 @@
|
||||||
accounts)
|
accounts)
|
||||||
:before-block blockNumber
|
:before-block blockNumber
|
||||||
:limit 20
|
:limit 20
|
||||||
:historical? true}})
|
:historical? true}}
|
||||||
|
(wallet.core/restart-wallet-service)))
|
||||||
|
|
||||||
(fx/defn new-wallet-event
|
(fx/defn new-wallet-event
|
||||||
[cofx {:keys [type blockNumber accounts newTransactions] :as event}]
|
[cofx {:keys [type blockNumber accounts newTransactions] :as event}]
|
||||||
|
|
|
@ -602,7 +602,7 @@
|
||||||
:message-not-sent
|
:message-not-sent
|
||||||
:message-options-cancel
|
:message-options-cancel
|
||||||
:message-reply
|
:message-reply
|
||||||
:message-syncing
|
:data-syncing
|
||||||
:messages
|
:messages
|
||||||
:might-break
|
:might-break
|
||||||
:migrations-failed-content
|
:migrations-failed-content
|
||||||
|
|
|
@ -284,6 +284,7 @@
|
||||||
;;FIXME
|
;;FIXME
|
||||||
(when nodes
|
(when nodes
|
||||||
(fleet/set-nodes :eth.contract nodes))
|
(fleet/set-nodes :eth.contract nodes))
|
||||||
|
(wallet/restart-wallet-service)
|
||||||
(if login-only?
|
(if login-only?
|
||||||
(login-only-events key-uid password save-password?)
|
(login-only-events key-uid password save-password?)
|
||||||
(create-only-events))
|
(create-only-events))
|
||||||
|
|
|
@ -263,6 +263,14 @@
|
||||||
(log/debug "[native-module] app-state-change")
|
(log/debug "[native-module] app-state-change")
|
||||||
(.appStateChange ^js (status) state))
|
(.appStateChange ^js (status) state))
|
||||||
|
|
||||||
|
(defn stop-wallet []
|
||||||
|
(log/debug "[native-module] stop-wallet")
|
||||||
|
(.stopWallet ^js (status)))
|
||||||
|
|
||||||
|
(defn start-wallet []
|
||||||
|
(log/debug "[native-module] start-wallet")
|
||||||
|
(.startWallet ^js (status)))
|
||||||
|
|
||||||
(defn set-blank-preview-flag [flag]
|
(defn set-blank-preview-flag [flag]
|
||||||
(log/debug "[native-module] set-blank-preview-flag")
|
(log/debug "[native-module] set-blank-preview-flag")
|
||||||
(.setBlankPreviewFlag ^js (status) flag))
|
(.setBlankPreviewFlag ^js (status) flag))
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
[status-im.ui.screens.mobile-network-settings.events :as mobile-network]
|
[status-im.ui.screens.mobile-network-settings.events :as mobile-network]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
[status-im.wallet.core :as wallet]
|
[status-im.wallet.core :as wallet]
|
||||||
["@react-native-community/netinfo" :default net-info]))
|
["@react-native-community/netinfo" :default net-info]
|
||||||
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(fx/defn change-network-status
|
(fx/defn change-network-status
|
||||||
[{:keys [db] :as cofx} is-connected?]
|
[{:keys [db] :as cofx} is-connected?]
|
||||||
|
@ -26,11 +27,19 @@
|
||||||
[{:keys [db] :as cofx} {:keys [isConnected type details] :as state}]
|
[{:keys [db] :as cofx} {:keys [isConnected type details] :as state}]
|
||||||
(let [old-network-status (:network-status db)
|
(let [old-network-status (:network-status db)
|
||||||
old-network-type (:network/type db)
|
old-network-type (:network/type db)
|
||||||
connectivity-status (if isConnected :online :offline)]
|
connectivity-status (if isConnected :online :offline)
|
||||||
|
status-changed? (= connectivity-status old-network-status)
|
||||||
|
type-changed? (= type old-network-type)]
|
||||||
|
(log/debug "[net-info]"
|
||||||
|
"old-network-status" old-network-status
|
||||||
|
"old-network-type" old-network-type
|
||||||
|
"connectivity-status" connectivity-status
|
||||||
|
"type" type
|
||||||
|
"details" details)
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
(when-not (= connectivity-status old-network-status)
|
(when-not status-changed?
|
||||||
(change-network-status isConnected))
|
(change-network-status isConnected))
|
||||||
(when-not (= type old-network-type)
|
(when-not type-changed?
|
||||||
(change-network-type old-network-type type (:is-connection-expensive details))))))
|
(change-network-type old-network-type type (:is-connection-expensive details))))))
|
||||||
|
|
||||||
(defn add-net-info-listener []
|
(defn add-net-info-listener []
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
;;general
|
;;general
|
||||||
(reg-root-key-sub :sync-state :sync-state)
|
(reg-root-key-sub :sync-state :sync-state)
|
||||||
(reg-root-key-sub :network-status :network-status)
|
(reg-root-key-sub :network-status :network-status)
|
||||||
|
(reg-root-key-sub :network/type :network/type)
|
||||||
(reg-root-key-sub :peers-count :peers-count)
|
(reg-root-key-sub :peers-count :peers-count)
|
||||||
(reg-root-key-sub :about-app/node-info :node-info)
|
(reg-root-key-sub :about-app/node-info :node-info)
|
||||||
(reg-root-key-sub :peers-summary :peers-summary)
|
(reg-root-key-sub :peers-summary :peers-summary)
|
||||||
|
@ -153,7 +154,8 @@
|
||||||
(reg-root-key-sub :wallet.transactions :wallet.transactions)
|
(reg-root-key-sub :wallet.transactions :wallet.transactions)
|
||||||
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
|
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
|
||||||
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
|
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
|
||||||
|
(reg-root-key-sub :wallet-service/manual-setting :wallet-service/manual-setting)
|
||||||
|
(reg-root-key-sub :wallet-service/state :wallet-service/state)
|
||||||
;;commands
|
;;commands
|
||||||
(reg-root-key-sub :commands/select-account :commands/select-account)
|
(reg-root-key-sub :commands/select-account :commands/select-account)
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
|
[status-im.wallet.core :as wallet]
|
||||||
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
|
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
|
||||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||||
[status-im.navigation :as navigation]
|
[status-im.navigation :as navigation]
|
||||||
[status-im.mailserver.core :as mailserver]
|
[status-im.mailserver.core :as mailserver]
|
||||||
[status-im.ui.screens.mobile-network-settings.utils :as utils]))
|
[status-im.ui.screens.mobile-network-settings.utils :as utils]
|
||||||
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(fx/defn sheet-defaults
|
(fx/defn sheet-defaults
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
|
@ -34,7 +36,8 @@
|
||||||
|
|
||||||
logged-in?
|
logged-in?
|
||||||
[(mailserver/process-next-messages-request)
|
[(mailserver/process-next-messages-request)
|
||||||
(bottom-sheet/hide-bottom-sheet)]))))
|
(bottom-sheet/hide-bottom-sheet)
|
||||||
|
(wallet/restart-wallet-service)]))))
|
||||||
|
|
||||||
(defn apply-settings
|
(defn apply-settings
|
||||||
([sync?] (apply-settings sync? :default))
|
([sync?] (apply-settings sync? :default))
|
||||||
|
@ -44,7 +47,12 @@
|
||||||
remember-choice?
|
remember-choice?
|
||||||
(if (not= :default remember?)
|
(if (not= :default remember?)
|
||||||
remember?
|
remember?
|
||||||
(:mobile-network/remember-choice? db))]
|
(:mobile-network/remember-choice? db))
|
||||||
|
cellular? (utils/cellular? network)]
|
||||||
|
(log/info "apply mobile network settings"
|
||||||
|
"sunc?" sync?
|
||||||
|
"remember?" remember?
|
||||||
|
"cellular?" cellular?)
|
||||||
(fx/merge
|
(fx/merge
|
||||||
cofx
|
cofx
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
|
@ -52,8 +60,9 @@
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
:remember-syncing-choice? (boolean remember-choice?) {})
|
:remember-syncing-choice? (boolean remember-choice?) {})
|
||||||
(bottom-sheet/hide-bottom-sheet)
|
(bottom-sheet/hide-bottom-sheet)
|
||||||
(when (and (utils/cellular? network) sync?)
|
(when (and cellular? sync?)
|
||||||
(mailserver/process-next-messages-request)))))))
|
(mailserver/process-next-messages-request))
|
||||||
|
(wallet/restart-wallet-service))))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:mobile-network/continue-syncing
|
:mobile-network/continue-syncing
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
[react/view {:style {:flex 1 :background-color colors/white}}
|
[react/view {:style {:flex 1 :background-color colors/white}}
|
||||||
[topbar/topbar {:title (i18n/label :t/sync-settings)}]
|
[topbar/topbar {:title (i18n/label :t/sync-settings)}]
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
[quo/list-header (i18n/label :t/message-syncing)]
|
[quo/list-header (i18n/label :t/data-syncing)]
|
||||||
[quo/list-item {:size :small
|
[quo/list-item {:size :small
|
||||||
:title (i18n/label :t/mobile-network-settings)
|
:title (i18n/label :t/mobile-network-settings)
|
||||||
:accessibility-label :notifications-button
|
:accessibility-label :notifications-button
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
[status-im.ethereum.stateofus :as stateofus]
|
[status-im.ethereum.stateofus :as stateofus]
|
||||||
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
|
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
|
||||||
[status-im.wallet.prices :as prices]
|
[status-im.wallet.prices :as prices]
|
||||||
[status-im.wallet.utils :as wallet.utils]))
|
[status-im.wallet.utils :as wallet.utils]
|
||||||
|
[status-im.native-module.core :as status]
|
||||||
|
[status-im.ui.screens.mobile-network-settings.utils :as mobile-network-utils]))
|
||||||
|
|
||||||
(defn get-balance
|
(defn get-balance
|
||||||
[{:keys [address on-success on-error]}]
|
[{:keys [address on-success on-error]}]
|
||||||
|
@ -593,3 +595,44 @@
|
||||||
:cancel-button-text (i18n/label :t/no)
|
:cancel-button-text (i18n/label :t/no)
|
||||||
:on-accept #(re-frame/dispatch [:wallet.accounts/delete-account account])
|
:on-accept #(re-frame/dispatch [:wallet.accounts/delete-account account])
|
||||||
:on-cancel #()}})
|
:on-cancel #()}})
|
||||||
|
|
||||||
|
(re-frame/reg-fx
|
||||||
|
::stop-wallet
|
||||||
|
(fn []
|
||||||
|
(log/info "stop-wallet fx")
|
||||||
|
(status/stop-wallet)))
|
||||||
|
|
||||||
|
(re-frame/reg-fx
|
||||||
|
::start-wallet
|
||||||
|
(fn []
|
||||||
|
(log/info "start-wallet fx")
|
||||||
|
(status/start-wallet)))
|
||||||
|
|
||||||
|
(fx/defn stop-wallet
|
||||||
|
[{:keys [db] :as cofx}]
|
||||||
|
(let []
|
||||||
|
{:db (assoc db :wallet-service/state :stopped)
|
||||||
|
::stop-wallet nil}))
|
||||||
|
|
||||||
|
(fx/defn start-wallet
|
||||||
|
[{:keys [db] :as cofx}]
|
||||||
|
(let []
|
||||||
|
{:db (assoc db :wallet-service/state :started)
|
||||||
|
::start-wallet nil}))
|
||||||
|
|
||||||
|
(fx/defn restart-wallet-service
|
||||||
|
[{:keys [db] :as cofx}]
|
||||||
|
(when (:multiaccount db)
|
||||||
|
(let [state (:wallet-service/state db)
|
||||||
|
syncing-allowed? (mobile-network-utils/syncing-allowed? cofx)]
|
||||||
|
(log/info "restart-wallet-service"
|
||||||
|
"syncing-allowed" syncing-allowed?
|
||||||
|
"state" state)
|
||||||
|
(cond
|
||||||
|
(and (not syncing-allowed?)
|
||||||
|
(not= state :stopped))
|
||||||
|
(stop-wallet cofx)
|
||||||
|
|
||||||
|
(and syncing-allowed?
|
||||||
|
(not= state :started))
|
||||||
|
(start-wallet cofx)))))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "v0.56.6",
|
"version": "stop-wallet",
|
||||||
"commit-sha1": "2d0818d873fee570a73867d8ed4bc8e792215cf1",
|
"commit-sha1": "08d4f2e422ca3de0b639022baf840bebdb5bd67b",
|
||||||
"src-sha256": "0d9k0c2srhmm5dpzx3dkzn1h0p60x9zwjzim6x08gp9yd87h3zmv"
|
"src-sha256": "1k16fhr6hrmxv47jpwhlj164blf20sq96gba4378vmpzhakqk266"
|
||||||
}
|
}
|
||||||
|
|
|
@ -692,7 +692,7 @@
|
||||||
"message-not-sent": "Message not sent",
|
"message-not-sent": "Message not sent",
|
||||||
"message-options-cancel": "Cancel",
|
"message-options-cancel": "Cancel",
|
||||||
"message-reply": "Reply",
|
"message-reply": "Reply",
|
||||||
"message-syncing": "Message syncing",
|
"data-syncing": "Data syncing",
|
||||||
"messages": "Messages",
|
"messages": "Messages",
|
||||||
"chat-is-a-contact": "Contact",
|
"chat-is-a-contact": "Contact",
|
||||||
"chat-is-not-a-contact": "Not a contact",
|
"chat-is-not-a-contact": "Not a contact",
|
||||||
|
@ -712,9 +712,9 @@
|
||||||
"mobile-network-stop-syncing": "Stop syncing",
|
"mobile-network-stop-syncing": "Stop syncing",
|
||||||
"mobile-network-stop-syncing-details": "Until connected to Wi-Fi?",
|
"mobile-network-stop-syncing-details": "Until connected to Wi-Fi?",
|
||||||
"mobile-network-use-mobile": "Use mobile data",
|
"mobile-network-use-mobile": "Use mobile data",
|
||||||
"mobile-network-use-mobile-data": "Status uses a lot of data when syncing chats.",
|
"mobile-network-use-mobile-data": "Status uses a lot of data when syncing chats and wallet.",
|
||||||
"mobile-network-use-wifi": "Wi-Fi only",
|
"mobile-network-use-wifi": "Wi-Fi only",
|
||||||
"mobile-syncing-sheet-details": "Status uses a lot of data when syncing chats.",
|
"mobile-syncing-sheet-details": "Status uses a lot of data when syncing chats and wallet.",
|
||||||
"mobile-syncing-sheet-title": "Sync using mobile data?",
|
"mobile-syncing-sheet-title": "Sync using mobile data?",
|
||||||
"more": "more",
|
"more": "more",
|
||||||
"multiaccount-exists-title": "Keys for this account already exist",
|
"multiaccount-exists-title": "Keys for this account already exist",
|
||||||
|
|
Loading…
Reference in New Issue