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 [account, setAccount] = useState<Store | null>(null)
|
||||
|
||||
const [notificationsAllowed, setNotificationsAllowed] =
|
||||
useState<boolean>(false)
|
||||
const [sidebarAlwaysShowGames, setSidebarAlwaysShowGames] =
|
||||
useState<boolean>(false)
|
||||
const [linuxUseWine, setLinuxUseWine] = useState<boolean>(false)
|
||||
@@ -232,11 +230,10 @@ export default function RootLayout ({
|
||||
: d
|
||||
)
|
||||
)
|
||||
if (await settings?.get<boolean>('notificationsAllowed'))
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${info.displayName} has failed.`
|
||||
)
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${info.displayName} has failed.`
|
||||
)
|
||||
await getCurrentWindow().requestUserAttention(
|
||||
UserAttentionType.Critical
|
||||
)
|
||||
@@ -311,11 +308,10 @@ export default function RootLayout ({
|
||||
: d
|
||||
)
|
||||
)
|
||||
if (await settings?.get<boolean>('notificationsAllowed'))
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${info.displayName} has failed.`
|
||||
)
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${info.displayName} has failed.`
|
||||
)
|
||||
await getCurrentWindow().requestUserAttention(
|
||||
UserAttentionType.Critical
|
||||
)
|
||||
@@ -647,7 +643,6 @@ export default function RootLayout ({
|
||||
autoSave: true,
|
||||
defaults: {
|
||||
version: client,
|
||||
notificationsAllowed: true,
|
||||
sidebarAlwaysShowGames: true,
|
||||
linuxUseWine: false,
|
||||
linuxWineCommand: 'wine %path%',
|
||||
@@ -776,23 +771,14 @@ export default function RootLayout ({
|
||||
popupMode === 1
|
||||
) {
|
||||
setTimeout(async () => {
|
||||
if (notificationsAllowed) {
|
||||
await notifyUser('Downloads Complete', 'All downloads finished!')
|
||||
}
|
||||
await notifyUser('Downloads Complete', 'All downloads finished!')
|
||||
await getCurrentWindow().requestUserAttention(
|
||||
UserAttentionType.Informational
|
||||
)
|
||||
closePopup()
|
||||
}, 0)
|
||||
}
|
||||
}, [
|
||||
downloadProgress,
|
||||
downloadQueue,
|
||||
showPopup,
|
||||
popupMode,
|
||||
closePopup,
|
||||
notificationsAllowed
|
||||
])
|
||||
}, [downloadProgress, downloadQueue, showPopup, popupMode, closePopup])
|
||||
|
||||
useEffect(() => {
|
||||
if (!settings || !versions) return
|
||||
@@ -814,9 +800,6 @@ export default function RootLayout ({
|
||||
}
|
||||
|
||||
watchSettings<string>('theme', v => setTheme(v ?? 'dark'))
|
||||
watchSettings<boolean>('notificationsAllowed', v =>
|
||||
setNotificationsAllowed(v ?? true)
|
||||
)
|
||||
watchSettings<boolean>('sidebarAlwaysShowGames', v =>
|
||||
setSidebarAlwaysShowGames(v ?? true)
|
||||
)
|
||||
@@ -896,7 +879,6 @@ export default function RootLayout ({
|
||||
settings,
|
||||
versions,
|
||||
account,
|
||||
notificationsAllowed,
|
||||
sidebarAlwaysShowGames,
|
||||
linuxUseWine,
|
||||
linuxWineCommand,
|
||||
|
||||
@@ -18,7 +18,6 @@ export default function Settings () {
|
||||
account,
|
||||
version,
|
||||
versionsList,
|
||||
notificationsAllowed,
|
||||
sidebarAlwaysShowGames,
|
||||
linuxUseWine,
|
||||
linuxWineCommand,
|
||||
@@ -33,14 +32,6 @@ export default function Settings () {
|
||||
<p className='text-3xl ml-4 mt-4'>Settings</p>
|
||||
<div className='flex flex-row p-4 gap-4'>
|
||||
<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
|
||||
label='Always show games in sidebar'
|
||||
value={sidebarAlwaysShowGames}
|
||||
@@ -290,9 +281,7 @@ export default function Settings () {
|
||||
</div>
|
||||
<p
|
||||
className='fixed bottom-1.5 right-1.5 rounded-md cursor-pointer px-1 border z-100 transition-colors btntheme1'
|
||||
onClick={async () =>
|
||||
await copyToClipboard(`v${version}`, notificationsAllowed)
|
||||
}
|
||||
onClick={async () => await copyToClipboard(`v${version}`)}
|
||||
title='The current launcher version.'
|
||||
>
|
||||
v{version}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager'
|
||||
import { notifyUser } from './notifications'
|
||||
|
||||
export async function copyToClipboard (
|
||||
text: string,
|
||||
notificationsAllowed: boolean
|
||||
) {
|
||||
export async function copyToClipboard (text: string) {
|
||||
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,
|
||||
downloadQueue,
|
||||
setDownloadQueue,
|
||||
notificationsAllowed,
|
||||
versionsList,
|
||||
modsList,
|
||||
versions,
|
||||
@@ -117,15 +116,14 @@ export default function DownloadsPopup () {
|
||||
: d
|
||||
)
|
||||
)
|
||||
if (notificationsAllowed)
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${
|
||||
serverVersionList?.versions.find(
|
||||
vf => vf.id == v.version
|
||||
)?.displayName
|
||||
} has failed.`
|
||||
)
|
||||
await notifyUser(
|
||||
'Download Failed',
|
||||
`The download for version ${
|
||||
serverVersionList?.versions.find(
|
||||
vf => vf.id == v.version
|
||||
)?.displayName
|
||||
} has failed.`
|
||||
)
|
||||
await getCurrentWindow().requestUserAttention(
|
||||
UserAttentionType.Critical
|
||||
)
|
||||
|
||||
@@ -53,7 +53,6 @@ type GlobalCtxType = {
|
||||
settings: Store | null
|
||||
versions: Store | null
|
||||
account: Store | null
|
||||
notificationsAllowed: boolean
|
||||
sidebarAlwaysShowGames: boolean
|
||||
linuxUseWine: boolean
|
||||
linuxWineCommand: string
|
||||
|
||||
Reference in new issue
Block a user