onChangePage method

  1. @visibleForTesting
dynamic onChangePage(
  1. String? route
)

Implementation

@visibleForTesting
onChangePage(final String? route) async {
  if (overlay != null) {
    popHelper();
  }
  try {
    final InAppUserEntity inAppUser = await this.inAppUserClientService.getOrCreate();
    if(!hasSync) {
      var lang = Localizations.localeOf(navigatorKey!.currentContext!).languageCode;
      await this.helpersSynchronizer!.sync(inAppUser.id, languageCode: lang);
      this.hasSync = true;
    }
    final helperGroupToShow = await helperClientService.getPageNextHelper(
      route,
      inAppUser.id,
      packageVersionReader!.appVersion
    );
    if (helperGroupToShow != null && helperGroupToShow.helpers!.isNotEmpty) {
      showHelper(
        helperGroupToShow.page!.id,
        inAppUser.id,
        helperGroupToShow,
        0);
    }
  } catch (e) {
    // TODO log error to our server or crashlitycs...
    print("on change page error $e");
  }
}