checkAppStatus method

Future<void> checkAppStatus()

Check app initialization state and determine initial route @deprecated Use initializeApp() instead - this method is kept for compatibility

Implementation

Future<void> checkAppStatus() async {
  emit(state.copyWith(isLoading: true));

  try {
    final hasCompletedOnboarding =
        _prefs.getBool(_onboardingCompletedKey) ?? false;

    if (!hasCompletedOnboarding) {
      emit(state.copyWith(
        status: AppStatus.onboardingRequired,
        isLoading: false,
      ));
    } else {
      emit(state.copyWith(
        status: AppStatus.authenticated,
        isLoading: false,
      ));
    }
  } catch (e) {
    emit(state.copyWith(
      isLoading: false,
      error: e.toString(),
    ));
  }
}