Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
targets: ["CapacitorSQLitePlugin"])
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "8.0.0"),
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
.package(url: "https://github.com/sqlcipher/SQLCipher.swift.git", from: "4.14.0"),
.package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.0")
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ public void executeSet(PluginCall call) throws Exception {
JSONArray keys = set.getJSONObject(i).names();
for (int j = 0; j < keys.length(); ++j) {
String key = keys.getString(j);
if (!(key.equals("statement")) && !(key.equals("values"))) {
if (!key.equals("statement") && !key.equals("values")) {
String msg = "ExecuteSet: Must provide a set as Array of {statement,";
msg += "values}";
rHandler.retChanges(call, retRes, msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean isIndexes(JSONObject jsObj) {
}
}
if (key.equals("mode")) {
if (!(objValue instanceof String) || !(((String) objValue).equalsIgnoreCase("UNIQUE"))) {
if (!(objValue instanceof String) || !((String) objValue).equalsIgnoreCase("UNIQUE")) {
return false;
} else {
mode = (String) objValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public List<String> listDatabases(File fileDir) throws Exception {
for (File file : fList) {
if (file.isFile()) {
String fileName = file.getName();
if (getFileExtension((fileName)).equals("db")) {
if (getFileExtension(fileName).equals("db")) {
fileList.add(fileName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public void addSQLiteSuffix(Context context, String folderPath, ArrayList<String
String toFile = "";
if (dbList.size() > 0) {
if (dbList.contains(file)) {
if (uFile.getFileExtension((file)).equals("db")) {
if (uFile.getFileExtension(file).equals("db")) {
toFile = file.replace(".db", "SQLite.db");
} else {
toFile = file.concat("SQLite.db");
}
}
} else {
if (uFile.getFileExtension((file)).equals("db")) {
if (uFile.getFileExtension(file).equals("db")) {
toFile = file.replace(".db", "SQLite.db");
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ public void deleteOldDatabases(Context context, String folderPath, ArrayList<Str
delFile = file;
}
} else {
if (uFile.getFileExtension((file)).equals("db")) {
if (uFile.getFileExtension(file).equals("db")) {
delFile = file;
}
}
Expand Down Expand Up @@ -157,14 +157,14 @@ public void moveDatabasesAndAddSuffix(Context context, String folderPath, ArrayL
String toFile = "";
if (dbList.size() > 0) {
if (dbList.contains(file)) {
if (uFile.getFileExtension((file)).equals("db")) {
if (uFile.getFileExtension(file).equals("db")) {
toFile = file.replace(".db", "SQLite.db");
} else {
toFile = file.concat("SQLite.db");
}
}
} else {
if (uFile.getFileExtension((file)).equals("db")) {
if (uFile.getFileExtension(file).equals("db")) {
toFile = file.replace(".db", "SQLite.db");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ public State getDatabaseState(Context ctxt, File dbPath, SharedPreferences share

db.getVersion();

return (State.UNENCRYPTED);
return State.UNENCRYPTED;
} catch (Exception e) {
try {
String passphrase = sharedPreferences.getString("secret", "");
if (passphrase.length() > 0) {
db = SQLiteDatabase.openDatabase(dbPath.getAbsolutePath(), passphrase, null, SQLiteDatabase.OPEN_READONLY, null);
db.getVersion();
return (State.ENCRYPTED_SECRET);
return State.ENCRYPTED_SECRET;
} else {
return (State.UNKNOWN);
return State.UNKNOWN;
}
} catch (Exception e1) {
try {
Expand All @@ -66,12 +66,12 @@ public State getDatabaseState(Context ctxt, File dbPath, SharedPreferences share
null
);
db.getVersion();
return (State.ENCRYPTED_GLOBAL_SECRET);
return State.ENCRYPTED_GLOBAL_SECRET;
} else {
return (State.UNKNOWN);
return State.UNKNOWN;
}
} catch (Exception e2) {
return (State.UNKNOWN);
return State.UNKNOWN;
}
}
} finally {
Expand All @@ -81,7 +81,7 @@ public State getDatabaseState(Context ctxt, File dbPath, SharedPreferences share
}
}

return (State.DOES_NOT_EXIST);
return State.DOES_NOT_EXIST;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public ArrayList<String> stringJSArrayToArrayList(JSArray jsArray) throws JSONEx
public byte[] JSONArrayToByteArray(JSONArray arr) throws JSONException {
byte[] bArr = new byte[arr.length()];
for (int i = 0; i < arr.length(); i++) {
bArr[i] = (byte) (((int) arr.get(i)) & 0xFF);
bArr[i] = (byte) ((int) arr.get(i) & 0xFF);
}
return bArr;
}
Expand Down
Loading
Loading