Skip to content

Commit c22fd6e

Browse files
committed
Fix missing actions on StackTab
1 parent 16e2a4e commit c22fd6e

File tree

3 files changed

+43
-35
lines changed

3 files changed

+43
-35
lines changed

Modules/Sources/AppFeature/Navigation/ProfileFlow/ProfileFlow.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public struct ProfileTab: View {
3131
public var body: some View {
3232
WithPerceptionTracking {
3333
switch store.case {
34-
case let .loggedIn(store),
35-
let .loggedOut(store):
34+
case let .loggedIn(store):
35+
StackTabView(store: store)
36+
case let .loggedOut(store):
3637
StackTabView(store: store)
3738
}
3839
}

Modules/Sources/AuthFeature/AuthScreen.swift

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -158,35 +158,8 @@ public struct AuthScreen: View {
158158
}
159159
}
160160
._toolbarTitleDisplayMode(.inline)
161-
.toolbar {
162-
// Profile is used as root in this case so we don't need close button
163-
if store.openReason != .profile {
164-
ToolbarItem(placement: .topBarTrailing) {
165-
if #available(iOS 26, *) {
166-
Button(role: .close) {
167-
send(.closeButtonTapped)
168-
}
169-
} else {
170-
Button {
171-
send(.closeButtonTapped)
172-
} label: {
173-
Text("Close", bundle: .module)
174-
.foregroundStyle(tintColor)
175-
}
176-
}
177-
}
178-
}
179-
180-
// We're showing app settings only if it's opened from profile tab
181-
if store.openReason == .profile {
182-
ToolbarItem(placement: .topBarTrailing) {
183-
Button {
184-
send(.settingsButtonTapped)
185-
} label: {
186-
Image(systemSymbol: .gearshape)
187-
}
188-
}
189-
}
161+
.toolbar(id: "auth_toolbar") {
162+
ToolbarButtons()
190163
}
191164
.alert($store.scope(state: \.alert, action: \.alert))
192165
.bind($store.focus, to: $focus)
@@ -208,6 +181,40 @@ public struct AuthScreen: View {
208181
}
209182
}
210183

184+
// MARK: - Toolbar Buttons
185+
186+
@ToolbarContentBuilder
187+
private func ToolbarButtons() -> some CustomizableToolbarContent {
188+
// Profile is used as root in this case so we don't need close button
189+
if store.openReason != .profile {
190+
ToolbarItem(id: "auth_close_button", placement: .topBarTrailing) {
191+
if #available(iOS 26, *) {
192+
Button(role: .close) {
193+
send(.closeButtonTapped)
194+
}
195+
} else {
196+
Button {
197+
send(.closeButtonTapped)
198+
} label: {
199+
Text("Close", bundle: .module)
200+
.foregroundStyle(tintColor)
201+
}
202+
}
203+
}
204+
}
205+
206+
// We're showing app settings only if it's opened from profile tab
207+
if store.openReason == .profile {
208+
ToolbarItem(id: "auth_settings_button", placement: .topBarTrailing) {
209+
Button {
210+
send(.settingsButtonTapped)
211+
} label: {
212+
Image(systemSymbol: .gearshape)
213+
}
214+
}
215+
}
216+
}
217+
211218
// MARK: - Field
212219

213220
@ViewBuilder

Modules/Sources/ProfileFeature/ProfileScreen.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public struct ProfileScreen: View {
7070
.alert($store.scope(state: \.destination?.alert, action: \.destination.alert))
7171
.navigationTitle(Text("Profile", bundle: .module))
7272
._toolbarTitleDisplayMode(.large)
73-
.toolbar {
73+
.toolbar(id: "profile_toolbar") {
7474
ToolbarButtons()
7575
}
7676
.onAppear {
@@ -82,9 +82,9 @@ public struct ProfileScreen: View {
8282
// MARK: - Toolbar Items
8383

8484
@ToolbarContentBuilder
85-
private func ToolbarButtons() -> some ToolbarContent {
85+
private func ToolbarButtons() -> some CustomizableToolbarContent {
8686
if store.shouldShowToolbarButtons {
87-
ToolbarItem {
87+
ToolbarItem(id: "profile_logout_button") {
8888
Button {
8989
send(.logoutButtonTapped)
9090
} label: {
@@ -96,7 +96,7 @@ public struct ProfileScreen: View {
9696
ToolbarSpacer(.fixed)
9797
}
9898

99-
ToolbarItem {
99+
ToolbarItem(id: "profile_settings_button") {
100100
Button {
101101
send(.settingsButtonTapped)
102102
} label: {

0 commit comments

Comments
 (0)