Comments (12)
Using closure on one side to receive response
https://github.com/phimage/CallbackURLKit#use-callback-closure
And on the other side by calling success(with param or not) or failure(with error) or cancel
https://github.com/phimage/CallbackURLKit#add-new-action
from callbackurlkit.
@phimage so do I need to declare a new manager instance in my client class to handle incoming callbacks?
from callbackurlkit.
one manager by app, you can use the default one
from callbackurlkit.
@phimage ok, I don't exactly understand closures with on* operations
I have Client class with a method that does call.
try self.perform(action: "runOperation", parameters: parameters, onSuccess: { parameters in
}, onFailure: nil, onCancel: nil)
How do I pass sourceapp://x-callback-url/acceptTranslation on x-success?
from callbackurlkit.
did you need to know how to do it exactly or just fulfil a need to interact with two of your applications?
Maybe one is not yours and need specific this url
The framework do it automatically but use sourceapp://x-callback-url/response/ for error or success and pass an ID to retrieve the code to execute in callback
And in closure you can execute the code that could be call in an action called "acceptTranslation"
I can add parameters to implement such behaviour if I have time...
from callbackurlkit.
@phimage https://github.com/phimage/CallbackURLKit/blob/master/Sources/Manager.swift#L197
that implies that callback will happen to /response?
from callbackurlkit.
Yes this is the code
This is an auto communication, and success, ..., closure will be called
We could add an 'Action'(string) by callback type and change here the URL if this action is specified
from callbackurlkit.
@phimage hm.. Can't I just set it as one of the params?
let parameters = [
"x-succes": "sourceapp://x-callback-url/acceptTranslation"
]
from callbackurlkit.
@phimage additionally I am adding this plugin to the ObjectiveC app, and app delegate is actually in obj-c, and I can figure out how to add Manager.shared to pass it url handling
from callbackurlkit.
yes you can try to put this as parameters, never tried... I expect that I do not filter it
for obj-c I never tried if there is some incompatibility
You cannot access register
?
CallbackURLKit.register(action: "acceptTranslation") { parameters, _, _, _ in
}
from callbackurlkit.
@phimage Setting as parameter works.
I am working on Objective-c event binding to swift. I found this is how they do it in https://github.com/aerogear/aerogear-cordova-oauth2/
Here they are catching call https://github.com/aerogear/aerogear-cordova-oauth2/blob/master/src/ios/AppDelegate%2Burl.m#L36 which calls notification event
and here is the handler for event https://github.com/aerogear/aerogear-cordova-oauth2/blob/master/src/ios/oauth-0.4.0/OAuth2Module.swift#L92
from callbackurlkit.
with swizzle they try to achieve this automatically but it's not mandatory
https://github.com/phimage/CallbackURLKit#handle-incoming-urls
from callbackurlkit.
Related Issues (15)
- macOS 10.13 Issue HOT 4
- 'Manager' is not descriptive or unique enough. HOT 1
- Release HOT 4
- Unable to install CallbackURLKit via CocoaPods HOT 12
- response path should be prefixed with "/" when building callback URLs HOT 1
- client.perform() never reaches onSuccess HOT 9
- Update Demo App HOT 1
- New tag for updated package.swift for Accio support HOT 1
- Any plans of keeping this library updated? HOT 1
- Ampersands in callback URL query strings should be percent-encoded. HOT 4
- Explicit handlers for success and error callbacks HOT 3
- Swift Package will not build in Xcode 13 (beta 3+) HOT 3
- Request ID not transmitted in responses HOT 5
- Invoking an action on a locked device doesn't work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from callbackurlkit.