dht setting

This commit is contained in:
Akinwale Ariwodola 2020-02-10 11:58:51 +01:00
parent 601c589f69
commit 21749453df
3 changed files with 23 additions and 2 deletions

View file

@ -44,6 +44,7 @@ const Constants = {
SETTING_BACKUP_DISMISSED: 'backupDismissed',
SETTING_REWARDS_NOT_INTERESTED: 'rewardsNotInterested',
SETTING_DEVICE_WALLET_SYNCED: 'deviceWalletSynced',
SETTING_DHT_ENABLED: 'dhtEnabled',
ACTION_DELETE_COMPLETED_BLOBS: 'DELETE_COMPLETED_BLOBS',
ACTION_FIRST_RUN_PAGE_CHANGED: 'FIRST_RUN_PAGE_CHANGED',

View file

@ -11,6 +11,7 @@ const select = state => ({
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
currentRoute: selectCurrentRoute(state),
drawerStack: selectDrawerStack(state),
enableDht: makeSelectClientSetting(SETTINGS.SETTING_DHT_ENABLED)(state),
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
@ -31,5 +32,5 @@ const perform = dispatch => ({
export default connect(
select,
perform
perform,
)(SettingsPage);

View file

@ -140,6 +140,7 @@ class SettingsPage extends React.PureComponent {
render() {
const {
backgroundPlayEnabled,
enableDht,
keepDaemonRunning,
receiveSubscriptionNotifications,
receiveRewardNotifications,
@ -157,6 +158,7 @@ class SettingsPage extends React.PureComponent {
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
const actualEnableDht = this.getBooleanSetting(enableDht, true);
return (
<View style={settingsStyle.container}>
@ -294,7 +296,7 @@ class SettingsPage extends React.PureComponent {
</Text>
<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>
</View>
@ -310,6 +312,23 @@ class SettingsPage extends React.PureComponent {
/>
</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>
</View>
);