Skip to content

Commit

Permalink
Merge pull request #522 from eb1/master
Browse files Browse the repository at this point in the history
Updates to latest android and file plugins
  • Loading branch information
eb1 authored Sep 21, 2023
2 parents 466c5e5 + 9816929 commit 9aa7f87
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 80 deletions.
15 changes: 2 additions & 13 deletions build-aim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
DIR=$( cd "$( dirname "$0" )" && pwd )
TRUNK=$DIR
CURRENT_OS="OSX"
ANDROID_VER="@6.3.0" # cordova-android version
IOS_VER="@4.5.4" # cordova-ios version
WIN_VER="@latest" # cordova-windows version
ANDROID_VER="@12.0.1" # cordova-android version
IOS_VER="@7.0.1" # cordova-ios version

echo " "
echo "-- Adapt It Mobile build configuration --"
echo " Current directory: $DIR"
echo " cordova-android: $ANDROID_VER"
echo " cordova-ios: $IOS_VER"
echo " cordova-win: $WIN_VER"
echo "-------------------------------------"

# troubleshooting helps -- enable if needed
Expand Down Expand Up @@ -49,15 +47,6 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
osType="Linux"
echo "Linux detected... adding android platform"
cordova platform add android $ANDROID_VER
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
# Ancient mingw Windows thing -- error out
echo "unsupported operating system for AIM build"
exit 1
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
# Windows 10? 64 bit mingw implementation
osType="Windows"
cordova platform add android $ANDROID_VER
cordova platform add windows $WIN_VER
fi

# build ios and Android platforms
Expand Down
2 changes: 0 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<content src="index.html" />
<access origin="*" />
<allow-intent href="aim:*" />
<preference name="cordova.plugins.diagnostic.modules" value="BLUETOOTH WIFI EXTERNAL_STORAGE" />
<preference name="android-build-tool" value="gradle" />
<preference name="Orientation" value="default" />
<preference name="DisallowOverscroll" value="true" />
Expand All @@ -36,7 +35,6 @@
<preference name="AndroidPersistentFileLocation" value="Internal" />
<config-file mode="replace" parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="android.hardware.faketouch" android:required="false" />
Expand Down
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
"cordova-clipboard": "github:ihadeed/cordova-clipboard",
"cordova-ios": "^7.0.1",
"cordova-plugin-customurlscheme": "^5.0.2",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-device": "github:apache/cordova-plugin-device",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file": "^8.0.0",
"cordova-plugin-filepath": "github:VIAVI-Solutions/cordova-plugin-filepath",
"cordova-plugin-keyboard": "git+https://github.com/sinn1/cordova-plugin-keyboard.git",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-keyboard": "github:sinn1/cordova-plugin-keyboard",
"cordova-plugin-network-information": "github:apache/cordova-plugin-network-information",
"cordova-plugin-x-socialsharing-android12": "github:IsraelHikingMap/corodova-plugin-socialsharing-android12",
"cordova-sqlite-evcore-extbuild-free": "^0.18.0",
"cordova-uglify": "^0.0.8",
"cordova.plugins.diagnostic": "^3.9.2",
"fs": "0.0.2",
"gulp": "^3.9.1",
"path": "^0.12.7",
"phonegap-plugin-mobile-accessibility": "github:phonegap/phonegap-mobile-accessibility",
"plist": "^3.0.1"
},
"dependencies": {
Expand All @@ -44,8 +44,7 @@
"crypto-randomuuid": "^1.0.0",
"electron-builder": "^23.0.3",
"gulp-uglify": "^3.0.2",
"npx": "^3.0.0",
"phonegap-plugin-mobile-accessibility": "https://github.com/phonegap/phonegap-mobile-accessibility.git"
"npx": "^3.0.0"
},
"bugs": {
"url": "https://github.com/adapt-it/adapt-it-mobile/issues"
Expand Down Expand Up @@ -74,9 +73,6 @@
"cordova-plugin-device": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-network-information": {},
"cordova.plugins.diagnostic": {
"ANDROIDX_VERSION": "1.0.0"
},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "aim",
"ANDROID_SCHEME": " ",
Expand All @@ -91,11 +87,13 @@
"cordova-clipboard": {},
"cordova-plugin-filepath": {},
"cordova-sqlite-evcore-extbuild-free": {},
"cordova-plugin-file": {}
"cordova-plugin-file": {
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
}
},
"platforms": [
"android",
"ios"
"ios",
"android"
]
}
}
63 changes: 11 additions & 52 deletions www/js/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,51 +189,6 @@ define(function (require) {
cordova.file.dataDirectory,
cordova.file.syncedDataDirectory
];
// if (device.platform === "Android") {
// // request read access to the external storage if we don't have it
// cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(function (status) {
// if (status === cordova.plugins.diagnostic.permissionStatus.GRANTED) {
// console.log("External storage use is authorized");
// } else {
// cordova.plugins.diagnostic.requestExternalStorageAuthorization(function (result) {
// console.log("Authorization request for external storage use was " + (result === cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
// }, function (error) {
// console.error(error);
// });
// }
// }, function (error) {
// console.error("The following error occurred: " + error);
// });
// // request runtime permissions if needed
// cordova.plugins.diagnostic.getPermissionsAuthorizationStatus(function(statuses){
// for (var permission in statuses){
// switch(statuses[permission]){
// case cordova.plugins.diagnostic.permissionStatus.GRANTED:
// console.log("Permission granted to use "+permission);
// break;
// case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
// console.log("Permission to use "+permission+" has not been requested yet; asking now");
// cordova.plugins.diagnostic.requestRuntimePermission(function(status){
// console.log("Runtime permission request result: " + status.toString());
// }, function(error){
// console.error("The following error occurred: "+error);
// }, permission);
// break;
// case cordova.plugins.diagnostic.permissionStatus.DENIED_ONCE:
// console.log("Permission denied to use "+permission+" - ask again?");
// break;
// case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
// console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!");
// break;
// }
// }
// }, function(error){
// console.error("The following error occurred: "+error);
// },[
// cordova.plugins.diagnostic.permission.WRITE_EXTERNAL_STORAGE,
// cordova.plugins.diagnostic.permission.READ_EXTERNAL_STORAGE
// ]);
// }
}
// social sharing plugin / iPad popover coords
if (device && (device.platform !== "browser")) {
Expand Down Expand Up @@ -263,15 +218,19 @@ define(function (require) {
this.onInitDB();

} else if (device.platform === "Android") {
// Android -- use the device itself
// Android -- scoped storage wonkiness introduced in stages starting with API 30
// first check the data directory, then check the "default" location
db_dir = cordova.file.dataDirectory;
// now attempt to get the directory
console.log("db_dir: " + db_dir);
// // now attempt to get the directory
window.resolveLocalFileSystemURL(db_dir, function (directoryEntry) {
console.log("Got directoryEntry. Attempting to create / open AIM DB at: " + directoryEntry.toURL());
console.log("Got directoryEntry. Attempting to create / open AIM DB at: " + directoryEntry.nativeURL);
// Attempt to create / open our AIM database now
window.Application.db = window.sqlitePlugin.openDatabase({name: DB_NAME, androidDatabaseLocation: directoryEntry.toURL()});
window.Application.checkDBSchema().then(window.Application.onInitDB()); // Android only (iOS calls directly)
// window.Application.onInitDB();
window.Application.db = window.sqlitePlugin.openDatabase({name: DB_NAME, androidDatabaseLocation: directoryEntry.nativeURL}, function(db) {
window.Application.checkDBSchema().then(window.Application.onInitDB()); // Android only (iOS calls directly)
}, function (err) {
console.log("Open database ERROR: " + JSON.stringify(err));
});
}, function (err) {
console.log("resolveLocalFileSustemURL error: " + err.message);
});
Expand Down Expand Up @@ -370,7 +329,7 @@ define(function (require) {

onStart: function (app, options) {
// check the database schema now that we've created / opened it
this.checkDBSchema();
// this.checkDBSchema();
},

// Routes from AppRouter (router.js)
Expand Down

0 comments on commit 9aa7f87

Please sign in to comment.