@@ -38,6 +38,7 @@ import loadPolyFill from "./polyfill";
3838import internalFs from "./fileSystem/internalFs" ;
3939import Url from "./utils/Url" ;
4040import backupRestore from "../pages/settings/backup-restore" ;
41+ import applySettings from "./applySettings" ;
4142//@ts -check
4243
4344loadPolyFill . apply ( window ) ;
@@ -156,11 +157,6 @@ function Main() {
156157
157158 function ondeviceready ( ) {
158159
159- if ( / f r e e / . test ( BuildInfo . packageName ) && appSettings . value . appTheme === "dark" ) {
160- appSettings . value . appTheme = "default" ;
161- appSettings . update ( ) ;
162- }
163-
164160 if ( ! ( 'files' in localStorage ) ) {
165161 localStorage . setItem ( 'files' , '[]' ) ;
166162 }
@@ -278,14 +274,6 @@ function runApp() {
278274 }
279275 } ) ;
280276
281- app . addEventListener ( 'touchstart' , function ( e ) {
282- const el = e . target ;
283-
284- if ( el instanceof HTMLElement && el . hasAttribute ( 'vibrate' ) ) {
285- if ( appSettings . value . vibrateOnTap ) navigator . vibrate ( constants . VIBRATION_TIME ) ;
286- }
287- } ) ;
288-
289277 const Acode = {
290278 /**
291279 *
@@ -409,11 +397,11 @@ function App() {
409397 Acode . exec ( "toggle-quick-tools" ) ;
410398 } ;
411399
412- window . restoreTheme ( ) ;
413- $main . setAttribute ( "data-empty-msg" , strings [ 'no editor message' ] ) ;
414-
415400 //#region rendering
401+ applySettings . beforeRender ( ) ;
402+ window . restoreTheme ( ) ;
416403 root . append ( $header , $main , $footer , $headerToggler , $quickToolToggler ) ;
404+ applySettings . afterRender ( ) ;
417405 //#endregion
418406
419407 $fileMenu . addEventListener ( 'click' , handleMenu ) ;
@@ -423,10 +411,6 @@ function App() {
423411 document . addEventListener ( 'keydown' , handleMainKeyDown ) ;
424412 document . addEventListener ( 'keyup' , handleMainKeyUp ) ;
425413
426- if ( appSettings . value . fullscreen )
427- Acode . exec ( "enable-fullscreen" ) ;
428-
429- if ( appSettings . value . quickTools ) quickTools . actions ( "enable-quick-tools" ) ;
430414 window . beforeClose = saveState ;
431415
432416 loadFolders ( ) ;
@@ -438,7 +422,6 @@ function App() {
438422
439423 setTimeout ( ( ) => {
440424 app . classList . remove ( 'loading' , 'splash' ) ;
441- if ( ! appSettings . value . animation ) app . classList . add ( 'no-animation' ) ;
442425 onAppLoad ( ) ;
443426 } , 500 ) ;
444427 //#region event listeners
@@ -457,21 +440,6 @@ function App() {
457440 } ) ;
458441 document . addEventListener ( 'resume' , checkFiles ) ;
459442 checkFiles ( ) ;
460-
461- const autoSave = parseInt ( appSettings . value . autosave ) ;
462- if ( autoSave ) {
463- saveInterval = setInterval ( ( ) => {
464- editorManager . files . map ( file => {
465- if (
466- ! file . readOnly &&
467- ( file . fileUri || file . contentUri ) &&
468- file . isUnsaved &&
469- ! file . isSaving
470- ) Acode . exec ( "save" , false ) ;
471- return file ;
472- } ) ;
473- } , autoSave ) ;
474- }
475443 } ) ;
476444
477445 editorManager . onupdate = function ( ) {
0 commit comments