Merge pull request #39 from lbryio/settings-page

settings persisted to redux store
This commit is contained in:
akinwale 2018-03-23 09:04:32 +01:00 committed by GitHub
commit a809826bf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View file

@ -16,6 +16,7 @@
"react-navigation-redux-helpers": "^1.0.1", "react-navigation-redux-helpers": "^1.0.1",
"react-redux": "^5.0.3", "react-redux": "^5.0.3",
"redux": "^3.6.0", "redux": "^3.6.0",
"redux-logger": "3.0.6",
"redux-persist": "^4.8.0", "redux-persist": "^4.8.0",
"redux-persist-transform-compress": "^4.2.0", "redux-persist-transform-compress": "^4.2.0",
"redux-persist-transform-filter": "0.0.10", "redux-persist-transform-filter": "0.0.10",

View file

@ -87,12 +87,13 @@ const store = createStore(
const compressor = createCompressor(); const compressor = createCompressor();
const saveClaimsFilter = createFilter('claims', ['byId', 'claimsByUri']); const saveClaimsFilter = createFilter('claims', ['byId', 'claimsByUri']);
const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']); const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']);
const settingsFilter = createFilter('settings', ['clientSettings']);
const persistOptions = { const persistOptions = {
whitelist: ['claims', 'subscriptions'], whitelist: ['claims', 'subscriptions', 'settings'],
// Order is important. Needs to be compressed last or other transforms can't // Order is important. Needs to be compressed last or other transforms can't
// read the data // read the data
transforms: [saveClaimsFilter, subscriptionsFilter, compressor], transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, compressor],
debounce: 10000, debounce: 10000,
storage: AsyncStorage storage: AsyncStorage
}; };

View file

@ -13,7 +13,7 @@ reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
const clientSettings = Object.assign({}, state.clientSettings); const clientSettings = Object.assign({}, state.clientSettings);
clientSettings[key] = value; clientSettings[key] = value;
return Object.assign({}, state, { return Object.assign({}, state, {
clientSettings, clientSettings,
}); });

View file

@ -1512,9 +1512,10 @@ __d(function (global, require, module, exports, _dependencyMap) {
var compressor = (0, _reduxPersistTransformCompress2.default)(); var compressor = (0, _reduxPersistTransformCompress2.default)();
var saveClaimsFilter = (0, _reduxPersistTransformFilter2.default)('claims', ['byId', 'claimsByUri']); var saveClaimsFilter = (0, _reduxPersistTransformFilter2.default)('claims', ['byId', 'claimsByUri']);
var subscriptionsFilter = (0, _reduxPersistTransformFilter2.default)('subscriptions', ['subscriptions']); var subscriptionsFilter = (0, _reduxPersistTransformFilter2.default)('subscriptions', ['subscriptions']);
var settingsFilter = (0, _reduxPersistTransformFilter2.default)('settings', ['clientSettings']);
var persistOptions = { var persistOptions = {
whitelist: ['claims', 'subscriptions'], whitelist: ['claims', 'subscriptions', 'settings'],
transforms: [saveClaimsFilter, subscriptionsFilter, compressor], transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, compressor],
debounce: 10000, debounce: 10000,
storage: _reactNative.AsyncStorage storage: _reactNative.AsyncStorage
}; };
@ -1541,13 +1542,13 @@ __d(function (global, require, module, exports, _dependencyMap) {
store: store, store: store,
__source: { __source: {
fileName: _jsxFileName, fileName: _jsxFileName,
lineNumber: 109 lineNumber: 110
} }
}, },
_react2.default.createElement(_AppNavigator2.default, { _react2.default.createElement(_AppNavigator2.default, {
__source: { __source: {
fileName: _jsxFileName, fileName: _jsxFileName,
lineNumber: 110 lineNumber: 111
} }
}) })
); );

View file

@ -1 +1,2 @@
á…N†eº¸Îù‚ˆ™)5sCÊê őÚ¤
!’óĂŇW€mý6ű“­