From 9cbe5a6060f98632a2f83c1477fbfb584da73ab1 Mon Sep 17 00:00:00 2001 From: john4650-hub Date: Wed, 13 Sep 2023 06:52:46 +0300 Subject: [PATCH] now settings can be remembered on app start --- routines.sh | 2 +- www/js/components/main_FileEntry.js | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/routines.sh b/routines.sh index 7f3090e..e833f86 100644 --- a/routines.sh +++ b/routines.sh @@ -1,4 +1,4 @@ git add . -git commit -m "added saving file data" +git commit -m "now settings can be remembered on app start" git push diff --git a/www/js/components/main_FileEntry.js b/www/js/components/main_FileEntry.js index 5baaf1b..fac7365 100644 --- a/www/js/components/main_FileEntry.js +++ b/www/js/components/main_FileEntry.js @@ -53,7 +53,7 @@ export async function onDeviceReady() { $("#fileList").treeview({ data: getTree(), showBorder: false }); }, 2500) -applyEditorSettings() + applyEditorSettings() window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) { /** @@ -80,21 +80,19 @@ applyEditorSettings() alert(`file ${filename} is not valid`) } } + fs.root.getFile('Android/data/com.ace.code/files/settings.json', { + create: true, + exclusive: false + }, function(fEntry) { + fEntry.file(function(file) { + let reader = new FileReader() + reader.onloadend = function() { + aceEditor.setOptions(JSON.parse(this.result)) + } + reader.readAsText(file) + },(e)=>console.log()); + },(e)=>console.log(e)); - function applyEditorSettings() { - fs.root.getFile('Android/data/com.ace.code/files/settings.json', { - create: true, - exclusive: false - }, function(fEntry) { - fEntry.file(function(file) { - let reader = new FileReader() - reader.onloadend = function() { - aceEditor.setOptions(JSON.parse(this.result)) - } - reader.readAsText(file) - }, null) - }, null) - } window.getUrls = getUrls let fE; //Helps to avoid saving the same data in various entries function workWithFile(filePath) {