Add push notifications

This commit is contained in:
Christoph Hagen
2025-02-18 22:05:19 +01:00
parent de6f474aea
commit 66a40e52a0
9 changed files with 285 additions and 4 deletions

View File

@ -1,7 +1,11 @@
import Foundation
import SwiftUI
final class GeneralSettings: ObservableObject {
@AppStorage("pushNotificationAccessToken")
var pushNotificationAccessToken: String?
@Published
var url: String
@ -20,13 +24,17 @@ final class GeneralSettings: ObservableObject {
@Published
var remotePathForUpload: String
init(url: String, linkPreviewImageWidth: Int, linkPreviewImageHeight: Int, remoteUserForUpload: String, remotePortForUpload: Int, remotePathForUpload: String) {
@Published
var urlForPushNotification: String?
init(url: String, linkPreviewImageWidth: Int, linkPreviewImageHeight: Int, remoteUserForUpload: String, remotePortForUpload: Int, remotePathForUpload: String, urlForPushNotification: String?) {
self.url = url
self.linkPreviewImageWidth = linkPreviewImageWidth
self.linkPreviewImageHeight = linkPreviewImageHeight
self.remoteUserForUpload = remoteUserForUpload
self.remotePortForUpload = remotePortForUpload
self.remotePathForUpload = remotePathForUpload
self.urlForPushNotification = urlForPushNotification
}
}
@ -39,7 +47,8 @@ extension GeneralSettings {
linkPreviewImageHeight: data.linkPreviewImageHeight,
remoteUserForUpload: data.remoteUserForUpload,
remotePortForUpload: data.remotePortForUpload,
remotePathForUpload: data.remotePathForUpload)
remotePathForUpload: data.remotePathForUpload,
urlForPushNotification: data.urlForPushNotification)
}
var data: Data {
@ -49,7 +58,8 @@ extension GeneralSettings {
linkPreviewImageHeight: linkPreviewImageHeight,
remoteUserForUpload: remoteUserForUpload,
remotePortForUpload: remotePortForUpload,
remotePathForUpload: remotePathForUpload)
remotePathForUpload: remotePathForUpload,
urlForPushNotification: urlForPushNotification)
}
struct Data: Codable, Equatable {
@ -59,5 +69,6 @@ extension GeneralSettings {
let remoteUserForUpload: String
let remotePortForUpload: Int
let remotePathForUpload: String
let urlForPushNotification: String?
}
}

View File

@ -111,7 +111,8 @@ extension GeneralSettings {
linkPreviewImageHeight: 630,
remoteUserForUpload: "user",
remotePortForUpload: 22,
remotePathForUpload: "/home/user/web")
remotePathForUpload: "/home/user/web",
urlForPushNotification: nil)
}
extension AudioPlayerSettings {