Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hacky way to fix destination not getting nilled on macOS 13+ #43

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -138,6 +138,7 @@ public struct Connect: Reducer {
case dismissTapped
case logInButtonTapped
case onAppear
case onDisappear // Hacky way to fix destination not getting nilled on macOS 13+
case select(Profile.ID)
case startAgainTapped
case updatePassword(String)
Expand Down Expand Up @@ -279,6 +280,9 @@ public struct Connect: Reducer {
// Auto connect if there is only a single profile or a reminder was tapped
return connect(state: &state, dryRun: true)

case .onDisappear:
return .none

case let .destination(.presented(.termsAlert(action))):
switch action {
case .agreeButtonTapped:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public struct ConnectView_Mac: View {
.onAppear {
viewStore.send(.onAppear)
}
.onDisappear {
// Hacky way to fix destination not getting nilled on macOS 13+
if #available(macOS 13.0, *) {
viewStore.send(.onDisappear)
}
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .center)
.alert(
store: store.scope(state: \.$destination, action: Connect.Action.destination),
Expand Down
5 changes: 5 additions & 0 deletions geteduroam/GeteduroamPackage/Sources/Main/MainFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public struct Main: Reducer {
state.destination = .connect(.init(organization: organization))
return .none

case .destination(.presented(.connect(.onDisappear))):
// Hacky way to fix destination not getting nilled on macOS 13+
state.destination = nil
return .none

case .destination:
return .none
}
Expand Down