KjellConnelly / react-native-rate

Send your app users to Apple App Store, Google Play, Amazon, or other using the newest APIs
642 stars 101 forks source link

Can't get correct callback value when review modal is already shown #104

Closed SergeiGrigorev closed 2 years ago

SergeiGrigorev commented 2 years ago

Hey 👋 I can't understand logic inside native implementation for iOS: I have such config:

const options: IConfig = {
      AppleAppID: *************,
      GooglePackageName: *************,
      preferredAndroidMarket: AndroidMarket.Google,
      preferInApp: true,
      openAppStoreIfInAppFails: false,
    };

So this review modal successfully shown and then something weird starting in RNRate.m there is a call [SKStoreReviewController requestReviewInScene:activeScene]

then we go to possiblyOpenAppStore and there you compare windows count, I have added some logs and I can see that in my case newWindowCount=5 and originalWindowCount=5 After that I get in the last condition here:

 if (newWindowCount > originalWindowCount) {
            callback(@[[NSNumber numberWithBool:true]]);
        } else if (newWindowCount < originalWindowCount) {
            callback(@[[NSNumber numberWithBool:false]]);
        } else {
            ***HERE***
            int newInterations = iterations - 1;
            if (newInterations > 0) {
                [self possiblyOpenAppStore:url :originalWindowCount :callback :checkTime :newInterations :openAppStoreIfInAppFails];
            } else {
                if (openAppStoreIfInAppFails) {
                  [self openAppStoreAndRate:url];
                  callback(@[[NSNumber numberWithBool:true]]);
                } else {
                  callback(@[[NSNumber numberWithBool:false]]);
                }
            }
        }

there I have newInterations<0 and after that the most interesting part, I don't want to open appStore and because of that I receive false in callback

So my question is: Why you can't call callback just after [SKStoreReviewController requestReviewInScene:activeScene]; or there some extra hidden difficulties ?