-
Notifications
You must be signed in to change notification settings - Fork 190
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
feat: Android native in app review + revised native reviews flow #281
Conversation
@westonganger you can actually help in verifying the PR, is you can share with me your gmail account, I can add you as a beta tester of my app and you should probably see the review popup as I'm guessing you never rated our app before, and I suspect that is the reason I can't test it (Even though I deleted my review like Google suggested) |
Sorry I do not own an Android device currently. |
No worries I'll get a hold of an old android device tommrow to test it out |
I confirmed the PR works! see screenshot in the edited PR description |
Thanks a lot for this! I'm still confused how/when does the native prompt show? Also not sure if this wont conflict with other plugins:
probably not but just asking... does it support the typical semver Thanks for your time! |
@rodrigograca31 sure thing
In both Android and iOS you can use native code to call the native review prompt whenever you want, but you never know if it actually was shown or not to the user and whether or not the user reviewed. Because of that behavior, they say you are not allowed to prompt the user yourself before initiating the native prompt because it might not appear and thus causes confusion to the user. As such, this PR will skip the custom prompt you are used to and initiate the native prompt immediately. This scenario can only happen if the configuration states the "InAppReview" review type and the native review API is available. Otherwise it will fall back to the current behavior.
Sure I will switch it up to semver |
Are you adding a new public method |
@westonganger this is actually the name of a private non-accessible method, and also the name of a preference that is not controlled by the user, and as such should not be documented |
Ok then please do not use |
Also please be sure to document how it will fallback to InAppBrowser when the native prompt is not available. |
I followed ths same logic just like the app title is handled in the init function but sure I will change it. |
@westonganger I tried to explain it as much as I can but my verbal skills were never a strong suit of mine :-) Please let me know how I can improve it. |
Hey, when will this be merged? If there is anything I can help with to get it merged quicker please let me know. |
@westonganger is there anything else I need to change in order to get this update rolling? |
Merged. Thanks for your hard work on this. |
Sure thing @westonganger and thanks for the CR! |
Yes just install via commit hash, again, I like to give time before releasing new versions. |
@regevbr I just tried using this PR and when I set InAppReview to true it no longer works in IOS, am I doing something wrong? I am quite sure I am using the correct commit hash as well; |
@maandagdev the commit hash is ok reviewType: {
ios: 'InAppReview',
android: 'InAppReview'
}, Also notice that as mentioned in the docs, the prompt won't always be shown and you can't be aware if it did or not. |
@regevbr I am getting the following error though; Object literal may only specify known properties, and 'reviewType' does not exist in type 'AppRatePreferences'. |
@maandagdev it seems you are not using the updated code. The update was not officially released yet and in order to get that feature you will need to install by commit hash |
@maandagdev in Cordova to update a plugin you must remove it then reinstall it (fucked up I know) |
Worked perfectly! Thanks @regevbr Just had to: ionic cordova plugin rm cordova-plugin-apprate
ionic cordova plugin add git+https://github.com/pushandplay/cordova-plugin-apprate.git#91d3695 and add this line to my code: |
@regevbr Thank you, I had the ionic native package installed thats why I did not see the new style. But I can't for the life of me get it to work. I put this in my .ts file: But when I copy and paste the example it gives me errors and I need to fill in all options. Do you have any idea why? What am I doing wrong here? |
@maandagdev sadly not, I never worked with Ionic, or used typescript in my cordova projects. Can you please share some screenshots and detailed errors? When you go to the definition of app rate do you see the latest code? |
@regevbr I have it working, when I debug through the code it all looks okay and everything looks fine. the task.success even returns true. But I see nothing in the app, any idea why? |
@maandagdev as mentioned in the readme, there is no way to force it to show when using native... and there is no way to know if it was actually opened or not... if you are using IOS, you will always see it in the simulator and testing phase. If you are using Android, you will always see it in the test track (given that you never reviewed the app before) |
Ah yeah, I just read it.. my bad, I am an idiot. I have an app in review currently so I can't really talk on Android, I will give it a shot when I can do a release in a bit. Thanks for your help though, I did get it working 👍 |
and make sure you are a tester..... |
if you are going to use it without the ionic wrapper you don't need the import, that won't work. use: |
fix: #276
This PR adds the native Android in-app review feature.
Since both Apple and Android in-app reviews explicitly dictate not to prompt the user before calling the review API (as it might not be shown at all) I have revised the logic so if someone wants in-app review (in Android and/or IOS) and the native prompt is supported, no custom prompt will be shown (breaking change)
Backward compatibility was also in mind. Also, it will be bulletproof to CodePush updates that will update the js file of the plugin without updating the native code.
@westonganger I would appreciate your review and thoughts.
Please note that the Android in-app review is very hard to debug/display as I mentioned in the readme and can only be done in test track releases.
I managed to get the native prompt logic to work on the test track version of my app with this PR but Android refuses to actually show me the dialog (all the callbacks states success results). Since this is a really new feature, there is not much info on the web to help debug it. So I would appreciate if someone can test it out and see if it works for them @terreng @rodrigograca31I confirmed the PR works perfectly in Android