This commit is contained in:
Athou
2026-02-18 16:03:43 +01:00
parent 77bb948bf2
commit 2be61e8b1c
73 changed files with 1691 additions and 1556 deletions

View File

@@ -27,7 +27,7 @@ const createFeed = (id: number, unread: number): Subscription => ({
feedUrl: "",
feedLink: "",
iconUrl: "",
notifyOnNewEntries: true,
pushNotificationsEnabled: true,
})
const root = createCategory("root")

View File

@@ -29,7 +29,7 @@ export interface Subscription {
newestItemTime?: number
filter?: string
filterLegacy?: string
notifyOnNewEntries: boolean
pushNotificationsEnabled: boolean
}
export interface Category {
@@ -111,7 +111,7 @@ export interface FeedModificationRequest {
categoryId?: string
position?: number
filter?: string
notifyOnNewEntries?: boolean
pushNotificationsEnabled: boolean
}
export interface GetEntriesRequest {
@@ -238,6 +238,7 @@ export interface ServerInfo {
forceRefreshCooldownDuration: number
initialSetupRequired: boolean
minimumPasswordLength: number
pushNotificationsEnabled: boolean
}
export interface SharingSettings {
@@ -251,14 +252,13 @@ export interface SharingSettings {
buffer: boolean
}
export type NotificationService = "disabled" | "ntfy" | "gotify" | "pushover"
export type PushNotificationType = "ntfy" | "gotify" | "pushover"
export interface NotificationSettings {
enabled: boolean
type?: Exclude<NotificationService, "disabled">
export interface PushNotificationSettings {
type?: PushNotificationType
serverUrl?: string
token?: string
userKey?: string
userId?: string
userSecret?: string
topic?: string
}
@@ -284,7 +284,7 @@ export interface Settings {
disablePullToRefresh: boolean
primaryColor?: string
sharingSettings: SharingSettings
notificationSettings: NotificationSettings
pushNotificationSettings: PushNotificationSettings
}
export interface LocalSettings {
@@ -304,7 +304,7 @@ export interface SubscribeRequest {
url: string
title: string
categoryId?: string
notifyOnNewEntries: boolean
pushNotificationsEnabled: boolean
}
export interface TagRequest {

View File

@@ -151,10 +151,7 @@ export const userSlice = createSlice({
})
builder.addCase(changeNotificationSettings.pending, (state, action) => {
if (!state.settings) return
state.settings.notificationSettings = {
...state.settings.notificationSettings,
...action.meta.arg,
}
state.settings.pushNotificationSettings = action.meta.arg
})
builder.addMatcher(

View File

@@ -1,7 +1,7 @@
import { createAppAsyncThunk } from "@/app/async-thunk"
import { client } from "@/app/client"
import { reloadEntries } from "@/app/entries/thunks"
import type { IconDisplayMode, NotificationSettings, ReadingMode, ReadingOrder, ScrollMode, SharingSettings } from "@/app/types"
import type { IconDisplayMode, PushNotificationSettings, ReadingMode, ReadingOrder, ScrollMode, SharingSettings } from "@/app/types"
export const reloadSettings = createAppAsyncThunk("settings/reload", async () => await client.user.getSettings().then(r => r.data))
@@ -160,15 +160,12 @@ export const changeSharingSetting = createAppAsyncThunk(
export const changeNotificationSettings = createAppAsyncThunk(
"settings/notificationSettings",
(notificationUpdate: Partial<NotificationSettings>, thunkApi) => {
(pushNotificationSettings: PushNotificationSettings, thunkApi) => {
const { settings } = thunkApi.getState().user
if (!settings) return
client.user.saveSettings({
...settings,
notificationSettings: {
...settings.notificationSettings,
...notificationUpdate,
},
pushNotificationSettings,
})
}
)