Live Activities, nudging, unit tests

This commit is contained in:
2026-04-20 11:11:24 +02:00
parent 3858500a45
commit 7e25a4f978
15 changed files with 348 additions and 20 deletions
@@ -13,6 +13,7 @@ private let syncLogger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "Mobi
struct MainTabView: View {
@Environment(MAService.self) private var service
@Environment(MAStoreManager.self) private var storeManager
@Environment(\.scenePhase) private var scenePhase
@State private var selectedTab: String = "library"
@@ -40,6 +41,7 @@ struct MainTabView: View {
Tab("Settings", systemImage: "gear", value: "settings") {
SettingsView()
}
.badge(storeManager.hasEverSupported ? Text("") : nil)
}
.withToast()
.task {
@@ -597,6 +599,7 @@ struct SettingsView: View {
@Environment(MAStoreManager.self) private var storeManager
@State private var showThankYou = false
@State private var showClearCacheConfirm = false
@AppStorage("liveActivityEnabled") private var liveActivityEnabled = true
var body: some View {
NavigationStack {
@@ -679,6 +682,22 @@ struct SettingsView: View {
Text("Connection")
}
// Now Playing Section
Section {
Toggle(isOn: $liveActivityEnabled) {
Label("Lock Screen & Dynamic Island", systemImage: "music.note.list")
}
.onChange(of: liveActivityEnabled) { _, enabled in
if !enabled {
service.playerManager.liveActivityManager.end()
}
}
} header: {
Text("Now Playing")
} footer: {
Text("Shows the current track on the Lock Screen and in the Dynamic Island.")
}
// Actions Section
Section {
Button(role: .destructive) {
@@ -698,6 +717,20 @@ struct SettingsView: View {
// Support Development Section
Section {
// Supporter badge row
if storeManager.hasEverSupported {
HStack(spacing: 10) {
Image(systemName: "star.fill")
.foregroundStyle(.orange)
Text("Supporter")
.font(.body.weight(.semibold))
.foregroundStyle(.orange)
Spacer()
Text("Thank you! ♥")
.font(.subheadline)
.foregroundStyle(.secondary)
}
}
if let loadError = storeManager.loadError {
Label(loadError, systemImage: "exclamationmark.triangle")
.font(.caption)