From 3e72c35d8ba5bf73c18f0d12a7a3d4667e2d1232 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Wed, 26 Aug 2026 11:42:33 -0700 Subject: [PATCH] feat(push-demo): add temporary action icons Signed-off-by: Tom Brow --- mobile/ios/Runner/PushNativeState.swift | 34 +++++++++++++------ .../BuzzCommunicationNotificationTests.swift | 11 ++++++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/mobile/ios/Runner/PushNativeState.swift b/mobile/ios/Runner/PushNativeState.swift index 5f66089b9b..4b26ccc588 100644 --- a/mobile/ios/Runner/PushNativeState.swift +++ b/mobile/ios/Runner/PushNativeState.swift @@ -73,10 +73,15 @@ enum BuzzPushNotificationResponseCoordinator { enum BuzzPushNotificationCategoryRegistrar { static func register(with center: UNUserNotificationCenter) { + center.setNotificationCategories([messageCategory()]) + } + + static func messageCategory() -> UNNotificationCategory { let reply = UNTextInputNotificationAction( identifier: BuzzPushNotificationActions.replyActionIdentifier, title: "Reply", options: [], + icon: UNNotificationActionIcon(systemImageName: "arrowshape.turn.up.left"), textInputButtonTitle: "Send", textInputPlaceholder: "Reply to Buzz" ) @@ -84,17 +89,16 @@ enum BuzzPushNotificationCategoryRegistrar { UNNotificationAction( identifier: preset.actionIdentifier, title: preset.actionTitle, - options: [] + options: [], + icon: UNNotificationActionIcon(systemImageName: preset.systemImageName) ) } - center.setNotificationCategories([ - UNNotificationCategory( - identifier: BuzzPushNotificationActions.messageCategoryIdentifier, - actions: [reply] + reminderActions, - intentIdentifiers: [], - options: [] - ) - ]) + return UNNotificationCategory( + identifier: BuzzPushNotificationActions.messageCategoryIdentifier, + actions: [reply] + reminderActions, + intentIdentifiers: [], + options: [] + ) } } @@ -127,8 +131,16 @@ enum BuzzPushReminderPreset: CaseIterable, Equatable { var actionTitle: String { switch self { case .oneHour: "Remind Me in 1 Hour" - case .tomorrowAt9AM: "Remind Me Tomorrow at 9 AM" - case .nextMondayAt9AM: "Remind Me Next Monday at 9 AM" + case .tomorrowAt9AM: "Remind Me Tomorrow" + case .nextMondayAt9AM: "Remind Me Next Week" + } + } + + var systemImageName: String { + switch self { + case .oneHour: "clock" + case .tomorrowAt9AM: "sun.max" + case .nextMondayAt9AM: "calendar" } } diff --git a/mobile/ios/RunnerTests/BuzzCommunicationNotificationTests.swift b/mobile/ios/RunnerTests/BuzzCommunicationNotificationTests.swift index a88dc3b5a4..1faebc47ba 100644 --- a/mobile/ios/RunnerTests/BuzzCommunicationNotificationTests.swift +++ b/mobile/ios/RunnerTests/BuzzCommunicationNotificationTests.swift @@ -217,6 +217,17 @@ final class BuzzPushSnapshotEnrichmentTests: XCTestCase { } final class BuzzPushNotificationResponseTests: XCTestCase { + func testMessageCategoryUsesConciseTitlesAndPublicActionIcons() { + let category = BuzzPushNotificationCategoryRegistrar.messageCategory() + + XCTAssertEqual(category.identifier, BuzzPushNotificationActions.messageCategoryIdentifier) + XCTAssertEqual( + category.actions.map(\.title), + ["Reply", "Remind Me in 1 Hour", "Remind Me Tomorrow", "Remind Me Next Week"] + ) + XCTAssertTrue(category.actions.allSatisfy { $0.icon != nil }) + } + func testBackgroundCompletionReturnsToMainThreadExactlyOnce() { let completed = expectation(description: "completion returned on main thread") var completionCount = 0