Add x-callback-url response data
This commit is contained in:
parent
97fe450d1f
commit
e4fc6d36ca
|
@ -252,7 +252,10 @@ class ComposeViewController: UIViewController {
|
||||||
self.progressView.step()
|
self.progressView.step()
|
||||||
self.performSegue(withIdentifier: "postComplete", sender: self)
|
self.performSegue(withIdentifier: "postComplete", sender: self)
|
||||||
|
|
||||||
self.xcbSession?.complete(with: .success)
|
self.xcbSession?.complete(with: .success, additionalData: [
|
||||||
|
"statusURL": status.url!.absoluteString,
|
||||||
|
"statusURI": status.uri
|
||||||
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,15 @@ class XCBSession {
|
||||||
self.cancel = cancel
|
self.cancel = cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
func complete(with result: XCBSessionResult) {
|
func complete(with result: XCBSessionResult, additionalData: [String: String?]? = nil) {
|
||||||
let url = result == .success ? success : result == .error ? error : cancel
|
let url = result == .success ? success : result == .error ? error : cancel
|
||||||
if let url = url {
|
if var url = url {
|
||||||
|
if let additionalData = additionalData {
|
||||||
|
var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!
|
||||||
|
components.queryItems = components.queryItems ?? []
|
||||||
|
components.queryItems!.append(contentsOf: additionalData.map(URLQueryItem.init))
|
||||||
|
url = components.url!
|
||||||
|
}
|
||||||
UIApplication.shared.open(url, options: [:])
|
UIApplication.shared.open(url, options: [:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue