dpa99c / cordova-launch-review

Cordova/Phonegap plugin for iOS and Android to assist in leaving user reviews/ratings in the App Stores
71 stars 26 forks source link

If the rating dialog is displayed successfully on iOS, the result will not be returned. #24

Closed randnetdd closed 3 years ago

randnetdd commented 3 years ago

Bug report

CHECKLIST

Current behavior:

If the rating dialog is displayed successfully on iOS, the result will not be returned.

Expected behavior:

result returns show if rating dialog is displayed successfully on iOS

Steps to reproduce:

I haven't written any special code

Screenshots

image0 2 unnamed 1

Environment information

Runtime issue

iOS build issue:

Related code:

LaunchReview.rating(result => {
    console.log('result: ' + result);
    if (cordova.platformId === 'android') {
        console.log('Rating dialog displayed');
    } else if (cordova.platformId === 'ios') {
        if (result === 'requested') {
            console.log('Requested display of rating dialog');
            this.ratingTimerId = setTimeout(() => {
                console.warn('Rating dialog was not shown (after ' + 5000 + 'ms)');
            }, 5000);
        } else if (result === 'shown') {
            console.log('Rating dialog displayed');
            clearTimeout(this.ratingTimerId);
        } else if (result === 'dismissed') {
            console.log('Rating dialog dismissed');
        }
    }
}, (err) => {
    console.log('Error opening rating dialog: ' + err);
});

Console output

console output ``` [Log] Running cordova-ios@6.1.1 (cordova.js, line 1413) [Log] result: requested (cordova.js, line 1413) [Log] Requested display of rating dialog (cordova.js, line 1413) [Warning] Rating dialog was not shown (after 5000ms) (cordova.js, line 1413) ```


**Other information:** When the rating dialog is displayed It has been confirmed that the windowDidBecomeVisibleNotification of LaunchReview.m is called. At this time, notification.object was not MonitorObject but SKStoreReviewPresentationWindow was returned. It seems to be related to the issue below https://github.com/dpa99c/cordova-launch-review/issues/18
dpa99c commented 3 years ago

Looks like the underlying iOS implementation for the native in-app review dialog has changed in recent iOS versions which is causing this issue. I'll update the code to check for the SKStoreReviewPresentationWindow class name but also leave the check for the MonitorObject class name in order to support older iOS versions.

dpa99c commented 3 years ago

Fix has been published in v4.0.1

randnetdd commented 3 years ago

Thank you!