pushiomanager-react-native icon indicating copy to clipboard operation
pushiomanager-react-native copied to clipboard

SDK wrapper does not properly implement methods across platforms

Open shamilovtim opened this issue 4 years ago • 3 comments

Using the method declarePreference as an example:

    • On both iOS and Android this method requires reading the source code to understand how to use it. The lack of valid documentation contributes to a lack of transparency into how methods are not implemented the same on both Android and iOS.
  1. On iOS declarePreference:
  • To store a String requires a parameter of 0 which is opaque to the developers using this library. Why a 0? Presumably because it was easy to write the iOS implementation and ask for a 0 rather than to offer something more declarative. The correctness and user friendliness of such shortcuts aside, the library does not document this enum anywhere. Developers are left scanning the source code in order to use the library and React Native developers are not supposed to be scanning native source code and are not expected to understand it. This is not how a Javascript SDK wrapper is meant to be used.
  • On Android the very same method, instead of a 0 requires "STRING" to store a string. This is not a correct cross platform implementation, and defeats the purpose of bringing a library like this to a cross platform framework like React Native. Your iOS and Android developers are supposed to be cooperating and making sure that the javascript methods are implemented identically on both platforms. Where there are exceptions, you're supposed to call them out in documentation.

shamilovtim avatar Sep 23 '21 00:09 shamilovtim

Thanks for reporting this. We'll look into this and get back to you.

neerhaj avatar Sep 23 '21 06:09 neerhaj

I think there was a misunderstanding about the nature of this request. While this one method was an issue, we had already solved it by handling both platforms differently in the code. The complaint is actually about both the lack of documentation of methods and enums, and the lack of a uniform cross platform layer to your library. The complaint does not only apply to this method but to every method that is neither documented nor implemented identically across platforms. I would estimate there are over a dozen of these in the plugin.

shamilovtim avatar Sep 29 '21 19:09 shamilovtim

We are aware of the documentation issues and are working on improving it. I will let you know once we have an ETA on that.

neerhaj avatar Sep 30 '21 05:09 neerhaj