Skip to content

Commit 8a54eab

Browse files
fix(android, iOS): remove dependencies to OSLogger (#16)
* test: comment out dependencies to OSLogger * feat: replace logs using Logger with default Android logs References: https://outsystemsrd.atlassian.net/browse/RMET-4297 * feat: replace log using OSLogger with default iOS log References: https://outsystemsrd.atlassian.net/browse/RMET-4297 * chore(release): raise to version 0.1.7-OS10 References: https://outsystemsrd.atlassian.net/browse/RMET-4297
1 parent 2b15984 commit 8a54eab

5 files changed

Lines changed: 11 additions & 15 deletions

File tree

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
- Update SQLite to 3.46.1 (https://outsystemsrd.atlassian.net/browse/RMET-3850).
66

7+
## cordova-sqlcipher-adapter 0.1.7-OS10
8+
9+
- Fix: Remove dependencies to OSLogger (https://outsystemsrd.atlassian.net/browse/RMET-4297).
10+
711
## cordova-sqlcipher-adapter 0.1.7-OS9
812

913
- Update SQLCipher to 4.6.1, with support for 16KB page size devices (https://outsystemsrd.atlassian.net/browse/RMET-3602)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-sqlcipher-adapter",
3-
"version": "0.1.7-OS9",
3+
"version": "0.1.7-OS10",
44
"description": "SQLCipher database adapter for PhoneGap/Cordova, based on cordova-sqlite-storage",
55
"cordova": {
66
"id": "cordova-sqlcipher-adapter",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
id="cordova-sqlcipher-adapter"
5-
version="0.1.7-OS9">
5+
version="0.1.7-OS10">
66

77
<name>Cordova sqlcipher adapter</name>
88

src/android/io/sqlc/SQLitePlugin.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import android.database.sqlite.SQLiteException;
1010
import android.util.Log;
1111

12-
import com.outsystems.plugins.oslogger.OSLogger;
13-
import com.outsystems.plugins.oslogger.interfaces.Logger;
14-
1512
import java.io.File;
1613

1714
import java.lang.IllegalArgumentException;
@@ -56,7 +53,6 @@ public class SQLitePlugin extends CordovaPlugin {
5653
*/
5754
static Map<String, DBRunner> dbrmap = new ConcurrentHashMap<String, DBRunner>();
5855

59-
private Logger logger;
6056
private boolean selfHealingEnabled = false;
6157
private boolean didTryCipherMigration = false;
6258

@@ -74,7 +70,6 @@ public class SQLitePlugin extends CordovaPlugin {
7470
@Override
7571
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
7672
super.initialize(cordova, webView);
77-
logger = OSLogger.getInstance();
7873
selfHealingEnabled = preferences.getBoolean("EnableSQLCipherSelfHealing", false);
7974
SQLiteAndroidDatabase.initialize();
8075
}
@@ -252,10 +247,10 @@ private SQLiteAndroidDatabase openDatabase(String dbname, String key, CallbackCo
252247
return mydb;
253248
} catch (Exception e) {
254249

255-
logger.logWarning("Got " + e.getMessage() + " exception.", "SQLite");
250+
Log.w("SQLite", "Got " + e.getMessage() + " exception.");
256251

257252
if(mydb != null && !didTryCipherMigration) {
258-
logger.logVerbose("Will try Cipher Migration.", "SQLite");
253+
Log.v("SQLite", "Will try Cipher Migration.");
259254
/*
260255
* An error was found and will try to migrate.
261256
* The migration process is described here: https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_migrate
@@ -270,7 +265,7 @@ private SQLiteAndroidDatabase openDatabase(String dbname, String key, CallbackCo
270265
if(selfHealingEnabled && (e.getMessage().contains("file is encrypted or is not a database:") ||
271266
((e instanceof SQLiteException) && e.getMessage().contains("file is not a database:") )))
272267
{
273-
logger.logWarning("Android ciphered database will be deleted to self heal: " + e.getMessage(), "SQLite");
268+
Log.w("SQLite", "Android ciphered database will be deleted to self heal: " + e.getMessage());
274269
deleteDatabaseNow(dbname);
275270
return openDatabase(dbname, key, cbc, false);
276271
} else {

src/ios/SQLitePlugin.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
#import "SQLitePlugin.h"
10-
#import "OSLogger.h"
1110
#import "sqlite3.h"
1211

1312
// Defines Macro to only log lines when in DEBUG mode
@@ -29,7 +28,6 @@ @interface CustomPSPDFThreadSafeMutableDictionary : NSMutableDictionary
2928
@end
3029

3130
@interface SQLitePlugin()
32-
@property (nonatomic, readonly, strong) id <OSLoggerProtocol> logger;
3331
@property (nonatomic, assign, readonly) BOOL selfHealingEnabled;
3432
@end
3533

@@ -47,8 +45,6 @@ -(void)pluginInitialize
4745
{
4846
openDBs = [CustomPSPDFThreadSafeMutableDictionary dictionaryWithCapacity:0];
4947
appDBPaths = [NSMutableDictionary dictionaryWithCapacity:0];
50-
51-
_logger = [OSLogger sharedInstance];
5248

5349
id selfHealingEnabledValue = [self.commandDelegate.settings objectForKey: [@"EnableSQLCipherSelfHealing" lowercaseString]];
5450
if (selfHealingEnabledValue != nil) {
@@ -241,7 +237,8 @@ -(void)openNow: (CDVInvokedUrlCommand*)command migrateSqlCipher:(Boolean) migrat
241237

242238
if(selfHealingEnabled) {
243239
[[command.arguments objectAtIndex:0] setObject:dbfilename forKey:@"path"];
244-
[_logger logWarning:[NSString stringWithFormat:@"iOS ciphered database will be deleted to self heal"] withModule:@"SQLite"];
240+
NSLog(@"SQLite: iOS ciphered database will be deleted to self heal");
241+
245242
[self deleteNow:command];
246243
return [self openNow:command migrateSqlCipher:false];
247244
}

0 commit comments

Comments
 (0)