export class Context { static languageSettingId : string = 'setting-language-setting' ; static enableFilterNonExistsFilesId : string = 'setting-filter-non-exists-files' ; static enableGetFaviconFromNetId : string = 'setting-get-favicon-from-net' ; static enableGetFileIconId : string = 'setting-get-file-icon' ; static enableOpenNotificationId : string = 'setting-open-notification' ; static enableEditPathInputDirectlyId : string = 'setting-edit-path-input-directly' ; static enablePinyinIndexId : string = 'setting-pinyin-index' ; static browserHistoryLimitId : string = 'browser-history-limit' ; readonly languageSetting : string = 'auto' ; readonly enableFilterNonExistsFiles : boolean = false ; readonly enableGetFaviconFromNet : boolean = false ; readonly enableGetFileIcon : boolean = false ; readonly enableOpenNotification : boolean = false ; readonly enableEditPathInputDirectly : boolean = false ; readonly enablePinyinIndex : boolean = true ; readonly browserHistoryLimit : number = 100 ; constructor ( nativeId ) { this . languageSetting = utools . dbStorage . getItem ( Context . languageSettingId ) ?? 'auto' ; this . enableFilterNonExistsFiles = utools . dbStorage . getItem ( Context . enableFilterNonExistsFilesId ) ?? false ; this . enableGetFaviconFromNet = utools . dbStorage . getItem ( Context . enableGetFaviconFromNetId ) ?? false ; this . enableGetFileIcon = utools . dbStorage . getItem ( Context . enableGetFileIconId ) ?? false ; this . enableOpenNotification = utools . dbStorage . getItem ( Context . enableOpenNotificationId ) ?? false ; this . enablePinyinIndex = utools . dbStorage . getItem ( Context . enablePinyinIndexId ) ?? true ; this . browserHistoryLimit = parseInt ( utools . dbStorage . getItem ( Context . browserHistoryLimitId ) ?? '100' ) ; this . enableEditPathInputDirectly = utools . dbStorage . getItem ( Context . joinId ( nativeId , Context . enableEditPathInputDirectlyId ) ) ?? false ; } static joinId ( nativeId , id ) { return `${ nativeId }/${ id }` ; } static get ( ) { return new Context ( utools . getNativeId ( ) ) ; } static update ( id , value ) { utools . dbStorage . setItem ( id , value ) ; } static updateNative ( id , value ) { utools . dbStorage . setItem ( Context . joinId ( utools . getNativeId ( ) , id ) , value ) ; } static remove ( id ) { utools . dbStorage . removeItem ( id ) ; } static removeNative ( id ) { utools . dbStorage . removeItem ( Context . joinId ( utools . getNativeId ( ) , id ) ) ; } }