WIP - Replaced get_it + injectable with Provider

This commit is contained in:
Anton Stubenbord
2022-12-21 01:14:06 +01:00
parent 10149fb7c1
commit 60aecb549d
59 changed files with 1099 additions and 1362 deletions

View File

@@ -0,0 +1,44 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:paperless_mobile/features/login/model/authentication_information.dart';
part 'authentication_state.g.dart';
@JsonSerializable()
class AuthenticationState {
final bool wasLoginStored;
final bool? wasLocalAuthenticationSuccessful;
final bool isAuthenticated;
final AuthenticationInformation? authentication;
static final AuthenticationState initial = AuthenticationState(
wasLoginStored: false,
isAuthenticated: false,
);
AuthenticationState({
required this.isAuthenticated,
required this.wasLoginStored,
this.wasLocalAuthenticationSuccessful,
this.authentication,
});
AuthenticationState copyWith({
bool? wasLoginStored,
bool? isAuthenticated,
AuthenticationInformation? authentication,
bool? wasLocalAuthenticationSuccessful,
}) {
return AuthenticationState(
isAuthenticated: isAuthenticated ?? this.isAuthenticated,
wasLoginStored: wasLoginStored ?? this.wasLoginStored,
authentication: authentication ?? this.authentication,
wasLocalAuthenticationSuccessful: wasLocalAuthenticationSuccessful ??
this.wasLocalAuthenticationSuccessful,
);
}
factory AuthenticationState.fromJson(Map<String, dynamic> json) =>
_$AuthenticationStateFromJson(json);
Map<String, dynamic> toJson() => _$AuthenticationStateToJson(this);
}