Remove custom profiles

Instead of "custom profiles" each "reading mode" acts as a profile and has its own settings
This commit is contained in:
schroda
2024-12-16 15:22:21 +01:00
parent e95cc232a2
commit 74f78e40d4
19 changed files with 86 additions and 421 deletions

View File

@@ -19,6 +19,7 @@ import {
ReaderOverlayMode,
ReaderResumeMode,
ReadingDirection,
ReadingMode,
} from '@/modules/reader/types/Reader.types.ts';
import { useReaderStateMangaContext } from '@/modules/reader/contexts/state/ReaderStateMangaContext.tsx';
import { updateReaderSettings } from '@/modules/reader/services/ReaderSettingsMetadata.ts';
@@ -228,12 +229,12 @@ export class ReaderService {
value: IReaderSettings[Setting],
commit: boolean = true,
isGlobal: boolean = false,
profile?: string,
profile?: ReadingMode,
): void {
if (!manga) {
return;
}
const key = getMetadataKey(setting, profile ? [profile] : undefined);
const key = getMetadataKey(setting, profile !== undefined ? [profile?.toString()] : undefined);
const { cache } = requestManager.graphQLClient.client;
@@ -294,7 +295,7 @@ export class ReaderService {
return;
}
const key = getMetadataKey(setting, profile ? [profile] : undefined);
const key = getMetadataKey(setting, profile !== undefined ? [profile] : undefined);
const { cache } = requestManager.graphQLClient.client;
@@ -315,7 +316,7 @@ export class ReaderService {
static useCreateUpdateSetting<Setting extends keyof IReaderSettings>(
manga: MangaIdInfo,
profile?: string,
profile?: ReadingMode,
): (
...args: OmitFirst<Parameters<typeof this.updateSetting<Setting>>>
) => ReturnType<typeof this.updateSetting<Setting>> {
@@ -328,12 +329,12 @@ export class ReaderService {
static useCreateDeleteSetting<Setting extends keyof IReaderSettings>(
manga: MangaIdInfo,
profile?: string,
profile?: ReadingMode,
): (
...args: OmitFirst<Parameters<typeof this.deleteSetting<Setting>>>
) => ReturnType<typeof this.deleteSetting<Setting>> {
return useCallback(
(setting, isGlobal) => this.deleteSetting<Setting>(manga, setting, isGlobal, profile),
(setting, isGlobal) => this.deleteSetting<Setting>(manga, setting, isGlobal, profile?.toString()),
[manga, profile],
);
}