Remove allow notifications setting, it can be handled natively
This commit is contained in:
5 files changed
+21
-57
No files matched your search
+10
-28
@@ -88,8 +88,6 @@ export default function RootLayout ({
|
|||||||
const [versions, setVersions] = useState<Store | null>(null)
|
const [versions, setVersions] = useState<Store | null>(null)
|
||||||
const [account, setAccount] = useState<Store | null>(null)
|
const [account, setAccount] = useState<Store | null>(null)
|
||||||
|
|
||||||
const [notificationsAllowed, setNotificationsAllowed] =
|
|
||||||
useState<boolean>(false)
|
|
||||||
const [sidebarAlwaysShowGames, setSidebarAlwaysShowGames] =
|
const [sidebarAlwaysShowGames, setSidebarAlwaysShowGames] =
|
||||||
useState<boolean>(false)
|
useState<boolean>(false)
|
||||||
const [linuxUseWine, setLinuxUseWine] = useState<boolean>(false)
|
const [linuxUseWine, setLinuxUseWine] = useState<boolean>(false)
|
||||||
@@ -232,11 +230,10 @@ export default function RootLayout ({
|
|||||||
: d
|
: d
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (await settings?.get<boolean>('notificationsAllowed'))
|
await notifyUser(
|
||||||
await notifyUser(
|
'Download Failed',
|
||||||
'Download Failed',
|
`The download for version ${info.displayName} has failed.`
|
||||||
`The download for version ${info.displayName} has failed.`
|
)
|
||||||
)
|
|
||||||
await getCurrentWindow().requestUserAttention(
|
await getCurrentWindow().requestUserAttention(
|
||||||
UserAttentionType.Critical
|
UserAttentionType.Critical
|
||||||
)
|
)
|
||||||
@@ -311,11 +308,10 @@ export default function RootLayout ({
|
|||||||
: d
|
: d
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (await settings?.get<boolean>('notificationsAllowed'))
|
await notifyUser(
|
||||||
await notifyUser(
|
'Download Failed',
|
||||||
'Download Failed',
|
`The download for version ${info.displayName} has failed.`
|
||||||
`The download for version ${info.displayName} has failed.`
|
)
|
||||||
)
|
|
||||||
await getCurrentWindow().requestUserAttention(
|
await getCurrentWindow().requestUserAttention(
|
||||||
UserAttentionType.Critical
|
UserAttentionType.Critical
|
||||||
)
|
)
|
||||||
@@ -647,7 +643,6 @@ export default function RootLayout ({
|
|||||||
autoSave: true,
|
autoSave: true,
|
||||||
defaults: {
|
defaults: {
|
||||||
version: client,
|
version: client,
|
||||||
notificationsAllowed: true,
|
|
||||||
sidebarAlwaysShowGames: true,
|
sidebarAlwaysShowGames: true,
|
||||||
linuxUseWine: false,
|
linuxUseWine: false,
|
||||||
linuxWineCommand: 'wine %path%',
|
linuxWineCommand: 'wine %path%',
|
||||||
@@ -776,23 +771,14 @@ export default function RootLayout ({
|
|||||||
popupMode === 1
|
popupMode === 1
|
||||||
) {
|
) {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (notificationsAllowed) {
|
await notifyUser('Downloads Complete', 'All downloads finished!')
|
||||||
await notifyUser('Downloads Complete', 'All downloads finished!')
|
|
||||||
}
|
|
||||||
await getCurrentWindow().requestUserAttention(
|
await getCurrentWindow().requestUserAttention(
|
||||||
UserAttentionType.Informational
|
UserAttentionType.Informational
|
||||||
)
|
)
|
||||||
closePopup()
|
closePopup()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
}, [
|
}, [downloadProgress, downloadQueue, showPopup, popupMode, closePopup])
|
||||||
downloadProgress,
|
|
||||||
downloadQueue,
|
|
||||||
showPopup,
|
|
||||||
popupMode,
|
|
||||||
closePopup,
|
|
||||||
notificationsAllowed
|
|
||||||
])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!settings || !versions) return
|
if (!settings || !versions) return
|
||||||
@@ -814,9 +800,6 @@ export default function RootLayout ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
watchSettings<string>('theme', v => setTheme(v ?? 'dark'))
|
watchSettings<string>('theme', v => setTheme(v ?? 'dark'))
|
||||||
watchSettings<boolean>('notificationsAllowed', v =>
|
|
||||||
setNotificationsAllowed(v ?? true)
|
|
||||||
)
|
|
||||||
watchSettings<boolean>('sidebarAlwaysShowGames', v =>
|
watchSettings<boolean>('sidebarAlwaysShowGames', v =>
|
||||||
setSidebarAlwaysShowGames(v ?? true)
|
setSidebarAlwaysShowGames(v ?? true)
|
||||||
)
|
)
|
||||||
@@ -896,7 +879,6 @@ export default function RootLayout ({
|
|||||||
settings,
|
settings,
|
||||||
versions,
|
versions,
|
||||||
account,
|
account,
|
||||||
notificationsAllowed,
|
|
||||||
sidebarAlwaysShowGames,
|
sidebarAlwaysShowGames,
|
||||||
linuxUseWine,
|
linuxUseWine,
|
||||||
linuxWineCommand,
|
linuxWineCommand,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export default function Settings () {
|
|||||||
account,
|
account,
|
||||||
version,
|
version,
|
||||||
versionsList,
|
versionsList,
|
||||||
notificationsAllowed,
|
|
||||||
sidebarAlwaysShowGames,
|
sidebarAlwaysShowGames,
|
||||||
linuxUseWine,
|
linuxUseWine,
|
||||||
linuxWineCommand,
|
linuxWineCommand,
|
||||||
@@ -33,14 +32,6 @@ export default function Settings () {
|
|||||||
<p className='text-3xl ml-4 mt-4'>Settings</p>
|
<p className='text-3xl ml-4 mt-4'>Settings</p>
|
||||||
<div className='flex flex-row p-4 gap-4'>
|
<div className='flex flex-row p-4 gap-4'>
|
||||||
<div className='bg-(--col1) border border-(--col3) rounded-lg p-4 w-fit h-fit'>
|
<div className='bg-(--col1) border border-(--col3) rounded-lg p-4 w-fit h-fit'>
|
||||||
<Setting
|
|
||||||
label='Allow sending notifications'
|
|
||||||
value={notificationsAllowed}
|
|
||||||
onChange={async () => {
|
|
||||||
await settings?.set('notificationsAllowed', !notificationsAllowed)
|
|
||||||
}}
|
|
||||||
title='This setting does as you expect, allow the launcher to send notifications for when stuff like downloading is done.'
|
|
||||||
/>
|
|
||||||
<Setting
|
<Setting
|
||||||
label='Always show games in sidebar'
|
label='Always show games in sidebar'
|
||||||
value={sidebarAlwaysShowGames}
|
value={sidebarAlwaysShowGames}
|
||||||
@@ -290,9 +281,7 @@ export default function Settings () {
|
|||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
className='fixed bottom-1.5 right-1.5 rounded-md cursor-pointer px-1 border z-100 transition-colors btntheme1'
|
className='fixed bottom-1.5 right-1.5 rounded-md cursor-pointer px-1 border z-100 transition-colors btntheme1'
|
||||||
onClick={async () =>
|
onClick={async () => await copyToClipboard(`v${version}`)}
|
||||||
await copyToClipboard(`v${version}`, notificationsAllowed)
|
|
||||||
}
|
|
||||||
title='The current launcher version.'
|
title='The current launcher version.'
|
||||||
>
|
>
|
||||||
v{version}
|
v{version}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager'
|
import { writeText } from '@tauri-apps/plugin-clipboard-manager'
|
||||||
import { notifyUser } from './notifications'
|
import { notifyUser } from './notifications'
|
||||||
|
|
||||||
export async function copyToClipboard (
|
export async function copyToClipboard (text: string) {
|
||||||
text: string,
|
|
||||||
notificationsAllowed: boolean
|
|
||||||
) {
|
|
||||||
await writeText(text)
|
await writeText(text)
|
||||||
if (notificationsAllowed)
|
await notifyUser('Copied', 'Text "' + text + '" copied to clipboard')
|
||||||
await notifyUser('Copied', 'Text "' + text + '" copied to clipboard')
|
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,6 @@ export default function DownloadsPopup () {
|
|||||||
setDownloadProgress,
|
setDownloadProgress,
|
||||||
downloadQueue,
|
downloadQueue,
|
||||||
setDownloadQueue,
|
setDownloadQueue,
|
||||||
notificationsAllowed,
|
|
||||||
versionsList,
|
versionsList,
|
||||||
modsList,
|
modsList,
|
||||||
versions,
|
versions,
|
||||||
@@ -117,15 +116,14 @@ export default function DownloadsPopup () {
|
|||||||
: d
|
: d
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (notificationsAllowed)
|
await notifyUser(
|
||||||
await notifyUser(
|
'Download Failed',
|
||||||
'Download Failed',
|
`The download for version ${
|
||||||
`The download for version ${
|
serverVersionList?.versions.find(
|
||||||
serverVersionList?.versions.find(
|
vf => vf.id == v.version
|
||||||
vf => vf.id == v.version
|
)?.displayName
|
||||||
)?.displayName
|
} has failed.`
|
||||||
} has failed.`
|
)
|
||||||
)
|
|
||||||
await getCurrentWindow().requestUserAttention(
|
await getCurrentWindow().requestUserAttention(
|
||||||
UserAttentionType.Critical
|
UserAttentionType.Critical
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ type GlobalCtxType = {
|
|||||||
settings: Store | null
|
settings: Store | null
|
||||||
versions: Store | null
|
versions: Store | null
|
||||||
account: Store | null
|
account: Store | null
|
||||||
notificationsAllowed: boolean
|
|
||||||
sidebarAlwaysShowGames: boolean
|
sidebarAlwaysShowGames: boolean
|
||||||
linuxUseWine: boolean
|
linuxUseWine: boolean
|
||||||
linuxWineCommand: string
|
linuxWineCommand: string
|
||||||
|
|||||||
Reference in new issue
Block a user