Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common API: (Android) proc (lambda) callbacks are broken #605

Open
jtara opened this issue May 4, 2015 · 2 comments
Open

Common API: (Android) proc (lambda) callbacks are broken #605

jtara opened this issue May 4, 2015 · 2 comments
Assignees

Comments

@jtara
Copy link

jtara commented May 4, 2015

Common API proc (lambda) callbacks are broken on Android platform. They get messages like:

Error Setting callback ^^^

This is easily demonstrated using getProperty, getAllProperties or getProperties on any common API, and supply a lambda callback. (Since these both use optional callback.)

it works correctly on iOS platform.

Note also that URL callbacks do work on Android platform.

This means not only can developers not create extensions that have lambda-function callbacks, this also breaks internal API functionality like getAllProperties and getProperties.

I did a search, and in fact these three methods seem to be the only instances of optional callbacks in Rhodes (as of 5.0.30).

@jtara jtara changed the title Common API: (Android) optional callbacks are broken Common API: (Android) optional lambda callbacks are broken May 4, 2015
@jtara jtara changed the title Common API: (Android) optional lambda callbacks are broken Common API: (Android) lambda callbacks are broken May 5, 2015
@jtara
Copy link
Author

jtara commented May 5, 2015

I updated the title and text above. I'd previously said that only optional proc callbacks were broken. In fact, both optional and mandatory proc callbacks are broken.

Note that this affects ONLY common-API extensions that use generated common-API code. For built-in APIs, this affects ONLY getProperty, getAllProperties and getProperties. Other APIs (e.g. Network) I believe do not use generated common-API code but have combined the generated boilerplate code with the implementation code.

Workaround: do not use lambda callbacks with user-developed APIs (if using generated common API base). They do not work on Android platform.

As well, getProperty, getAllProperties, getProperty are not usable on Android with a Lambda callback - so only use URL callbacks for these 3 methods.

FYI, I do use Network lambda callbacks on Android, and they do work. But I cannot use it in my own extensions.

@jtara jtara changed the title Common API: (Android) lambda callbacks are broken Common API: (Android) proc (lambda) callbacks are broken May 5, 2015
@jtara
Copy link
Author

jtara commented May 5, 2015

method callbacks seem broken on Android platform as well. They work on iOS, though I think are of dubious value, and are not documented. (I got this from the source code.)

This works on iOS. Does not on Android. Same error, error setting callback.

    # Test method callback
    # Note class method
    Rho::BonjourBrowser.callbackTest(self.class.method(:on_test_callback_method))

  # Note class method. This is undocumeted, discovered in source code.
  def self.on_test_callback_method(params)
    puts "on_test_callback_method params = #{params.inspect}"
  end

@alex-epifanoff alex-epifanoff self-assigned this Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants