@capacitor-community/sqlite 5.0.5-2 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLite.java +118 -156
  2. package/android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLitePlugin.java +81 -249
  3. package/android/src/main/java/com/getcapacitor/community/database/sqlite/NotificationCenter.java +1 -1
  4. package/android/src/main/java/com/getcapacitor/community/database/sqlite/RetHandler.java +0 -12
  5. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java +184 -40
  6. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ExportToJson.java +141 -135
  7. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ImportFromJson.java +2 -1
  8. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/UtilsEncryption.java +111 -0
  9. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsBiometric.java +0 -4
  10. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsFile.java +30 -18
  11. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsMigrate.java +12 -4
  12. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsNCDatabase.java +4 -1
  13. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLCipher.java +8 -6
  14. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLite.java +14 -28
  15. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSecret.java +3 -4
  16. package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsUpgrade.java +0 -1
  17. package/dist/esm/definitions.d.ts +91 -4
  18. package/dist/esm/definitions.js +79 -19
  19. package/dist/esm/definitions.js.map +1 -1
  20. package/dist/esm/web.d.ts +3 -1
  21. package/dist/esm/web.js +8 -0
  22. package/dist/esm/web.js.map +1 -1
  23. package/dist/plugin.cjs.js +87 -19
  24. package/dist/plugin.cjs.js.map +1 -1
  25. package/dist/plugin.js +87 -19
  26. package/dist/plugin.js.map +1 -1
  27. package/electron/dist/plugin.js +333 -148
  28. package/electron/dist/plugin.js.map +1 -1
  29. package/electron/rollup.config.js +2 -0
  30. package/ios/Plugin/CapacitorSQLite.swift +125 -92
  31. package/ios/Plugin/CapacitorSQLitePlugin.swift +6 -3
  32. package/ios/Plugin/Database.swift +45 -19
  33. package/ios/Plugin/ImportExportJson/ExportToJson.swift +10 -5
  34. package/ios/Plugin/ImportExportJson/ImportData.swift +434 -0
  35. package/ios/Plugin/ImportExportJson/ImportFromJson.swift +47 -59
  36. package/ios/Plugin/ImportExportJson/JsonSQLite.swift +7 -0
  37. package/ios/Plugin/Utils/UtilsDownloadFromHTTP.swift +61 -61
  38. package/ios/Plugin/Utils/UtilsDrop.swift +2 -1
  39. package/ios/Plugin/Utils/UtilsJson.swift +123 -1
  40. package/ios/Plugin/Utils/UtilsSQLCipher.swift +254 -23
  41. package/ios/Plugin/Utils/UtilsUpgrade.swift +0 -1
  42. package/package.json +2 -2
  43. package/src/definitions.ts +171 -18
  44. package/src/web.ts +10 -0
@@ -6,11 +6,8 @@ import com.getcapacitor.JSArray;
6
6
  import com.getcapacitor.JSObject;
7
7
  import com.getcapacitor.Plugin;
8
8
  import com.getcapacitor.PluginCall;
9
- import com.getcapacitor.PluginConfig;
10
9
  import com.getcapacitor.PluginMethod;
11
10
  import com.getcapacitor.annotation.CapacitorPlugin;
12
- import com.getcapacitor.community.database.sqlite.SQLite.Database;
13
- import com.getcapacitor.community.database.sqlite.SQLite.ImportExportJson.JsonSQLite;
14
11
  import com.getcapacitor.community.database.sqlite.SQLite.SqliteConfig;
15
12
  import java.util.Collections;
16
13
  import java.util.Dictionary;
@@ -24,11 +21,10 @@ import org.json.JSONObject;
24
21
  public class CapacitorSQLitePlugin extends Plugin {
25
22
 
26
23
  private static final String TAG = CapacitorSQLitePlugin.class.getName();
27
- private Context context;
28
24
  private SqliteConfig config;
29
25
  private CapacitorSQLite implementation;
30
- private Dictionary<String, Dictionary<Integer, JSONObject>> versionUpgrades = new Hashtable<>();
31
- private RetHandler rHandler = new RetHandler();
26
+ private final Dictionary<String, Dictionary<Integer, JSONObject>> versionUpgrades = new Hashtable<>();
27
+ private final RetHandler rHandler = new RetHandler();
32
28
  private String passphrase = null;
33
29
  private String oldpassphrase = null;
34
30
  private String loadMessage = "";
@@ -38,15 +34,11 @@ public class CapacitorSQLitePlugin extends Plugin {
38
34
  * Load the context
39
35
  */
40
36
  public void load() {
41
- context = getContext();
37
+ Context context = getContext();
42
38
  try {
43
39
  config = getSqliteConfig();
44
40
  AddObserversToNotificationCenter();
45
41
  implementation = new CapacitorSQLite(context, config);
46
- } catch (JSONException e) {
47
- implementation = null;
48
- loadMessage = "CapacitorSQLitePlugin: " + e.getMessage();
49
- Log.e(TAG, loadMessage);
50
42
  } catch (Exception e) {
51
43
  implementation = null;
52
44
  loadMessage = "CapacitorSQLitePlugin: " + e.getMessage();
@@ -58,7 +50,7 @@ public class CapacitorSQLitePlugin extends Plugin {
58
50
  * Echo Method
59
51
  * test the plugin
60
52
  *
61
- * @param call
53
+ * @param call PluginCall
62
54
  */
63
55
  @PluginMethod
64
56
  public void echo(PluginCall call) {
@@ -80,7 +72,7 @@ public class CapacitorSQLitePlugin extends Plugin {
80
72
  * IsSecretStored
81
73
  * Check if a secret has been stored
82
74
  *
83
- * @param call
75
+ * @param call PluginCall
84
76
  */
85
77
  @PluginMethod
86
78
  public void isSecretStored(PluginCall call) {
@@ -88,15 +80,12 @@ public class CapacitorSQLitePlugin extends Plugin {
88
80
  try {
89
81
  Boolean res = implementation.isSecretStored();
90
82
  rHandler.retResult(call, res, null);
91
- return;
92
83
  } catch (Exception e) {
93
84
  String msg = "IsSecretStored: " + e.getMessage();
94
85
  rHandler.retResult(call, null, msg);
95
- return;
96
86
  }
97
87
  } else {
98
88
  rHandler.retResult(call, null, loadMessage);
99
- return;
100
89
  }
101
90
  }
102
91
 
@@ -104,11 +93,11 @@ public class CapacitorSQLitePlugin extends Plugin {
104
93
  * SetEncryptionSecret
105
94
  * set a passphrase secret for a database
106
95
  *
107
- * @param call
96
+ * @param call PluginCall
108
97
  */
109
98
  @PluginMethod
110
99
  public void setEncryptionSecret(PluginCall call) {
111
- String passphrase = null;
100
+ String passphrase;
112
101
  if (!call.getData().has("passphrase")) {
113
102
  String msg = "SetEncryptionSecret: Must provide a passphrase";
114
103
  rHandler.retResult(call, null, msg);
@@ -119,15 +108,12 @@ public class CapacitorSQLitePlugin extends Plugin {
119
108
  try {
120
109
  implementation.setEncryptionSecret(passphrase);
121
110
  rHandler.retResult(call, null, null);
122
- return;
123
111
  } catch (Exception e) {
124
112
  String msg = "SetEncryptionSecret: " + e.getMessage();
125
113
  rHandler.retResult(call, null, msg);
126
- return;
127
114
  }
128
115
  } else {
129
116
  rHandler.retResult(call, null, loadMessage);
130
- return;
131
117
  }
132
118
  }
133
119
 
@@ -136,7 +122,7 @@ public class CapacitorSQLitePlugin extends Plugin {
136
122
  * change a passphrase secret for a database
137
123
  * with a new passphrase
138
124
  *
139
- * @param call
125
+ * @param call PluginCall
140
126
  */
141
127
  @PluginMethod
142
128
  public void changeEncryptionSecret(PluginCall call) {
@@ -156,24 +142,18 @@ public class CapacitorSQLitePlugin extends Plugin {
156
142
  if (implementation != null) {
157
143
  getActivity()
158
144
  .runOnUiThread(
159
- new Runnable() {
160
- @Override
161
- public void run() {
162
- try {
163
- implementation.changeEncryptionSecret(call, passphrase, oldpassphrase);
164
- rHandler.retResult(call, null, null);
165
- return;
166
- } catch (Exception e) {
167
- String msg = "ChangeEncryptionSecret: " + e.getMessage();
168
- rHandler.retResult(call, null, msg);
169
- return;
170
- }
145
+ () -> {
146
+ try {
147
+ implementation.changeEncryptionSecret(call, passphrase, oldpassphrase);
148
+ rHandler.retResult(call, null, null);
149
+ } catch (Exception e) {
150
+ String msg = "ChangeEncryptionSecret: " + e.getMessage();
151
+ rHandler.retResult(call, null, msg);
171
152
  }
172
153
  }
173
154
  );
174
155
  } else {
175
156
  rHandler.retResult(call, null, loadMessage);
176
- return;
177
157
  }
178
158
  }
179
159
 
@@ -181,7 +161,7 @@ public class CapacitorSQLitePlugin extends Plugin {
181
161
  * ClearEncryptionSecret
182
162
  * clear the passphrase secret for a database
183
163
  *
184
- * @param call
164
+ * @param call PluginCall
185
165
  */
186
166
  @PluginMethod
187
167
  public void clearEncryptionSecret(PluginCall call) {
@@ -189,15 +169,12 @@ public class CapacitorSQLitePlugin extends Plugin {
189
169
  try {
190
170
  implementation.clearEncryptionSecret();
191
171
  rHandler.retResult(call, null, null);
192
- return;
193
172
  } catch (Exception e) {
194
173
  String msg = "ClearEncryptionSecret: " + e.getMessage();
195
174
  rHandler.retResult(call, null, msg);
196
- return;
197
175
  }
198
176
  } else {
199
177
  rHandler.retResult(call, null, loadMessage);
200
- return;
201
178
  }
202
179
  }
203
180
 
@@ -205,11 +182,11 @@ public class CapacitorSQLitePlugin extends Plugin {
205
182
  * checkEncryptionSecret
206
183
  * check a passphrase secret against the stored passphrase
207
184
  *
208
- * @param call
185
+ * @param call PluginCall
209
186
  */
210
187
  @PluginMethod
211
188
  public void checkEncryptionSecret(PluginCall call) {
212
- String passphrase = null;
189
+ String passphrase;
213
190
  if (!call.getData().has("passphrase")) {
214
191
  String msg = "checkEncryptionSecret: Must provide a passphrase";
215
192
  rHandler.retResult(call, null, msg);
@@ -220,22 +197,19 @@ public class CapacitorSQLitePlugin extends Plugin {
220
197
  try {
221
198
  Boolean res = implementation.checkEncryptionSecret(passphrase);
222
199
  rHandler.retResult(call, res, null);
223
- return;
224
200
  } catch (Exception e) {
225
201
  String msg = "CheckEncryptionSecret: " + e.getMessage();
226
202
  rHandler.retResult(call, null, msg);
227
- return;
228
203
  }
229
204
  } else {
230
205
  rHandler.retResult(call, null, loadMessage);
231
- return;
232
206
  }
233
207
  }
234
208
 
235
209
  @PluginMethod
236
210
  public void getNCDatabasePath(PluginCall call) {
237
- String folderPath = null;
238
- String dbName = null;
211
+ String folderPath;
212
+ String dbName;
239
213
  if (!call.getData().has("path")) {
240
214
  String msg = "getNCDatabasePath: Must provide a folder path";
241
215
  rHandler.retPath(call, null, msg);
@@ -252,15 +226,12 @@ public class CapacitorSQLitePlugin extends Plugin {
252
226
  try {
253
227
  String databasePath = implementation.getNCDatabasePath(folderPath, dbName);
254
228
  rHandler.retPath(call, databasePath, null);
255
- return;
256
229
  } catch (Exception e) {
257
230
  String msg = "getNCDatabasePath: " + e.getMessage();
258
231
  rHandler.retResult(call, null, msg);
259
- return;
260
232
  }
261
233
  } else {
262
234
  rHandler.retResult(call, null, loadMessage);
263
- return;
264
235
  }
265
236
  }
266
237
 
@@ -268,32 +239,29 @@ public class CapacitorSQLitePlugin extends Plugin {
268
239
  * CreateNCConnection Method
269
240
  * Create a non-conformed connection to a database
270
241
  *
271
- * @param call
242
+ * @param call PluginCall
272
243
  */
273
244
  @PluginMethod
274
245
  public void createNCConnection(PluginCall call) {
275
- String dbPath = null;
276
- int dbVersion = Integer.valueOf(-1);
246
+ String dbPath;
247
+ int dbVersion;
277
248
  if (!call.getData().has("databasePath")) {
278
249
  String msg = "CreateNCConnection: Must provide a database path";
279
250
  rHandler.retResult(call, null, msg);
280
251
  return;
281
252
  }
282
- dbPath = call.getString("databasePath");
283
- dbVersion = call.getInt("version", 1);
284
253
  if (implementation != null) {
285
254
  try {
255
+ dbPath = call.getString("databasePath");
256
+ dbVersion = call.getInt("version", 1);
286
257
  implementation.createNCConnection(dbPath, dbVersion);
287
258
  rHandler.retResult(call, null, null);
288
- return;
289
259
  } catch (Exception e) {
290
260
  String msg = "CreateNCConnection: " + e.getMessage();
291
261
  rHandler.retResult(call, null, msg);
292
- return;
293
262
  }
294
263
  } else {
295
264
  rHandler.retResult(call, null, loadMessage);
296
- return;
297
265
  }
298
266
  }
299
267
 
@@ -301,14 +269,13 @@ public class CapacitorSQLitePlugin extends Plugin {
301
269
  * CreateConnection Method
302
270
  * Create a connection to a database
303
271
  *
304
- * @param call
272
+ * @param call PluginCall
305
273
  */
306
274
  @PluginMethod
307
275
  public void createConnection(PluginCall call) {
308
- String dbName = null;
309
- int dbVersion = Integer.valueOf(-1);
310
- String inMode = null;
311
- JSObject ret = new JSObject();
276
+ String dbName;
277
+ int dbVersion;
278
+ String inMode;
312
279
  if (!call.getData().has("database")) {
313
280
  String msg = "CreateConnection: Must provide a database name";
314
281
  rHandler.retResult(call, null, msg);
@@ -338,15 +305,12 @@ public class CapacitorSQLitePlugin extends Plugin {
338
305
  try {
339
306
  implementation.createConnection(dbName, encrypted, inMode, dbVersion, upgDict, readOnly);
340
307
  rHandler.retResult(call, null, null);
341
- return;
342
308
  } catch (Exception e) {
343
309
  String msg = "CreateConnection: " + e.getMessage();
344
310
  rHandler.retResult(call, null, msg);
345
- return;
346
311
  }
347
312
  } else {
348
313
  rHandler.retResult(call, null, loadMessage);
349
- return;
350
314
  }
351
315
  }
352
316
 
@@ -354,7 +318,7 @@ public class CapacitorSQLitePlugin extends Plugin {
354
318
  * Open Method
355
319
  * Open a database
356
320
  *
357
- * @param call
321
+ * @param call PluginCall
358
322
  */
359
323
  @PluginMethod
360
324
  public void open(PluginCall call) {
@@ -369,15 +333,12 @@ public class CapacitorSQLitePlugin extends Plugin {
369
333
  try {
370
334
  implementation.open(dbName, readOnly);
371
335
  rHandler.retResult(call, null, null);
372
- return;
373
336
  } catch (Exception e) {
374
337
  String msg = "Open: " + e.getMessage();
375
338
  rHandler.retResult(call, null, msg);
376
- return;
377
339
  }
378
340
  } else {
379
341
  rHandler.retResult(call, null, loadMessage);
380
- return;
381
342
  }
382
343
  }
383
344
 
@@ -385,7 +346,7 @@ public class CapacitorSQLitePlugin extends Plugin {
385
346
  * Close Method
386
347
  * Close a Database
387
348
  *
388
- * @param call
349
+ * @param call PluginCall
389
350
  */
390
351
  @PluginMethod
391
352
  public void close(PluginCall call) {
@@ -400,15 +361,12 @@ public class CapacitorSQLitePlugin extends Plugin {
400
361
  try {
401
362
  implementation.close(dbName, readOnly);
402
363
  rHandler.retResult(call, null, null);
403
- return;
404
364
  } catch (Exception e) {
405
365
  String msg = "Close: " + e.getMessage();
406
366
  rHandler.retResult(call, null, msg);
407
- return;
408
367
  }
409
368
  } else {
410
369
  rHandler.retResult(call, null, loadMessage);
411
- return;
412
370
  }
413
371
  }
414
372
 
@@ -416,7 +374,7 @@ public class CapacitorSQLitePlugin extends Plugin {
416
374
  * GetUrl Method
417
375
  * Get a database Url
418
376
  *
419
- * @param call
377
+ * @param call PluginCall
420
378
  */
421
379
  @PluginMethod
422
380
  public void getUrl(PluginCall call) {
@@ -431,15 +389,12 @@ public class CapacitorSQLitePlugin extends Plugin {
431
389
  try {
432
390
  String res = implementation.getUrl(dbName, readOnly);
433
391
  rHandler.retUrl(call, res, null);
434
- return;
435
392
  } catch (Exception e) {
436
393
  String msg = "GetUrl: " + e.getMessage();
437
394
  rHandler.retUrl(call, null, msg);
438
- return;
439
395
  }
440
396
  } else {
441
397
  rHandler.retUrl(call, null, loadMessage);
442
- return;
443
398
  }
444
399
  }
445
400
 
@@ -447,7 +402,7 @@ public class CapacitorSQLitePlugin extends Plugin {
447
402
  * GetVersion Method
448
403
  * Get a database Version
449
404
  *
450
- * @param call
405
+ * @param call PluginCall
451
406
  */
452
407
  @PluginMethod
453
408
  public void getVersion(PluginCall call) {
@@ -462,15 +417,12 @@ public class CapacitorSQLitePlugin extends Plugin {
462
417
  try {
463
418
  Integer res = implementation.getVersion(dbName, readOnly);
464
419
  rHandler.retVersion(call, res, null);
465
- return;
466
420
  } catch (Exception e) {
467
421
  String msg = "GetVersion: " + e.getMessage();
468
422
  rHandler.retVersion(call, null, msg);
469
- return;
470
423
  }
471
424
  } else {
472
425
  rHandler.retVersion(call, null, loadMessage);
473
- return;
474
426
  }
475
427
  }
476
428
 
@@ -478,7 +430,7 @@ public class CapacitorSQLitePlugin extends Plugin {
478
430
  * CloseNCConnection Method
479
431
  * Close a non-conformed database connection
480
432
  *
481
- * @param call
433
+ * @param call PluginCall
482
434
  */
483
435
  @PluginMethod
484
436
  public void closeNCConnection(PluginCall call) {
@@ -492,15 +444,12 @@ public class CapacitorSQLitePlugin extends Plugin {
492
444
  try {
493
445
  implementation.closeNCConnection(dbPath);
494
446
  rHandler.retResult(call, null, null);
495
- return;
496
447
  } catch (Exception e) {
497
448
  String msg = "CloseNCConnection: " + e.getMessage();
498
449
  rHandler.retResult(call, null, msg);
499
- return;
500
450
  }
501
451
  } else {
502
452
  rHandler.retResult(call, null, loadMessage);
503
- return;
504
453
  }
505
454
  }
506
455
 
@@ -508,7 +457,7 @@ public class CapacitorSQLitePlugin extends Plugin {
508
457
  * CloseConnection Method
509
458
  * Close the connection to a database
510
459
  *
511
- * @param call
460
+ * @param call PluginCall
512
461
  */
513
462
  @PluginMethod
514
463
  public void closeConnection(PluginCall call) {
@@ -523,15 +472,12 @@ public class CapacitorSQLitePlugin extends Plugin {
523
472
  try {
524
473
  implementation.closeConnection(dbName, readOnly);
525
474
  rHandler.retResult(call, null, null);
526
- return;
527
475
  } catch (Exception e) {
528
476
  String msg = "CloseConnection: " + e.getMessage();
529
477
  rHandler.retResult(call, null, msg);
530
- return;
531
478
  }
532
479
  } else {
533
480
  rHandler.retResult(call, null, loadMessage);
534
- return;
535
481
  }
536
482
  }
537
483
 
@@ -539,7 +485,7 @@ public class CapacitorSQLitePlugin extends Plugin {
539
485
  * CheckConnectionsConsistency Method
540
486
  * Check the connections consistency JS <=> Native
541
487
  *
542
- * @param call
488
+ * @param call PluginCall
543
489
  */
544
490
  @PluginMethod
545
491
  public void checkConnectionsConsistency(PluginCall call) {
@@ -564,15 +510,12 @@ public class CapacitorSQLitePlugin extends Plugin {
564
510
  try {
565
511
  Boolean res = implementation.checkConnectionsConsistency(dbNames, openModes);
566
512
  rHandler.retResult(call, res, null);
567
- return;
568
513
  } catch (Exception e) {
569
514
  String msg = "CheckConnectionsConsistency: " + e.getMessage();
570
515
  rHandler.retResult(call, null, msg);
571
- return;
572
516
  }
573
517
  } else {
574
518
  rHandler.retResult(call, null, loadMessage);
575
- return;
576
519
  }
577
520
  }
578
521
 
@@ -580,7 +523,7 @@ public class CapacitorSQLitePlugin extends Plugin {
580
523
  * IsDatabase Method
581
524
  * Check if the database file exists
582
525
  *
583
- * @param call
526
+ * @param call PluginCall
584
527
  */
585
528
  @PluginMethod
586
529
  public void isDatabase(PluginCall call) {
@@ -593,15 +536,12 @@ public class CapacitorSQLitePlugin extends Plugin {
593
536
  try {
594
537
  Boolean res = implementation.isDatabase(dbName);
595
538
  rHandler.retResult(call, res, null);
596
- return;
597
539
  } catch (Exception e) {
598
540
  String msg = "isDatabase: " + e.getMessage();
599
541
  rHandler.retResult(call, null, msg);
600
- return;
601
542
  }
602
543
  } else {
603
544
  rHandler.retResult(call, null, loadMessage);
604
- return;
605
545
  }
606
546
  }
607
547
 
@@ -609,7 +549,7 @@ public class CapacitorSQLitePlugin extends Plugin {
609
549
  * IsDatabaseEncrypted Method
610
550
  * Check if the database is encrypted
611
551
  *
612
- * @param call
552
+ * @param call PluginCall
613
553
  */
614
554
  @PluginMethod
615
555
  public void isDatabaseEncrypted(PluginCall call) {
@@ -622,15 +562,12 @@ public class CapacitorSQLitePlugin extends Plugin {
622
562
  try {
623
563
  Boolean res = implementation.isDatabaseEncrypted(dbName);
624
564
  rHandler.retResult(call, res, null);
625
- return;
626
565
  } catch (Exception e) {
627
566
  String msg = "isDatabaseEncrypted: " + e.getMessage();
628
567
  rHandler.retResult(call, null, msg);
629
- return;
630
568
  }
631
569
  } else {
632
570
  rHandler.retResult(call, null, loadMessage);
633
- return;
634
571
  }
635
572
  }
636
573
 
@@ -638,33 +575,31 @@ public class CapacitorSQLitePlugin extends Plugin {
638
575
  * isInConfigEncryption
639
576
  * Check if encryption is definrd in capacitor.config
640
577
  *
641
- * @param call
578
+ * @param call PluginCall
642
579
  */
643
580
  @PluginMethod
644
581
  public void isInConfigEncryption(PluginCall call) {
645
582
  Boolean res = this.config.getIsEncryption();
646
583
  rHandler.retResult(call, res, null);
647
- return;
648
584
  }
649
585
 
650
586
  /**
651
587
  * isInConfigBiometricAuth
652
588
  * Check if biometric auth is definrd in capacitor.config
653
589
  *
654
- * @param call
590
+ * @param call PluginCall
655
591
  */
656
592
  @PluginMethod
657
593
  public void isInConfigBiometricAuth(PluginCall call) {
658
594
  Boolean res = this.config.getBiometricAuth();
659
595
  rHandler.retResult(call, res, null);
660
- return;
661
596
  }
662
597
 
663
598
  /**
664
599
  * IsNCDatabase Method
665
600
  * Check if the database file exists
666
601
  *
667
- * @param call
602
+ * @param call PluginCall
668
603
  */
669
604
  @PluginMethod
670
605
  public void isNCDatabase(PluginCall call) {
@@ -677,15 +612,12 @@ public class CapacitorSQLitePlugin extends Plugin {
677
612
  try {
678
613
  Boolean res = implementation.isNCDatabase(dbPath);
679
614
  rHandler.retResult(call, res, null);
680
- return;
681
615
  } catch (Exception e) {
682
616
  String msg = "isNCDatabase: " + e.getMessage();
683
617
  rHandler.retResult(call, null, msg);
684
- return;
685
618
  }
686
619
  } else {
687
620
  rHandler.retResult(call, null, loadMessage);
688
- return;
689
621
  }
690
622
  }
691
623
 
@@ -693,7 +625,7 @@ public class CapacitorSQLitePlugin extends Plugin {
693
625
  * IsTableExists Method
694
626
  * Check if a table exists in a database
695
627
  *
696
- * @param call
628
+ * @param call PluginCall
697
629
  */
698
630
  @PluginMethod
699
631
  public void isTableExists(PluginCall call) {
@@ -712,15 +644,12 @@ public class CapacitorSQLitePlugin extends Plugin {
712
644
  try {
713
645
  Boolean res = implementation.isTableExists(dbName, tableName, readOnly);
714
646
  rHandler.retResult(call, res, null);
715
- return;
716
647
  } catch (Exception e) {
717
648
  String msg = "isTableExists: " + e.getMessage();
718
649
  rHandler.retResult(call, null, msg);
719
- return;
720
650
  }
721
651
  } else {
722
652
  rHandler.retResult(call, null, loadMessage);
723
- return;
724
653
  }
725
654
  }
726
655
 
@@ -734,15 +663,12 @@ public class CapacitorSQLitePlugin extends Plugin {
734
663
  try {
735
664
  JSArray res = implementation.getDatabaseList();
736
665
  rHandler.retValues(call, res, null);
737
- return;
738
666
  } catch (Exception e) {
739
667
  String msg = "getDatabaseList: " + e.getMessage();
740
668
  rHandler.retValues(call, new JSArray(), msg);
741
- return;
742
669
  }
743
670
  } else {
744
671
  rHandler.retValues(call, new JSArray(), loadMessage);
745
- return;
746
672
  }
747
673
  }
748
674
 
@@ -763,15 +689,12 @@ public class CapacitorSQLitePlugin extends Plugin {
763
689
  try {
764
690
  JSArray res = implementation.getMigratableDbList(folderPath);
765
691
  rHandler.retValues(call, res, null);
766
- return;
767
692
  } catch (Exception e) {
768
693
  String msg = "getMigratableDbList: " + e.getMessage();
769
694
  rHandler.retValues(call, new JSArray(), msg);
770
- return;
771
695
  }
772
696
  } else {
773
697
  rHandler.retValues(call, new JSArray(), loadMessage);
774
- return;
775
698
  }
776
699
  }
777
700
 
@@ -802,15 +725,12 @@ public class CapacitorSQLitePlugin extends Plugin {
802
725
  try {
803
726
  implementation.addSQLiteSuffix(folderPath, dbList);
804
727
  rHandler.retResult(call, null, null);
805
- return;
806
728
  } catch (Exception e) {
807
729
  String msg = "addSQLiteSuffix: " + e.getMessage();
808
730
  rHandler.retResult(call, null, msg);
809
- return;
810
731
  }
811
732
  } else {
812
733
  rHandler.retResult(call, null, loadMessage);
813
- return;
814
734
  }
815
735
  }
816
736
 
@@ -841,15 +761,12 @@ public class CapacitorSQLitePlugin extends Plugin {
841
761
  try {
842
762
  implementation.deleteOldDatabases(folderPath, dbList);
843
763
  rHandler.retResult(call, null, null);
844
- return;
845
764
  } catch (Exception e) {
846
765
  String msg = "deleteOldDatabases: " + e.getMessage();
847
766
  rHandler.retResult(call, null, msg);
848
- return;
849
767
  }
850
768
  } else {
851
769
  rHandler.retResult(call, null, loadMessage);
852
- return;
853
770
  }
854
771
  }
855
772
 
@@ -880,15 +797,12 @@ public class CapacitorSQLitePlugin extends Plugin {
880
797
  try {
881
798
  implementation.moveDatabasesAndAddSuffix(folderPath, dbList);
882
799
  rHandler.retResult(call, null, null);
883
- return;
884
800
  } catch (Exception e) {
885
801
  String msg = "moveDatabasesAndAddSuffix: " + e.getMessage();
886
802
  rHandler.retResult(call, null, msg);
887
- return;
888
803
  }
889
804
  } else {
890
805
  rHandler.retResult(call, null, loadMessage);
891
- return;
892
806
  }
893
807
  }
894
808
 
@@ -896,7 +810,7 @@ public class CapacitorSQLitePlugin extends Plugin {
896
810
  * Execute Method
897
811
  * Execute SQL statements provided in a String
898
812
  *
899
- * @param call
813
+ * @param call PluginCall
900
814
  */
901
815
  @PluginMethod
902
816
  public void execute(PluginCall call) {
@@ -921,15 +835,12 @@ public class CapacitorSQLitePlugin extends Plugin {
921
835
  try {
922
836
  JSObject res = implementation.execute(dbName, statements, transaction, readOnly);
923
837
  rHandler.retChanges(call, res, null);
924
- return;
925
838
  } catch (Exception e) {
926
839
  String msg = "Execute: " + e.getMessage();
927
840
  rHandler.retChanges(call, retRes, msg);
928
- return;
929
841
  }
930
842
  } else {
931
843
  rHandler.retChanges(call, retRes, loadMessage);
932
- return;
933
844
  }
934
845
  }
935
846
 
@@ -937,8 +848,8 @@ public class CapacitorSQLitePlugin extends Plugin {
937
848
  * ExecuteSet Method
938
849
  * Execute a Set of raw sql statement
939
850
  *
940
- * @param call
941
- * @throws Exception
851
+ * @param call PluginCall
852
+ * @throws Exception message
942
853
  */
943
854
  @PluginMethod
944
855
  public void executeSet(PluginCall call) throws Exception {
@@ -980,19 +891,17 @@ public class CapacitorSQLitePlugin extends Plugin {
980
891
  }
981
892
  Boolean transaction = call.getBoolean("transaction", true);
982
893
  Boolean readOnly = call.getBoolean("readonly", false);
894
+ String returnMode = call.getString("returnMode", "no");
983
895
  if (implementation != null) {
984
896
  try {
985
- JSObject res = implementation.executeSet(dbName, set, transaction, readOnly);
897
+ JSObject res = implementation.executeSet(dbName, set, transaction, readOnly, returnMode);
986
898
  rHandler.retChanges(call, res, null);
987
- return;
988
899
  } catch (Exception e) {
989
900
  String msg = "ExecuteSet: " + e.getMessage();
990
901
  rHandler.retChanges(call, retRes, msg);
991
- return;
992
902
  }
993
903
  } else {
994
904
  rHandler.retChanges(call, retRes, loadMessage);
995
- return;
996
905
  }
997
906
  }
998
907
 
@@ -1000,7 +909,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1000
909
  * Run method
1001
910
  * Execute a raw sql statement
1002
911
  *
1003
- * @param call
912
+ * @param call PluginCall
1004
913
  */
1005
914
  @PluginMethod
1006
915
  public void run(PluginCall call) {
@@ -1031,19 +940,17 @@ public class CapacitorSQLitePlugin extends Plugin {
1031
940
  }
1032
941
  Boolean transaction = call.getBoolean("transaction", true);
1033
942
  Boolean readOnly = call.getBoolean("readonly", false);
943
+ String returnMode = call.getString("returnMode", "no");
1034
944
  if (implementation != null) {
1035
945
  try {
1036
- JSObject res = implementation.run(dbName, statement, values, transaction, readOnly);
946
+ JSObject res = implementation.run(dbName, statement, values, transaction, readOnly, returnMode);
1037
947
  rHandler.retChanges(call, res, null);
1038
- return;
1039
948
  } catch (Exception e) {
1040
949
  String msg = "Run: " + e.getMessage();
1041
950
  rHandler.retChanges(call, retRes, msg);
1042
- return;
1043
951
  }
1044
952
  } else {
1045
953
  rHandler.retChanges(call, retRes, loadMessage);
1046
- return;
1047
954
  }
1048
955
  }
1049
956
 
@@ -1051,7 +958,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1051
958
  * Query Method
1052
959
  * Execute an sql query
1053
960
  *
1054
- * @param call
961
+ * @param call PluginCall
1055
962
  */
1056
963
  @PluginMethod
1057
964
  public void query(PluginCall call) {
@@ -1083,15 +990,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1083
990
  try {
1084
991
  JSArray res = implementation.query(dbName, statement, values, readOnly);
1085
992
  rHandler.retValues(call, res, null);
1086
- return;
1087
993
  } catch (Exception e) {
1088
994
  String msg = "Query: " + e.getMessage();
1089
995
  rHandler.retValues(call, new JSArray(), msg);
1090
- return;
1091
996
  }
1092
997
  } else {
1093
998
  rHandler.retValues(call, new JSArray(), loadMessage);
1094
- return;
1095
999
  }
1096
1000
  }
1097
1001
 
@@ -1108,15 +1012,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1108
1012
  try {
1109
1013
  JSArray res = implementation.getTableList(dbName, readOnly);
1110
1014
  rHandler.retValues(call, res, null);
1111
- return;
1112
1015
  } catch (Exception e) {
1113
1016
  String msg = "GetTableList: " + e.getMessage();
1114
1017
  rHandler.retValues(call, new JSArray(), msg);
1115
- return;
1116
1018
  }
1117
1019
  } else {
1118
1020
  rHandler.retValues(call, new JSArray(), loadMessage);
1119
- return;
1120
1021
  }
1121
1022
  }
1122
1023
 
@@ -1124,7 +1025,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1124
1025
  * IsDBExists Method
1125
1026
  * check if the database exists on the database folder
1126
1027
  *
1127
- * @param call
1028
+ * @param call PluginCall
1128
1029
  */
1129
1030
  @PluginMethod
1130
1031
  public void isDBExists(PluginCall call) {
@@ -1140,15 +1041,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1140
1041
  try {
1141
1042
  Boolean res = implementation.isDBExists(dbName, readOnly);
1142
1043
  rHandler.retResult(call, res, null);
1143
- return;
1144
1044
  } catch (Exception e) {
1145
1045
  String msg = "isDBExists: " + e.getMessage();
1146
1046
  rHandler.retResult(call, false, msg);
1147
- return;
1148
1047
  }
1149
1048
  } else {
1150
1049
  rHandler.retResult(call, null, loadMessage);
1151
- return;
1152
1050
  }
1153
1051
  }
1154
1052
 
@@ -1156,7 +1054,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1156
1054
  * IsDBOpen Method
1157
1055
  * check if the database is opened
1158
1056
  *
1159
- * @param call
1057
+ * @param call PluginCall
1160
1058
  */
1161
1059
  @PluginMethod
1162
1060
  public void isDBOpen(PluginCall call) {
@@ -1171,15 +1069,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1171
1069
  try {
1172
1070
  Boolean res = implementation.isDBOpen(dbName, readOnly);
1173
1071
  rHandler.retResult(call, res, null);
1174
- return;
1175
1072
  } catch (Exception e) {
1176
1073
  String msg = "isDBOpen: " + e.getMessage();
1177
1074
  rHandler.retResult(call, false, msg);
1178
- return;
1179
1075
  }
1180
1076
  } else {
1181
1077
  rHandler.retResult(call, null, loadMessage);
1182
- return;
1183
1078
  }
1184
1079
  }
1185
1080
 
@@ -1187,7 +1082,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1187
1082
  * DeleteDatabase Method
1188
1083
  * delete a database from the database folder
1189
1084
  *
1190
- * @param call
1085
+ * @param call PluginCall
1191
1086
  */
1192
1087
  @PluginMethod
1193
1088
  public void deleteDatabase(PluginCall call) {
@@ -1202,15 +1097,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1202
1097
  try {
1203
1098
  implementation.deleteDatabase(dbName, readOnly);
1204
1099
  rHandler.retResult(call, null, null);
1205
- return;
1206
1100
  } catch (Exception e) {
1207
1101
  String msg = "deleteDatabase: " + e.getMessage();
1208
1102
  rHandler.retResult(call, null, msg);
1209
- return;
1210
1103
  }
1211
1104
  } else {
1212
1105
  rHandler.retResult(call, null, loadMessage);
1213
- return;
1214
1106
  }
1215
1107
  }
1216
1108
 
@@ -1218,7 +1110,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1218
1110
  * CreateSyncTable Method
1219
1111
  * Create the synchronization table
1220
1112
  *
1221
- * @param call
1113
+ * @param call PluginCall
1222
1114
  */
1223
1115
  @PluginMethod
1224
1116
  public void createSyncTable(PluginCall call) {
@@ -1235,15 +1127,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1235
1127
  try {
1236
1128
  JSObject res = implementation.createSyncTable(dbName, readOnly);
1237
1129
  rHandler.retChanges(call, res, null);
1238
- return;
1239
1130
  } catch (Exception e) {
1240
1131
  String msg = "CreateSyncTable: " + e.getMessage();
1241
1132
  rHandler.retChanges(call, retRes, msg);
1242
- return;
1243
1133
  }
1244
1134
  } else {
1245
1135
  rHandler.retChanges(call, retRes, loadMessage);
1246
- return;
1247
1136
  }
1248
1137
  }
1249
1138
 
@@ -1251,7 +1140,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1251
1140
  * SetSyncDate Method
1252
1141
  * set the synchronization date
1253
1142
  *
1254
- * @param call
1143
+ * @param call PluginCall
1255
1144
  */
1256
1145
  @PluginMethod
1257
1146
  public void setSyncDate(PluginCall call) {
@@ -1273,15 +1162,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1273
1162
  try {
1274
1163
  implementation.setSyncDate(dbName, syncDate, readOnly);
1275
1164
  rHandler.retResult(call, null, null);
1276
- return;
1277
1165
  } catch (Exception e) {
1278
1166
  String msg = "SetSyncDate: " + e.getMessage();
1279
1167
  rHandler.retResult(call, null, msg);
1280
- return;
1281
1168
  }
1282
1169
  } else {
1283
1170
  rHandler.retResult(call, null, loadMessage);
1284
- return;
1285
1171
  }
1286
1172
  }
1287
1173
 
@@ -1289,7 +1175,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1289
1175
  * GetSyncDate Method
1290
1176
  * Get the synchronization date
1291
1177
  *
1292
- * @param call
1178
+ * @param call PluginCall
1293
1179
  */
1294
1180
  @PluginMethod
1295
1181
  public void getSyncDate(PluginCall call) {
@@ -1297,7 +1183,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1297
1183
  if (!call.getData().has("database")) {
1298
1184
  String msg = "GetSyncDate : Must provide a database name";
1299
1185
  retRes.put("changes", Integer.valueOf(-1));
1300
- rHandler.retSyncDate(call, Long.valueOf(0), msg);
1186
+ rHandler.retSyncDate(call, 0L, msg);
1301
1187
  return;
1302
1188
  }
1303
1189
  String dbName = call.getString("database");
@@ -1306,15 +1192,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1306
1192
  try {
1307
1193
  long syncDate = implementation.getSyncDate(dbName, readOnly);
1308
1194
  rHandler.retSyncDate(call, syncDate, null);
1309
- return;
1310
1195
  } catch (Exception e) {
1311
1196
  String msg = "GetSyncDate: " + e.getMessage();
1312
- rHandler.retSyncDate(call, Long.valueOf(0), msg);
1313
- return;
1197
+ rHandler.retSyncDate(call, 0L, msg);
1314
1198
  }
1315
1199
  } else {
1316
- rHandler.retSyncDate(call, Long.valueOf(0), loadMessage);
1317
- return;
1200
+ rHandler.retSyncDate(call, 0L, loadMessage);
1318
1201
  }
1319
1202
  }
1320
1203
 
@@ -1322,7 +1205,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1322
1205
  * AddUpgradeStatement Method
1323
1206
  * Define an upgrade object when updating to a new version
1324
1207
  *
1325
- * @param call
1208
+ * @param call PluginCall
1326
1209
  */
1327
1210
  @PluginMethod
1328
1211
  public void addUpgradeStatement(PluginCall call) {
@@ -1360,15 +1243,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1360
1243
  }
1361
1244
 
1362
1245
  rHandler.retResult(call, null, null);
1363
- return;
1364
1246
  } catch (Exception e) {
1365
1247
  String msg = "AddUpgradeStatement: " + e.getMessage();
1366
1248
  rHandler.retResult(call, null, msg);
1367
- return;
1368
1249
  }
1369
1250
  } else {
1370
1251
  rHandler.retResult(call, null, loadMessage);
1371
- return;
1372
1252
  }
1373
1253
  }
1374
1254
 
@@ -1376,7 +1256,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1376
1256
  * IsJsonValid
1377
1257
  * Check the validity of a given Json object
1378
1258
  *
1379
- * @param call
1259
+ * @param call PluginCall
1380
1260
  */
1381
1261
  @PluginMethod
1382
1262
  public void isJsonValid(PluginCall call) {
@@ -1390,15 +1270,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1390
1270
  try {
1391
1271
  Boolean res = implementation.isJsonValid(parsingData);
1392
1272
  rHandler.retResult(call, res, null);
1393
- return;
1394
1273
  } catch (Exception e) {
1395
1274
  String msg = "IsJsonValid: " + e.getMessage();
1396
1275
  rHandler.retResult(call, false, msg);
1397
- return;
1398
1276
  }
1399
1277
  } else {
1400
1278
  rHandler.retResult(call, null, loadMessage);
1401
- return;
1402
1279
  }
1403
1280
  }
1404
1281
 
@@ -1406,7 +1283,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1406
1283
  * ImportFromJson Method
1407
1284
  * Import from a given Json object
1408
1285
  *
1409
- * @param call
1286
+ * @param call PluginCall
1410
1287
  */
1411
1288
  @PluginMethod
1412
1289
  public void importFromJson(PluginCall call) {
@@ -1422,15 +1299,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1422
1299
  try {
1423
1300
  JSObject res = implementation.importFromJson(parsingData);
1424
1301
  rHandler.retChanges(call, res, null);
1425
- return;
1426
1302
  } catch (Exception e) {
1427
1303
  String msg = "ImportFromJson: " + e.getMessage();
1428
1304
  rHandler.retChanges(call, retRes, msg);
1429
- return;
1430
1305
  }
1431
1306
  } else {
1432
1307
  rHandler.retChanges(call, retRes, loadMessage);
1433
- return;
1434
1308
  }
1435
1309
  }
1436
1310
 
@@ -1438,12 +1312,11 @@ public class CapacitorSQLitePlugin extends Plugin {
1438
1312
  * ExportToJson Method
1439
1313
  * Export the database to Json Object
1440
1314
  *
1441
- * @param call
1315
+ * @param call PluginCall
1442
1316
  */
1443
1317
  @PluginMethod
1444
1318
  public void exportToJson(PluginCall call) {
1445
1319
  JSObject retObj = new JSObject();
1446
- JsonSQLite retJson = new JsonSQLite();
1447
1320
  if (!call.getData().has("database")) {
1448
1321
  String msg = "ExportToJson: Must provide a database name";
1449
1322
  rHandler.retJSObject(call, retObj, msg);
@@ -1468,22 +1341,17 @@ public class CapacitorSQLitePlugin extends Plugin {
1468
1341
  try {
1469
1342
  JSObject res = implementation.exportToJson(dbName, expMode, readOnly);
1470
1343
  rHandler.retJSObject(call, res, null);
1471
- return;
1472
1344
  } catch (Exception e) {
1473
1345
  String msg = "ExportToJson: " + e.getMessage();
1474
1346
  rHandler.retJSObject(call, retObj, msg);
1475
- return;
1476
1347
  }
1477
1348
  } else {
1478
1349
  rHandler.retJSObject(call, retObj, loadMessage);
1479
- return;
1480
1350
  }
1481
1351
  }
1482
1352
 
1483
1353
  @PluginMethod
1484
1354
  public void deleteExportedRows(PluginCall call) {
1485
- JSObject retObj = new JSObject();
1486
- JsonSQLite retJson = new JsonSQLite();
1487
1355
  if (!call.getData().has("database")) {
1488
1356
  String msg = "DeleteExportedRows: Must provide a database name";
1489
1357
  rHandler.retResult(call, null, msg);
@@ -1495,15 +1363,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1495
1363
  try {
1496
1364
  implementation.deleteExportedRows(dbName, readOnly);
1497
1365
  rHandler.retResult(call, null, null);
1498
- return;
1499
1366
  } catch (Exception e) {
1500
1367
  String msg = "DeleteExportedRows: " + e.getMessage();
1501
1368
  rHandler.retResult(call, null, msg);
1502
- return;
1503
1369
  }
1504
1370
  } else {
1505
1371
  rHandler.retResult(call, null, loadMessage);
1506
- return;
1507
1372
  }
1508
1373
  }
1509
1374
 
@@ -1511,7 +1376,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1511
1376
  * CopyFromAssets
1512
1377
  * copy all databases from public/assets/databases to application folder
1513
1378
  *
1514
- * @param call
1379
+ * @param call PluginCall
1515
1380
  */
1516
1381
  @PluginMethod
1517
1382
  public void copyFromAssets(PluginCall call) {
@@ -1521,15 +1386,12 @@ public class CapacitorSQLitePlugin extends Plugin {
1521
1386
  try {
1522
1387
  implementation.copyFromAssets(overwrite);
1523
1388
  rHandler.retResult(call, null, null);
1524
- return;
1525
1389
  } catch (Exception e) {
1526
1390
  String msg = "CopyFromAssets: " + e.getMessage();
1527
1391
  rHandler.retResult(call, null, msg);
1528
- return;
1529
1392
  }
1530
1393
  } else {
1531
1394
  rHandler.retResult(call, null, loadMessage);
1532
- return;
1533
1395
  }
1534
1396
  }
1535
1397
 
@@ -1537,7 +1399,7 @@ public class CapacitorSQLitePlugin extends Plugin {
1537
1399
  * GetFromHTTPRequest
1538
1400
  * get a database or a zipped database from HTTP Request
1539
1401
  *
1540
- * @param call
1402
+ * @param call PluginCall
1541
1403
  */
1542
1404
  @PluginMethod
1543
1405
  public void getFromHTTPRequest(PluginCall call) {
@@ -1548,54 +1410,27 @@ public class CapacitorSQLitePlugin extends Plugin {
1548
1410
  }
1549
1411
  String url = call.getString("url");
1550
1412
  if (implementation != null) {
1551
- Runnable setHTTPRunnable = new Runnable() {
1552
- @Override
1553
- public void run() {
1554
- android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
1555
- try {
1556
- implementation.getFromHTTPRequest(url);
1557
- getActivity()
1558
- .runOnUiThread(
1559
- new Runnable() {
1560
- @Override
1561
- public void run() {
1562
- rHandler.retResult(call, null, null);
1563
- return;
1564
- }
1565
- }
1566
- );
1567
- } catch (Exception e) {
1568
- getActivity()
1569
- .runOnUiThread(
1570
- new Runnable() {
1571
- @Override
1572
- public void run() {
1573
- String msg = "GetFromHTTPRequest: " + e.getMessage();
1574
- rHandler.retResult(call, null, msg);
1575
- return;
1576
- }
1577
- }
1578
- );
1579
- }
1413
+ Runnable setHTTPRunnable = () -> {
1414
+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
1415
+ try {
1416
+ implementation.getFromHTTPRequest(url);
1417
+ getActivity().runOnUiThread(() -> rHandler.retResult(call, null, null));
1418
+ } catch (Exception e) {
1419
+ getActivity()
1420
+ .runOnUiThread(
1421
+ () -> {
1422
+ String msg = "GetFromHTTPRequest: " + e.getMessage();
1423
+ rHandler.retResult(call, null, msg);
1424
+ }
1425
+ );
1580
1426
  }
1581
1427
  };
1582
1428
  Thread myHttpThread = new Thread(setHTTPRunnable);
1583
1429
  myHttpThread.start();
1584
1430
  while (myHttpThread.isAlive());
1585
1431
  System.out.println("Thread Exiting!");
1586
- /* try {
1587
- implementation.getFromHTTPRequest(url);
1588
- rHandler.retResult(call, null, null);
1589
- return;
1590
- } catch (Exception e) {
1591
- String msg = "GetFromHTTPRequest: " + e.getMessage();
1592
- rHandler.retResult(call, null, msg);
1593
- return;
1594
- }
1595
- */
1596
1432
  } else {
1597
1433
  rHandler.retResult(call, null, loadMessage);
1598
- return;
1599
1434
  }
1600
1435
  }
1601
1436
 
@@ -1610,7 +1445,6 @@ public class CapacitorSQLitePlugin extends Plugin {
1610
1445
  JSObject data = new JSObject();
1611
1446
  data.put("progress", this.getInfo().get("progress"));
1612
1447
  notifyListeners("sqliteImportProgressEvent", data);
1613
- return;
1614
1448
  }
1615
1449
  }
1616
1450
  );
@@ -1624,7 +1458,6 @@ public class CapacitorSQLitePlugin extends Plugin {
1624
1458
  JSObject data = new JSObject();
1625
1459
  data.put("progress", this.getInfo().get("progress"));
1626
1460
  notifyListeners("sqliteExportProgressEvent", data);
1627
- return;
1628
1461
  }
1629
1462
  }
1630
1463
  );
@@ -1639,7 +1472,6 @@ public class CapacitorSQLitePlugin extends Plugin {
1639
1472
  data.put("result", this.getInfo().get("result"));
1640
1473
  data.put("message", this.getInfo().get("message"));
1641
1474
  notifyListeners("sqliteBiometricEvent", data);
1642
- return;
1643
1475
  }
1644
1476
  }
1645
1477
  );
@@ -1648,11 +1480,11 @@ public class CapacitorSQLitePlugin extends Plugin {
1648
1480
  private SqliteConfig getSqliteConfig() throws JSONException {
1649
1481
  SqliteConfig config = new SqliteConfig();
1650
1482
  JSONObject pConfig = getConfig().getConfigJSON();
1651
- Boolean isEncryption = pConfig.has("androidIsEncryption") ? pConfig.getBoolean("androidIsEncryption") : config.getIsEncryption();
1483
+ boolean isEncryption = pConfig.has("androidIsEncryption") ? pConfig.getBoolean("androidIsEncryption") : config.getIsEncryption();
1652
1484
  config.setIsEncryption(isEncryption);
1653
1485
  JSONObject androidBiometric = pConfig.has("androidBiometric") ? pConfig.getJSONObject("androidBiometric") : null;
1654
1486
  if (androidBiometric != null) {
1655
- Boolean biometricAuth = androidBiometric.has("biometricAuth") && isEncryption
1487
+ boolean biometricAuth = androidBiometric.has("biometricAuth") && isEncryption
1656
1488
  ? androidBiometric.getBoolean("biometricAuth")
1657
1489
  : config.getBiometricAuth();
1658
1490
  config.setBiometricAuth(biometricAuth);