milestone/stable-1-reconcile-auth-3 #176
@ -44,6 +44,19 @@ class AuthenticationRepositoryImpl<T extends Object>
 | 
			
		||||
  })  : _authChangeListener = onAuthChange,
 | 
			
		||||
        _accountStreamTransformer = accountStreamTransformer {
 | 
			
		||||
    _formRepository = formRepository ?? FormRepositoryImpl();
 | 
			
		||||
    _accountStreamTransformer ??= (input) => input
 | 
			
		||||
            .where((event) => event is! SignUpAuthChangeEvent)
 | 
			
		||||
            .map<FutureOrResult<AccountWrapper<T>>>((event) async {
 | 
			
		||||
          if (listener == null) {
 | 
			
		||||
            return Ok(AccountWrapperModel<T>(event.account, null));
 | 
			
		||||
          }
 | 
			
		||||
          // Handle sign in, sign out and refresh
 | 
			
		||||
          final dataResult = await listener!.call(this, event);
 | 
			
		||||
          return dataResult.map((data) {
 | 
			
		||||
            authenticationCacheDataSource.storeData(data);
 | 
			
		||||
            return AccountWrapperModel(event.account, data);
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
    if (formRepository != null) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
@ -90,19 +103,6 @@ class AuthenticationRepositoryImpl<T extends Object>
 | 
			
		||||
          name: AuthFormName.passwordResetForm,
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    _accountStreamTransformer ??= (input) => input
 | 
			
		||||
            .where((event) => event is! SignUpAuthChangeEvent)
 | 
			
		||||
            .map<FutureOrResult<AccountWrapper<T>>>((event) async {
 | 
			
		||||
          if (listener == null) {
 | 
			
		||||
            return Ok(AccountWrapperModel<T>(event.account, null));
 | 
			
		||||
          }
 | 
			
		||||
          // Handle sign in, sign out and refresh
 | 
			
		||||
          final dataResult = await listener!.call(this, event);
 | 
			
		||||
          return dataResult.map((data) {
 | 
			
		||||
            authenticationCacheDataSource.storeData(data);
 | 
			
		||||
            return AccountWrapperModel(event.account, data);
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
  }
 | 
			
		||||
  final AuthenticationCacheDataSource<T> authenticationCacheDataSource;
 | 
			
		||||
  final AuthenticationRemoteDataSource authenticationRemoteDataSource;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user