Skip to content

Commit

Permalink
Switched to using the cordova-sqlite-storage plugin for android for b…
Browse files Browse the repository at this point in the history
…etter device support (resolves #384).
  • Loading branch information
nero120 committed Mar 26, 2022
1 parent 3104d43 commit 4e0e569
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions res/android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"cordova-plugin-snackbar": "github:xbrowsersync/cordova-plugin-snackbar#2.2.2",
"cordova-plugin-whitelist": "1.3.4",
"cordova-plugin-x-socialsharing": "github:xbrowsersync/SocialSharing-PhoneGap-Plugin#5.6.6",
"cordova-sqlite-evcore-extbuild-free": "^0.12.1",
"cordova-sqlite-storage": "^6.0.0",
"es6-promise-plugin": "^4.2.2"
},
"cordova": {
Expand All @@ -54,10 +54,10 @@
"cordova-plugin-exit": {},
"cordova-plugin-globalization": {},
"cordova-plugin-app-version": {},
"cordova-sqlite-evcore-extbuild-free": {},
"com-darryncampbell-cordova-plugin-intent": {},
"cordova-plugin-android-dark-mode-support": {},
"cordova-plugin-androidx-adapter": {}
"cordova-plugin-androidx-adapter": {},
"cordova-sqlite-storage": {}
},
"platforms": [
"android"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,17 @@ export class AndroidStoreService extends StoreService {
return this.$q.resolve(this.db);
}
return this.$q((resolve, reject) => {
window.resolveLocalFileSystemURL(window.cordova.file.externalDataDirectory, (dataDir: any) => {
window.sqlitePlugin.openDatabase(
{ name: this.dbName, androidDatabaseLocation: dataDir.toURL() },
resolve,
reject
);
});
})
.then((db) => {
this.db = db;
return db;
})
.catch((err) => this.handleSqlError(err));
try {
this.db = window.sqlitePlugin.openDatabase({
androidDatabaseProvider: 'system',
location: 'default',
name: this.dbName
});
resolve(this.db);
} catch (err) {
reject(new FailedLocalStorageError(err.message));
}
});
}

protected removeFromStore(keys: string[] = []): ng.IPromise<void> {
Expand Down

0 comments on commit 4e0e569

Please sign in to comment.