Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-App Update is not showing #42

Open
FoloosiApps opened this issue Nov 1, 2023 · 0 comments
Open

In-App Update is not showing #42

FoloosiApps opened this issue Nov 1, 2023 · 0 comments

Comments

@FoloosiApps
Copy link

FoloosiApps commented Nov 1, 2023

Hi,

The new_version_plus plugin was integrated into my flutter app for Android and iOS in-app updates. In iOS builds, sometimes the In-app update popup does not appear. Could you please guide this case?

I mentioned my source code in below:

@override
  void initState() {
    WidgetsBinding.instance.addObserver(this);
    inAppUpdateFlowCheck();
    super.initState();
  }

  Future<void> inAppUpdateFlowCheck() async {
    bool isOnline = await Utility().hasNetwork();
    if (isOnline) {
       final newVersion = NewVersionPlus(
          iOSId: 'com.example.app',
          androidId: 'com.example.app,
          androidHtmlReleaseNotes: true,
        );
        basicStatusCheck(newVersion);
    } else {
      var data = {"errorName": "No Internet Connection"};
      Get.toNamed(PageNamesList.commonErrorPage, parameters: data);
    }
  }

basicStatusCheck(NewVersionPlus newVersion) async {
    try {
      final version = await newVersion.getVersionStatus();
      if (version != null) {
        release = version.releaseNotes ?? "";
        String localVersion = version.localVersion;
        String appStoreVersion = version.storeVersion;
        bool updateStatus = version.canUpdate;

        debugPrint("localVersion - $localVersion");
        debugPrint("appStoreVersion - $appStoreVersion");

        if (updateStatus) {
          newVersion.showUpdateDialog(
            context: Get.context!,
            versionStatus: version,
            dialogTitle: 'Update Available',
            dialogText:
                'Features:\nUI enhancements have been added for a smoother experience.',
            updateButtonText: 'Update',
            allowDismissal: true,
            dismissButtonText: 'Close',
            dismissAction: () => appClose(),
            launchModeVersion: LaunchModeVersion.external,
          );
        } else {
          // No Inapp Update
        }
      }
    } catch (e) {
      // Error
    }
  }
@FoloosiApps FoloosiApps changed the title InApp Update is not showing In-App Update is not showing Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant