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

UpgradeAlert dialog not showing, except when App navigate to the page with UpgradeAlertHandler #440

Open
justatipfromthedeadsequoiatree opened this issue Aug 28, 2024 · 1 comment

Comments

@justatipfromthedeadsequoiatree
Copy link

justatipfromthedeadsequoiatree commented Aug 28, 2024

My app is live with version 1.0.5, but my currently installed app version is 1.0.4, and it doesn't show the update alert.

Log output when my app launch from terminated state

flutter: upgrader: instantiated
flutter: upgrader: initialize called
flutter: upgrader: build UpgradeAlert
flutter: upgrader: initializing
flutter: upgrader: operatingSystem: ios, version: Version 17.5.1 (Build 21F90)
flutter: upgrader: packageInfo packageName: com.xxx.xxx
flutter: upgrader: packageInfo appName: xxx
flutter: upgrader: packageInfo version: 1.0.4
flutter: upgrader: current locale: en_MY
flutter: upgrader: countryCode: MY
flutter: upgrader: languageCode: en
flutter: upgrader: download: https://itunes.apple.com/lookup?bundleId=com.bundle.id&country=MY&_cb=xxxxxxxxxxx
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: response statusCode: 200
flutter: upgrader: UpgraderAppStore: version info: appStoreListingURL: https://apps.apple.com/my/app/xxxxx/xxx, appStoreVersion: 1.0.5, installedVersion: 1.0.4, isCriticalUpdate: null, minAppVersion: null, releaseNotes: - sample release note

upgrader version from pubspec.lock

   upgrader:
    dependency: "direct main"
    description:
      name: upgrader
      sha256: d45483694620883107c2f5ca1dff7cdd4237b16810337a9c9c234203eb79eb5f
      url: "https://pub.dev"
    source: hosted
    version: "10.3.0"

I have created a StatefulWidget that accept a child for the UpgraderAlert

import 'package:flutter/material.dart';
import 'package:xxxx/core/utils/utilities.dart';
import 'package:xxxx/widgets/app_upgrader/app_upgrader_language_config.dart';
import 'package:upgrader/upgrader.dart';
import 'package:version/version.dart';

class UpgradeAlertHandler extends StatefulWidget {
  const UpgradeAlertHandler({
    super.key,
    required this.child,
    this.updateDialogIsActive,
  });

  final Widget child;
  final Function(bool)? updateDialogIsActive;

  @override
  State<UpgradeAlertHandler> createState() => _UpgradeAlertHandlerState();
}

class _UpgradeAlertHandlerState extends State<UpgradeAlertHandler> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return UpgradeAlert(
      barrierDismissible: false,
      upgrader: Upgrader(
          messages: UpgraderLanguageConfig(),
          // debugDisplayAlways: true,
          debugLogging: true,
          willDisplayUpgrade: ({required bool display, String? installedVersion, UpgraderVersionInfo? versionInfo}) {
            if (widget.updateDialogIsActive != null) {
              widget.updateDialogIsActive!(display);
            }
          }
      ),
      showLater: false,
      showIgnore: false,
      showReleaseNotes: true,
      shouldPopScope: () => false,
      // onUpdate: () {
      //   return true;
      // },
      child: widget.child,
    );
  }
}

I then use the UpgradeAlertHandler on my Skeleton where the skeleton holds the View for bottom navigation bar

  @override
  Widget vBuilder() {
    return UpgradeAlertHandler(
      child: Container(), // child widget
    );
  }

Abstract class for vBuilder()

abstract class BaseView<T extends BaseController> extends StatelessWidget {
  const BaseView({Key? key}) : super(key: key);

  final String tag = "";

  T get controller => GetInstance().find<T>(tag: tag);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<T>(
      builder: (controller){
        return vBuilder();
      },
    );
  }

  Widget vBuilder();

}

hi @larryaasen , need your help to check on this, thank you in advance

@justatipfromthedeadsequoiatree justatipfromthedeadsequoiatree changed the title UpgradeAlert dialog not showing UpgradeAlert dialog not showing, except when App navigate to the page with UpgradeAlertHandler Aug 28, 2024
@justatipfromthedeadsequoiatree
Copy link
Author

justatipfromthedeadsequoiatree commented Aug 28, 2024

I wrap my Skeleton and LoginPage with UpgradeAlertHandler

Step to Reproduce

  1. When app launch from terminated state and show LoginPage, no alert dialog showing

Log Output

flutter: upgrader: instantiated
flutter: upgrader: initialize called
flutter: upgrader: build UpgradeAlert
flutter: upgrader: initializing
flutter: upgrader: operatingSystem: ios, version: Version 17.5.1 (Build 21F90)
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: packageInfo packageName: com.xxx.xxx
flutter: upgrader: packageInfo appName: xxxx
flutter: upgrader: packageInfo version: 1.0.4
flutter: upgrader: current locale: en_MY
flutter: upgrader: countryCode: MY
flutter: upgrader: languageCode: en
flutter: upgrader: download: https://itunes.apple.com/lookup?bundleId=com.xxx.xxx&country=MY&_cb=xxxxx
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: response statusCode: 200
flutter: upgrader: UpgraderAppStore: version info: appStoreListingURL: https://apps.apple.com/my/app/xxxxxx, appStoreVersion: 1.0.5, installedVersion: 1.0.4, isCriticalUpdate: null, minAppVersion: null, releaseNotes: - sample release note
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
  1. When i login, and App navigate to Skeleton view, no alert dialog showing

Log Output

flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: instantiated
flutter: upgrader: initialize called
flutter: upgrader: build UpgradeAlert
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: initializing
flutter: upgrader: operatingSystem: ios, version: Version 17.5.1 (Build 21F90)
flutter: upgrader: packageInfo packageName: com.xxx.xxx
flutter: upgrader: packageInfo appName: xxx
flutter: upgrader: packageInfo version: 1.0.4
flutter: upgrader: current locale: en_MY
flutter: upgrader: countryCode: MY
flutter: upgrader: languageCode: en
flutter: upgrader: download: https://itunes.apple.com/lookup?bundleId=com.xxx.xxx&country=MY&_cb=xxxxxxx
flutter: upgrader: response statusCode: 200
flutter: upgrader: UpgraderAppStore: version info: appStoreListingURL: https://apps.apple.com/my/app/xxxxxx, appStoreVersion: 1.0.5, installedVersion: 1.0.4, isCriticalUpdate: null, minAppVersion: null, releaseNotes: - sample release note
flutter: upgrader: need to evaluate version
flutter: upgrader: blocked: false
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: installedVersion: 1.0.4
flutter: upgrader: minAppVersion: null
flutter: upgrader: isUpdateAvailable: true
flutter: upgrader: isTooSoon: true
flutter: upgrader: shouldDisplayUpgrade: false
flutter: upgrader: shouldDisplayReleaseNotes: true
  1. When i logout, and navigate to LoginPage, alert dialog showing

Log Output

flutter: upgrader: instantiated
flutter: upgrader: initialize called
flutter: upgrader: build UpgradeAlert
flutter: upgrader: instantiated
flutter: upgrader: build UpgradeAlert
flutter: upgrader: need to evaluate version
flutter: upgrader: blocked: false
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: installedVersion: null
flutter: upgrader: minAppVersion: null
flutter: upgrader: isUpdateAvailable: false
flutter: upgrader: shouldDisplayUpgrade: false
flutter: upgrader: shouldDisplayReleaseNotes: false
flutter: upgrader: initializing
flutter: upgrader: operatingSystem: ios, version: Version 17.5.1 (Build 21F90)
flutter: upgrader: packageInfo packageName: com.xxx.xxx
flutter: upgrader: packageInfo appName: xxx
flutter: upgrader: packageInfo version: 1.0.4
flutter: upgrader: current locale: en_MY
flutter: upgrader: countryCode: MY
flutter: upgrader: languageCode: en
flutter: upgrader: download: https://itunes.apple.com/lookup?bundleId=com.xxx.xxx=MY&_cb=xxxxxx
flutter: upgrader: response statusCode: 200
flutter: upgrader: UpgraderAppStore: version info: appStoreListingURL: https://apps.apple.com/my/app/xxxxxx, appStoreVersion: 1.0.5, installedVersion: 1.0.4, isCriticalUpdate: null, minAppVersion: null, releaseNotes: - sample release note
flutter: upgrader: need to evaluate version
flutter: upgrader: blocked: false
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: installedVersion: 1.0.4
flutter: upgrader: minAppVersion: null
flutter: upgrader: isUpdateAvailable: true
flutter: upgrader: shouldDisplayUpgrade: true
flutter: upgrader: shouldDisplayReleaseNotes: true
flutter: upgrader: showTheDialog title: Update App?
flutter: upgrader: showTheDialog message: A new version of xxx is available! Version 1.0.5 is now available. You have 1.0.4.
flutter: upgrader: showTheDialog releaseNotes: - sample release note
flutter: upgrader: onCanPop called
flutter: upgrader: shouldPopScope=false

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