11diff --git a/node_modules/@op-engineering/op-sqlite/android/build.gradle b/node_modules/@op-engineering/op-sqlite/android/build.gradle
2- index d36fd85..7513556 100644
2+ index 08631df..3e61af5 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 @@
@@ -33,7 +33,7 @@ index d36fd85..7513556 100644
3333- // Start from the root + 1 level up (to avoid detecting the op-sqlite/package.json) and traverse upwards to find the first package.json
3434- File currentDir = new File("$rootDir/../")
3535- packageJsonFile = null
36- -
36+ -
3737- // Try to find package.json by traversing upwards
3838- while (currentDir != null) {
3939- File potential = new File(currentDir, "package.json")
@@ -54,22 +54,22 @@ index d36fd85..7513556 100644
5454-
5555- if(opsqliteConfig) {
5656- println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath
57- - useSQLCipher = opsqliteConfig["sqlcipher"]
58- - useCRSQLite = opsqliteConfig["crsqlite"]
59- - useSqliteVec = opsqliteConfig["sqliteVec"]
57+ - useSQLCipher = !! opsqliteConfig["sqlcipher"]
58+ - useCRSQLite = !! opsqliteConfig["crsqlite"]
59+ - useSqliteVec = !! opsqliteConfig["sqliteVec"]
6060- performanceMode = opsqliteConfig["performanceMode"]
6161- sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : ""
62- - enableFTS5 = opsqliteConfig["fts5"]
63- - useLibsql = opsqliteConfig["libsql"]
64- - enableRtree = opsqliteConfig["rtree"]
62+ - enableFTS5 = !! opsqliteConfig["fts5"]
63+ - useLibsql = !! opsqliteConfig["libsql"]
64+ - enableRtree = !! opsqliteConfig["rtree"]
6565- tokenizers = opsqliteConfig["tokenizers"] ? opsqliteConfig["tokenizers"] : []
6666- }
6767-
6868 if(useSQLCipher) {
6969 println "[OP-SQLITE] using sqlcipher."
7070 } else if(useLibsql) {
7171diff --git a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
72- index 8feaf77..261ec22 100644
72+ index 5912d7b..495880e 100644
7373--- a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
7474+++ b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
7575@@ -19,8 +19,8 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
@@ -118,20 +118,20 @@ index 44f86df..9d9f710 100644
118118 val instance = OPSQLiteBridge()
119119 }
120120diff --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
121- index 688832f..9ea814b 100644
121+ index 8d341b7..3ce6179 100644
122122--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
123123+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
124- @@ -13,7 +13,7 @@ import java.io.OutputStream
124+ @@ -12,7 +12,7 @@ import java.io.InputStream
125+ import java.io.OutputStream
125126 import com.facebook.react.util.RNLog;
126127
127- //@ReactModule(name = OPSQLiteModule.NAME)
128128- internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
129129+ class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
130130 override fun getName(): String {
131131 return NAME
132132 }
133- @@ -56 ,6 +56 ,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134- return true
133+ @@ -54 ,6 +54 ,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134+ throw Exception("Do not call getDylibPath on Android")
135135 }
136136
137137+ @ReactMethod(isBlockingSynchronousMethod = true)
@@ -149,10 +149,10 @@ index 688832f..9ea814b 100644
149149 fun moveAssetsDatabase(args: ReadableMap, promise: Promise) {
150150 val filename = args.getString("filename")!!
151151diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
152- index 85710ee..8cf10f2 100644
152+ index 9682941..c0b9c21 100644
153153--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
154154+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
155- @@ -889 ,6 +889 ,10 @@ void DBHostObject::invalidate() {
155+ @@ -682 ,6 +682 ,10 @@ void DBHostObject::invalidate() {
156156 #endif
157157 }
158158
@@ -164,23 +164,23 @@ index 85710ee..8cf10f2 100644
164164
165165 } // namespace opsqlite
166166diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
167- index cc174b7..ff36f74 100644
167+ index 002b8c9..f3a2e1f 100644
168168--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
169169+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
170- @@ -73 ,6 +73 ,7 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
171- void on_commit();
172- void on_rollback();
173- void invalidate();
174- + void drop();
175- ~DBHostObject() override;
170+ @@ -68 ,6 +68 ,7 @@ public:
171+ void on_commit();
172+ void on_rollback();
173+ void invalidate();
174+ + void drop();
175+ ~DBHostObject() override;
176176
177- private:
178- diff --git a/node_modules/@op-engineering/op-sqlite/cpp/bindings .cpp b/node_modules/@op-engineering/op-sqlite/cpp/bindings .cpp
179- index 5e1c1de..dc21c65 100644
180- --- a/node_modules/@op-engineering/op-sqlite/cpp/bindings .cpp
181- +++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings .cpp
182- @@ -36 ,6 +36 ,13 @@ void invalidate() {
183- dbs.clear();
177+ private:
178+ diff --git a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite .cpp b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite .cpp
179+ index e33579a..791fa70 100644
180+ --- a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite .cpp
181+ +++ b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite .cpp
182+ @@ -42 ,6 +42 ,13 @@ void invalidate() {
183+ dbs.clear();
184184 }
185185
186186+ bool deleteAllDbs() {
@@ -191,12 +191,12 @@ index 5e1c1de..dc21c65 100644
191191+ }
192192+
193193 void install(jsi::Runtime &rt,
194- const std::shared_ptr<react::CallInvoker> &invoker ,
194+ const std::shared_ptr<react::CallInvoker> &_invoker ,
195195 const char *base_path, const char *crsqlite_path,
196- diff --git a/node_modules/@op-engineering/op-sqlite/cpp/bindings.h b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
196+ diff --git a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp
197197index 91511ab..cc73dfe 100644
198- --- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
199- +++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
198+ --- a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp
199+ +++ b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp
200200@@ -14,6 +14,7 @@ void install(jsi::Runtime &rt,
201201 const char *base_path, const char *crsqlite_path,
202202 const char *sqlite_vec_path);
@@ -206,17 +206,47 @@ index 91511ab..cc73dfe 100644
206206
207207 } // namespace opsqlite
208208diff --git a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
209- index 375cc3e..e6fce21 100644
209+ index e717811..5f441b2 100644
210210--- a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
211211+++ b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
212212@@ -1,4 +1,3 @@
213213- require "json"
214214 require_relative "./generate_tokenizers_header_file"
215215
216216 log_message = lambda do |message|
217- @@ -39,11 +38,10 @@ else
218- app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
219- end
217+ @@ -8,41 +7,11 @@ end
218+ # In the sample app the dir is not inside of node_modules
219+ is_user_app = __dir__.include?("node_modules")
220+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
221+ - app_package = nil
222+ - package_json_path = nil
223+ -
224+ - # When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
225+ - # Find the users package.json by searching up through parent directories
226+ - if is_user_app
227+ - current_dir = File.expand_path(__dir__)
228+ - # Move one level up to the parent directory
229+ - current_dir = File.dirname(current_dir)
230+ -
231+ - # Find the package.json by searching up through parent directories
232+ - loop do
233+ - package_path = File.join(current_dir, "package.json")
234+ - if File.exist?(package_path)
235+ - package_json_path = package_path
236+ - break
237+ - end
238+ -
239+ - parent_dir = File.dirname(current_dir)
240+ - break if parent_dir == current_dir # reached filesystem root
241+ - current_dir = parent_dir
242+ - end
243+ -
244+ - raise "package.json not found" if package_json_path.nil?
245+ - else
246+ - package_json_path = File.join(__dir__, "example", "package.json")
247+ - end
248+ -
249+ - app_package = JSON.parse(File.read(package_json_path))
220250
221251- op_sqlite_config = app_package["op-sqlite"]
222252- use_sqlcipher = false
@@ -228,7 +258,7 @@ index 375cc3e..e6fce21 100644
228258 phone_version = false
229259 sqlite_flags = ""
230260 fts5 = false
231- @@ -51 ,37 +49 ,6 @@ rtree = false
261+ @@ -50 ,37 +19 ,6 @@ rtree = false
232262 use_sqlite_vec = false
233263 tokenizers = []
234264
@@ -247,22 +277,31 @@ index 375cc3e..e6fce21 100644
247277-
248278- if phone_version then
249279- if use_sqlcipher then
250- - raise "SQLCipher is not supported with phone version"
280+ - raise "SQLCipher is not supported with phone version. It cannot load extensions. "
251281- end
252282-
253283- if use_crsqlite then
254- - raise "CRSQLite is not supported with phone version"
284+ - raise "CRSQLite is not supported with phone version. It cannot load extensions. "
255285- end
256286-
257287- if rtree then
258- - raise "RTree is not supported with phone version"
288+ - raise "RTree is not supported with phone version. It cannot load extensions. "
259289- end
260290-
261291- if use_sqlite_vec then
262- - raise "SQLite Vec is not supported with phone version"
292+ - raise "SQLite Vec is not supported with phone version. It cannot load extensions. "
263293- end
264294- end
265295-
266296 Pod::Spec.new do |s|
267297 s.name = "op-sqlite"
268298 s.version = package["version"]
299+ @@ -92,7 +30,7 @@ Pod::Spec.new do |s|
300+ s.platforms = { :ios => min_ios_version_supported, :tvos => "13.0", :osx => "10.15", :visionos => "1.0" }
301+ s.source = { :git => "https://github.com/op-engineering/op-sqlite.git", :tag => "#{s.version}" }
302+
303+ - log_message.call("[OP-SQLITE] Configuration found at #{package_json_path}")
304+ + log_message.call("[OP-SQLITE] Configuration hardcoded in podspec")
305+
306+ install_modules_dependencies(s)
307+
0 commit comments