diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 458ea7d..5ec44e6 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -22,6 +22,7 @@ jobs: name: Build and Test Swift Package iOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' scheme: SpeziNotifications-Package resultBundle: SpeziNotifications-iOS.xcresult artifactname: SpeziNotifications-iOS.xcresult @@ -29,6 +30,7 @@ jobs: name: Build and Test Swift Package watchOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' scheme: SpeziNotifications-Package destination: 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)' resultBundle: SpeziNotifications-watchOS.xcresult @@ -37,6 +39,7 @@ jobs: name: Build and Test Swift Package visionOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' scheme: SpeziNotifications-Package destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: SpeziNotifications-visionOS.xcresult @@ -45,6 +48,7 @@ jobs: name: Build and Test Swift Package tvOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' scheme: SpeziNotifications-Package resultBundle: SpeziNotifications-tvOS.xcresult destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' @@ -53,6 +57,7 @@ jobs: name: Build and Test Swift Package macOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' scheme: SpeziNotifications-Package resultBundle: SpeziNotifications-macOS.xcresult destination: 'platform=macOS,arch=arm64' @@ -61,6 +66,7 @@ jobs: name: Build and Test iOS uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 with: + runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp resultBundle: TestApp-iOS.xcresult diff --git a/.spi.yml b/.spi.yml index 506f8e0..0a55c66 100644 --- a/.spi.yml +++ b/.spi.yml @@ -12,3 +12,5 @@ builder: - platform: ios documentation_targets: - SpeziNotifications + - XCTSpeziNotifications + - XCTSpeziNotificationsUI diff --git a/Sources/SpeziNotifications/Misc/BackgroundFetchResult.swift b/Sources/SpeziNotifications/Misc/BackgroundFetchResult.swift index 0184743..6c638fe 100644 --- a/Sources/SpeziNotifications/Misc/BackgroundFetchResult.swift +++ b/Sources/SpeziNotifications/Misc/BackgroundFetchResult.swift @@ -6,5 +6,7 @@ // SPDX-License-Identifier: MIT // +#if os(iOS) || os(visionOS) || os(tvOS) || os(watchOS) // BackgroundFetchResult type-alias is currently defined in Spezi. Once Spezi removes it and makes a breaking change, we can move it to this package. @_exported import typealias Spezi.BackgroundFetchResult +#endif diff --git a/Sources/XCTSpeziNotifications/XCUIApplication+AuthorizationAlert.swift b/Sources/XCTSpeziNotifications/XCUIApplication+AuthorizationAlert.swift index a176b9a..d5263a6 100644 --- a/Sources/XCTSpeziNotifications/XCUIApplication+AuthorizationAlert.swift +++ b/Sources/XCTSpeziNotifications/XCUIApplication+AuthorizationAlert.swift @@ -20,6 +20,7 @@ extension XCUIApplication { /// Confirm the notification authorization dialog. /// - Parameter action: The action to confirm the alert with. + @available(tvOS, unavailable) public func confirmNotificationAuthorization(action: NotificationAuthorizationAction = .allow) { let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") diff --git a/Sources/XCTSpeziNotificationsUI/NotificationRequestLabel.swift b/Sources/XCTSpeziNotificationsUI/NotificationRequestLabel.swift index b0907f0..62458c8 100644 --- a/Sources/XCTSpeziNotificationsUI/NotificationRequestLabel.swift +++ b/Sources/XCTSpeziNotificationsUI/NotificationRequestLabel.swift @@ -22,8 +22,12 @@ struct NotificationRequestLabel: View { NotificationRequestView(request) } label: { VStack(alignment: .leading) { +#if os(tvOS) + Text("Notification", bundle: .module) +#else Text(request.content.title) .bold() +#endif if let trigger = request.trigger, let nextDate = trigger.nextDate() { NotificationTriggerLabel(nextDate) diff --git a/Sources/XCTSpeziNotificationsUI/NotificationRequestView.swift b/Sources/XCTSpeziNotificationsUI/NotificationRequestView.swift index 97c2db1..638ab3b 100644 --- a/Sources/XCTSpeziNotificationsUI/NotificationRequestView.swift +++ b/Sources/XCTSpeziNotificationsUI/NotificationRequestView.swift @@ -20,27 +20,32 @@ public struct NotificationRequestView: View { public var body: some View { List { - content - - delivery - - trigger - Section { LabeledContent { Text(request.identifier) } label: { Text("Identifier", bundle: .module) } - .accessibilityElement(children: .combine) + .accessibilityElement(children: .combine) } + +#if !os(tvOS) + content +#endif + + delivery + + trigger } +#if !os(tvOS) .navigationTitle(request.content.title) #if !os(macOS) .navigationBarTitleDisplayMode(.inline) +#endif #endif } + @available(tvOS, unavailable) @ViewBuilder private var content: some View { Section { // swiftlint:disable:this closure_body_length LabeledContent { @@ -90,12 +95,14 @@ public struct NotificationRequestView: View { @ViewBuilder private var delivery: some View { Section { +#if !os(tvOS) LabeledContent { Text(request.content.sound != nil ? "Yes" : "No", bundle: .module) } label: { Text("Sound", bundle: .module) } .accessibilityElement(children: .combine) +#endif LabeledContent { Text(request.content.interruptionLevel.description) diff --git a/Sources/XCTSpeziNotificationsUI/NotificationsView.swift b/Sources/XCTSpeziNotificationsUI/NotificationsView.swift index 706b4bd..fdd9d95 100644 --- a/Sources/XCTSpeziNotificationsUI/NotificationsView.swift +++ b/Sources/XCTSpeziNotificationsUI/NotificationsView.swift @@ -36,7 +36,12 @@ public struct NotificationsView: View { await queryAuthorization() authorizationAction() } label: { - Label("Request Notification Authorization", systemImage: "alarm.waves.left.and.right.fill") + Label { + Text("Request Notification Authorization", bundle: .module) + } icon: { + Image(systemName: "alarm.waves.left.and.right.fill") + .accessibilityHidden(true) + } } } } diff --git a/Sources/XCTSpeziNotificationsUI/Resources/Localizable.xcstrings b/Sources/XCTSpeziNotificationsUI/Resources/Localizable.xcstrings index e399d8f..6905b26 100644 --- a/Sources/XCTSpeziNotificationsUI/Resources/Localizable.xcstrings +++ b/Sources/XCTSpeziNotificationsUI/Resources/Localizable.xcstrings @@ -11,17 +11,6 @@ } } }, - "active" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "active" - } - } - } - }, "Body" : { "localizations" : { "en" : { @@ -62,17 +51,6 @@ } } }, - "critical" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "critical" - } - } - } - }, "Delivery" : { "localizations" : { "en" : { @@ -173,13 +151,12 @@ } } }, - "passive" : { - "extractionState" : "stale", + "Notification" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "passive" + "value" : "Notification" } } } @@ -215,45 +192,41 @@ } }, "Request Notification Authorization" : { - - }, - "Sound" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Sound" + "value" : "Request Notification Authorization" } } } }, - "Subtitle" : { + "Sound" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Subtitle" + "value" : "Sound" } } } }, - "Thread" : { + "Subtitle" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Thread" + "value" : "Subtitle" } } } }, - "timeSensitive" : { - "extractionState" : "stale", + "Thread" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "timeSensitive" + "value" : "Thread" } } } @@ -298,17 +271,6 @@ } } }, - "unknown(%llu)" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "unknown(%llu)" - } - } - } - }, "Yes" : { "localizations" : { "en" : { diff --git a/Sources/XCTSpeziNotificationsUI/UNNotificationTrigger+Extensions.swift b/Sources/XCTSpeziNotificationsUI/UNNotificationTrigger+Extensions.swift index 45bacfc..1af858e 100644 --- a/Sources/XCTSpeziNotificationsUI/UNNotificationTrigger+Extensions.swift +++ b/Sources/XCTSpeziNotificationsUI/UNNotificationTrigger+Extensions.swift @@ -19,7 +19,7 @@ extension UNNotificationTrigger { } else if self is UNPushNotificationTrigger { LocalizedStringResource("Push", bundle: .atURL(from: .module)) } else { -#if !os(visionOS) && !os(macOS) +#if !os(visionOS) && !os(macOS) && !os(tvOS) if self is UNLocationNotificationTrigger { LocalizedStringResource("Location", bundle: .atURL(from: .module)) } else {