diff --git a/apps/ios/Sources/Gateway/GatewaySettingsStore.swift b/apps/ios/Sources/Gateway/GatewaySettingsStore.swift index 1da68bb25bc..e467659a451 100644 --- a/apps/ios/Sources/Gateway/GatewaySettingsStore.swift +++ b/apps/ios/Sources/Gateway/GatewaySettingsStore.swift @@ -223,11 +223,12 @@ enum GatewaySettingsStore { defaults.removeObject(forKey: self.lastGatewayStableIDDefaultsKey) } - private static func saveLastGatewayConnectionData(_ payload: LastGatewayConnectionData) { + @discardableResult + private static func saveLastGatewayConnectionData(_ payload: LastGatewayConnectionData) -> Bool { guard let data = try? JSONEncoder().encode(payload), let json = String(data: data, encoding: .utf8) - else { return } - _ = KeychainStore.saveString( + else { return false } + return KeychainStore.saveString( json, service: self.gatewayService, account: self.lastGatewayConnectionAccount) } @@ -259,7 +260,7 @@ enum GatewaySettingsStore { kind: kind, stableID: stableID, useTLS: useTLS, host: kind == .manual ? host : nil, port: kind == .manual ? port : nil) - self.saveLastGatewayConnectionData(payload) + guard self.saveLastGatewayConnectionData(payload) else { return } self.removeLastGatewayDefaults(defaults) } diff --git a/apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayTLSPinning.swift b/apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayTLSPinning.swift index 923918f11d1..981f43047ab 100644 --- a/apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayTLSPinning.swift +++ b/apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayTLSPinning.swift @@ -46,7 +46,7 @@ public enum GatewayTLSStore { !existing.isEmpty else { return } if self.keychainLoad(account: stableID) == nil { - self.keychainSave(existing, account: stableID) + guard self.keychainSave(existing, account: stableID) else { return } } defaults.removeObject(forKey: legacyKey) }