Add DHT setting #130

Merged
akinwale merged 4 commits from dht into master 2020-03-13 17:05:30 +01:00
3 changed files with 8 additions and 11 deletions
Showing only changes of commit 1a638e88e4 - Show all commits

@ -1 +1 @@
Subproject commit 37b893103da874282f2bdef4a8a1bb543d2c9859 Subproject commit ea8ac783a8b05db8ab78472efc3fff32dc6869e6

View file

@ -11,7 +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), enableDht: makeSelectClientSetting(Constants.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),
@ -30,7 +30,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)), setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
}); });
export default connect( export default connect(select, perform)(SettingsPage);
select,
perform,
)(SettingsPage);

View file

@ -158,7 +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); const actualEnableDht = this.getBooleanSetting(enableDht, false);
return ( return (
<View style={settingsStyle.container}> <View style={settingsStyle.container}>
@ -315,16 +315,16 @@ class SettingsPage extends React.PureComponent {
<View style={settingsStyle.row}> <View style={settingsStyle.row}>
<View style={settingsStyle.switchText}> <View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>{__('Enable DHT')}</Text> <Text style={settingsStyle.label}>{__('Participate in the data network')}</Text>
<Text style={settingsStyle.description}> <Text style={settingsStyle.description}>
{__('Participate in the data network (requires app and service restart)')} {__('Enable DHT (this will take effect upon app and background service restart)')}
</Text> </Text>
</View> </View>
<View style={settingsStyle.switchContainer}> <View style={settingsStyle.switchContainer}>
<Switch <Switch
value={actualKeepDaemonRunning} value={actualEnableDht}
onValueChange={value => { onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.SETTING_DHT_ENABLED, value); this.setNativeBooleanSetting(Constants.SETTING_DHT_ENABLED, value);
}} }}
/> />
</View> </View>