Closed rolinger closed 3 years ago
For android, here is my fix:
LaunchReview.rating(function(result){
if (cordova.platformId === "android"){
if (result === 0) {
errMgmt("menu/rateApp",2601.3,"Android: In-App Review failed, opening store review.") ;
$scope.rateAppStore() ;
} else {
errMgmt("menu/rateApp",2601.4,"Android: In-App Review opened.") ;
}
} else if(cordova.platformId === "ios"){
if (result === "requested"){
ratingTimerId = setTimeout(function(){
$scope.rateAppStore() ;
}, MAX_DIALOG_WAIT_TIME);
} else if (result === "shown"){
errMgmt("menu/rateApp",2601.5,"iOS: In-App Review opened.") ;
clearTimeout(ratingTimerId);
} else if (result === "dismissed"){
} else {
// default open app store review
errMgmt("menu/rateApp",2601.6,"iOS: In-App Review failed, opening store review.") ;
}
}
},function(err){
errMgmt("menu/rateApp",2601.7,"In-App Review function failed, opening store review.") ;
$scope.rateAppStore() ;
});
}
The same thing happened to me on Android. I'm receiving status == 0
and dialog is not opening. I tested on Galaxy Note 10, Android 10.
Packages version:
cordova: 8.1.2,
cordova-android: 7.1.2,
cordova-ios: 5.1.1,
cordova-launch-review: 4.0.0
Code usage:
const LaunchReview: LaunchReviewPlugin = window.LaunchReview;
const platformId = window.cordova && window.cordova.platformId;
const IOS: string = 'ios';
const ANDROID: string = 'android';
const MAX_DIALOG_WAIT_TIME: number = 5000;
let ratingTimerId: NodeJS.Timeout;
export const cordovaDriver = {
rating: () => new Promise((resolve, reject) => {
LaunchReview.rating((status => {
if (platformId === ANDROID) {
const message = 'Rating dialog displayed';
resolve({status: PROMPT_DISPLAY_STATUS.SHOWN, message})
}else if (platformId === IOS) {
if (status === PROMPT_DISPLAY_STATUS.REQUESTED) {
ratingTimerId = setTimeout(() => {
const message = `Rating prompt was not shown after ${MAX_DIALOG_WAIT_TIME}ms`;
reject( message);
}, MAX_DIALOG_WAIT_TIME);
} else if (status === PROMPT_DISPLAY_STATUS.SHOWN) {
clearTimeout(ratingTimerId);
const message = 'Rating prompt was shown';
resolve({status: PROMPT_DISPLAY_STATUS.SHOWN, message})
}
}
}), (err) => {
const errMessage = `Error opening rating prompt: ${err}`;
reject(errMessage);
});
}),
}
Calling this method by:
export async function showAppRatingPrompt () {
// Service-level method
try {
return await cordovaDriver.rating()
}catch (err) {
console.error(`[ LAUNCH REVIEW SERVICE ] ${err}`)
}
}
Will take a look into this when I get a moment
I'm integrating this module and I'm also seeing the same 0 result for android, as described above in the first example, with the same code.
Just published a fix for this issue in v4.0.1
See updated documentation and example project for reference.
Bug report
CHECKLIST
[x ] I have read the issue reporting guidelines
[x ] I confirm this is a suspected bug or issue that will affect other users
[ ] I have reproduced the issue using the example projector provided the necessary information to reproduce the issue.
[ ] I have read the documentation thoroughly and it does not help solve my issue.
[ ] I have checked that no similar issues (open or closed) already exist. Bring attention back to: https://github.com/dpa99c/cordova-launch-review/issues/25 - I posted more details at bottom of this closed issue with what is happening.
Current behavior:
This is breaking on v4.0.0 on Android versions 7 - 10, but older version 3.1.1 still works on v7 - 10. I don't have an Android 11 device (yet) to test on so I don't know the behavior for v11.
Result is returning value 0, not opening dialog but also causing external app review to not launch.
LaunchReview.rating(function(result) { // result = 0, unexpected }
Expected behavior:
On Android, using old v3.1.1 advanced code or the new v4.0.0 advanced code, rating
result
returns value while also not prompting for dialog box or launching external app store review. Condition0
is not an expected response.Steps to reproduce:
To fix, I had to add: