Giter VIP home page Giter VIP logo

Comments (12)

phimage avatar phimage commented on July 28, 2024

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.

yackermann avatar yackermann commented on July 28, 2024

@phimage so do I need to declare a new manager instance in my client class to handle incoming callbacks?

from callbackurlkit.

phimage avatar phimage commented on July 28, 2024

one manager by app, you can use the default one

from callbackurlkit.

yackermann avatar yackermann commented on July 28, 2024

@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.

phimage avatar phimage commented on July 28, 2024

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.

yackermann avatar yackermann commented on July 28, 2024

@phimage https://github.com/phimage/CallbackURLKit/blob/master/Sources/Manager.swift#L197
that implies that callback will happen to /response?

from callbackurlkit.

phimage avatar phimage commented on July 28, 2024

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.

yackermann avatar yackermann commented on July 28, 2024

@phimage hm.. Can't I just set it as one of the params?

let parameters = [
    "x-succes": "sourceapp://x-callback-url/acceptTranslation"
]

from callbackurlkit.

yackermann avatar yackermann commented on July 28, 2024

@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.

phimage avatar phimage commented on July 28, 2024

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.

yackermann avatar yackermann commented on July 28, 2024

@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.

phimage avatar phimage commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.