riverscuomo / public-bug-hunt

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

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

Closed riverscuomo closed 1 year ago

riverscuomo commented 1 year 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 1 year 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 1 year 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';
  }