Use redux-persist-filesystem-storage engine due to AsyncStorage size limitation on Android
This commit is contained in:
parent
89bfc845f6
commit
f109e4872c
6 changed files with 66 additions and 13 deletions
37
app/package-lock.json
generated
37
app/package-lock.json
generated
|
@ -2076,6 +2076,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"base-64": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz",
|
||||
"integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
|
@ -5175,6 +5180,30 @@
|
|||
"react-native-drawer-layout": "1.3.2"
|
||||
}
|
||||
},
|
||||
"react-native-fetch-blob": {
|
||||
"version": "0.10.8",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fetch-blob/-/react-native-fetch-blob-0.10.8.tgz",
|
||||
"integrity": "sha1-T8JWq64MtfEOfEHyjBGz/zMNcqk=",
|
||||
"requires": {
|
||||
"base-64": "0.1.0",
|
||||
"glob": "7.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
|
||||
"integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.2",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-native-image-pan-zoom": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/react-native-image-pan-zoom/-/react-native-image-pan-zoom-2.1.3.tgz",
|
||||
|
@ -5364,6 +5393,14 @@
|
|||
"lodash-es": "^4.17.4"
|
||||
}
|
||||
},
|
||||
"redux-persist-filesystem-storage": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist-filesystem-storage/-/redux-persist-filesystem-storage-1.2.0.tgz",
|
||||
"integrity": "sha512-cFenkZN9h29WaerxmnHamc7EW1+voYE9H3iAJYI6JMWcnFJGue+RYjxYCoHk9B4LWVfYAkmiBsz3oTAA7NIcAQ==",
|
||||
"requires": {
|
||||
"react-native-fetch-blob": "^0.10.0"
|
||||
}
|
||||
},
|
||||
"redux-persist-transform-compress": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist-transform-compress/-/redux-persist-transform-compress-4.2.0.tgz",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"moment": "^2.22.1",
|
||||
"react": "16.2.0",
|
||||
"react-native": "0.55.3",
|
||||
"react-native-fetch-blob": "^0.10.8",
|
||||
"react-native-image-zoom-viewer": "^2.2.5",
|
||||
"react-native-vector-icons": "^5.0.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
|
@ -19,6 +20,7 @@
|
|||
"redux": "^3.6.0",
|
||||
"redux-logger": "3.0.6",
|
||||
"redux-persist": "^4.8.0",
|
||||
"redux-persist-filesystem-storage": "^1.2.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"redux-thunk": "^2.2.0"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import DiscoverPage from './page/discover';
|
||||
import {
|
||||
AppRegistry,
|
||||
AppState,
|
||||
|
@ -9,16 +8,6 @@ import {
|
|||
View,
|
||||
NativeModules
|
||||
} from 'react-native';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import {
|
||||
StackNavigator, addNavigationHelpers
|
||||
} from 'react-navigation';
|
||||
import { AppNavigator } from './component/AppNavigator';
|
||||
import AppWithNavigationState from './component/AppNavigator';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import thunk from 'redux-thunk';
|
||||
import {
|
||||
Lbry,
|
||||
claimsReducer,
|
||||
|
@ -28,9 +17,18 @@ import {
|
|||
searchReducer,
|
||||
walletReducer
|
||||
} from 'lbry-redux';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import { StackNavigator, addNavigationHelpers } from 'react-navigation';
|
||||
import { AppNavigator } from './component/AppNavigator';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import { reactNavigationMiddleware } from './utils/redux';
|
||||
import AppWithNavigationState from './component/AppNavigator';
|
||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import thunk from 'redux-thunk';
|
||||
import settingsReducer from './redux/reducers/settings';
|
||||
import moment from 'moment';
|
||||
import { reactNavigationMiddleware } from './utils/redux';
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
|
@ -106,7 +104,7 @@ const persistOptions = {
|
|||
// read the data
|
||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||
debounce: 10000,
|
||||
storage: AsyncStorage
|
||||
storage: FilesystemStorage
|
||||
};
|
||||
|
||||
persistStore(store, persistOptions, err => {
|
||||
|
|
|
@ -68,8 +68,20 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
afterEvaluate {project ->
|
||||
if (project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':react-native-video')
|
||||
compile project(':react-native-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
compile(name: '{{ aar }}', ext: 'aar')
|
||||
{%- endfor -%}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
rootProject.name = 'browser'
|
||||
include ':react-native-video'
|
||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android-exoplayer')
|
||||
include ':react-native-fetch-blob'
|
||||
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-fetch-blob/android')
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.RNFetchBlob.RNFetchBlobPackage;
|
||||
|
||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||
import io.lbry.browser.reactmodules.DownloadManagerModule;
|
||||
|
@ -88,6 +89,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
|||
.setJSMainModulePath("index")
|
||||
.addPackage(new MainReactPackage())
|
||||
.addPackage(new ReactVideoPackage())
|
||||
.addPackage(new RNFetchBlobPackage())
|
||||
.addPackage(new LbryReactPackage())
|
||||
.setUseDeveloperSupport(true)
|
||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||
|
|
Loading…
Reference in a new issue