Skip to content

Commit

Permalink
Merge pull request #3 from louisg1337/louis_fix_log_email
Browse files Browse the repository at this point in the history
Addressed review comments
  • Loading branch information
louisg1337 authored Jul 5, 2024
2 parents e542cd2 + 8d4aeda commit d82b109
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
},

"shareFile-service": {
"send-to": "Please send this file to k.shankari@nrel.gov, or another OpenPATH team member.",
"send-to": "Please send this file to openpath@nrel.gov, or another OpenPATH team member.",
"send-log": {
"subject-logs": "emission logs",
"body-please-fill-in-what-is-wrong": "please fill in what is wrong"
Expand Down
11 changes: 8 additions & 3 deletions www/js/services/shareLocalDBFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ function localDBHelpers(fileName: string, fileExtension: string = '.txt') {
return new Promise<void>((resolve, reject) => {

Check warning on line 6 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L5-L6

Added lines #L5 - L6 were not covered by tests
let pathToFile, parentDirectory;
if (window['cordova'].platformId == 'android') {
// parentDirectory: file:///data/user/0/edu.berkeley.eecs.emission/files/
parentDirectory = window['cordova'].file.dataDirectory.replace('files', 'databases');

Check warning on line 10 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L10

Added line #L10 was not covered by tests
// pathToFile: /data/user/0/edu.berkeley.eecs.emission/files/
pathToFile = parentDirectory.replace('file://', '') + fileName;

Check warning on line 12 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L12

Added line #L12 was not covered by tests
} else if (window['cordova'].platformId == 'ios') {
// parentDirectory: file:///var/mobile/Containers/Data/Application/<32-hex-digit-id>/Library/NoCloud/../
parentDirectory = window['cordova'].file.dataDirectory + '../';
pathToFile = 'LocalDatabase/' + fileName;
} else {
Expand All @@ -17,6 +20,8 @@ function localDBHelpers(fileName: string, fileExtension: string = '.txt') {
}

window['resolveLocalFileSystemURL'](parentDirectory, (fs) => {

Check warning on line 22 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L22

Added line #L22 was not covered by tests
// On iOS, pass in relative path to getFile https://github.com/e-mission/e-mission-phone/pull/1160#issuecomment-2192112472
// On Android, pass in absolute path to getFile https://github.com/e-mission/e-mission-phone/pull/1160#issuecomment-2204297874
fs.filesystem.root.getFile(pathToFile, { create: false, exclusive: false }, (fileEntry) => {

Check warning on line 25 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L25

Added line #L25 was not covered by tests
// logDebug(`fileEntry ${fileEntry.nativeURL} is file? ${fileEntry.isFile.toString()}`);
logDebug(`fileEntry is: ${JSON.stringify(fileEntry, null, 2)}`);
Expand All @@ -31,7 +36,7 @@ function localDBHelpers(fileName: string, fileExtension: string = '.txt') {
resolve();

Check warning on line 36 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L34-L36

Added lines #L34 - L36 were not covered by tests
},
(rej) => {
logDebug(`Rej: ${JSON.stringify(rej, null, 2)}`);
displayErrorMsg(`Rej: ${JSON.stringify(rej, null, 2)}`);
reject();

Check warning on line 40 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L38-L40

Added lines #L38 - L40 were not covered by tests
},
);
Expand Down Expand Up @@ -61,7 +66,7 @@ function localDBHelpers(fileName: string, fileExtension: string = '.txt') {
resolve();

Check warning on line 66 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L63-L66

Added lines #L63 - L66 were not covered by tests
},
(msg) => {
logDebug(`Sharing failed with message ${msg}`);
displayErrorMsg(`Sharing failed with message ${msg}`);

Check warning on line 69 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L68-L69

Added lines #L68 - L69 were not covered by tests
},
);
},
Expand All @@ -84,7 +89,7 @@ function localDBHelpers(fileName: string, fileExtension: string = '.txt') {
resolve();

Check warning on line 89 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L82-L89

Added lines #L82 - L89 were not covered by tests
},
(err) => {
logWarn(`Error deleting ${fileName} : ${err}`);
displayError(err, `Error deleting ${fileName}`);
reject(err);

Check warning on line 93 in www/js/services/shareLocalDBFile.ts

View check run for this annotation

Codecov / codecov/patch

www/js/services/shareLocalDBFile.ts#L91-L93

Added lines #L91 - L93 were not covered by tests
},
);
Expand Down

0 comments on commit d82b109

Please sign in to comment.