I'm using your framework in a project running on the 10.13 beta and while it sends x-callbacks without a problem to an installed app (Ulysses, a writing program that has great x-callback support), I don't receive the callback. It's like my registration is ignored.
There's not much code...
import Cocoa
import os.log
import CallbackURLKit
public class UlyssesClient: Client {
var ulyssesAuthSuccess = ""
var ulyssesAuthError = ""
var ulyssesScheme = "ulysses"
init() {
super.init(urlScheme:"ulysses")
ulyssesAuthSuccess = "fictivity://x-callback-url/auth-success"//.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
ulyssesAuthError = "fictivity://x-callback-url/auth-error"//.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
//os_log("%@", ulyssesURLString)
CallbackURLKit.register(action: "auth-success") { parameters, success, failure, cancel in
os_log("auth-success")
for parameter in parameters {
os_log("%@ = %@", parameter.key, parameter.value)
}
}
CallbackURLKit.register(action: "auth-error") { parameters, success, failure, cancel in
os_log("auth-error")
for parameter in parameters {
os_log("%@ = %@", parameter.key, parameter.value)
}
}
}
func authorize(onSuccess: SuccessCallback? = nil, onFailure: FailureCallback? = nil, onCancel: CancelCallback? = nil) throws {
try self.perform(action: "authorize", parameters: ["appname": "Fictivity", "x-success": ulyssesAuthSuccess, "x-error": ulyssesAuthError], onSuccess: onSuccess, onFailure: onFailure, onCancel: onCancel)
}
}
func applicationDidFinishLaunching(_ aNotification: Notification) {
let manager = Manager.shared
manager.callbackURLScheme = Manager.urlSchemes?.first
Manager.shared.registerToURLEvent()
}
I did try changing the url scheme name, and confirmed that Ulysses give an error that there isn't any support for that url scheme. So, Ulysses is replying, the reply is just not propagating.