Compare commits
	
		
			No commits in common. "f0ed08bd49f06d48d7db392b6c767618d2bb0c1a" and "a66db23ace25c438786a99e6da09839fcfa80838" have entirely different histories.
		
	
	
		
			f0ed08bd49
			...
			a66db23ace
		
	
		
@ -114,7 +114,6 @@ class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource {
 | 
			
		||||
      providerId: 'wyatt',
 | 
			
		||||
      creationTime: creation,
 | 
			
		||||
      lastSignInTime: creation,
 | 
			
		||||
      isNewUser: creation == creation,
 | 
			
		||||
    );
 | 
			
		||||
    _streamAccount.add(mock);
 | 
			
		||||
    _connectedMock = _connectedMock?.copyWith(left: mock);
 | 
			
		||||
@ -189,7 +188,6 @@ class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource {
 | 
			
		||||
      email: email,
 | 
			
		||||
      creationTime: creation,
 | 
			
		||||
      lastSignInTime: creation,
 | 
			
		||||
      isNewUser: creation == creation,
 | 
			
		||||
    );
 | 
			
		||||
    _streamAccount.add(mock);
 | 
			
		||||
    _registeredMock = Pair(mock, password);
 | 
			
		||||
 | 
			
		||||
@ -14,9 +14,6 @@
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
import 'dart:async';
 | 
			
		||||
 | 
			
		||||
import 'package:rxdart/rxdart.dart';
 | 
			
		||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/src/core/constants/form_field.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/src/core/constants/form_name.dart';
 | 
			
		||||
@ -46,8 +43,6 @@ class AuthenticationRepositoryImpl<T extends Object>
 | 
			
		||||
  final OnSignUpSuccess<T>? _onSignUpSuccess;
 | 
			
		||||
 | 
			
		||||
  final OnAuthChange<T>? _onAccountChanges;
 | 
			
		||||
  final StreamController<FutureResult<AccountWrapper<T>>> _signUpStream =
 | 
			
		||||
      StreamController();
 | 
			
		||||
 | 
			
		||||
  bool _pause = false; // Semaphore
 | 
			
		||||
 | 
			
		||||
@ -139,11 +134,7 @@ class AuthenticationRepositoryImpl<T extends Object>
 | 
			
		||||
              _formRepository.accessForm(AuthFormName.signUpForm).clone(),
 | 
			
		||||
            );
 | 
			
		||||
            await dataResult.foldAsync(
 | 
			
		||||
              (data) async {
 | 
			
		||||
                await _authenticationLocalDataSource.storeData(data);
 | 
			
		||||
                _signUpStream
 | 
			
		||||
                    .add(Future.value(Ok(AccountWrapperModel(account, data))));
 | 
			
		||||
              },
 | 
			
		||||
              _authenticationLocalDataSource.storeData,
 | 
			
		||||
              (error) async => error,
 | 
			
		||||
            );
 | 
			
		||||
          }
 | 
			
		||||
@ -214,21 +205,16 @@ class AuthenticationRepositoryImpl<T extends Object>
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Stream<FutureResult<AccountWrapper<T>>> streamAccount() => MergeStream([
 | 
			
		||||
        _signUpStream.stream.asBroadcastStream(),
 | 
			
		||||
  Stream<FutureResult<AccountWrapper<T>>> streamAccount() =>
 | 
			
		||||
      _authenticationRemoteDataSource.streamAccount().map((account) async {
 | 
			
		||||
        if (_onAccountChanges.isNotNull && !_pause) {
 | 
			
		||||
          final dataResult = await _onAccountChanges!.call(account);
 | 
			
		||||
            return dataResult.map((data) {
 | 
			
		||||
              _authenticationLocalDataSource.storeData(data);
 | 
			
		||||
              return AccountWrapperModel(account, data);
 | 
			
		||||
            });
 | 
			
		||||
          return dataResult.map((data) => AccountWrapperModel(account, data));
 | 
			
		||||
        }
 | 
			
		||||
        return Ok<AccountWrapperModel<T>, AppException>(
 | 
			
		||||
          AccountWrapperModel<T>(account, null),
 | 
			
		||||
        );
 | 
			
		||||
        })
 | 
			
		||||
      ]);
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureResult<void> confirmPasswordReset({
 | 
			
		||||
 | 
			
		||||
@ -56,19 +56,6 @@ class AuthenticationCubit<Extra> extends Cubit<AuthenticationState<Extra>> {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// If authenticated, re-emits state with data freshly loaded from cache.
 | 
			
		||||
  FutureOr<void> reloadCache() async {
 | 
			
		||||
    if (state.status == AuthenticationStatus.authenticated) {
 | 
			
		||||
      final data = await _authenticationRepository.getCache();
 | 
			
		||||
      emit(
 | 
			
		||||
        data.fold(
 | 
			
		||||
          AuthenticationState<Extra>.authenticated,
 | 
			
		||||
          (error) => state,
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  FutureOr<void> signOut() {
 | 
			
		||||
    // TODO(hpcl): maybe force unauthenticated by emitting an event
 | 
			
		||||
    _authenticationRepository.signOut();
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ dependencies:
 | 
			
		||||
  flutter_facebook_auth: ^4.3.0
 | 
			
		||||
  sign_in_with_apple: ^3.3.0
 | 
			
		||||
  twitter_login: ^4.2.3
 | 
			
		||||
  rxdart: ^0.27.7
 | 
			
		||||
 | 
			
		||||
  wyatt_form_bloc:
 | 
			
		||||
    hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user