redux-persist v5. style tweaks.

This commit is contained in:
Akinwale Ariwodola 2019-08-09 07:17:44 +01:00
parent 9d7d2c821f
commit 836ff2ae13
20 changed files with 1241 additions and 88 deletions

1144
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
"private": "true", "private": "true",
"scripts": { "scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start", "start": "node node_modules/react-native/local-cli/cli.js start",
"devtools": "react-devtools",
"format": "prettier 'src/**/*.{js,json}' --write", "format": "prettier 'src/**/*.{js,json}' --write",
"precommit": "lint-staged" "precommit": "lint-staged"
}, },
@ -11,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#cd23c12fb7fd541d28d7cbf3874b1058b036fd13", "lbry-redux": "lbryio/lbry-redux#67a654f60630710cae72419448a73a18d076d18a",
"lbryinc": "lbryio/lbryinc", "lbryinc": "lbryio/lbryinc",
"lodash": ">=4.17.11", "lodash": ">=4.17.11",
"merge": ">=1.2.1", "merge": ">=1.2.1",
@ -36,7 +37,7 @@
"react-navigation-redux-helpers": "^3.0.2", "react-navigation-redux-helpers": "^3.0.2",
"react-redux": "^5.0.3", "react-redux": "^5.0.3",
"redux": "^4.0.4", "redux": "^4.0.4",
"redux-persist": "^4.10.2", "redux-persist": "^5.10.0",
"redux-persist-filesystem-storage": "^1.3.2", "redux-persist-filesystem-storage": "^1.3.2",
"redux-persist-transform-compress": "^4.2.0", "redux-persist-transform-compress": "^4.2.0",
"redux-persist-transform-filter": "0.0.18", "redux-persist-transform-filter": "0.0.18",
@ -63,6 +64,7 @@
"husky": "^0.14.3", "husky": "^0.14.3",
"lint-staged": "^7.0.4", "lint-staged": "^7.0.4",
"metro-react-native-babel-preset": "^0.55.0", "metro-react-native-babel-preset": "^0.55.0",
"prettier": "^1.11.1" "prettier": "^1.11.1",
"react-devtools": "^3.6.3"
} }
} }

View file

@ -199,8 +199,8 @@ class ClaimList extends React.PureComponent {
ListHeaderComponent={ListHeaderComponent} ListHeaderComponent={ListHeaderComponent}
style={claimListStyle.verticalScrollContainer} style={claimListStyle.verticalScrollContainer}
contentContainerStyle={claimListStyle.verticalScrollPadding} contentContainerStyle={claimListStyle.verticalScrollPadding}
initialNumToRender={8} initialNumToRender={10}
maxToRenderPerBatch={24} maxToRenderPerBatch={20}
removeClippedSubviews removeClippedSubviews
renderItem={({ item }) => ( renderItem={({ item }) => (
<FileListItem key={item} uri={item} style={claimListStyle.verticalListItem} navigation={navigation} /> <FileListItem key={item} uri={item} style={claimListStyle.verticalListItem} navigation={navigation} />
@ -208,7 +208,7 @@ class ClaimList extends React.PureComponent {
data={data} data={data}
keyExtractor={(item, index) => item} keyExtractor={(item, index) => item}
onEndReached={this.handleVerticalEndReached} onEndReached={this.handleVerticalEndReached}
onEndReachedThreshold={0.9} onEndReachedThreshold={0.2}
/> />
{(((subscriptionsView || trendingForAllView) && claimSearchLoading) || loading) && ( {(((subscriptionsView || trendingForAllView) && claimSearchLoading) || loading) && (
<View style={claimListStyle.verticalLoading}> <View style={claimListStyle.verticalLoading}>

View file

@ -57,7 +57,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
return ( return (
<View style={[rewardStyle.rewardCard, rewardStyle.row]}> <View style={[rewardStyle.rewardCard, rewardStyle.row]}>
<View style={rewardStyle.leftCol}> <View style={rewardStyle.leftCol}>
{rewardIsPending && <ActivityIndicator size="small" color={Colors.LbryGreen} />} {rewardIsPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
</View> </View>
<View style={rewardStyle.midCol}> <View style={rewardStyle.midCol}>
<Text style={rewardStyle.rewardTitle}>Custom Code</Text> <Text style={rewardStyle.rewardTitle}>Custom Code</Text>

View file

@ -468,7 +468,7 @@ class MediaPlayer extends React.PureComponent {
{this.state.buffering && ( {this.state.buffering && (
<View style={mediaPlayerStyle.loadingContainer}> <View style={mediaPlayerStyle.loadingContainer}>
<ActivityIndicator color={Colors.LbryGreen} size="large" /> <ActivityIndicator color={Colors.NextLbryGreen} size="large" />
</View> </View>
)} )}

View file

@ -6,7 +6,7 @@ import FileListItem from 'component/fileListItem';
import fileListStyle from 'styles/fileList'; import fileListStyle from 'styles/fileList';
import relatedContentStyle from 'styles/relatedContent'; import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent<Props> { export default class RelatedContent extends React.PureComponent {
constructor() { constructor() {
super(); super();
@ -17,7 +17,7 @@ export default class RelatedContent extends React.PureComponent<Props> {
this.getRecommendedContent(); this.getRecommendedContent();
} }
componentDidUpdate(prevProps: Props) { componentDidUpdate(prevProps) {
const { claim, uri } = this.props; const { claim, uri } = this.props;
if (uri !== prevProps.uri) { if (uri !== prevProps.uri) {
@ -38,7 +38,7 @@ export default class RelatedContent extends React.PureComponent<Props> {
} }
} }
didSearch: ?boolean; didSearch;
render() { render() {
const { recommendedContent, isSearching, navigation } = this.props; const { recommendedContent, isSearching, navigation } = this.props;
@ -60,7 +60,9 @@ export default class RelatedContent extends React.PureComponent<Props> {
onPress={() => navigateToUri(navigation, recommendedUri, { autoplay: true })} onPress={() => navigateToUri(navigation, recommendedUri, { autoplay: true })}
/> />
))} ))}
{isSearching && <ActivityIndicator size="small" color={Colors.LbryGreen} style={relatedContentStyle.loading} />} {isSearching && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={relatedContentStyle.loading} />
)}
</View> </View>
); );
} }

View file

@ -86,7 +86,7 @@ class RewardCard extends React.PureComponent<Props> {
)} )}
</TouchableOpacity> </TouchableOpacity>
)} )}
{isPending && <ActivityIndicator size="small" color={Colors.LbryGreen} />} {isPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
</View> </View>
<View style={rewardStyle.midCol}> <View style={rewardStyle.midCol}>
<Text style={rewardStyle.rewardTitle}>{reward.reward_title}</Text> <Text style={rewardStyle.rewardTitle}>{reward.reward_title}</Text>

View file

@ -43,7 +43,7 @@ class SuggestedSubscriptions extends React.PureComponent {
if (loading) { if (loading) {
return ( return (
<View style={subscriptionsStyle.centered}> <View style={subscriptionsStyle.centered}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} />
</View> </View>
); );
} }

View file

@ -25,14 +25,14 @@ import {
syncReducer, syncReducer,
userReducer, userReducer,
} from 'lbryinc'; } from 'lbryinc';
import { createStore, applyMiddleware, combineReducers, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux';
import AppWithNavigationState, { import AppWithNavigationState, {
AppNavigator, AppNavigator,
navigatorReducer, navigatorReducer,
reactNavigationMiddleware, reactNavigationMiddleware,
} from 'component/AppNavigator'; } from 'component/AppNavigator';
import { autoRehydrate, persistStore } from 'redux-persist'; import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage'; import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage'; import FilesystemStorage from 'redux-persist-filesystem-storage';
import createCompressor from 'redux-persist-transform-compress'; import createCompressor from 'redux-persist-transform-compress';
import createFilter from 'redux-persist-transform-filter'; import createFilter from 'redux-persist-transform-filter';
@ -76,7 +76,30 @@ function enableBatching(reducer) {
}; };
} }
const reducers = combineReducers({ const compressor = createCompressor();
const authFilter = createFilter('auth', ['authToken']);
const contentFilter = createFilter('content', ['positions']);
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']);
const settingsFilter = createFilter('settings', ['clientSettings']);
const tagsFilter = createFilter('tags', ['followedTags']);
const walletFilter = createFilter('wallet', ['receiveAddress']);
const v4PersistOptions = {
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
// Order is important. Needs to be compressed last or other transforms can't
// read the data
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
debounce: 10000,
storage: FilesystemStorage,
};
const persistOptions = Object.assign({}, v4PersistOptions, {
key: 'primary',
getStoredState: getStoredStateMigrateV4(v4PersistOptions),
});
const reducers = persistCombineReducers(persistOptions, {
auth: authReducer, auth: authReducer,
blacklist: blacklistReducer, blacklist: blacklistReducer,
claims: claimsReducer, claims: claimsReducer,
@ -113,20 +136,28 @@ const store = createStore(
); );
window.store = store; window.store = store;
const compressor = createCompressor(); const persistor = persistStore(store, persistOptions, err => {
const authFilter = createFilter('auth', ['authToken']); if (err) {
/* const contentFilter = createFilter('content', ['positions']); console.log('Unable to load saved SETTINGS');
const saveClaimsFilter = createFilter('claims', ['byId', 'claimsByUri']); }
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']); });
const settingsFilter = createFilter('settings', ['clientSettings']); window.persistor = persistor;
const tagsFilter = createFilter('tags', ['followedTags']);
const walletFilter = createFilter('wallet', ['receiveAddress']); */
const whitelist = ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet']; /*
/* store.subscribe(() => { const persistFilter = {
const state = store.getState(); 'auth': ['authToken'],
const filteredState = Object.keys(state).filter(key => whitelist.includes(key)).reduce((o, k) => { o[k] = state[k]; return o; }, {}); 'claims': ['byId', 'claimsByUri'],
NativeModules.StatePersistor.update(filteredState); 'content': ['positions'],
'subscriptions': ['enabledChannelNotifications', 'subscriptions'],
'settings': ['clientSettings'],
'tags': ['followedTags'],
'wallet': ['receiveAddress']
};
store.subscribe(() => {
const state = (({ auth, claims, content, subscriptions, settings, tags, wallet }) =>
({ auth, claims, content, subscriptions, settings, tags, wallet }))(store.getState());
NativeModules.StatePersistor.update(state, persistFilter);
}); */ }); */
// TODO: Find i18n module that is compatible with react-native // TODO: Find i18n module that is compatible with react-native

View file

@ -4,7 +4,7 @@ import { ActivityIndicator, Dimensions, Image, ScrollView, Text, TouchableOpacit
import { TabView, SceneMap } from 'react-native-tab-view'; import { TabView, SceneMap } from 'react-native-tab-view';
import { navigateBack } from 'utils/helper'; import { navigateBack } from 'utils/helper';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
import Constants from 'constants'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Button from 'component/button'; import Button from 'component/button';
import Link from 'component/link'; import Link from 'component/link';
import FileList from 'component/fileList'; import FileList from 'component/fileList';
@ -53,7 +53,7 @@ class ChannelPage extends React.PureComponent {
if (fetching) { if (fetching) {
contentList = ( contentList = (
<View style={channelPageStyle.busyContainer}> <View style={channelPageStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={channelPageStyle.infoText}>Fetching content...</Text> <Text style={channelPageStyle.infoText}>Fetching content...</Text>
</View> </View>
); );
@ -123,21 +123,21 @@ class ChannelPage extends React.PureComponent {
); );
} }
const { cover, description, thumbnail, email, website_url, title } = claim.value; const { cover, description, thumbnail, email, website_url: websiteUrl, title } = claim.value;
return ( return (
<View style={channelPageStyle.aboutTab}> <View style={channelPageStyle.aboutTab}>
{!website_url && !email && !description && ( {!websiteUrl && !email && !description && (
<View style={channelPageStyle.busyContainer}> <View style={channelPageStyle.busyContainer}>
<Text style={channelPageStyle.infoText}>Nothing here yet. Please check back later.</Text> <Text style={channelPageStyle.infoText}>Nothing here yet. Please check back later.</Text>
</View> </View>
)} )}
{(website_url || email || description) && ( {(websiteUrl || email || description) && (
<ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}> <ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}>
{website_url && website_url.trim().length > 0 && ( {websiteUrl && websiteUrl.trim().length > 0 && (
<View style={channelPageStyle.aboutItem}> <View style={channelPageStyle.aboutItem}>
<Text style={channelPageStyle.aboutTitle}>Website</Text> <Text style={channelPageStyle.aboutTitle}>Website</Text>
<Link style={channelPageStyle.aboutText} text={website_url} href={website_url} /> <Link style={channelPageStyle.aboutText} text={websiteUrl} href={websiteUrl} />
</View> </View>
)} )}

View file

@ -217,7 +217,7 @@ class DiscoverPage extends React.PureComponent {
// each of the followed tags // each of the followed tags
const tagCollection = _.shuffle(tags) const tagCollection = _.shuffle(tags)
.slice(0, 4) .slice(0, 6)
.map(tag => [tag]); .map(tag => [tag]);
// everything // everything
tagCollection.unshift(tags); tagCollection.unshift(tags);

View file

@ -3,7 +3,7 @@ import { Lbry, buildURI } from 'lbry-redux';
import { ActivityIndicator, Button, FlatList, Text, TextInput, View, ScrollView } from 'react-native'; import { ActivityIndicator, Button, FlatList, Text, TextInput, View, ScrollView } from 'react-native';
import { navigateToUri, uriFromFileInfo } from 'utils/helper'; import { navigateToUri, uriFromFileInfo } from 'utils/helper';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
import Constants from 'constants'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PageHeader from 'component/pageHeader'; import PageHeader from 'component/pageHeader';
import FileListItem from 'component/fileListItem'; import FileListItem from 'component/fileListItem';
import FloatingWalletBalance from 'component/floatingWalletBalance'; import FloatingWalletBalance from 'component/floatingWalletBalance';
@ -65,7 +65,7 @@ class DownloadsPage extends React.PureComponent {
)} )}
{fetching && !hasDownloads && ( {fetching && !hasDownloads && (
<View style={downloadsStyle.busyContainer}> <View style={downloadsStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} style={downloadsStyle.loading} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
</View> </View>
)} )}
{hasDownloads && ( {hasDownloads && (

View file

@ -567,7 +567,7 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.container}> <View style={filePageStyle.container}>
{isResolvingUri && ( {isResolvingUri && (
<View style={filePageStyle.busyContainer}> <View style={filePageStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={filePageStyle.infoText}>Loading decentralized data...</Text> <Text style={filePageStyle.infoText}>Loading decentralized data...</Text>
</View> </View>
)} )}
@ -724,7 +724,7 @@ class FilePage extends React.PureComponent {
<FileItemMedia style={filePageStyle.thumbnail} title={title} thumbnail={thumbnail} /> <FileItemMedia style={filePageStyle.thumbnail} title={title} thumbnail={thumbnail} />
)} )}
{(!this.state.downloadButtonShown || this.state.downloadPressed) && !this.state.mediaLoaded && ( {(!this.state.downloadButtonShown || this.state.downloadPressed) && !this.state.mediaLoaded && (
<ActivityIndicator size="large" color={Colors.LbryGreen} style={filePageStyle.loading} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
)} )}
{((isPlayable && !completed && !canLoadMedia) || {((isPlayable && !completed && !canLoadMedia) ||
canOpen || canOpen ||

View file

@ -550,7 +550,7 @@ class PublishPage extends React.PureComponent {
</View> </View>
{(!videos || !thumbnailPath || !galleryThumbnailsChecked) && ( {(!videos || !thumbnailPath || !galleryThumbnailsChecked) && (
<View style={publishStyle.loadingView}> <View style={publishStyle.loadingView}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} />
</View> </View>
)} )}
{thumbnailPath && (!videos || videos.length === 0) && ( {thumbnailPath && (!videos || videos.length === 0) && (

View file

@ -2,7 +2,7 @@ import React from 'react';
import { Lbry } from 'lbry-redux'; import { Lbry } from 'lbry-redux';
import { ActivityIndicator, NativeModules, ScrollView, Text, View } from 'react-native'; import { ActivityIndicator, NativeModules, ScrollView, Text, View } from 'react-native';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
import Constants from 'constants'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Link from 'component/link'; import Link from 'component/link';
import CustomRewardCard from 'component/customRewardCard'; import CustomRewardCard from 'component/customRewardCard';
import PageHeader from 'component/pageHeader'; import PageHeader from 'component/pageHeader';
@ -87,7 +87,7 @@ class RewardsPage extends React.PureComponent {
// claim new_user and new_mobile rewards // claim new_user and new_mobile rewards
for (let i = 0; i < rewards.length; i++) { for (let i = 0; i < rewards.length; i++) {
const { reward_type: type } = rewards[i]; const { reward_type: type } = rewards[i];
if ('new_user' === type || 'new_mobile' === type) { if (type === 'new_user' || type === 'new_mobile') {
claimReward(rewards[i]); claimReward(rewards[i]);
} }
} }
@ -127,7 +127,7 @@ class RewardsPage extends React.PureComponent {
if (fetching) { if (fetching) {
return ( return (
<View style={rewardStyle.busyContainer}> <View style={rewardStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={rewardStyle.infoText}>Fetching rewards...</Text> <Text style={rewardStyle.infoText}>Fetching rewards...</Text>
</View> </View>
); );

View file

@ -3,7 +3,7 @@ import { Lbry, parseURI, normalizeURI, isURIValid } from 'lbry-redux';
import { ActivityIndicator, Button, Text, TextInput, View, ScrollView } from 'react-native'; import { ActivityIndicator, Button, Text, TextInput, View, ScrollView } from 'react-native';
import { navigateToUri } from 'utils/helper'; import { navigateToUri } from 'utils/helper';
import Colors from 'styles/colors'; import Colors from 'styles/colors';
import Constants from 'constants'; import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PageHeader from 'component/pageHeader'; import PageHeader from 'component/pageHeader';
import FileListItem from 'component/fileListItem'; import FileListItem from 'component/fileListItem';
import FloatingWalletBalance from 'component/floatingWalletBalance'; import FloatingWalletBalance from 'component/floatingWalletBalance';
@ -91,7 +91,7 @@ class SearchPage extends React.PureComponent {
<UriBar value={query} navigation={navigation} onSearchSubmitted={this.handleSearchSubmitted} /> <UriBar value={query} navigation={navigation} onSearchSubmitted={this.handleSearchSubmitted} />
{isSearching && ( {isSearching && (
<View style={searchStyle.busyContainer}> <View style={searchStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} style={searchStyle.loading} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} style={searchStyle.loading} />
</View> </View>
)} )}
@ -105,7 +105,7 @@ class SearchPage extends React.PureComponent {
<FileListItem <FileListItem
key={this.state.currentUri} key={this.state.currentUri}
uri={this.state.currentUri} uri={this.state.currentUri}
featuredResult={true} featuredResult
style={searchStyle.featuredResultItem} style={searchStyle.featuredResultItem}
navigation={navigation} navigation={navigation}
onPress={() => navigateToUri(navigation, this.state.currentUri)} onPress={() => navigateToUri(navigation, this.state.currentUri)}

View file

@ -5,8 +5,8 @@ import {
doFetchRecommendedSubscriptions, doFetchRecommendedSubscriptions,
selectSubscriptionClaims, selectSubscriptionClaims,
selectSubscriptions, selectSubscriptions,
selectSubscriptionsBeingFetched,
selectIsFetchingSubscriptions, selectIsFetchingSubscriptions,
selectIsFetchingSuggested,
selectSuggestedChannels, selectSuggestedChannels,
selectUnreadSubscriptions, selectUnreadSubscriptions,
selectViewMode, selectViewMode,
@ -22,7 +22,8 @@ import SubscriptionsPage from './view';
const select = state => ({ const select = state => ({
currentRoute: selectCurrentRoute(state), currentRoute: selectCurrentRoute(state),
loading: selectIsFetchingSubscriptions(state) || Boolean(Object.keys(selectSubscriptionsBeingFetched(state)).length), loading: selectIsFetchingSubscriptions(state),
loadingSuggested: selectIsFetchingSuggested(state),
subscribedChannels: selectSubscriptions(state), subscribedChannels: selectSubscriptions(state),
suggestedChannels: selectSuggestedChannels(state), suggestedChannels: selectSuggestedChannels(state),
subscriptionsViewMode: makeSelectClientSetting(Constants.SETTING_SUBSCRIPTIONS_VIEW_MODE)(state), subscriptionsViewMode: makeSelectClientSetting(Constants.SETTING_SUBSCRIPTIONS_VIEW_MODE)(state),

View file

@ -118,9 +118,9 @@ class SubscriptionsPage extends React.PureComponent {
suggestedChannels, suggestedChannels,
subscribedChannels, subscribedChannels,
allSubscriptions, allSubscriptions,
loading,
viewMode, viewMode,
doSetViewMode, doSetViewMode,
loading,
loadingSuggested, loadingSuggested,
firstRunCompleted, firstRunCompleted,
doCompleteFirstRun, doCompleteFirstRun,
@ -183,7 +183,7 @@ class SubscriptionsPage extends React.PureComponent {
{hasSubscriptions && loading && ( {hasSubscriptions && loading && (
<View style={subscriptionsStyle.busyContainer}> <View style={subscriptionsStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} style={subscriptionsStyle.loading} /> <ActivityIndicator size="large" color={Colors.NextLbryGreen} style={subscriptionsStyle.loading} />
</View> </View>
)} )}
@ -208,12 +208,12 @@ class SubscriptionsPage extends React.PureComponent {
</View> </View>
)} )}
{loadingSuggested && suggestedChannels.length === 0 && ( {loadingSuggested && (
<View style={subscriptionsStyle.centered}> <View style={subscriptionsStyle.centered}>
<ActivityIndicator size="large" colors={Colors.LbryGreen} style={subscriptionsStyle.loading} /> <ActivityIndicator size="large" colors={Colors.NextLbryGreen} style={subscriptionsStyle.loading} />
</View> </View>
)} )}
{suggestedChannels && suggestedChannels.length > 0 && <SuggestedSubscriptions navigation={navigation} />} {!loadingSuggested && <SuggestedSubscriptions navigation={navigation} />}
</View> </View>
)} )}

View file

@ -95,6 +95,7 @@ class TrendingPage extends React.PureComponent {
orderBy={Constants.DEFAULT_ORDER_BY} orderBy={Constants.DEFAULT_ORDER_BY}
trendingForAll={TRENDING_FOR_ITEMS[0].name === currentTrendingForItem.name} trendingForAll={TRENDING_FOR_ITEMS[0].name === currentTrendingForItem.name}
tags={followedTags.map(tag => tag.name)} tags={followedTags.map(tag => tag.name)}
time={null}
navigation={navigation} navigation={navigation}
orientation={Constants.ORIENTATION_VERTICAL} orientation={Constants.ORIENTATION_VERTICAL}
/> />

View file

@ -1,11 +1,17 @@
import { ACTIONS } from 'lbry-redux'; import { ACTIONS } from 'lbry-redux';
export function doSetClientSetting(key, value) { export function doSetClientSetting(key, value) {
return { return dispatch => {
dispatch({
type: ACTIONS.CLIENT_SETTING_CHANGED, type: ACTIONS.CLIENT_SETTING_CHANGED,
data: { data: {
key, key,
value, value,
}, },
});
if (window.persistor) {
window.persistor.flush();
}
}; };
} }