Preferences #56

Closed
akinwale wants to merge 4 commits from preferences into master
3 changed files with 13 additions and 8 deletions
Showing only changes of commit f42cbb90a0 - Show all commits

View file

@ -29,7 +29,7 @@ import {
import { connect } from 'react-redux';
kauffj commented 2019-10-11 22:47:33 +02:00 (Migrated from github.com)
Review

none of the logic in this file appears to affect the presentation or rendering of this component

is there a design that would separate this out more cleanly? maybe just make it it's own component?

none of the logic in this file appears to affect the presentation or rendering of this component is there a design that would separate this out more cleanly? maybe just make it it's own component?
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doToast, selectToast } from 'lbry-redux';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
import {
Lbryio,
doGetSync,
@ -308,8 +308,8 @@ class AppWithNavigationState extends React.Component {
getUserSettings = () => {
const { dispatch } = this.props;
Lbryio.call('user_settings', 'get').then(settings => {
dispatch(doPopulateSharedUserState(settings));
doPreferenceGet('shared', null, null, preference => {
dispatch(doPopulateSharedUserState(preference));
});
};

View file

@ -148,7 +148,11 @@ const persistor = persistStore(store, persistOptions, err => {
});
window.persistor = persistor;
const sharedStateCache = {};
/**
* source: the reducer name
* property: the property in the reducer-specific state
* transform: optional method to modify the value to be stored
*/
const sharedStateFilters = {
tags: { source: 'tags', property: 'followedTags' },
subscriptions: {
@ -163,7 +167,7 @@ const sharedStateFilters = {
store.subscribe(() => {
try {
const state = store.getState();
sharedStateSubscriber(state, sharedStateFilters, sharedStateCache);
sharedStateSubscriber(state, sharedStateFilters, '0.1');
} catch (e) {
// handle gracefully?
}

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Lbry } from 'lbry-redux';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
@ -113,8 +113,9 @@ class SplashScreen extends React.PureComponent {
getUserSettings = () => {
const { populateSharedUserState } = this.props;
Lbryio.call('user_settings', 'get').then(settings => {
populateSharedUserState(settings);
doPreferenceGet('shared', null, null, preference => {
populateSharedUserState(preference);
});
};