riverscuomo / public-bug-hunt

A place to file bug reports for all of my apps
GNU General Public License v3.0
6 stars 0 forks source link

riv not getting auth user so not loading riv.user #36

Closed riverscuomo closed 12 months ago

riverscuomo commented 12 months ago

just seeing loading indicators

in weezify we create user subscription at this pointin the debugger:

I/flutter (31568): 💡 startUp I/flutter (31568): 💡 core postInit I/flutter (31568): 💡 base app postInit ...e in this device. DebugMessage: Billing service unavailable on device.. ErrorCode: BILLING_UNAVAILABLE., message='The device or user is not allowed to make the purchase.')


class AuthBloc<T extends BaseAuthRepository>
    extends Bloc<AuthEvent, AuthState> {
  final T authRepository;
  StreamSubscription<auth.User?>? _userSubscription;

  AuthBloc({
    required this.authRepository,
  }) : super(AuthState.unknown()) {
    _userSubscription =
        authRepository.user.listen((user) => add(AuthUserChanged(user: user)));
riverscuomo commented 12 months ago

added else if (authUser == null) { return '/login'; }

to main


redirect: (BuildContext context, GoRouterState state) {
      final User? authUser = context.read<AuthBloc>().state.user;

      final String requestedPage = state.matchedLocation;

      if (authUser != null && requestedPage == '/login') {
        return '/';
      } else if (authUser == null) {
        return '/login';
      }
    },

this won't work in weezify tho because of username etc?
riverscuomo commented 12 months ago

ok in weezify i removed

  /// Redirect users without a Firebase auth session user to the login page.
  // if (authUser==null && requestedPage != '/signup') { // not sure why the requestedPage != '/signup' is needed
  if (authUser == null) {
    return '/login';
  }