11diff --git a/node_modules/@op-engineering/op-sqlite/android/build.gradle b/node_modules/@op-engineering/op-sqlite/android/build.gradle
2- index 4186aa3..242dd95 100644
2+ index 70ebca0..5da8659 100644
33--- a/node_modules/@op-engineering/op-sqlite/android/build.gradle
44+++ b/node_modules/@op-engineering/op-sqlite/android/build.gradle
55@@ -1,5 +1,4 @@
@@ -8,50 +8,50 @@ index 4186aa3..242dd95 100644
88
99 buildscript {
1010 repositories {
11- @@ -27,28 +26,14 @@ def isNewArchitectureEnabled() {
11+ @@ -27,10 +26,10 @@ def isNewArchitectureEnabled() {
1212 return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
1313 }
1414
1515- def useSQLCipher = false
1616+ def useSQLCipher = true
1717 def useLibsql = false
1818 def useCRSQLite = false
19- - def performanceMode = "0"
20- + def performanceMode = "2"
19+ - def performanceMode = false
20+ + def performanceMode = true
2121 def sqliteFlags = ""
2222 def enableFTS5 = false
2323 def useSqliteVec = false
24+ @@ -38,28 +37,6 @@ def enableRtree = false
25+ def tokenizers = []
2426
25- - def packageJsonFile = new File("$rootDir/../package.json")
26- - def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
27+ def isInsideNodeModules = rootDir.absolutePath.contains("node_modules")
28+ - def packageJson
29+ -
30+ - if ( isInsideNodeModules ) {
31+ - def packageJsonFile = new File("$rootDir/../../../package.json")
32+ - packageJson = new JsonSlurper().parseText(packageJsonFile.text)
33+ - } else {
34+ - def packageJsonFile = new File("$rootDir/../package.json")
35+ - packageJson = new JsonSlurper().parseText(packageJsonFile.text)
36+ - }
2737-
2838- def opsqliteConfig = packageJson["op-sqlite"]
2939- if(opsqliteConfig) {
3040- useSQLCipher = opsqliteConfig["sqlcipher"]
3141- useCRSQLite = opsqliteConfig["crsqlite"]
3242- useSqliteVec = opsqliteConfig["sqliteVec"]
33- - performanceMode = opsqliteConfig["performanceMode"] ? opsqliteConfig["performanceMode"] : ""
43+ - performanceMode = opsqliteConfig["performanceMode"]
3444- sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : ""
3545- enableFTS5 = opsqliteConfig["fts5"]
3646- useLibsql = opsqliteConfig["libsql"]
47+ - enableRtree = opsqliteConfig["rtree"]
48+ - tokenizers = opsqliteConfig["tokenizers"] ? opsqliteConfig["tokenizers"] : []
3749- }
38- -
50+
3951 if(useSQLCipher) {
4052 println "[OP-SQLITE] using SQLCipher 🔒"
41- } else if(useLibsql) {
42- @@ -171,8 +156,8 @@ android {
43- }
44-
45- compileOptions {
46- - sourceCompatibility JavaVersion.VERSION_1_8
47- - targetCompatibility JavaVersion.VERSION_1_8
48- + sourceCompatibility JavaVersion.VERSION_17
49- + targetCompatibility JavaVersion.VERSION_17
50- }
51-
52- externalNativeBuild {
5353diff --git a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
54- index ed599ea..4813667 100644
54+ index 8feaf77..be0ade9 100644
5555--- a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
5656+++ b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
5757@@ -19,8 +19,8 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
@@ -65,9 +65,9 @@ index ed599ea..4813667 100644
6565 }
6666
6767 private:
68- @@ -39,8 +39,14 @@ private:
68+ @@ -39,6 +39,10 @@ private:
6969 static void clearStateNativeJsi(jni::alias_ref<jni::JObject> thiz) {
70- opsqlite::clearState ();
70+ opsqlite::invalidate ();
7171 }
7272+
7373+ static bool deleteAllDBsJsi(jni::alias_ref<jni::JObject> thiz) {
@@ -76,14 +76,8 @@ index ed599ea..4813667 100644
7676 };
7777
7878 JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
79- - return jni::initialize(vm, [] { OPSQLiteBridge::registerNatives(); });
80- + return jni::initialize(vm, [] {
81- + OPSQLiteBridge::registerNatives();
82- + });
83- }
84- \ No newline at end of file
8579diff --git a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
86- index 7445a4c..a9dcf14 100644
80+ index 44f86df..0cb1287 100644
8781--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
8882+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
8983@@ -13,6 +13,8 @@ class OPSQLiteBridge {
@@ -107,7 +101,7 @@ index 7445a4c..a9dcf14 100644
107101 val instance = OPSQLiteBridge()
108102 }
109103diff --git a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
110- index 6179cfc..7663a49 100644
104+ index fea0aa7..e169fea 100644
111105--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
112106+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
113107@@ -6,14 +6,15 @@ import com.facebook.react.bridge.ReactApplicationContext
@@ -128,13 +122,13 @@ index 6179cfc..7663a49 100644
128122 override fun getName(): String {
129123 return NAME
130124 }
131- @@ -50 ,6 +51 ,16 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
132- }
125+ @@ -55 ,6 +56 ,16 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
126+ throw Exception("Do not call getDylibPath on Android")
133127 }
134128
135129+ @ReactMethod(isBlockingSynchronousMethod = true)
136130+ fun closeAllConnections() {
137- + OPSQLiteBridge.instance.clearState ()
131+ + OPSQLiteBridge.instance.invalidate ()
138132+ }
139133+
140134+ @ReactMethod(isBlockingSynchronousMethod = true)
@@ -146,94 +140,75 @@ index 6179cfc..7663a49 100644
146140 fun moveAssetsDatabase(args: ReadableMap, promise: Promise) {
147141 val filename = args.getString("filename")!!
148142diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
149- index c3663dd..a81af62 100644
143+ index 33e8e25..5843a46 100644
150144--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
151145+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
152- @@ -946 ,6 +946,16 @@ void DBHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name,
153-
154- void DBHostObject::invalidate() { invalidated = true; }
146+ @@ -847 ,6 +847,10 @@ void DBHostObject::invalidate() {
147+ #endif
148+ }
155149
156- + bool DBHostObject::drop() {
157- + BridgeResult result = opsqlite_remove(db_name, std::string(base_path));
158- +
159- + if (result.type == SQLiteError) {
160- + throw std::runtime_error(result.message);
161- + }
162- +
163- + return true;
150+ + void DBHostObject::drop() {
151+ + opsqlite_remove(db, db_name, std::string(base_path));
164152+ }
165153+
166- DBHostObject::~DBHostObject() { invalidated = true ; }
154+ DBHostObject::~DBHostObject() { invalidate() ; }
167155
168156 } // namespace opsqlite
169157diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
170- index dcb694c..8ec3f4b 100644
158+ index b665ddd..26a561d 100644
171159--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
172160+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
173- @@ -52 ,6 +52 ,7 @@ public:
174- void set(jsi::Runtime &rt, const jsi::PropNameID &name,
175- const jsi::Value &value );
176- void invalidate();
177- + bool drop();
178- ~DBHostObject();
179-
180- private:
161+ @@ -67 ,6 +67 ,7 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
162+ void on_commit();
163+ void on_rollback( );
164+ void invalidate();
165+ + void drop();
166+ ~DBHostObject() override ;
167+
168+ private:
181169diff --git a/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
182- index b471d3d..e06ec0c 100644
170+ index 3af52b2..90e8ded 100644
183171--- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
184172+++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
185- @@ -47 ,6 +47 ,13 @@ void clearState () {
186- thread_pool->restartPool ();
173+ @@ -36 ,6 +36 ,13 @@ void invalidate () {
174+ dbs.clear ();
187175 }
188176
189177+ bool deleteAllDbs() {
190- + for(const auto &db : dbs) {
191- + db->drop();
192- + }
193- + return true;
194- + };
178+ + for(const auto &db : dbs) {
179+ + db->drop();
180+ + }
181+ + return true;
182+ + }
195183+
196- void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> invoker,
184+ void install(jsi::Runtime &rt,
185+ const std::shared_ptr<react::CallInvoker> &invoker,
197186 const char *base_path, const char *crsqlite_path,
198- const char *sqlite_vec_path) {
199- @@ -72,13 +79,6 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> invoker,
200- options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt);
201- }
202-
203- - #ifdef OP_SQLITE_USE_SQLCIPHER
204- - if (encryptionKey.empty()) {
205- - throw std::runtime_error(
206- - "[OP SQLite] using SQLCipher encryption key is required");
207- - }
208- - #endif
209- -
210- if (!location.empty()) {
211- if (location == ":memory:") {
212- path = ":memory:";
213187diff --git a/node_modules/@op-engineering/op-sqlite/cpp/bindings.h b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
214- index 912bd47..4d1a2cf 100644
188+ index 91511ab..cc73dfe 100644
215189--- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
216190+++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
217- @@ -13,5 +13,6 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> invoker ,
191+ @@ -14,6 +14,7 @@ void install(jsi::Runtime &rt,
218192 const char *base_path, const char *crsqlite_path,
219193 const char *sqlite_vec_path);
220- void clearState ();
194+ void invalidate ();
221195+ bool deleteAllDbs();
196+ void expoUpdatesWorkaround(const char *base_path);
222197
223198 } // namespace opsqlite
224199diff --git a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
225- index ee168c4..103e3bf 100644
200+ index b8568b9..f547bc0 100644
226201--- a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
227202+++ b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
228- @@ -9,36 +9,16 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
203+ @@ -11,20 +11,11 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
229204 fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
230205
231206 parent_folder_name = File.basename(__dir__)
232207- app_package = nil
233- - # for development purposes on user machines the podspec should be able to read the package.json from the root folder
234- - # since it lives inside node_modules/@op-engineering/op-sqlite
235- - if __dir__.include?("node_modules")
208+ - # When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
209+ - if is_user_app
236210- app_package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
211+ - # When running on the example app
237212- else
238213- app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
239214- end
@@ -243,24 +218,28 @@ index ee168c4..103e3bf 100644
243218+ use_sqlcipher = true
244219 use_crsqlite = false
245220 use_libsql = false
246- - performance_mode = "0"
247- + performance_mode = "2"
221+ - performance_mode = false
222+ + performance_mode = true
248223 phone_version = false
249224 sqlite_flags = ""
250225 fts5 = false
226+ @@ -32,19 +23,6 @@ rtree = false
251227 use_sqlite_vec = false
228+ tokenizers = []
252229
253230- if(op_sqlite_config != nil)
254231- use_sqlcipher = op_sqlite_config["sqlcipher"] == true
255232- use_crsqlite = op_sqlite_config["crsqlite"] == true
256233- use_libsql = op_sqlite_config["libsql"] == true
257- - performance_mode = op_sqlite_config["performanceMode"] || "0"
234+ - performance_mode = op_sqlite_config["performanceMode"] || false
258235- phone_version = op_sqlite_config["iosSqlite"] == true
259236- sqlite_flags = op_sqlite_config["sqliteFlags"] || ""
260237- fts5 = op_sqlite_config["fts5"] == true
238+ - rtree = op_sqlite_config["rtree"] == true
261239- use_sqlite_vec = op_sqlite_config["sqliteVec"] == true
240+ - tokenizers = op_sqlite_config["tokenizers"] || []
262241- end
263242-
264- if phone_version && use_sqlcipher
265- raise "Cannot use phone embedded version and SQLCipher. SQLCipher needs to be compiled from sources with the project."
266- end
243+ if phone_version then
244+ if use_sqlcipher then
245+ raise "SQLCipher is not supported with phone version"
0 commit comments