larryaasen / upgrader

A Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
MIT License
531 stars 262 forks source link

Do you support iosSimulator/ androidEmulator? #279

Closed mafreud closed 3 months ago

mafreud commented 1 year ago

Do you support iosSimulator / androidEmulator?

In simulator/emulator, I got these error messages.

flutter: upgrader.ITunesResults.version: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.trackViewUrl: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.releaseNotes: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.description: RangeError (index): Invalid value: Valid value range is empty: 0
naturalDev0 commented 1 year ago

Experiencing the same issue here.

Also, is it normal for iOS's debug logging appStoreVersion to be 'null'? (Anyone can assist with answering this). Thanks!

larryaasen commented 1 year ago

Yes, upgrader works fine with the simulator and emulator. Do these apps have published apps in the stores? Can you include the full upgrader log here?

naturalDev0 commented 1 year ago

hi @larryaasen, you can refer to the following logs.

flutter: upgrader: instantiated.
flutter: UpgradeCard: build UpgradeCard
flutter: upgrader: languageCode: en
flutter: upgrader: default operatingSystem: ios Version 16.2 (Build 20C52)
flutter: upgrader: operatingSystem: ios
flutter: upgrader: platform: TargetPlatform.iOS
flutter: upgrader: isAndroid: false, isIOS: true, isLinux: false, isMacOS: false, isWindows: false, isFuchsia: false, isWeb: false
flutter: upgrader: package info packageName: com.company.department
flutter: upgrader: package info appName: MSS Nexus
flutter: upgrader: package info version: 2.2.7
flutter: upgrader: countryCode: US
flutter: upgrader: languageCode: en
flutter: upgrader.ITunesResults.version: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.trackViewUrl: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.releaseNotes: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader.ITunesResults.description: RangeError (index): Invalid value: Valid value range is empty: 0
flutter: upgrader: blocked: false
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: appStoreVersion: null
flutter: upgrader: installedVersion: 2.2.7
flutter: upgrader: minAppVersion: null
flutter: upgrader: isUpdateAvailable: false
flutter: upgrader: shouldDisplayUpgrade: false
flutter: UpgradeCard: will not display

Please let me know what can I do to make it work for the simulator. thank you! and looking forward to your wizardry.

larryaasen commented 1 year ago

@naturalDev0 The upgrader package looks in the App Store for the listed app and finds the version number published in the store. When the app has not been published yet, or it cannot find the app using the bundle id com.company.department, it will not be able to determine the version. This is what is being returned from the App Store:


{
 "resultCount":0,
 "results": []
}

Has your app been published yet?

To see upgrader work before the app has been published, use this parameter:

upgrader: Upgrader(debugDisplayAlways: true)

Use that only while debugging your app and do not leave that in for a release.

naturalDev0 commented 1 year ago

@larryaasen thanks for the clarification! The API query service that you used I believe it to be from iTunes?

I think the problem lies on my end that it seems the app is hidden from the public... thus the difficulty in finding it on app store and not play store. Regarding this, could anyone advise what is this mode I could switch on/off so the visibility can be toggled as and when I desire?

Also, thanks for the tips mentioned in the later paragraph, definitely will bear in mind as development goes on.

samatzp commented 7 months ago

[ final Upgrader upGrader = Upgrader(debugDisplayAlways: true);

void get _checkForceUpdate async { //com.mobisharks.lawyer final minAppVersion = upGrader.minAppVersion; final currentVersion = upGrader.currentInstalledVersion(); final storeVersion = upGrader.currentAppStoreVersion(); log("mm: $minAppVersion,cc: $currentVersion, ss: $storeVersion");

final iTunes = ITunesSearchAPI();
final resultsFuture = await iTunes.lookupByBundleId(
  'com.mobisharks.lawyer',
);
print('results: ${resultsFuture}');

}](url)

Result: mm: null,cc: null, ss: null - but Itunes lookup founded @larryaasen

larryaasen commented 3 months ago

Look at the latest version of this package with a latest customization options. I think it now meets your needs. If not, please open a new issue with your details.

mafreud commented 3 months ago

@larryaasen thank you!