mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Remember custom theme path
This commit is contained in:
@@ -79,7 +79,7 @@ export class SettingsComponent implements OnInit {
|
||||
async getCustomTheme() {
|
||||
const result = await window.electron.invoke.showOpenDialog({
|
||||
title: 'Choose custom theme',
|
||||
defaultPath: this.settingsService.libraryDirectory || '',
|
||||
defaultPath: this.settingsService.customThemePath || '',
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{ name: "Themes", extensions: ["json"] },
|
||||
@@ -87,10 +87,12 @@ export class SettingsComponent implements OnInit {
|
||||
})
|
||||
|
||||
if (result.canceled === false) {
|
||||
const newThemeColors = await window.electron.invoke.getThemeColors(result.filePaths[0])
|
||||
const path = result.filePaths[0].replace(/\\/g, '/')
|
||||
const newThemeColors = await window.electron.invoke.getThemeColors(path)
|
||||
|
||||
if (newThemeColors) {
|
||||
this.settingsService.customTheme = newThemeColors
|
||||
this.settingsService.customThemePath = path.substring(0, path.lastIndexOf('/'))
|
||||
} else {
|
||||
alert(`ERROR: ${result.filePaths[0]} was not a valid JSON file.`)
|
||||
}
|
||||
|
||||
@@ -96,6 +96,13 @@ export class SettingsService {
|
||||
this.settings.customTheme = value
|
||||
this.saveSettings()
|
||||
}
|
||||
get customThemePath() {
|
||||
return this.settings.customThemePath
|
||||
}
|
||||
set customThemePath(value: string | null) {
|
||||
this.settings.customThemePath = value
|
||||
this.saveSettings()
|
||||
}
|
||||
|
||||
get isSng() {
|
||||
return this.settings.isSng
|
||||
|
||||
Reference in New Issue
Block a user