aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorbitpshr <mail@bitpshr.net>2018-10-11 02:52:26 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-11-06 07:07:09 +0800
commit226601a956594d00817cdb1fa5214242aae7936c (patch)
treeca3b8a64b685599ef8ef26d4bf3396170949d122 /ui
parentbfcb73ad533b7c2acea012a586c2a391811faf03 (diff)
downloadtangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.gz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.bz2
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.lz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.xz
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.tar.zst
tangerine-wallet-browser-226601a956594d00817cdb1fa5214242aae7936c.zip
EIP-1102: add user privacy option
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js7
-rw-r--r--ui/app/components/modals/force-injection/force-injection.component.js39
-rw-r--r--ui/app/components/modals/force-injection/force-injection.container.js16
-rw-r--r--ui/app/components/modals/force-injection/index.js1
-rw-r--r--ui/app/components/modals/modal.js14
-rw-r--r--ui/app/components/pages/settings/settings-tab/settings-tab.component.js65
-rw-r--r--ui/app/components/pages/settings/settings-tab/settings-tab.container.js8
7 files changed, 37 insertions, 113 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 2430b8217..501fef76d 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -328,7 +328,6 @@ var actions = {
approveProviderRequest,
rejectProviderRequest,
clearApprovedOrigins,
- forceInjection,
}
module.exports = actions
@@ -2506,9 +2505,3 @@ function clearApprovedOrigins () {
background.clearApprovedOrigins()
}
}
-
-function forceInjection () {
- return (dispatch) => {
- background.forceInjection()
- }
-}
diff --git a/ui/app/components/modals/force-injection/force-injection.component.js b/ui/app/components/modals/force-injection/force-injection.component.js
deleted file mode 100644
index 1ea08b5ee..000000000
--- a/ui/app/components/modals/force-injection/force-injection.component.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import React, { PureComponent } from 'react'
-import PropTypes from 'prop-types'
-import Modal, { ModalContent } from '../../modal'
-
-export default class ForceInjection extends PureComponent {
- static propTypes = {
- hideModal: PropTypes.func.isRequired,
- forceInjection: PropTypes.func.isRequired,
- }
-
- static contextTypes = {
- t: PropTypes.func,
- }
-
- handleForce = () => {
- const { forceInjection, hideModal } = this.props
- forceInjection()
- hideModal()
- }
-
- render () {
- const { t } = this.context
-
- return (
- <Modal
- onSubmit={this.handleForce}
- onCancel={() => this.props.hideModal()}
- submitText={t('ok')}
- cancelText={t('nevermind')}
- submitType="secondary"
- >
- <ModalContent
- title={t('exposeAccounts')}
- description={t('confirmExpose')}
- />
- </Modal>
- )
- }
-}
diff --git a/ui/app/components/modals/force-injection/force-injection.container.js b/ui/app/components/modals/force-injection/force-injection.container.js
deleted file mode 100644
index fa0a325c3..000000000
--- a/ui/app/components/modals/force-injection/force-injection.container.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { connect } from 'react-redux'
-import { compose } from 'recompose'
-import withModalProps from '../../../higher-order-components/with-modal-props'
-import ForceInjectionComponent from './force-injection.component'
-import { forceInjection } from '../../../actions'
-
-const mapDispatchToProps = dispatch => {
- return {
- forceInjection: () => dispatch(forceInjection()),
- }
-}
-
-export default compose(
- withModalProps,
- connect(null, mapDispatchToProps)
-)(ForceInjectionComponent)
diff --git a/ui/app/components/modals/force-injection/index.js b/ui/app/components/modals/force-injection/index.js
deleted file mode 100644
index 4ea4dc695..000000000
--- a/ui/app/components/modals/force-injection/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from './force-injection.container'
diff --git a/ui/app/components/modals/modal.js b/ui/app/components/modals/modal.js
index bdf8e4b9e..5aff4f5e1 100644
--- a/ui/app/components/modals/modal.js
+++ b/ui/app/components/modals/modal.js
@@ -29,7 +29,6 @@ import CancelTransaction from './cancel-transaction'
import WelcomeBeta from './welcome-beta'
import RejectTransactions from './reject-transactions'
import ClearApprovedOrigins from './clear-approved-origins'
-import ForceInjection from './force-injection'
const modalContainerBaseStyle = {
transform: 'translate3d(-50%, 0, 0px)',
@@ -227,19 +226,6 @@ const MODALS = {
},
},
- FORCE_INJECTION: {
- contents: h(ForceInjection),
- mobileModalStyle: {
- ...modalContainerMobileStyle,
- },
- laptopModalStyle: {
- ...modalContainerLaptopStyle,
- },
- contentStyle: {
- borderRadius: '8px',
- },
- },
-
OLD_UI_NOTIFICATION_MODAL: {
contents: [
h(NotifcationModal, {
diff --git a/ui/app/components/pages/settings/settings-tab/settings-tab.component.js b/ui/app/components/pages/settings/settings-tab/settings-tab.component.js
index 95a18d28b..a0a8ed47e 100644
--- a/ui/app/components/pages/settings/settings-tab/settings-tab.component.js
+++ b/ui/app/components/pages/settings/settings-tab/settings-tab.component.js
@@ -39,6 +39,8 @@ export default class SettingsTab extends PureComponent {
metamask: PropTypes.object,
setUseBlockie: PropTypes.func,
setHexDataFeatureFlag: PropTypes.func,
+ setPrivacyMode: PropTypes.func,
+ privacyMode: PropTypes.bool,
setCurrentCurrency: PropTypes.func,
setRpcTarget: PropTypes.func,
delRpcTarget: PropTypes.func,
@@ -46,7 +48,6 @@ export default class SettingsTab extends PureComponent {
revealSeedConfirmation: PropTypes.func,
setFeatureFlagToBeta: PropTypes.func,
showClearApprovalModal: PropTypes.func,
- showForceInjectionModal: PropTypes.func,
showResetAccountConfirmationModal: PropTypes.func,
warning: PropTypes.string,
history: PropTypes.object,
@@ -308,36 +309,6 @@ export default class SettingsTab extends PureComponent {
)
}
- renderForceInjection () {
- const { t } = this.context
- const { showForceInjectionModal } = this.props
- return (
- <div className="settings-page__content-row">
- <div className="settings-page__content-item">
- <span>{ t('exposeAccounts') }</span>
- <span className="settings-page__content-description">
- { t('exposeDescription') }
- </span>
- </div>
- <div className="settings-page__content-item">
- <div className="settings-page__content-item-col">
- <Button
- type="secondary"
- large
- className="settings-tab__button--orange"
- onClick={event => {
- event.preventDefault()
- showForceInjectionModal()
- }}
- >
- { t('exposeAccounts') }
- </Button>
- </div>
- </div>
- </div>
- )
- }
-
renderSeedWords () {
const { t } = this.context
const { history } = this.props
@@ -523,6 +494,32 @@ export default class SettingsTab extends PureComponent {
)
}
+ renderPrivacyOptIn () {
+ const { t } = this.context
+ const { privacyMode, setPrivacyMode } = this.props
+
+ return (
+ <div className="settings-page__content-row">
+ <div className="settings-page__content-item">
+ <span>{ t('privacyMode') }</span>
+ <div className="settings-page__content-description">
+ { t('privacyModeDescription') }
+ </div>
+ </div>
+ <div className="settings-page__content-item">
+ <div className="settings-page__content-item-col">
+ <ToggleButton
+ value={privacyMode}
+ onToggle={value => setPrivacyMode(!value)}
+ activeLabel=""
+ inactiveLabel=""
+ />
+ </div>
+ </div>
+ </div>
+ )
+ }
+
render () {
const { warning, isMascara } = this.props
@@ -535,12 +532,12 @@ export default class SettingsTab extends PureComponent {
{ this.renderNewRpcUrl() }
{ this.renderStateLogs() }
{ this.renderSeedWords() }
- { this.renderClearApproval() }
- { this.renderForceInjection() }
{ !isMascara && this.renderOldUI() }
{ this.renderResetAccount() }
- { this.renderBlockieOptIn() }
+ { this.renderClearApproval() }
+ { this.renderPrivacyOptIn() }
{ this.renderHexDataOptIn() }
+ { this.renderBlockieOptIn() }
</div>
)
}
diff --git a/ui/app/components/pages/settings/settings-tab/settings-tab.container.js b/ui/app/components/pages/settings/settings-tab/settings-tab.container.js
index 0af62e135..b6c33a5b2 100644
--- a/ui/app/components/pages/settings/settings-tab/settings-tab.container.js
+++ b/ui/app/components/pages/settings/settings-tab/settings-tab.container.js
@@ -22,7 +22,10 @@ const mapStateToProps = state => {
conversionDate,
nativeCurrency,
useBlockie,
- featureFlags: { sendHexData } = {},
+ featureFlags: {
+ sendHexData,
+ privacyMode,
+ } = {},
provider = {},
isMascara,
currentLocale,
@@ -38,6 +41,7 @@ const mapStateToProps = state => {
nativeCurrency,
useBlockie,
sendHexData,
+ privacyMode,
provider,
useNativeCurrencyAsPrimaryCurrency,
}
@@ -55,12 +59,12 @@ const mapDispatchToProps = dispatch => {
return dispatch(setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
},
setHexDataFeatureFlag: shouldShow => dispatch(setFeatureFlag('sendHexData', shouldShow)),
+ setPrivacyMode: enabled => dispatch(setFeatureFlag('privacyMode', enabled)),
showResetAccountConfirmationModal: () => dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
setUseNativeCurrencyAsPrimaryCurrencyPreference: value => {
return dispatch(setUseNativeCurrencyAsPrimaryCurrencyPreference(value))
},
showClearApprovalModal: () => dispatch(showModal({ name: 'CLEAR_APPROVED_ORIGINS' })),
- showForceInjectionModal: () => dispatch(showModal({ name: 'FORCE_INJECTION' })),
}
}