privly / privly-applications

The central repository for Privly Injectable Applications.
MIT License
19 stars 48 forks source link

Android client receives 'undefined' when creating new Privly Content. #353

Open vshivam opened 8 years ago

vshivam commented 8 years ago

When creating a new PlainPost or Message, the receiveNewPrivlyURL() [0] method receives 'undefined' instead of a Privly Url on the client side.

Not sure if this is relevant but the applications on being loaded in the WebView also throw this exception : setListener is called but is not implemented (current adapter: %s) -- From line 215 of file:///android_asset/PrivlyApplications/shared/javascripts/context_messenger.js

[0] https://github.com/privly/privly-applications/blob/master/shared/javascripts/context_messenger.js#L686

vshivam commented 8 years ago

Based on some basic testing, passing data.body.privlyUrl to the receiveNewPrivlyURL() method works. I'm not sure how it effects everything else.

smcgregor commented 8 years ago

I am confused how this could be broken on Android and not on the other platforms. Is there a problem with the newer context messenger?

vshivam commented 8 years ago

The context messenger doesn't actually send 'undefined'. It sends the whole data object to the JS bridge. The interface however, only understands primitive types and strings which results in an 'undefined'.

As to what it does with the client does with the original Url and how it uses it, check this[0] out.

[0] https://github.com/privly/privly-android/blob/master/app/src/main/java/ly/priv/mobile/gui/fragments/ShowContentFragment.java#L208

smcgregor commented 8 years ago

So privly-applications needs to serialize the object and we add a JSON deserialization library to the Android side?

vshivam commented 8 years ago

Works for me. The other option would be to retrieve the Url from the data object and pass it on to the receiveNewPrivlyURL method.