mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-27 00:55:16 -07:00
Fix Windows mpv logging and add log export (#88)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
export type CharacterDictionaryManagerNotificationType = 'osd' | 'system' | 'both' | 'none';
|
||||
|
||||
export const CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE =
|
||||
'Enable Name Match in Settings to use the character dictionary manager.';
|
||||
|
||||
export interface CharacterDictionaryManagerGateDeps {
|
||||
isCharacterDictionaryEnabled: () => boolean;
|
||||
getNotificationType: () => CharacterDictionaryManagerNotificationType;
|
||||
openManager: () => void;
|
||||
showOsd: (message: string) => void;
|
||||
showDesktopNotification: (title: string, options: { body: string }) => void;
|
||||
logWarn?: (message: string, error?: unknown) => void;
|
||||
}
|
||||
|
||||
function notifyManagerDisabled(deps: CharacterDictionaryManagerGateDeps): void {
|
||||
const type = deps.getNotificationType();
|
||||
if (type === 'osd' || type === 'both') {
|
||||
deps.showOsd(CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE);
|
||||
}
|
||||
if (type === 'system' || type === 'both') {
|
||||
try {
|
||||
deps.showDesktopNotification('SubMiner', {
|
||||
body: CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE,
|
||||
});
|
||||
} catch (error) {
|
||||
deps.logWarn?.('Unable to show character dictionary manager notification.', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function openCharacterDictionaryManagerWithConfigGate(
|
||||
deps: CharacterDictionaryManagerGateDeps,
|
||||
): void {
|
||||
if (deps.isCharacterDictionaryEnabled()) {
|
||||
deps.openManager();
|
||||
return;
|
||||
}
|
||||
notifyManagerDisabled(deps);
|
||||
}
|
||||
Reference in New Issue
Block a user