Skip to content

Commit

Permalink
Anilist | Properly read and set "Hide From Status List" (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kagari-mimi authored Apr 30, 2023
1 parent a8fa857 commit 5f69f11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/Anilist/AlSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getDefaultStatus = async (stateManager: SourceStateManager): Promis
export const getDefaultPrivate = async (stateManager: SourceStateManager): Promise<string[]> => {
return (await stateManager.retrieve('defaultPrivate') as string[]) ?? ['NEVER']
}
export const getDefaultHideFromActivity = async (stateManager: SourceStateManager): Promise<string[]> => {
export const getDefaultHideFromStatusLists = async (stateManager: SourceStateManager): Promise<string[]> => {
return (await stateManager.retrieve('defaultHideFromActivity') as string[]) ?? ['NEVER']
}

Expand Down Expand Up @@ -83,11 +83,11 @@ export const trackerSettings = (stateManager: SourceStateManager): DUINavigation
]
}),
App.createDUISelect({
id: 'defaultHideFromActivity',
label: 'Hide from Activity by Default',
id: 'defaultHideFromStatusLists',
label: 'Hide from Status List by Default',
allowsMultiselect: false,
value: App.createDUIBinding({
get: () => getDefaultHideFromActivity(stateManager),
get: () => getDefaultHideFromStatusLists(stateManager),
set: async (newValue) => await stateManager.store('defaultHideFromActivity', newValue)
}),
labelResolver: async (value) => {
Expand Down
10 changes: 5 additions & 5 deletions src/Anilist/Anilist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { AnilistResult } from './models/anilist-result'
import {
getDefaultStatus,
getDefaultPrivate,
getDefaultHideFromActivity,
getDefaultHideFromStatusLists,
trackerSettings
} from './AlSettings'

Expand Down Expand Up @@ -350,10 +350,10 @@ export class Anilist implements Searchable, MangaProgressProviding {
value: anilistManga.mediaListEntry?.private != undefined ? anilistManga.mediaListEntry.private : ((await getDefaultPrivate(this.stateManager) == 'ADULTONLY' && anilistManga.isAdult || await getDefaultPrivate(this.stateManager) == 'ALWAYS') ? true : false)
}),
App.createDUISwitch({
id: 'hideFromActivity',
label: 'Hide From Activity',
id: 'hiddenFromStatusLists',
label: 'Hide From Status List',
//@ts-ignore
value: anilistManga.mediaListEntry?.private != undefined ? anilistManga.mediaListEntry.private : ((await getDefaultHideFromActivity(this.stateManager) == 'ADULTONLY' && anilistManga.isAdult || await getDefaultHideFromActivity(this.stateManager) == 'ALWAYS') ? true : false)
value: anilistManga.mediaListEntry?.hiddenFromStatusLists != undefined ? anilistManga.mediaListEntry.hiddenFromStatusLists : ((await getDefaultHideFromStatusLists(this.stateManager) == 'ADULTONLY' && anilistManga.isAdult || await getDefaultHideFromStatusLists(this.stateManager) == 'ALWAYS') ? true : false)
})
]
}),
Expand Down Expand Up @@ -392,7 +392,7 @@ export class Anilist implements Searchable, MangaProgressProviding {
progressVolumes: values['progressVolumes'],
repeat: values['repeat'],
private: values['private'],
hiddenFromStatusLists: values['hideFromActivity'],
hiddenFromStatusLists: values['hiddenFromStatusLists'],
score: Number(values['score'])
})
}
Expand Down

0 comments on commit 5f69f11

Please sign in to comment.