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

@ -41,6 +41,9 @@ struct MainView: App {
@StateObject
private var upload: RemotePush = .init()
@StateObject
private var notifications: NotificationSender = .init()
@State
private var language: ContentLanguage = .english
@ -68,6 +71,9 @@ struct MainView: App {
@State
private var showUploadSheet = false
@State
private var showNotificationsSheet = false
@ViewBuilder
var sidebar: some View {
switch selection.tab {
@ -188,6 +194,11 @@ struct MainView: App {
Image(systemSymbol: .squareAndArrowUp)
}
}
ToolbarItem {
Button(action: { showNotificationsSheet = true }) {
Image(systemSymbol: .bell)
}
}
ToolbarItem {
Button(action: saveButtonPressed) {
Image(systemSymbol: content.saveState.symbol)
@ -235,6 +246,11 @@ struct MainView: App {
.environmentObject(content)
.environmentObject(upload)
}
.sheet(isPresented: $showNotificationsSheet) {
NotificationSheet()
.environmentObject(content)
.environmentObject(notifications)
}
}
}