-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wallet] Add Celo Lite toggle (UI only, zeroSync on/off in other PR) (#…
- Loading branch information
1 parent
f9a72a6
commit 72ffef8
Showing
23 changed files
with
413 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react' | ||
import 'react-native' | ||
import { Provider } from 'react-redux' | ||
import * as renderer from 'react-test-renderer' | ||
import Analytics from 'src/account/Analytics' | ||
import { createMockStore } from 'test/utils' | ||
|
||
describe('Analytics', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create( | ||
<Provider store={createMockStore({})}> | ||
<Analytics /> | ||
</Provider> | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react' | ||
import 'react-native' | ||
import { Provider } from 'react-redux' | ||
import * as renderer from 'react-test-renderer' | ||
import CeloLite from 'src/account/CeloLite' | ||
import { createMockStore } from 'test/utils' | ||
|
||
describe('CeloLite', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create( | ||
<Provider store={createMockStore({})}> | ||
<CeloLite /> | ||
</Provider> | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import SettingsSwitchItem from '@celo/react-components/components/SettingsSwitchItem' | ||
import colors from '@celo/react-components/styles/colors' | ||
import fontStyles from '@celo/react-components/styles/fonts' | ||
import * as React from 'react' | ||
import { WithNamespaces, withNamespaces } from 'react-i18next' | ||
import { ScrollView, StyleSheet, Text } from 'react-native' | ||
import { connect } from 'react-redux' | ||
import i18n, { Namespaces } from 'src/i18n' | ||
import { headerWithCancelButton } from 'src/navigator/Headers' | ||
import { RootState } from 'src/redux/reducers' | ||
import { setZeroSyncMode } from 'src/web3/actions' | ||
|
||
interface StateProps { | ||
zeroSyncEnabled: boolean | ||
} | ||
|
||
interface DispatchProps { | ||
setZeroSyncMode: typeof setZeroSyncMode | ||
} | ||
|
||
type Props = StateProps & DispatchProps & WithNamespaces | ||
|
||
const mapDispatchToProps = { | ||
setZeroSyncMode, | ||
} | ||
|
||
const mapStateToProps = (state: RootState): StateProps => { | ||
return { | ||
zeroSyncEnabled: state.web3.zeroSyncMode, | ||
} | ||
} | ||
|
||
export class CeloLite extends React.Component<Props> { | ||
static navigationOptions = () => ({ | ||
...headerWithCancelButton, | ||
headerTitle: i18n.t('accountScreen10:celoLite'), | ||
}) | ||
|
||
render() { | ||
const { zeroSyncEnabled, t } = this.props | ||
return ( | ||
<ScrollView style={style.scrollView} keyboardShouldPersistTaps="handled"> | ||
<SettingsSwitchItem | ||
switchValue={zeroSyncEnabled} | ||
onSwitchChange={this.props.setZeroSyncMode} | ||
details={t('celoLiteDetail')} | ||
> | ||
<Text style={fontStyles.body}>{t('enableCeloLite')}</Text> | ||
</SettingsSwitchItem> | ||
</ScrollView> | ||
) | ||
} | ||
} | ||
|
||
const style = StyleSheet.create({ | ||
scrollView: { | ||
flex: 1, | ||
backgroundColor: colors.background, | ||
}, | ||
}) | ||
|
||
export default connect<StateProps, DispatchProps, {}, RootState>( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(withNamespaces(Namespaces.accountScreen10)(CeloLite)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react' | ||
import 'react-native' | ||
import { Provider } from 'react-redux' | ||
import * as renderer from 'react-test-renderer' | ||
import Licenses from 'src/account/Licenses' | ||
import { createMockStore } from 'test/utils' | ||
|
||
describe('Licenses', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create( | ||
<Provider store={createMockStore({})}> | ||
<Licenses /> | ||
</Provider> | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
packages/mobile/src/account/__snapshots__/Analytics.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Analytics renders correctly 1`] = ` | ||
<RCTScrollView | ||
keyboardShouldPersistTaps="handled" | ||
style={ | ||
Object { | ||
"backgroundColor": "#FFFFFF", | ||
"flex": 1, | ||
} | ||
} | ||
> | ||
<View> | ||
<View | ||
style={ | ||
Object { | ||
"borderBottomWidth": 1, | ||
"borderColor": "#EEEEEE", | ||
"marginLeft": 15, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"justifyContent": "space-between", | ||
"padding": 20, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
Array [ | ||
Object { | ||
"justifyContent": "center", | ||
}, | ||
] | ||
} | ||
> | ||
<Text | ||
style={ | ||
Object { | ||
"color": "#2E3338", | ||
"fontFamily": "Hind-Regular", | ||
"fontSize": 16, | ||
"lineHeight": 24, | ||
} | ||
} | ||
> | ||
shareAnalytics | ||
</Text> | ||
</View> | ||
<View | ||
style={ | ||
Array [ | ||
Object { | ||
"justifyContent": "center", | ||
}, | ||
] | ||
} | ||
> | ||
<AndroidSwitch | ||
accessibilityRole="button" | ||
enabled={true} | ||
on={true} | ||
onChange={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
thumbTintColor="#FFFFFF" | ||
trackColorForFalse="#E3E3E5" | ||
trackColorForTrue="#42D689" | ||
trackTintColor="#42D689" | ||
/> | ||
</View> | ||
</View> | ||
<View | ||
style={ | ||
Object { | ||
"paddingBottom": 20, | ||
"paddingLeft": 20, | ||
"paddingRight": 20, | ||
} | ||
} | ||
> | ||
<Text> | ||
shareAnalytics_detail | ||
</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</RCTScrollView> | ||
`; |
Oops, something went wrong.