aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorVimal <vtiwari@coinswitch.co>2018-11-12 20:20:37 +0800
committerVimal <vtiwari@coinswitch.co>2018-11-12 20:20:37 +0800
commit6bb92a8672edf23465fb109c8966d2e56500ea86 (patch)
tree6f5c4e348fb58fcf23b27278ffae1c1b912ad08e /ui/app/actions.js
parent82b11b69a5dea38a4a036096528354a5a291a447 (diff)
parentda1036f2c4b20748407b7fa89b60df5e321fcab7 (diff)
downloadtangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar.gz
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar.bz2
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar.lz
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar.xz
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.tar.zst
tangerine-wallet-browser-6bb92a8672edf23465fb109c8966d2e56500ea86.zip
merging upstream branch
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js63
1 files changed, 60 insertions, 3 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index eea581d33..501fef76d 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -305,6 +305,12 @@ var actions = {
updateFeatureFlags,
UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS',
+ // Preferences
+ setPreference,
+ updatePreferences,
+ UPDATE_PREFERENCES: 'UPDATE_PREFERENCES',
+ setUseNativeCurrencyAsPrimaryCurrencyPreference,
+
setMouseUserState,
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
@@ -319,6 +325,9 @@ var actions = {
clearPendingTokens,
createCancelTransaction,
+ approveProviderRequest,
+ rejectProviderRequest,
+ clearApprovedOrigins,
}
module.exports = actions
@@ -1868,10 +1877,10 @@ function updateProviderType (type) {
}
}
-function setRpcTarget (newRpc) {
+function setRpcTarget (newRpc, chainId, ticker = 'ETH', nickname = '') {
return (dispatch) => {
- log.debug(`background.setRpcTarget: ${newRpc}`)
- background.setCustomRpc(newRpc, (err, result) => {
+ log.debug(`background.setRpcTarget: ${newRpc} ${chainId} ${ticker} ${nickname}`)
+ background.setCustomRpc(newRpc, chainId, ticker, nickname, (err, result) => {
if (err) {
log.error(err)
return dispatch(actions.displayWarning('Had a problem changing networks!'))
@@ -2298,6 +2307,36 @@ function updateFeatureFlags (updatedFeatureFlags) {
}
}
+function setPreference (preference, value) {
+ return dispatch => {
+ dispatch(actions.showLoadingIndication())
+ return new Promise((resolve, reject) => {
+ background.setPreference(preference, value, (err, updatedPreferences) => {
+ dispatch(actions.hideLoadingIndication())
+
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ return reject(err)
+ }
+
+ dispatch(actions.updatePreferences(updatedPreferences))
+ resolve(updatedPreferences)
+ })
+ })
+ }
+}
+
+function updatePreferences (value) {
+ return {
+ type: actions.UPDATE_PREFERENCES,
+ value,
+ }
+}
+
+function setUseNativeCurrencyAsPrimaryCurrencyPreference (value) {
+ return setPreference('useNativeCurrencyAsPrimaryCurrency', value)
+}
+
function setNetworkNonce (networkNonce) {
return {
type: actions.SET_NETWORK_NONCE,
@@ -2448,3 +2487,21 @@ function setPendingTokens (pendingTokens) {
payload: tokens,
}
}
+
+function approveProviderRequest (origin) {
+ return (dispatch) => {
+ background.approveProviderRequest(origin)
+ }
+}
+
+function rejectProviderRequest (origin) {
+ return (dispatch) => {
+ background.rejectProviderRequest(origin)
+ }
+}
+
+function clearApprovedOrigins () {
+ return (dispatch) => {
+ background.clearApprovedOrigins()
+ }
+}