updateApp2 method

  1. @override
Future<LoggedIn> updateApp2(
  1. AccessBloc accessBloc,
  2. AppModel newCurrentApp
)
override

Implementation

@override
Future<LoggedIn> updateApp2(
    AccessBloc accessBloc, AppModel newCurrentApp) async {
  var newAccesses = await AccessHelper.extendAccesses(
      accessBloc, member, accesses, newCurrentApp, true);

  var newApps = <DeterminedApp>[];
  for (var app in apps) {
    if (app.app.documentID == newCurrentApp.documentID) {
      var privilegeLevel =
          _privilegeLevel(newCurrentApp.documentID, newAccesses);
      var appIsBlocked = _isBlocked(newCurrentApp.documentID, newAccesses);
      var homePage =
          await getHomepage(newCurrentApp, appIsBlocked, privilegeLevel);
      newApps.add(DeterminedApp(newCurrentApp, homePage));
    } else {
      newApps.add(app);
    }
  }

  return Future.value(LoggedIn._(
    usr,
    member,
    postLoginAction,
    newApps,
    newAccesses,
    subscribedToApps,
    blockedMembers,
    playstoreApp: playstoreApp,
    newForceRefresh: forceRefresh,
  ));
}