Compare commits
2 commits
master
...
notificati
Author | SHA1 | Date | |
---|---|---|---|
|
8e142f5429 | ||
|
065e91bfb4 |
5 changed files with 97 additions and 6 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -5640,8 +5640,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lbry-redux": {
|
"lbry-redux": {
|
||||||
"version": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
"version": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"from": "github:lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
"from": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"requires": {
|
"requires": {
|
||||||
"proxy-polyfill": "0.1.6",
|
"proxy-polyfill": "0.1.6",
|
||||||
"reselect": "^3.0.0",
|
"reselect": "^3.0.0",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#9919a8150998822ca997cd23418f023d64d4a3da",
|
"lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
|
|
|
@ -14,6 +14,10 @@ const select = state => ({
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||||
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||||
|
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
|
||||||
|
receiveRewardNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS)(state),
|
||||||
|
receiveInterestsNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS)(state),
|
||||||
|
receiveCreatorNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SETTINGS } from 'lbry-redux';
|
import { SETTINGS } from 'lbry-redux';
|
||||||
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||||
import { navigateBack } from 'utils/helper';
|
import { __, navigateBack } from 'utils/helper';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
import settingsStyle from 'styles/settings';
|
import settingsStyle from 'styles/settings';
|
||||||
|
@ -43,6 +43,16 @@ class SettingsPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setNativeBooleanSetting = (key, value) => {
|
||||||
|
const { setClientSetting } = this.props;
|
||||||
|
setClientSetting(key, value);
|
||||||
|
NativeModules.UtilityModule.setNativeBooleanSetting(key, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
getBooleanSetting = (value, defaultValue) => {
|
||||||
|
return value === null || value === undefined ? defaultValue : value;
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
backgroundPlayEnabled,
|
backgroundPlayEnabled,
|
||||||
|
@ -50,14 +60,21 @@ class SettingsPage extends React.PureComponent {
|
||||||
keepDaemonRunning,
|
keepDaemonRunning,
|
||||||
navigation,
|
navigation,
|
||||||
popDrawerStack,
|
popDrawerStack,
|
||||||
|
receiveSubscriptionNotifications,
|
||||||
|
receiveRewardNotifications,
|
||||||
|
receiveInterestsNotifications,
|
||||||
|
receiveCreatorNotifications,
|
||||||
showNsfw,
|
showNsfw,
|
||||||
showUriBarSuggestions,
|
showUriBarSuggestions,
|
||||||
setClientSetting,
|
setClientSetting,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// default to true if the setting is null or undefined
|
// default to true if the setting is null or undefined
|
||||||
const actualKeepDaemonRunning =
|
const actualKeepDaemonRunning = this.getBooleanSetting(keepDaemonRunning, true);
|
||||||
keepDaemonRunning === null || keepDaemonRunning === undefined ? true : keepDaemonRunning;
|
const actualReceiveSubscriptionNotifications = this.getBooleanSetting(receiveSubscriptionNotifications, true);
|
||||||
|
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
||||||
|
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
||||||
|
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={settingsStyle.container}>
|
<View style={settingsStyle.container}>
|
||||||
|
@ -88,6 +105,69 @@ class SettingsPage extends React.PureComponent {
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.sectionDivider} />
|
||||||
|
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
|
||||||
|
<Text style={settingsStyle.sectionDescription}>
|
||||||
|
{__('Choose the notifications you would like to receive.')}
|
||||||
|
</Text>
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveSubscriptionNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Rewards')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveRewardNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Tags you follow')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveInterestsNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{false && (
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Content creator tips')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveCreatorNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={settingsStyle.sectionDivider} />
|
<View style={settingsStyle.sectionDivider} />
|
||||||
<Text style={settingsStyle.sectionTitle}>Search</Text>
|
<Text style={settingsStyle.sectionTitle}>Search</Text>
|
||||||
<View style={settingsStyle.row}>
|
<View style={settingsStyle.row}>
|
||||||
|
|
|
@ -44,6 +44,13 @@ const settingsStyle = StyleSheet.create({
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
marginBottom: 4,
|
marginBottom: 4,
|
||||||
},
|
},
|
||||||
|
sectionDescription: {
|
||||||
|
color: '#aaaaaa',
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 12,
|
||||||
|
lineHeight: 18,
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
sectionDivider: {
|
sectionDivider: {
|
||||||
marginTop: 24,
|
marginTop: 24,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue