feat(settings): add Account and Notifications pages, gate download notifications

This commit is contained in:
Gauvain
2026-06-03 23:36:39 +02:00
parent a0e6b31500
commit e783227ba6
4 changed files with 145 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
import type * as NotificationsType from "expo-notifications";
import type { TFunction } from "i18next";
import { Platform } from "react-native";
import { storage } from "@/utils/mmkv";
// Conditionally import expo-notifications only on non-TV platforms
const Notifications = Platform.isTV
@@ -67,6 +68,14 @@ export async function sendDownloadNotification(
): Promise<void> {
if (Platform.isTV || !Notifications) return;
try {
const raw = storage.getString("settings");
const s = raw ? JSON.parse(raw) : {};
if (s.notificationsEnabled === false || s.notifyDownloads === false) return;
} catch {
// ignore parse errors; fall through to sending (defaults are enabled)
}
try {
await Notifications.scheduleNotificationAsync({
content: {