Skip to content

Commit

Permalink
Revert "Re-Added email plugin for Android"
Browse files Browse the repository at this point in the history
This reverts commit 3e0ddb8.

Reverting to restory parity on iOS / Android
  • Loading branch information
the-bay-kay committed Jun 24, 2024
1 parent 1233e58 commit e81164c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 50 deletions.
2 changes: 0 additions & 2 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"ANDROID_HOST": " ",
"ANDROID_PATHPREFIX": "/"
},
"cordova-plugin-email-composer": {},
"cordova-plugin-x-socialsharing": {
"PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to share photos on social media.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to share photos on social media."
Expand Down Expand Up @@ -128,7 +127,6 @@
"cordova-plugin-em-settings": "git+https://github.com/e-mission/cordova-connection-settings.git#v1.2.3",
"cordova-plugin-em-unifiedlogger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.6",
"cordova-plugin-em-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.9",
"cordova-plugin-email-composer": "git+https://github.com/katzer/cordova-plugin-email-composer.git#0.10.1",
"cordova-plugin-file": "8.0.0",
"cordova-plugin-inappbrowser": "5.0.0",
"cordova-plugin-ionic-keyboard": "2.2.0",
Expand Down
60 changes: 20 additions & 40 deletions www/js/services/shareLocalDBFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,35 @@ export async function sendLocalDBFile(database: string) {

if (window['cordova'].platformId == 'android') {
parentDir = 'app://databases';
logInfo('Going to email ' + database);

parentDir = parentDir + '/' + database;

const emailData = {
to: 'k.shankari@nrel.gov',
attachments: [parentDir],
subject: i18next.t('shareFile-service.send-log.body-please-fill-in-what-is-wrong'),
body: i18next.t('shareFile-service.send-log.subject-logs'),
};

alert(i18next.t('shareFile-service.send-to'));

// Gmail app has issues attatching `loggerDB` file when using the `socialSharing`
// plugin. As such, we'll keep using this plugin for Android - since GMail is
// the default on Android, we want to support this!
window['cordova'].plugins['email'].open(emailData, () => {
logWarn(`Email app closed while sending,
emailData = ${JSON.stringify(emailData)}`);
});
}

if (window['cordova'].platformId == 'ios') {
logDebug(window['cordova'].file.dataDirectory);
parentDir = window['cordova'].file.dataDirectory + '../LocalDatabase';

logInfo('Going to email ' + database);
parentDir = parentDir + '/' + database;

const shareObj = {
files: [parentDir],
message: i18next.t('shareFile-service.send-log.body-please-fill-in-what-is-wrong'),
subject: i18next.t('shareFile-service.send-log.subject-logs'),
};

alert(i18next.t('shareFile-service.send-to'));
window['plugins'].socialsharing.shareWithOptions(
shareObj,
(result) => {
logDebug(`Shared to app: ${result.app}`);
},
(err) => {
logWarn(`Sharing failed with error: ${err}`);
},
);
}

if (parentDir == 'unknown') {
displayErrorMsg('parentDir unexpectedly = ' + parentDir + '!');
return;
}

logInfo('Going to email ' + database);
parentDir = parentDir + '/' + database;

const shareObj = {
files: [parentDir],
message: i18next.t('shareFile-service.send-log.body-please-fill-in-what-is-wrong'),
subject: i18next.t('shareFile-service.send-log.subject-logs'),
};

alert(i18next.t('shareFile-service.send-to'));
window['plugins'].socialsharing.shareWithOptions(
shareObj,
(result) => {
logDebug(`Shared to app: ${result.app}`);
},
(err) => {
logWarn(`Sharing failed with error: ${err}`);
},
);
}
16 changes: 8 additions & 8 deletions www/js/usePermissionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ const usePermissionStatus = () => {
androidVersion < 6
? 'intro.appstatus.locperms.description.android-lt-6'
: androidVersion < 10
? 'intro.appstatus.locperms.description.android-6-9'
: androidVersion < 11
? 'intro.appstatus.locperms.description.android-10'
: androidVersion < 12
? 'intro.appstatus.locperms.description.android-11'
: 'intro.appstatus.locperms.description.android-gte-12';
? 'intro.appstatus.locperms.description.android-6-9'
: androidVersion < 11
? 'intro.appstatus.locperms.description.android-10'
: androidVersion < 12
? 'intro.appstatus.locperms.description.android-11'
: 'intro.appstatus.locperms.description.android-gte-12';
logDebug('description tags are ' + androidSettingsDescTag + ' ' + androidPermDescTag);
// location settings
let locSettingsCheck = {
Expand Down Expand Up @@ -392,8 +392,8 @@ const usePermissionStatus = () => {
androidVersion == 12
? 'intro.appstatus.unusedapprestrict.description.android-disable-12'
: androidVersion < 12
? 'intro.appstatus.unusedapprestrict.description.android-disable-lt-12'
: 'intro.appstatus.unusedapprestrict.description.android-disable-gte-13';
? 'intro.appstatus.unusedapprestrict.description.android-disable-lt-12'
: 'intro.appstatus.unusedapprestrict.description.android-disable-gte-13';
let unusedAppsUnrestrictedCheck = {
name: t('intro.appstatus.unusedapprestrict.name'),
desc: t(androidUnusedDescTag),
Expand Down

0 comments on commit e81164c

Please sign in to comment.