mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-05 12:53:33 +00:00
* Fix mobile protocol mismatch recovery * Test iOS protocol mismatch connect failures * Fix iOS protocol mismatch problem actions
35 lines
989 B
Swift
35 lines
989 B
Swift
import OpenClawKit
|
|
import UIKit
|
|
|
|
enum GatewayProblemPrimaryAction {
|
|
static func title(
|
|
for problem: GatewayConnectionProblem,
|
|
retryTitle: String,
|
|
resetTitle: String? = nil,
|
|
nonRetryableTitle: String? = nil) -> String?
|
|
{
|
|
if problem.suggestsOnboardingReset, let resetTitle {
|
|
return resetTitle
|
|
}
|
|
if problem.canTrustRotatedCertificate {
|
|
return "Trust certificate"
|
|
}
|
|
if problem.kind == .protocolMismatch {
|
|
return problem.actionLabel
|
|
}
|
|
if problem.retryable {
|
|
return problem.actionLabel ?? retryTitle
|
|
}
|
|
return nonRetryableTitle
|
|
}
|
|
|
|
@MainActor
|
|
static func openProtocolMismatchHelpIfNeeded(_ problem: GatewayConnectionProblem) -> Bool {
|
|
guard problem.kind == .protocolMismatch else { return false }
|
|
if let url = problem.docsURL {
|
|
UIApplication.shared.open(url)
|
|
}
|
|
return true
|
|
}
|
|
}
|