Use redux-persist-filesystem-storage engine due to AsyncStorage size limitation on Android (#227)
This commit is contained in:
parent
8ed87d0739
commit
ee90951945
6 changed files with 68 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": {
|
"base64-js": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
"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-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": {
|
"react-native-image-pan-zoom": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-image-pan-zoom/-/react-native-image-pan-zoom-2.1.3.tgz",
|
"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"
|
"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": {
|
"redux-persist-transform-compress": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/redux-persist-transform-compress/-/redux-persist-transform-compress-4.2.0.tgz",
|
"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",
|
"moment": "^2.22.1",
|
||||||
"react": "16.2.0",
|
"react": "16.2.0",
|
||||||
"react-native": "0.55.3",
|
"react-native": "0.55.3",
|
||||||
|
"react-native-fetch-blob": "^0.10.8",
|
||||||
"react-native-image-zoom-viewer": "^2.2.5",
|
"react-native-image-zoom-viewer": "^2.2.5",
|
||||||
"react-native-vector-icons": "^5.0.0",
|
"react-native-vector-icons": "^5.0.0",
|
||||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
"redux": "^3.6.0",
|
"redux": "^3.6.0",
|
||||||
"redux-logger": "3.0.6",
|
"redux-logger": "3.0.6",
|
||||||
"redux-persist": "^4.8.0",
|
"redux-persist": "^4.8.0",
|
||||||
|
"redux-persist-filesystem-storage": "^1.2.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",
|
||||||
"redux-thunk": "^2.2.0"
|
"redux-thunk": "^2.2.0"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Provider, connect } from 'react-redux';
|
import { Provider, connect } from 'react-redux';
|
||||||
import DiscoverPage from './page/discover';
|
|
||||||
import {
|
import {
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
AppState,
|
AppState,
|
||||||
|
@ -9,15 +8,6 @@ import {
|
||||||
View,
|
View,
|
||||||
NativeModules
|
NativeModules
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
|
||||||
import { createLogger } from 'redux-logger';
|
|
||||||
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 {
|
import {
|
||||||
Lbry,
|
Lbry,
|
||||||
claimsReducer,
|
claimsReducer,
|
||||||
|
@ -27,9 +17,19 @@ import {
|
||||||
searchReducer,
|
searchReducer,
|
||||||
walletReducer
|
walletReducer
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import settingsReducer from './redux/reducers/settings';
|
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||||
import moment from 'moment';
|
import { createLogger } from 'redux-logger';
|
||||||
|
import { StackNavigator, addNavigationHelpers } from 'react-navigation';
|
||||||
|
import { AppNavigator } from './component/AppNavigator';
|
||||||
|
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||||
import { reactNavigationMiddleware } from './utils/redux';
|
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 moment from 'moment';
|
||||||
|
import settingsReducer from './redux/reducers/settings';
|
||||||
|
import thunk from 'redux-thunk';
|
||||||
|
|
||||||
function isFunction(object) {
|
function isFunction(object) {
|
||||||
return typeof object === 'function';
|
return typeof object === 'function';
|
||||||
|
@ -106,7 +106,7 @@ const persistOptions = {
|
||||||
// read the data
|
// read the data
|
||||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||||
debounce: 10000,
|
debounce: 10000,
|
||||||
storage: AsyncStorage
|
storage: FilesystemStorage
|
||||||
};
|
};
|
||||||
|
|
||||||
persistStore(store, persistOptions, err => {
|
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 {
|
dependencies {
|
||||||
compile project(':react-native-video')
|
compile project(':react-native-video')
|
||||||
|
compile project(':react-native-fetch-blob')
|
||||||
{%- for aar in aars %}
|
{%- for aar in aars %}
|
||||||
compile(name: '{{ aar }}', ext: 'aar')
|
compile(name: '{{ aar }}', ext: 'aar')
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
rootProject.name = 'browser'
|
rootProject.name = 'browser'
|
||||||
include ':react-native-video'
|
include ':react-native-video'
|
||||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android-exoplayer')
|
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.ReactRootView;
|
||||||
import com.facebook.react.ReactInstanceManager;
|
import com.facebook.react.ReactInstanceManager;
|
||||||
import com.facebook.react.shell.MainReactPackage;
|
import com.facebook.react.shell.MainReactPackage;
|
||||||
|
import com.RNFetchBlob.RNFetchBlobPackage;
|
||||||
|
|
||||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||||
import io.lbry.browser.reactmodules.DownloadManagerModule;
|
import io.lbry.browser.reactmodules.DownloadManagerModule;
|
||||||
|
@ -88,6 +89,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||||
.setJSMainModulePath("index")
|
.setJSMainModulePath("index")
|
||||||
.addPackage(new MainReactPackage())
|
.addPackage(new MainReactPackage())
|
||||||
.addPackage(new ReactVideoPackage())
|
.addPackage(new ReactVideoPackage())
|
||||||
|
.addPackage(new RNFetchBlobPackage())
|
||||||
.addPackage(new LbryReactPackage())
|
.addPackage(new LbryReactPackage())
|
||||||
.setUseDeveloperSupport(true)
|
.setUseDeveloperSupport(true)
|
||||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||||
|
|
Loading…
Reference in a new issue