show macOS warning one, don't show artist link if invalid
This commit is contained in:
parent
5d6503c1f4
commit
ebd2f07447
2 changed files with 29 additions and 18 deletions
|
@ -6,18 +6,20 @@ import { store } from '../settings';
|
||||||
export const enableMediaKeys = (window: BrowserWindow | null) => {
|
export const enableMediaKeys = (window: BrowserWindow | null) => {
|
||||||
if (isMacOS()) {
|
if (isMacOS()) {
|
||||||
const shouldPrompt = store.get('should_prompt_accessibility', true) as boolean;
|
const shouldPrompt = store.get('should_prompt_accessibility', true) as boolean;
|
||||||
|
const shownWarning = store.get('shown_accessibility_warning', false) as boolean;
|
||||||
const trusted = systemPreferences.isTrustedAccessibilityClient(shouldPrompt);
|
const trusted = systemPreferences.isTrustedAccessibilityClient(shouldPrompt);
|
||||||
|
|
||||||
if (shouldPrompt) {
|
if (shouldPrompt) {
|
||||||
store.set('should_prompt_accessibility', false);
|
store.set('should_prompt_accessibility', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trusted) {
|
if (!trusted && !shownWarning) {
|
||||||
window?.webContents.send('toast-from-main', {
|
window?.webContents.send('toast-from-main', {
|
||||||
message:
|
message:
|
||||||
'Feishin is not a trusted accessibility client. Media keys will not work until this setting is changed',
|
'Feishin is not a trusted accessibility client. Media keys will not work until this setting is changed',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
|
store.set('shown_accessibility_warning', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,24 +48,33 @@ const handleRow = <T extends AnyLibraryItem>(t: TFunction, item: T, rule: ItemDe
|
||||||
|
|
||||||
const formatArtists = (isAlbumArtist: boolean) => (item: Album | Song) =>
|
const formatArtists = (isAlbumArtist: boolean) => (item: Album | Song) =>
|
||||||
(isAlbumArtist ? item.albumArtists : item.artists)?.map((artist, index) => (
|
(isAlbumArtist ? item.albumArtists : item.artists)?.map((artist, index) => (
|
||||||
<span key={artist.id}>
|
<span key={artist.id || artist.name}>
|
||||||
{index > 0 && <Separator />}
|
{index > 0 && <Separator />}
|
||||||
<Text
|
{artist.id ? (
|
||||||
$link
|
<Text
|
||||||
component={Link}
|
$link
|
||||||
overflow="visible"
|
component={Link}
|
||||||
size="md"
|
overflow="visible"
|
||||||
to={
|
size="md"
|
||||||
artist.id
|
to={
|
||||||
? generatePath(AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL, {
|
artist.id
|
||||||
albumArtistId: artist.id,
|
? generatePath(AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL, {
|
||||||
})
|
albumArtistId: artist.id,
|
||||||
: ''
|
})
|
||||||
}
|
: ''
|
||||||
weight={500}
|
}
|
||||||
>
|
weight={500}
|
||||||
{artist.name || '—'}
|
>
|
||||||
</Text>
|
{artist.name || '—'}
|
||||||
|
</Text>
|
||||||
|
) : (
|
||||||
|
<Text
|
||||||
|
overflow="visible"
|
||||||
|
size="md"
|
||||||
|
>
|
||||||
|
{artist.name || '-'}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
Reference in a new issue