-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Issues with socialSharing, `loggerDB` file, and Gmail App - Because Gmail is default mail on Android, we want to make sure it works - Reverting to old plugin to make sure this sends correctly - Tested and confirmed send works on iOS & Android Hardware - Please see PR for further details
- Loading branch information
1 parent
f25a2e9
commit 3e0ddb8
Showing
3 changed files
with
50 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,35 +6,55 @@ 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: '[email protected]', | ||
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}`); | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters