shouldDisplayUpgrade method

bool shouldDisplayUpgrade()

Implementation

bool shouldDisplayUpgrade() {
  final isBlocked = blocked();

  if (debugLogging) {
    if (kDebugMode) {
      print('hcUpgrade: blocked: $isBlocked');
      print('hcUpgrade: debugDisplayAlways: $debugDisplayAlways');
      print('hcUpgrade: debugDisplayOnce: $debugDisplayOnce');
      print('hcUpgrade: hasAlerted: $_hasAlerted');
    }
  }

  bool rv = true;
  if (debugDisplayAlways || (debugDisplayOnce && !_hasAlerted)) {
    rv = true;
  } else if (!isUpdateAvailable()) {
    rv = false;
  } else if (isBlocked) {
    rv = true;
  } else if (isTooSoon() || alreadyIgnoredThisVersion()) {
    rv = false;
  }
  if (debugLogging) {
    if (kDebugMode) {
      print('hcUpgrade: shouldDisplayUpgrade: $rv');
    }
  }

  // Call the [willDisplayUpgrade] callback when available.
  if (willDisplayUpgrade != null) {
    willDisplayUpgrade!(
        display: rv,
        minAppVersion: minAppVersion,
        installedVersion: _installedVersion,
        appStoreVersion: _appStoreVersion);
  }

  return rv;
}