sp-react-native-in-app-updates icon indicating copy to clipboard operation
sp-react-native-in-app-updates copied to clipboard

Android result.shouldUpdate returns - { "line": 3784, "column": 260, "sourceURL": "index.android.bundle" }

Open Aggroid opened this issue 1 year ago • 2 comments

Hi guys,

I'm using react-native 0.68.2

in-app-updates version : 1.3.1

I'm keep getting this error from result.shouldUpdate returns - { "line": 3784, "column": 260, "sourceURL": "index.android.bundle" }

My implementation is :

const inAppUpdates = new SpInAppUpdates(
        false, // isDebug
    );

    let updateType;

    if (isAndroidFlexibleEnabled) {
        updateType = IAUUpdateKind.FLEXIBLE;
    } else {
        updateType = IAUUpdateKind.IMMEDIATE;
    }

    // Update functionality start
    if (isAndroidForceUpgradeEnabled) {
        inAppUpdates.checkNeedsUpdate().then((result) => {
            if (result.shouldUpdate) {
                const updateOptions = Platform.select({
                    ios: {
                        title: 'Update available',
                        message: 'There is a new version of the app available on the App Store, do you want to update it?',
                        buttonUpgradeText: 'Update',
                        buttonCancelText: 'Cancel',
                    },
                    android: {
                        updateType,
                    },
                });
                // checking if it's android and ff for android is turned on
                if (isAndroid && isAndroidForceUpgradeEnabled) {
                    inAppUpdates.startUpdate(updateOptions);
                }
                // checking if it's not android but iOS and ios ff is turned on
                if (!isAndroid && isIOSforceUpgradeEnabled) {
                    inAppUpdates.startUpdate(updateOptions);
                }
            }
        });
    }

does anyone faced that before?

Thanks!

Aggroid avatar Mar 07 '23 14:03 Aggroid

I even tried to add the version inAppUpdates.checkNeedsUpdate( { curVersion: '0.0.1' } ).then .. but the same error is showing.

Aggroid avatar Mar 07 '23 15:03 Aggroid

@Aggroid Any solution found?

zain-khalid avatar Sep 20 '23 10:09 zain-khalid