mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-26 01:32:13 +00:00
Fix modals not re-appearing in iOS 16
- Paywall - Error handler Expose setLater/enableLater.
This commit is contained in:
parent
a92c2c2c64
commit
4fcac3c95a
@ -187,7 +187,10 @@ extension AppCoordinator {
|
||||
present(.editProviderEntity($0, pair.module, pair.selection))
|
||||
},
|
||||
onPurchaseRequired: {
|
||||
paywallReason = .init($0, needsConfirmation: true)
|
||||
// FIXME: #951, use of setLater/enableLater
|
||||
setLater(.init($0, needsConfirmation: true)) {
|
||||
paywallReason = $0
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -279,7 +282,7 @@ extension AppCoordinator {
|
||||
|
||||
func present(_ route: ModalRoute?) {
|
||||
|
||||
// XXX: this is a workaround for #791 on iOS 16
|
||||
// FIXME: #951, use of setLater/enableLater
|
||||
setLater(route) {
|
||||
modalRoute = $0
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ private struct ToggleButton: View {
|
||||
.scaleEffect(1.5, anchor: .trailing)
|
||||
}
|
||||
)
|
||||
// TODO: #584, necessary to avoid cell selection
|
||||
// XXX: #584, necessary to avoid cell selection
|
||||
.buttonStyle(.plain)
|
||||
.foregroundStyle(tunnel.statusColor(theme))
|
||||
.opaque(isOpaque)
|
||||
|
@ -37,7 +37,7 @@ struct ProfileInfoButton: View {
|
||||
} label: {
|
||||
ThemeImage(.info)
|
||||
}
|
||||
// TODO: #584, necessary to avoid cell selection
|
||||
// XXX: #584, necessary to avoid cell selection
|
||||
.buttonStyle(.borderless)
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ private extension ProfileRowView {
|
||||
ThemeImage(.moreDetails)
|
||||
.imageScale(.large)
|
||||
}
|
||||
// TODO: #584, necessary to avoid cell selection
|
||||
// XXX: #584, necessary to avoid cell selection
|
||||
#if os(iOS)
|
||||
.menuStyle(.borderlessButton)
|
||||
#else
|
||||
|
@ -51,7 +51,10 @@ public final class ErrorHandler: ObservableObject {
|
||||
message: composedMessage,
|
||||
dismissAction: onDismiss
|
||||
)
|
||||
isPresented = true
|
||||
// FIXME: #951, use of setLater/enableLater
|
||||
enableLater {
|
||||
self.isPresented = $0
|
||||
}
|
||||
}
|
||||
|
||||
public func handle(title: String, message: String, onDismiss: (() -> Void)? = nil) {
|
||||
@ -60,7 +63,10 @@ public final class ErrorHandler: ObservableObject {
|
||||
message: message,
|
||||
dismissAction: onDismiss
|
||||
)
|
||||
isPresented = true
|
||||
// FIXME: #951, use of setLater/enableLater
|
||||
enableLater {
|
||||
self.isPresented = $0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,6 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
public func setLater<T>(_ value: T?, millis: Int = 50, block: @escaping (T?) -> Void) {
|
||||
globalSetLater(value, millis: millis, block: block)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
public func `if`(_ condition: Bool) -> some View {
|
||||
if condition {
|
||||
@ -88,13 +84,19 @@ extension ViewModifier {
|
||||
Self._printChanges()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func setLater<T>(_ value: T?, millis: Int = 50, block: @escaping (T?) -> Void) {
|
||||
globalSetLater(value, millis: millis, block: block)
|
||||
@MainActor
|
||||
public func enableLater(millis: Int = 50, block: @escaping (Bool) -> Void) {
|
||||
Task {
|
||||
block(false)
|
||||
try await Task.sleep(for: .milliseconds(millis))
|
||||
block(true)
|
||||
}
|
||||
}
|
||||
|
||||
private func globalSetLater<T>(_ value: T?, millis: Int = 50, block: @escaping (T?) -> Void) {
|
||||
@MainActor
|
||||
public func setLater<T>(_ value: T?, millis: Int = 50, block: @escaping (T?) -> Void) {
|
||||
Task {
|
||||
block(nil)
|
||||
try await Task.sleep(for: .milliseconds(millis))
|
||||
|
@ -120,7 +120,12 @@ extension Theme.ImageName {
|
||||
case .tunnelRestart: return "arrow.clockwise"
|
||||
case .tunnelToggle: return "power"
|
||||
case .tunnelUninstall: return "arrow.uturn.down"
|
||||
case .tvOff: return "tv.slash"
|
||||
case .tvOff:
|
||||
if #available(iOS 17, macOS 14, tvOS 17, *) {
|
||||
return "tv.slash"
|
||||
} else {
|
||||
return "tv"
|
||||
}
|
||||
case .tvOn: return "tv"
|
||||
case .upgrade: return "arrow.up.circle"
|
||||
case .warning: return "exclamationmark.triangle"
|
||||
|
@ -324,7 +324,7 @@ public struct ThemeCopiableText<Value, ValueView>: View where Value: CustomStrin
|
||||
} label: {
|
||||
ThemeImage(.copy)
|
||||
}
|
||||
// TODO: #584, necessary to avoid cell selection
|
||||
// TODO: #XXX, necessary to avoid cell selection
|
||||
.buttonStyle(.borderless)
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ private extension PurchaseRequiredButton {
|
||||
guard let features, !isEligible else {
|
||||
return
|
||||
}
|
||||
// FIXME: #951, use of setLater/enableLater
|
||||
setLater(.init(features, suggestedProduct: suggestedProduct)) {
|
||||
paywallReason = $0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user