Feature: add kDidUpdateRemoteConfigHook hook
This commit is contained in:
parent
2661f1f5d9
commit
6eaa3cc31e
@ -145,6 +145,7 @@ class RemoteConfigManager: NSObject {
|
||||
} else {
|
||||
self.alert(with: "Update Success!")
|
||||
}
|
||||
self.didUpdateConfig()
|
||||
} catch let err {
|
||||
if let complete = complete {
|
||||
complete(err.localizedDescription)
|
||||
@ -155,6 +156,15 @@ class RemoteConfigManager: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
static func didUpdateConfig() {
|
||||
guard let hook = UserDefaults.standard.string(forKey: "kDidUpdateRemoteConfigHook") else {return}
|
||||
DispatchQueue.global().async {
|
||||
let appleScriptStr = "do shell script \"\(hook)\""
|
||||
let appleScript = NSAppleScript(source: appleScriptStr)
|
||||
_ = appleScript?.executeAndReturnError(nil)
|
||||
}
|
||||
}
|
||||
|
||||
static func alert(with text:String) {
|
||||
let alert = NSAlert()
|
||||
alert.messageText = text
|
||||
|
Loading…
Reference in New Issue
Block a user