Skip to content

Commit

Permalink
feat: Add plugin for managing AsyncStorage
Browse files Browse the repository at this point in the history
ATM. It's hard to know what informations are the AsyncStorage.
 So let's add a few flipper plugins to see what's going on. I added
two plugins, because one let us edit the content of the async storage,
but the display is not good, the other has a better display but don't
let us edit the content.

You need to install async-storage and async-storage-advanced within
the flipper plugins window.

Those plugins are only enabled on DEV mode. Not in release mode.
  • Loading branch information
Crash-- committed Jun 10, 2022
1 parent 2b92e64 commit 8f4401b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
12 changes: 9 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,14 @@ PODS:
- React-Core
- react-native-cookies (6.0.7):
- React-Core
- react-native-flipper (0.146.1):
- React-Core
- react-native-gzip (2.0.0):
- NVHTarGzip
- React
- react-native-netinfo (8.3.0):
- React-Core
- react-native-safe-area-context (4.2.4):
- react-native-safe-area-context (4.3.1):
- RCT-Folly
- RCTRequired
- RCTTypeSafety
Expand Down Expand Up @@ -459,6 +461,7 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-android-navbar-height (from `../node_modules/react-native-android-navbar-height`)
- "react-native-cookies (from `../node_modules/@react-native-cookies/cookies`)"
- react-native-flipper (from `../node_modules/react-native-flipper`)
- "react-native-gzip (from `../node_modules/@fengweichong/react-native-gzip`)"
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
Expand Down Expand Up @@ -547,6 +550,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-android-navbar-height"
react-native-cookies:
:path: "../node_modules/@react-native-cookies/cookies"
react-native-flipper:
:path: "../node_modules/react-native-flipper"
react-native-gzip:
:path: "../node_modules/@fengweichong/react-native-gzip"
react-native-netinfo:
Expand Down Expand Up @@ -639,9 +644,10 @@ SPEC CHECKSUMS:
React-logger: 933f80c97c633ee8965d609876848148e3fef438
react-native-android-navbar-height: bff52dac6312be20b4b90f1ff14b0444f3bbbbc4
react-native-cookies: 6004d512ffc6f2c498c5b70cda0bc040350c0585
react-native-flipper: 4bfe0a324e663f1ae2f76ad0da75673de6895efe
react-native-gzip: 5ffb84bf191c7cd135338eca748317bc466d41a1
react-native-netinfo: 3671b091c4843fda5e153612866ef4024b8f5d62
react-native-safe-area-context: f98b0b16d1546d208fc293b4661e3f81a895afd9
react-native-safe-area-context: 6c12e3859b6f27b25de4fee8201cfb858432d8de
react-native-webview: 8ec7ddf9eb4ddcd92b32cee7907efec19a9ec7cb
React-perflogger: 93075d8931c32cd1fce8a98c15d2d5ccc4d891bd
React-RCTActionSheet: 7d3041e6761b4f3044a37079ddcb156575fb6d89
Expand Down Expand Up @@ -672,4 +678,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 6090fd6ebe65fb2e19d80296deab33044d8647aa

COCOAPODS: 1.10.1
COCOAPODS: 1.11.3
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"react-native": "0.66.4",
"react-native-android-navbar-height": "git+https://github.com/ConnectyCube/react-native-android-navbar-height.git#main",
"react-native-bootsplash": "3.2.3",
"react-native-flipper": "^0.146.1",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "1.10.3",
"react-native-google-safetynet": "npm:cozy-react-native-google-safetynet@^1.0.1",
Expand All @@ -65,7 +66,9 @@
"react-native-url-polyfill": "^1.3.0",
"react-native-web": "0.17.7",
"react-native-webview": "^11.18.2",
"react-scripts": "4.0.3"
"react-scripts": "4.0.3",
"rn-async-storage-flipper": "^0.0.10",
"rn-flipper-async-storage-advanced": "^1.0.4"
},
"devDependencies": {
"@babel/core": "7.14.8",
Expand Down
10 changes: 9 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { decode, encode } from 'base-64'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import { Provider as PaperProvider } from 'react-native-paper'
import FlipperAsyncStorage from 'rn-flipper-async-storage-advanced'
import AsyncStorage from '@react-native-async-storage/async-storage'
import RNAsyncStorageFlipper from 'rn-async-storage-flipper'

import { CozyProvider, useClient } from 'cozy-client'
import { NativeIntentProvider } from 'cozy-intent'
Expand Down Expand Up @@ -165,9 +168,14 @@ const WrappedApp = () => {

const Wrapper = () => {
const [hasCrypto, setHasCrypto] = useState(false)

useEffect(() => {
if (__DEV__) {
RNAsyncStorageFlipper(AsyncStorage)
}
}, [])
return (
<>
{__DEV__ && <FlipperAsyncStorage />}
<CryptoWebView setHasCrypto={setHasCrypto} />
{hasCrypto && (
<HttpServerProvider>
Expand Down
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14441,6 +14441,11 @@ react-native-codegen@^0.0.7:
jscodeshift "^0.11.0"
nullthrows "^1.1.1"

react-native-flipper@^0.146.1:
version "0.146.1"
resolved "https://registry.yarnpkg.com/react-native-flipper/-/react-native-flipper-0.146.1.tgz#b6bbb23edc347597788bdca4c89b58bad425e1a1"
integrity sha512-M3pjqDigOPRpPN9lkT3o0yKDViqciGe5aUjPrtuKdxmaCbH4ofpMEZGxrcKjnEwXJWKC24IDZKtz7WitaWgRig==

react-native-fs@^2.20.0:
version "2.20.0"
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.20.0.tgz#05a9362b473bfc0910772c0acbb73a78dbc810f6"
Expand Down Expand Up @@ -15296,6 +15301,16 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"

rn-async-storage-flipper@^0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/rn-async-storage-flipper/-/rn-async-storage-flipper-0.0.10.tgz#c7ddeffef9f2fa0871652e4a4e09e612907ee589"
integrity sha512-Bp8B3oWufAHhc1okewR6EXZL7gRkMQMODYepTpsTgvFq7Iae57Ow4ZIDjumb6BxoCfipFSFBnxvfPhy3PDDBRQ==

rn-flipper-async-storage-advanced@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/rn-flipper-async-storage-advanced/-/rn-flipper-async-storage-advanced-1.0.4.tgz#ca3d0c315a75f379fef3771cc6ee3bef2d774265"
integrity sha512-ixA6LJOxz+spdeJ8a2x6KimIiDCuKDky0ic5VaOHWIPSUcGmtmmZKJ98TQ0Uj3Cx/sM9K5VaUyjt2Gt1lrZNiw==

rollup-plugin-babel@^4.3.3:
version "4.4.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb"
Expand Down

0 comments on commit 8f4401b

Please sign in to comment.