Complete global vs individual settings

This commit is contained in:
aditya.chandel
2025-01-17 18:24:39 -07:00
parent f374b1ac13
commit 8108bf56ee
18 changed files with 126 additions and 76 deletions
@@ -19,8 +19,8 @@
[inputId]="item"
name="spread"
[value]="item"
[(ngModel)]="selectedPdf"
(ngModelChange)="onPdfIndividualOrGlobalChange()">
[(ngModel)]="selectedPdfScope"
(ngModelChange)="onPdfScopeChange()">
</p-radiobutton>
<label [for]="item">{{ item }}</label>
</div>
@@ -33,8 +33,8 @@
[inputId]="item"
name="spread"
[value]="item"
[(ngModel)]="selectedEpub"
(ngModelChange)="onEpubIndividualOrGlobalChange()">
[(ngModel)]="selectedEpubScope"
(ngModelChange)="onEpubScopeChange()">
</p-radiobutton>
<label [for]="item">{{ item }}</label>
</div>
@@ -58,8 +58,8 @@ export class SettingsComponent implements OnInit {
selectedTheme!: any;
fontSize: number = 100;
selectedFont: any;
selectedPdf!: string;
selectedEpub!: string;
selectedPdfScope!: string;
selectedEpubScope!: string;
private appSettingsService = inject(AppSettingsService);
appSettings$: Observable<AppSettings | null> = this.appSettingsService.appSettings$;
@@ -87,6 +87,11 @@ export class SettingsComponent implements OnInit {
this.fontSize = Number(epubSettings.fontSize);
this.selectedFont = this.fonts.find(f => f.key === epubSettings.font)?.key;
}
if (settings.readerSettings) {
this.selectedPdfScope = settings.readerSettings.pdfScope;
this.selectedEpubScope = settings.readerSettings.epubScope;
}
}
onThemeChange(): void {
@@ -113,6 +118,14 @@ export class SettingsComponent implements OnInit {
this.appSettingsService.saveAppSetting('epub', 'fontSize', this.fontSize);
}
onPdfScopeChange(): void {
this.appSettingsService.saveAppSetting('reader_setting', 'pdf', this.selectedPdfScope);
}
onEpubScopeChange(): void {
this.appSettingsService.saveAppSetting('reader_setting', 'epub', this.selectedEpubScope);
}
increaseFontSize(): void {
if (this.fontSize < 250) {
this.fontSize += 10;
@@ -126,12 +139,4 @@ export class SettingsComponent implements OnInit {
this.onFontSizeChange();
}
}
onPdfIndividualOrGlobalChange() {
}
onEpubIndividualOrGlobalChange() {
}
}
@@ -12,7 +12,13 @@ export interface PdfSettings {
page: number;
}
export interface ReaderSettings {
pdfScope: 'Global' | 'Individual';
epubScope: 'Global' | 'Individual';
}
export interface AppSettings {
epub?: EpubSettings;
pdf?: PdfSettings;
readerSettings?: ReaderSettings;
}