Add DHT setting #130
3 changed files with 23 additions and 2 deletions
|
@ -44,6 +44,7 @@ const Constants = {
|
||||||
SETTING_BACKUP_DISMISSED: 'backupDismissed',
|
SETTING_BACKUP_DISMISSED: 'backupDismissed',
|
||||||
SETTING_REWARDS_NOT_INTERESTED: 'rewardsNotInterested',
|
SETTING_REWARDS_NOT_INTERESTED: 'rewardsNotInterested',
|
||||||
SETTING_DEVICE_WALLET_SYNCED: 'deviceWalletSynced',
|
SETTING_DEVICE_WALLET_SYNCED: 'deviceWalletSynced',
|
||||||
|
SETTING_DHT_ENABLED: 'dhtEnabled',
|
||||||
|
|
||||||
ACTION_DELETE_COMPLETED_BLOBS: 'DELETE_COMPLETED_BLOBS',
|
ACTION_DELETE_COMPLETED_BLOBS: 'DELETE_COMPLETED_BLOBS',
|
||||||
ACTION_FIRST_RUN_PAGE_CHANGED: 'FIRST_RUN_PAGE_CHANGED',
|
ACTION_FIRST_RUN_PAGE_CHANGED: 'FIRST_RUN_PAGE_CHANGED',
|
||||||
|
|
|
@ -11,6 +11,7 @@ const select = state => ({
|
||||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||||
currentRoute: selectCurrentRoute(state),
|
currentRoute: selectCurrentRoute(state),
|
||||||
drawerStack: selectDrawerStack(state),
|
drawerStack: selectDrawerStack(state),
|
||||||
|
enableDht: makeSelectClientSetting(SETTINGS.SETTING_DHT_ENABLED)(state),
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||||
|
@ -31,5 +32,5 @@ const perform = dispatch => ({
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(SettingsPage);
|
)(SettingsPage);
|
||||||
|
|
|
@ -140,6 +140,7 @@ class SettingsPage extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
backgroundPlayEnabled,
|
backgroundPlayEnabled,
|
||||||
|
enableDht,
|
||||||
keepDaemonRunning,
|
keepDaemonRunning,
|
||||||
receiveSubscriptionNotifications,
|
receiveSubscriptionNotifications,
|
||||||
receiveRewardNotifications,
|
receiveRewardNotifications,
|
||||||
|
@ -157,6 +158,7 @@ class SettingsPage extends React.PureComponent {
|
||||||
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
||||||
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
||||||
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
||||||
|
const actualEnableDht = this.getBooleanSetting(enableDht, true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={settingsStyle.container}>
|
<View style={settingsStyle.container}>
|
||||||
|
@ -294,7 +296,7 @@ class SettingsPage extends React.PureComponent {
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={settingsStyle.description}>
|
<Text style={settingsStyle.description}>
|
||||||
{__(
|
{__(
|
||||||
'Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.'
|
'Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.',
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
@ -310,6 +312,23 @@ class SettingsPage extends React.PureComponent {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Enable DHT')}</Text>
|
||||||
|
<Text style={settingsStyle.description}>
|
||||||
|
{__('Participate in the data network (requires app and service restart)')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualKeepDaemonRunning}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.SETTING_DHT_ENABLED, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue