Merge pull request #74 from lbryio/fcm-data

show notification settings. handle blackListedOutpoints being null.
This commit is contained in:
Akinwale Ariwodola 2019-11-01 06:54:02 +01:00 committed by GitHub
commit a127e14a0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 52 deletions

View file

@ -66,7 +66,9 @@ class FileItem extends React.PureComponent {
let shouldHide = false; let shouldHide = false;
if (blackListedOutpoints || filteredOutpoints) { if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints); const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout); shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
} }
if (shouldHide) { if (shouldHide) {

View file

@ -120,7 +120,9 @@ class FileListItem extends React.PureComponent {
shortChannelUri = signingChannel ? signingChannel.short_url : null; shortChannelUri = signingChannel ? signingChannel.short_url : null;
if (blackListedOutpoints || filteredOutpoints) { if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints); const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout); shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
} }

View file

@ -105,56 +105,52 @@ class SettingsPage extends React.PureComponent {
</View> </View>
</View> </View>
{false && ( <View style={settingsStyle.sectionDivider} />
<View> <Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
<View style={settingsStyle.sectionDivider} /> <Text style={settingsStyle.sectionDescription}>
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text> {__('Choose the notifications you would like to receive.')}
<Text style={settingsStyle.sectionDescription}> </Text>
{__('Choose the notifications you would like to receive.')} <View style={settingsStyle.row}>
</Text> <View style={settingsStyle.switchText}>
<View style={settingsStyle.row}> <Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
<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>
</View> </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}>{__('Content Interests')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
value={actualReceiveInterestsNotifications}
onValueChange={value => {
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
}}
/>
</View>
</View>
{false && ( {false && (
<View style={settingsStyle.row}> <View style={settingsStyle.row}>

View file

@ -158,7 +158,10 @@ class SplashScreen extends React.PureComponent {
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true }); this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken() NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken)) .then(firebaseToken => {
console.log(firebaseToken);
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS)); .catch(() => authenticate(appVersion, Platform.OS));
}); });
} }