Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
012885e
feat(ios): add workspace-only bottom search
Jul 22, 2026
8288249
fix(ios): use native toolbar workspace search
Jul 22, 2026
2c2287b
fix(ios): integrate workspace search with tab bar
Jul 22, 2026
7c71bab
test(ios): cover persistent contextual search
azooz2003-bit Jul 23, 2026
eaecf92
fix(ios): keep search stable across primary tabs
azooz2003-bit Jul 23, 2026
1141f72
Merge remote-tracking branch 'origin/main' into task-ios-workspace-bo…
azooz2003-bit Jul 23, 2026
2fa4df3
test(ios): focus notification search assertion
azooz2003-bit Jul 23, 2026
4dc5f9e
fix(ios): make notification search resilient
azooz2003-bit Jul 23, 2026
4022dcb
fix(ios): close contextual search review feedback
azooz2003-bit Jul 23, 2026
9755d32
fix(ios): stabilize contextual search state
azooz2003-bit Jul 25, 2026
ade0028
merge origin/main into iOS search tab PR
azooz2003-bit Jul 25, 2026
763e9cb
fix(ios): preserve search query across submit cleanup
azooz2003-bit Jul 25, 2026
eb0daa9
fix(ios): address search review lifecycle
azooz2003-bit Jul 25, 2026
7e60ac7
fix(ios): isolate search state and projection work
azooz2003-bit Jul 25, 2026
425aa01
fix(ios): split search content from root lifecycle
azooz2003-bit Jul 25, 2026
64c1eb4
fix(ios): guard search activation ownership
azooz2003-bit Jul 25, 2026
97736d2
fix(ios): deactivate search before result navigation
azooz2003-bit Jul 25, 2026
64a4038
fix(ios): preserve search result navigation ownership
azooz2003-bit Jul 25, 2026
65237a8
fix(ios): keep notification search open until commit
azooz2003-bit Jul 25, 2026
7b7d607
fix(ios): isolate notification search navigation path
azooz2003-bit Jul 25, 2026
4e8a3c0
fix(ios): show workspace action failures from search
azooz2003-bit Jul 25, 2026
37824d9
fix(ios): bound notification feed search source
azooz2003-bit Jul 25, 2026
db74dcf
fix(ios): stabilize retained notification feed revisions
azooz2003-bit Jul 25, 2026
2264ffc
fix(ios): bound notification feed aggregation work
azooz2003-bit Jul 25, 2026
3afa599
fix(ios): keep notification feed persistence loadable
azooz2003-bit Jul 25, 2026
bdc7b37
fix(ios): bound notification feed wire recovery
azooz2003-bit Jul 25, 2026
390c94c
fix(ios): preserve bounded notification feed revisions
azooz2003-bit Jul 25, 2026
44efeb1
fix(ios): make notification feed recovery transactional
azooz2003-bit Jul 25, 2026
eafedd0
fix(ios): bound notification feed recovery scan
azooz2003-bit Jul 25, 2026
1d9bb7c
fix(ios): isolate search drafts and recovery metadata
azooz2003-bit Jul 25, 2026
03d0755
fix(ios): align notification feed quarantine naming
azooz2003-bit Jul 25, 2026
e370d33
fix(ios): bound notification feed history text
azooz2003-bit Jul 25, 2026
85582f3
fix(ios): bound notification feed ingress recovery
azooz2003-bit Jul 25, 2026
7d3e771
fix(ios): coalesce notification feed persistence
azooz2003-bit Jul 25, 2026
faed67e
fix(ios): parse notification feed history metadata safely
azooz2003-bit Jul 25, 2026
67a54ca
fix(ios): recover oversized notification feed metadata from tail
azooz2003-bit Jul 25, 2026
1b8879d
fix(ios): retain notification feed projections during rebuild
azooz2003-bit Jul 25, 2026
3c83691
fix(ios): disable stale notification rows during source rebuild
azooz2003-bit Jul 25, 2026
952050f
fix(ios): bound notification feed migration and decode
azooz2003-bit Jul 25, 2026
648c094
fix(ios): fail closed on oversized feed edge cases
azooz2003-bit Jul 25, 2026
7201cae
fix(ios): cancel notification feed decode workers
azooz2003-bit Jul 25, 2026
5c946a9
fix(ios): cap notification search source state
azooz2003-bit Jul 25, 2026
228883f
fix(ios): normalize primary search queries
azooz2003-bit Jul 25, 2026
210cca0
fix(ios): preserve editable search drafts
azooz2003-bit Jul 25, 2026
d418d55
fix(ios): preserve filtered notification empty states
azooz2003-bit Jul 25, 2026
916ea31
fix(mac): retire oversized history quarantines
azooz2003-bit Jul 25, 2026
b49f210
fix(ios): route notification links by search scope
azooz2003-bit Jul 25, 2026
a6310c3
fix(ios): preserve notification source tails
azooz2003-bit Jul 25, 2026
2dfd323
fix(mac): fit notification feed frames in one pass
azooz2003-bit Jul 25, 2026
484bdc7
fix(ios): aggregate scoped notification feeds
azooz2003-bit Jul 25, 2026
8ec3425
fix(mac): recover oversized history scan exhaustion
azooz2003-bit Jul 25, 2026
dfd88bd
fix(ios): target notification feed bulk scope
azooz2003-bit Jul 25, 2026
e044eab
fix(ios): satisfy notification search policy gates
azooz2003-bit Jul 25, 2026
73331dc
fix(ios): ignore initial native search cleanup
azooz2003-bit Jul 25, 2026
0304d5f
fix(ios): use native task composer toolbar on iOS 26
azooz2003-bit Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,312 @@
import CmuxMobileSupport
import SwiftUI

/// The two first-class destinations in the mobile app.
/// The mobile app's primary destinations and transient search selection.
enum MobilePrimaryTab: Hashable {
case workspaces
case notifications
case search
}

/// The searchable primary destination that owns the persistent search tab.
///
/// New primary tabs must explicitly choose whether they introduce a search
/// scope or preserve the most recent searchable destination.
private enum MobilePrimarySearchScope: Equatable {
case workspaces
case notifications
}

private enum MobilePrimarySearchPhase: Equatable {
case inactive
case active(MobilePrimarySearchScope)
case deactivating(MobilePrimarySearchScope)
}

private struct MobilePrimaryPendingEmptyCommit: Equatable {
let scope: MobilePrimarySearchScope
let previousCommittedQuery: String
}

private extension MobilePrimaryTab {
var searchScope: MobilePrimarySearchScope? {
switch self {
case .workspaces:
.workspaces
case .notifications:
.notifications
case .search:
nil
}
}
}

/// Native primary navigation shared by the live shell and deterministic UI
/// fixtures. Keeping the tab construction here guarantees that previews exercise
/// the same labels, symbols, badge behavior, and selection semantics as the app.
struct MobilePrimaryTabScaffold<Workspaces: View, Notifications: View>: View {
@Binding var selection: MobilePrimaryTab
@Binding var workspaceSearchText: String
@Binding var notificationSearchText: String
@State private var searchScope: MobilePrimarySearchScope
@State private var isSearchPresented = false
@State private var searchPhase: MobilePrimarySearchPhase = .inactive
@State private var workspaceNativeSearchText = ""
@State private var notificationNativeSearchText = ""
@State private var pendingEmptyCommit: MobilePrimaryPendingEmptyCommit?
let notificationUnreadCount: Int
let workspaces: Workspaces
let notifications: Notifications

init(
selection: Binding<MobilePrimaryTab>,
workspaceSearchText: Binding<String>,
notificationSearchText: Binding<String>,
notificationUnreadCount: Int,
@ViewBuilder workspaces: () -> Workspaces,
@ViewBuilder notifications: () -> Notifications
) {
_selection = selection
_workspaceSearchText = workspaceSearchText
_notificationSearchText = notificationSearchText
_searchScope = State(initialValue: selection.wrappedValue.searchScope ?? .workspaces)
self.notificationUnreadCount = notificationUnreadCount
self.workspaces = workspaces()
self.notifications = notifications()
}

var body: some View {
TabView(selection: $selection) {
Tab(value: MobilePrimaryTab.workspaces) {
workspaces
} label: {
Label(
L10n.string("mobile.tabs.workspaces", defaultValue: "Workspaces"),
systemImage: "rectangle.stack"
)
.accessibilityIdentifier("MobilePrimaryTabWorkspaces")
if #available(iOS 26.0, *) {
TabView(selection: tabSelection) {
primaryTabs

Tab(value: MobilePrimaryTab.search, role: .search) {
searchDestination
}
.accessibilityIdentifier("MobilePrimaryTabSearch")
}
.searchable(
text: activeSearchText,
isPresented: searchPresentation,
prompt: activeSearchPrompt
)
.tabViewSearchActivation(.searchTabSelection)
.accessibilityIdentifier("MobilePrimaryTabs")
.onChange(of: selection, initial: true) { _, selection in
guard let scope = selection.searchScope else { return }
searchScope = scope
syncNativeSearchText(fromCommittedQueryFor: scope)
}
} else {
TabView(selection: $selection) {
primaryTabs
}
.accessibilityIdentifier("MobilePrimaryTabs")
}
}

private var tabSelection: Binding<MobilePrimaryTab> {
Binding(
get: { selection },
set: { newValue in
if selection == .search, newValue.searchScope != nil {
beginSearchDeactivation(for: searchScope)
}
selection = newValue
}
)
}

Tab(value: MobilePrimaryTab.notifications) {
notifications
} label: {
Label(
L10n.string("mobile.tabs.notifications", defaultValue: "Notifications"),
systemImage: "bell"
private var searchPresentation: Binding<Bool> {
Binding(
get: { isSearchPresented },
set: { presented in
if isSearchPresented, !presented {
beginSearchDeactivation(for: searchScope)
}
isSearchPresented = presented
if presented {
searchPhase = .active(searchScope)
resolvePendingEmptyCommitIfNeeded(for: searchScope)
if pendingEmptyCommit == nil {
syncNativeSearchText(fromCommittedQueryFor: searchScope)
}
}
}
)
}

@ViewBuilder
private var searchDestination: some View {
switch searchScope {
case .workspaces:
workspaces
.modifier(MobilePrimarySearchLifecycleModifier(
scope: .workspaces,
update: updateSearchLifecycle
))
case .notifications:
notifications
.modifier(MobilePrimarySearchLifecycleModifier(
scope: .notifications,
update: updateSearchLifecycle
))
}
}

private var activeSearchText: Binding<String> {
return Binding(
get: { nativeSearchText(for: searchScope) },
set: { value in
commitNativeSearchText(value, for: searchScope)
}
)
}

private var activeSearchPrompt: Text {
switch searchScope {
case .workspaces:
Text(
L10n.string(
"mobile.workspaces.search.placeholder",
defaultValue: "Search workspaces"
)
.accessibilityIdentifier("MobilePrimaryTabNotifications")
)
case .notifications:
Text(
L10n.string(
"mobile.notificationFeed.search.placeholder",
defaultValue: "Search notifications"
)
)
}
}

private func nativeSearchText(for scope: MobilePrimarySearchScope) -> String {
switch scope {
case .workspaces:
workspaceNativeSearchText
case .notifications:
notificationNativeSearchText
}
}

private func committedSearchText(for scope: MobilePrimarySearchScope) -> String {
switch scope {
case .workspaces:
workspaceSearchText
case .notifications:
notificationSearchText
}
}

private func setNativeSearchText(_ value: String, for scope: MobilePrimarySearchScope) {
switch scope {
case .workspaces:
workspaceNativeSearchText = value
case .notifications:
notificationNativeSearchText = value
}
}

private func setCommittedSearchText(_ value: String, for scope: MobilePrimarySearchScope) {
switch scope {
case .workspaces:
workspaceSearchText = value
case .notifications:
notificationSearchText = value
}
}

private func syncNativeSearchText(fromCommittedQueryFor scope: MobilePrimarySearchScope) {
setNativeSearchText(committedSearchText(for: scope), for: scope)
}

private func commitNativeSearchText(_ value: String, for scope: MobilePrimarySearchScope) {
setNativeSearchText(value, for: scope)
guard value.isEmpty, !committedSearchText(for: scope).isEmpty else {
pendingEmptyCommit = nil
setCommittedSearchText(value, for: scope)
return
}
pendingEmptyCommit = MobilePrimaryPendingEmptyCommit(
scope: scope,
previousCommittedQuery: committedSearchText(for: scope)
)
}

private func updateSearchLifecycle(scope: MobilePrimarySearchScope, isSearching: Bool) {
if isSearching {
searchPhase = .active(scope)
resolvePendingEmptyCommitIfNeeded(for: scope)
if pendingEmptyCommit == nil {
syncNativeSearchText(fromCommittedQueryFor: scope)
}
.badge(notificationUnreadCount)
} else if searchPhase == .active(scope) {
beginSearchDeactivation(for: scope)
}
.accessibilityIdentifier("MobilePrimaryTabs")
}

private func beginSearchDeactivation(for scope: MobilePrimarySearchScope) {
searchPhase = .deactivating(scope)
pendingEmptyCommit = nil
syncNativeSearchText(fromCommittedQueryFor: scope)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Clear action gets reverted

When the user clears a non-empty query and then dismisses search, commitNativeSearchText leaves the clear in pendingEmptyCommit. This deactivation path deletes that pending change and copies the old committed query back into the native field. Reopening search therefore restores the query the user explicitly cleared. The lifecycle state needs to preserve queries on presentation-only dismissal without treating a user clear as presentation cleanup.

Rule Used: Flag Swift fixes that patch symptoms while leaving... (source)


private func resolvePendingEmptyCommitIfNeeded(for scope: MobilePrimarySearchScope) {
guard
pendingEmptyCommit == MobilePrimaryPendingEmptyCommit(
scope: scope,
previousCommittedQuery: committedSearchText(for: scope)
),
searchPhase == .active(scope),
nativeSearchText(for: scope).isEmpty
else {
return
}
pendingEmptyCommit = nil
setCommittedSearchText("", for: scope)
}

@TabContentBuilder<MobilePrimaryTab>
private var primaryTabs: some TabContent<MobilePrimaryTab> {
Tab(value: MobilePrimaryTab.workspaces) {
workspaces
} label: {
Label(
L10n.string("mobile.tabs.workspaces", defaultValue: "Workspaces"),
systemImage: "rectangle.stack"
)
.accessibilityIdentifier("MobilePrimaryTabWorkspaces")
}

Tab(value: MobilePrimaryTab.notifications) {
notifications
} label: {
Label(
L10n.string("mobile.tabs.notifications", defaultValue: "Notifications"),
systemImage: "bell"
)
.accessibilityIdentifier("MobilePrimaryTabNotifications")
}
.badge(notificationUnreadCount)
}
}

private struct MobilePrimarySearchLifecycleModifier: ViewModifier {
@Environment(\.isSearching) private var isSearching

let scope: MobilePrimarySearchScope
let update: (MobilePrimarySearchScope, Bool) -> Void

func body(content: Content) -> some View {
content
.onChange(of: isSearching, initial: true) { _, isSearching in
update(scope, isSearching)
}
.onDisappear {
update(scope, false)
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import SwiftUI
/// verification. It mounts the production tab scaffold and production feed.
public struct NotificationFeedPreviewView: View {
@State private var selectedTab: MobilePrimaryTab = .notifications
@State private var workspaceSearchText = ""
@State private var notificationSearchText = ""
@State private var items: [MobileNotificationFeedItem]
@State private var projection = NotificationFeedProjection()
@State private var notificationNavigationPath: [MobileWorkspacePreview.ID] = []
@State private var macSelection: WorkspaceMacSelection = .all

Expand All @@ -19,6 +22,8 @@ public struct NotificationFeedPreviewView: View {
GeometryReader { geometry in
MobilePrimaryTabScaffold(
selection: $selectedTab,
workspaceSearchText: $workspaceSearchText,
notificationSearchText: $notificationSearchText,
notificationUnreadCount: items.lazy.filter { !$0.isRead }.count
) {
NotificationFeedPreviewWorkspacesView()
Expand All @@ -27,6 +32,8 @@ public struct NotificationFeedPreviewView: View {
NotificationFeedView(
items: items,
status: .ready,
searchText: notificationSearchText,
projection: projection,
actions: actions
)
.toolbar {
Expand Down
Loading