Skip to content

Commit

Permalink
Changed fileIO directory to fix android issue
Browse files Browse the repository at this point in the history
  • Loading branch information
the-bay-kay committed Nov 27, 2023
1 parent a232e3f commit 369b3ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions www/js/services/controlHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getMyDataHelpers = function (
const localWriteFile = function (result: ServerResponse<any>) {
const resultList = result.phone_data;
return new Promise<void>(function (resolve, reject) {
window['resolveLocalFileSystemURL'](window['cordova'].file.tempDirectory, function (fs) {
window['resolveLocalFileSystemURL'](window['cordova'].file.cacheDirectory, function (fs) {
fs.filesystem.root.getFile(
fileName,
{ create: true, exclusive: false },
Expand Down Expand Up @@ -46,7 +46,7 @@ export const getMyDataHelpers = function (

const localShareData = function () {
return new Promise<void>(function (resolve, reject) {
window['resolveLocalFileSystemURL'](window['cordova'].file.tempDirectory, function (fs) {
window['resolveLocalFileSystemURL'](window['cordova'].file.cacheDirectory, function (fs) {
fs.filesystem.root.getFile(fileName, null, function (fileEntry) {
logDebug(`fileEntry ${fileEntry.nativeURL} is file? ${fileEntry.isFile.toString()}`);
fileEntry.file(
Expand Down Expand Up @@ -93,11 +93,11 @@ export const getMyDataHelpers = function (
});
};

// window['cordova'].file.TempDirectory is not guaranteed to free up memory,
// window['cordova'].file.cacheDirectory is not guaranteed to free up memory,
// so it's good practice to remove the file right after it's used!
const localClearData = function () {
return new Promise<void>(function (resolve, reject) {
window['resolveLocalFileSystemURL'](window['cordova'].file.tempDirectory, function (fs) {
window['resolveLocalFileSystemURL'](window['cordova'].file.cacheDirectory, function (fs) {
fs.filesystem.root.getFile(fileName, null, function (fileEntry) {
fileEntry.remove(
() => {
Expand Down

0 comments on commit 369b3ad

Please sign in to comment.