checkVersion method

void checkVersion({
  1. required BuildContext context,
})

Will show the alert dialog when it should be dispalyed. Only called by HcUpgradeAlert and not used by UpgradeCard.

Implementation

void checkVersion({required BuildContext context}) {
  final shouldDisplay = widget.upgrade.shouldDisplayUpgrade();
  if (widget.upgrade.debugLogging) {
    if (kDebugMode) {
      print('hcUpgrade: shouldDisplayReleaseNotes: shouldDisplayReleaseNotes');
    }
  }
  if (shouldDisplay) {
    displayed = true;
    final appMessages = widget.upgrade.determineMessages(context);

    Future.delayed(const Duration(milliseconds: 0), () {
      showTheDialog(
        key: widget.dialogKey ?? const Key('upgrade_alert_dialog'),
        context: context,
        title: appMessages.message(HcUpgradeMessage.title),
        message: widget.upgrade.body(appMessages),
        releaseNotes:
        shouldDisplayReleaseNotes ? widget.upgrade.releaseNotes : null,
        canDismissDialog: widget.canDismissDialog,
        messages: appMessages,
      );
    });
  }
}