mirror of https://github.com/openclaw/openclaw.git
30 lines
1.0 KiB
Swift
30 lines
1.0 KiB
Swift
import Foundation
|
|
|
|
public enum ShareToAgentSettings {
|
|
private static let suiteName = "group.ai.openclaw.shared"
|
|
private static let defaultInstructionKey = "share.defaultInstruction"
|
|
private static let fallbackInstruction = "Please help me with this."
|
|
|
|
private static var defaults: UserDefaults {
|
|
UserDefaults(suiteName: suiteName) ?? .standard
|
|
}
|
|
|
|
public static func loadDefaultInstruction() -> String {
|
|
let raw = self.defaults.string(forKey: self.defaultInstructionKey)?
|
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if let raw, !raw.isEmpty {
|
|
return raw
|
|
}
|
|
return self.fallbackInstruction
|
|
}
|
|
|
|
public static func saveDefaultInstruction(_ value: String?) {
|
|
let trimmed = value?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
|
if trimmed.isEmpty {
|
|
self.defaults.removeObject(forKey: self.defaultInstructionKey)
|
|
return
|
|
}
|
|
self.defaults.set(trimmed, forKey: self.defaultInstructionKey)
|
|
}
|
|
}
|