-
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.
Refractored
emailService
into shareLocalDBFile
- Moved into `services/` directory - Refractored `emailService.ts` to now use sharePlugin, to match controlHelper - To reflect this change, renamed the service to `shareLocalDBFile` - Reworked 18next translations to reflect change
- Loading branch information
1 parent
a16bbc0
commit f25a2e9
Showing
8 changed files
with
54 additions
and
70 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
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import i18next from 'i18next'; | ||
import { displayErrorMsg, logDebug, logInfo, logWarn } from '../plugin/logger'; | ||
|
||
export async function sendLocalDBFile(database: string) { | ||
let parentDir = 'unknown'; | ||
|
||
if (window['cordova'].platformId == 'android') { | ||
parentDir = 'app://databases'; | ||
} | ||
|
||
if (window['cordova'].platformId == 'ios') { | ||
logDebug(window['cordova'].file.dataDirectory); | ||
parentDir = window['cordova'].file.dataDirectory + '../LocalDatabase'; | ||
} | ||
|
||
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}`); | ||
}, | ||
); | ||
} |