Skip to content

Commit 3fa1930

Browse files
committed
Fix content filter sheet crash on macOS (closes #2371)
1 parent 293ed9d commit 3fa1930

File tree

9 files changed

+40
-10
lines changed

9 files changed

+40
-10
lines changed

IceCubesApp/App/Main/AppView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ struct AppView: View {
130130
}
131131
}
132132
.id(appAccountsManager.currentClient.id)
133-
.withSheetDestinations(sheetDestinations: $appRouterPath.presentedSheet)
133+
.withSheetDestinations(
134+
sheetDestinations: $appRouterPath.presentedSheet,
135+
routerPath: appRouterPath
136+
)
134137
.environment(\.selectedTabScrollToTop, selectedTabScrollToTop)
135138
}
136139

IceCubesApp/App/Router/AppRegistry.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,13 @@ extension View {
9696
}
9797
}
9898

99-
func withSheetDestinations(sheetDestinations: Binding<SheetDestination?>) -> some View {
99+
func withSheetDestinations(
100+
sheetDestinations: Binding<SheetDestination?>,
101+
routerPath: RouterPath
102+
) -> some View {
100103
sheet(item: sheetDestinations) { destination in
101-
switch destination {
104+
Group {
105+
switch destination {
102106
case .replyToStatusEditor(let status):
103107
StatusEditor.MainView(mode: .replyTo(status: status))
104108
.withEnvironments()
@@ -183,7 +187,9 @@ extension View {
183187
case .accountFiltersList:
184188
FiltersListView()
185189
.withEnvironments()
190+
}
186191
}
192+
.environment(routerPath)
187193
}
188194
}
189195

IceCubesApp/App/Tabs/ExploreTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ struct ExploreTab: View {
1818
NavigationStack(path: $routerPath.path) {
1919
ExploreView()
2020
.withAppRouter()
21-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
21+
.withSheetDestinations(
22+
sheetDestinations: $routerPath.presentedSheet,
23+
routerPath: routerPath
24+
)
2225
.toolbar {
2326
ToolbarTab(routerPath: $routerPath)
2427
}

IceCubesApp/App/Tabs/MessagesTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ struct MessagesTab: View {
2020
NavigationStack(path: $routerPath.path) {
2121
ConversationsListView()
2222
.withAppRouter()
23-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
23+
.withSheetDestinations(
24+
sheetDestinations: $routerPath.presentedSheet,
25+
routerPath: routerPath
26+
)
2427
.toolbar {
2528
ToolbarTab(routerPath: $routerPath)
2629
}

IceCubesApp/App/Tabs/NavigationTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ struct NavigationTab<Content: View>: View {
2727
content()
2828
.withEnvironments()
2929
.withAppRouter()
30-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
30+
.withSheetDestinations(
31+
sheetDestinations: $routerPath.presentedSheet,
32+
routerPath: routerPath
33+
)
3134
.withSafariRouter()
3235
.toolbar {
3336
ToolbarTab(routerPath: $routerPath)

IceCubesApp/App/Tabs/NotificationTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ struct NotificationsTab: View {
2929
NavigationStack(path: $routerPath.path) {
3030
NotificationsListView(lockedType: lockedType)
3131
.withAppRouter()
32-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
32+
.withSheetDestinations(
33+
sheetDestinations: $routerPath.presentedSheet,
34+
routerPath: routerPath
35+
)
3336
.toolbar {
3437
ToolbarItem(placement: .topBarTrailing) {
3538
Button {

IceCubesApp/App/Tabs/ProfileTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ struct ProfileTab: View {
2020
if let account = currentAccount.account {
2121
AccountDetailView(account: account)
2222
.withAppRouter()
23-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
23+
.withSheetDestinations(
24+
sheetDestinations: $routerPath.presentedSheet,
25+
routerPath: routerPath
26+
)
2427
.id(account.id)
2528
} else {
2629
AccountDetailView(account: .placeholder())

IceCubesApp/App/Tabs/Settings/SettingsTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ struct SettingsTabs: View {
6464
}
6565
}
6666
.withAppRouter()
67-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
67+
.withSheetDestinations(
68+
sheetDestinations: $routerPath.presentedSheet,
69+
routerPath: routerPath
70+
)
6871
.onAppear {
6972
startingPoint = RouterPath.settingsStartingPoint
7073
RouterPath.settingsStartingPoint = nil

IceCubesApp/App/Tabs/Timeline/TimelineTab.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ struct TimelineTab: View {
5050
canFilterTimeline: canFilterTimeline
5151
)
5252
.withAppRouter()
53-
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
53+
.withSheetDestinations(
54+
sheetDestinations: $routerPath.presentedSheet,
55+
routerPath: routerPath
56+
)
5457
.toolbar {
5558
toolbarView
5659
}

0 commit comments

Comments
 (0)