LCOV - code coverage report
Current view: top level - auth/middleware - sign_in_with_apple_middleware.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 7 11 63.6 %
Date: 2022-03-03 12:16:56 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:redux/redux.dart';
       2             : 
       3             : import '../../../actions.dart';
       4             : import '../../../types.dart';
       5             : import '../../redux/extensions/store_extensions.dart';
       6             : import '../../types/red_fire_state.dart';
       7             : import '../../utils/red_fire_locator.dart';
       8             : 
       9             : class SignInWithAppleMiddleware<T extends RedFireState>
      10             :     extends TypedMiddleware<T, SignInWithAppleAction> {
      11           1 :   SignInWithAppleMiddleware()
      12           2 :       : super((store, action, next) async {
      13           1 :           next(action);
      14             : 
      15             :           try {
      16           1 :             final authService = RedFireLocator.getAuthService();
      17             : 
      18           2 :             store.dispatch(SetAuthStepAction.contactingApple());
      19             : 
      20           1 :             final appleIdCredential = await authService.getAppleCredential();
      21             : 
      22           0 :             store.dispatch(SetAuthStepAction.signingInWithFirebase());
      23             : 
      24             :             // We don't do anyting with the UserData object here as the
      25             :             // authStateChanges stream will emit the same object and the state is
      26             :             // changed there.
      27           0 :             final authUserData = await authService.signInWithApple(
      28             :                 credential: appleIdCredential);
      29             : 
      30           0 :             store.dispatch(SetAuthUserDataAction(authUserData));
      31           0 :             store.dispatch(SetAuthStepAction.waitingForInput());
      32             :           } catch (error, trace) {
      33           1 :             store.dispatchProblem(error, trace);
      34             :           }
      35             :         });
      36             : }

Generated by: LCOV version 1.13