Feature: add kDidUpdateRemoteConfigHook hook

This commit is contained in:
yicheng 2019-05-17 10:50:00 +08:00
parent 2661f1f5d9
commit 6eaa3cc31e

View File

@ -145,6 +145,7 @@ class RemoteConfigManager: NSObject {
} else { } else {
self.alert(with: "Update Success!") self.alert(with: "Update Success!")
} }
self.didUpdateConfig()
} catch let err { } catch let err {
if let complete = complete { if let complete = complete {
complete(err.localizedDescription) 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) { static func alert(with text:String) {
let alert = NSAlert() let alert = NSAlert()
alert.messageText = text alert.messageText = text