Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade pouchdb-adapter-react-native-sqlite to V4 and benefits from OPSqlite #1268

Open
wants to merge 2 commits into
base: feat/improve_netservice
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ android {
prod {
}
}

packagingOptions {
pickFirst 'lib/x86/libcrypto.so'
pickFirst 'lib/x86_64/libcrypto.so'
pickFirst 'lib/armeabi-v7a/libcrypto.so'
pickFirst 'lib/arm64-v8a/libcrypto.so'
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
minSdkVersion = 23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to inform the team about this update (which is relevant)

compileSdkVersion = 34
targetSdkVersion = 34
androidXBrowser = "1.4.0"
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.exports = {
alias: {
'^/(.+)': './src/\\1',
'pouchdb-collate': '@craftzdog/pouchdb-collate-react-native',
crypto: 'react-native-quick-crypto',
stream: 'readable-stream',
buffer: '@craftzdog/react-native-buffer',
'@cozy/minilog': 'cozy-minilog'
},
extensions: [
Expand Down
2 changes: 2 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ target 'CozyReactNative' do

pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

pod 'OpenSSL-Universal', :modular_headers => true, :configurations => ['Release']

target 'CozyReactNativeDev' do
inherit! :complete
# Pods for testing
Expand Down
23 changes: 21 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ PODS:
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- NVHTarGzip (1.0.1)
- op-sqlite (6.2.11):
- React
- React-callinvoker
- React-Core
- OpenSSL-Universal (1.1.1100)
- PromisesObjC (2.4.0)
- Protobuf (3.28.2)
Expand Down Expand Up @@ -1109,6 +1113,12 @@ PODS:
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- react-native-quick-crypto (0.7.6):
- glog
- OpenSSL-Universal
- RCT-Folly (= 2022.05.16.00)
- React
- React-Core
- react-native-quick-sqlite (8.0.6):
- React
- React-callinvoker
Expand Down Expand Up @@ -1395,6 +1405,8 @@ DEPENDENCIES:
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- libevent (~> 2.1.12)
- "op-sqlite (from `../node_modules/@op-engineering/op-sqlite`)"
- OpenSSL-Universal
- OpenSSL-Universal (= 1.1.1100)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
Expand Down Expand Up @@ -1439,6 +1451,7 @@ DEPENDENCIES:
- react-native-performance (from `../node_modules/react-native-performance`)
- react-native-print (from `../node_modules/react-native-print`)
- react-native-quick-base64 (from `../node_modules/react-native-quick-base64`)
- react-native-quick-crypto (from `../node_modules/react-native-quick-crypto`)
- react-native-quick-sqlite (from `../node_modules/react-native-quick-sqlite`)
- "react-native-receive-sharing-intent (from `../node_modules/@mythologi/react-native-receive-sharing-intent`)"
- react-native-restart (from `../node_modules/react-native-restart`)
Expand Down Expand Up @@ -1546,6 +1559,8 @@ EXTERNAL SOURCES:
hermes-engine:
:podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
:tag: hermes-2024-04-29-RNv0.73.8-644c8be78af1eae7c138fa4093fb87f0f4f8db85
op-sqlite:
:path: "../node_modules/@op-engineering/op-sqlite"
RCT-Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTRequired:
Expand Down Expand Up @@ -1626,6 +1641,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-print"
react-native-quick-base64:
:path: "../node_modules/react-native-quick-base64"
react-native-quick-crypto:
:path: "../node_modules/react-native-quick-crypto"
react-native-quick-sqlite:
:path: "../node_modules/react-native-quick-sqlite"
react-native-receive-sharing-intent:
Expand Down Expand Up @@ -1769,6 +1786,7 @@ SPEC CHECKSUMS:
MMKVCore: c04b296010fcb1d1638f2c69405096aac12f6390
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
NVHTarGzip: 74cc227b902e5725900d37eb6d79b57e93005a73
op-sqlite: b4f61f3085ea3b70f264f3a64b724c81ab117e58
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
Protobuf: 28c89b24435762f60244e691544ed80f50d82701
Expand Down Expand Up @@ -1812,6 +1830,7 @@ SPEC CHECKSUMS:
react-native-performance: ff93f8af3b2ee9519fd7879896aa9b8b8272691d
react-native-print: f704aef52d931bfce6d1d84351dbb5232d7ecb89
react-native-quick-base64: e1ea036b3dec44c6da2439bd62881a09de614b23
react-native-quick-crypto: 070488f041b282af3e375e511490061f1cf50474
react-native-quick-sqlite: e0e23b749382a85e4b57146f753de737a6c3a9e1
react-native-receive-sharing-intent: 0c21b8e80f629a73341f2566ce9b99df8124bb10
react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162
Expand Down Expand Up @@ -1866,6 +1885,6 @@ SPEC CHECKSUMS:
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 66a97477b94264cc4e49990c8fe6b153260d871d

PODFILE CHECKSUM: e53a16a804de17b86c29f5452d36e0ae6205ef23
PODFILE CHECKSUM: 5ca14179a4e0b17ebbb7dd74c2a5fcb845f82a9d

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
},
"dependencies": {
"@craftzdog/pouchdb-collate-react-native": "^7.3.0",
"@craftzdog/react-native-buffer": "^6.0.5",
"@fengweichong/react-native-gzip": "github:cozy/react-native-gzip#1.1.0",
"@mythologi/react-native-receive-sharing-intent": "2.2.1",
"@notifee/react-native": "^7.8.0",
"@op-engineering/op-sqlite": "^6.2.11",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-native-camera-roll/camera-roll": "^7.2.0",
"@react-native-clipboard/clipboard": "^1.13.2",
Expand Down Expand Up @@ -79,7 +81,7 @@
"post-me": "^0.4.5",
"postinstall-postinstall": "^2.1.0",
"pouchdb-adapter-http": "^8.0.1",
"pouchdb-adapter-react-native-sqlite": "^3.0.1",
"pouchdb-adapter-react-native-sqlite": "^4.0.5",
"pouchdb-core": "^8.0.1",
"pouchdb-mapreduce": "^8.0.1",
"pouchdb-replication": "^8.0.1",
Expand Down Expand Up @@ -121,6 +123,7 @@
"react-native-play-install-referrer": "^1.1.8",
"react-native-print": "0.11.0",
"react-native-quick-base64": "2.1.2",
"react-native-quick-crypto": "^0.7.6",
"react-native-quick-sqlite": "8.0.6",
"react-native-quick-websql": "^0.3.0",
"react-native-restart": "^0.0.27",
Expand Down
7 changes: 6 additions & 1 deletion src/pouchdb/getLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export const getLinks = (): CozyLink[] => {
]
})
),
performanceApi: PouchLinkPerformanceApi
performanceApi: PouchLinkPerformanceApi,
pouch: {
options: {
adapter: 'react-native-sqlite'
}
}
}

const stackLink = new StackLink({
Expand Down
5 changes: 1 addition & 4 deletions src/pouchdb/pouchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
import 'react-native-get-random-values'

import HttpPouch from 'pouchdb-adapter-http'
import SQLiteAdapterFactory from 'pouchdb-adapter-react-native-sqlite'
import SQLiteAdapter from 'pouchdb-adapter-react-native-sqlite'
import PouchDB from 'pouchdb-core'
import PouchDBFind from 'pouchdb-find'
import mapreduce from 'pouchdb-mapreduce'
import replication from 'pouchdb-replication'
import WebSQLite from 'react-native-quick-websql'

const SQLiteAdapter = SQLiteAdapterFactory(WebSQLite)

export default PouchDB.plugin(HttpPouch)
.plugin(PouchDBFind)
Expand Down
7 changes: 2 additions & 5 deletions src/pouchdb/shim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { shim } from 'react-native-quick-base64'
import { install } from 'react-native-quick-crypto'

shim()

// Avoid using node dependent modules
process.browser = true
install()
Loading
Loading