Add loggin

This commit is contained in:
Hillel Coren 2021-02-23 17:48:02 +02:00
parent 5c93d1fcf7
commit bd57671369
5 changed files with 15 additions and 6 deletions

View File

@ -81,7 +81,7 @@ void main({bool isTesting = false}) async {
..addAll(createStoreGroupsMiddleware())
..addAll(createStorePersistenceMiddleware())
//..addAll(isTesting || kReleaseMode
..addAll(isTesting
..addAll(isTesting // TODO remove this
? []
: [
LoggingMiddleware<dynamic>.printer(

View File

@ -811,7 +811,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
'\nis Large: ${(company?.isLarge ?? false) ? 'Yes' : 'No'}'
'\nCompany: $companyUpdated${userCompanyState.isStale ? ' [S]' : ''}'
'\nStatic: $staticUpdated${staticState.isStale ? ' [S]' : ''}'
'\nPassword $passwordUpdated${authState.hasRecentlyEnteredPassword ? '' : ' [S]'}'
'\nPassword: $passwordUpdated${authState.hasRecentlyEnteredPassword ? '' : ' [S]'}'
'\n';
}
}

View File

@ -106,6 +106,12 @@ void passwordCallback({
bool alwaysRequire = false,
}) {
final state = StoreProvider.of<AppState>(context).state;
print(
'## hasRecentlyEnteredPassword: ${state.authState.hasRecentlyEnteredPassword}');
print('## oauthProvider.isNotEmpty: ${state.user.oauthProvider.isNotEmpty}');
print(
'## company.oauthPasswordRequired: ${state.company.oauthPasswordRequired}');
if (state.authState.hasRecentlyEnteredPassword && !alwaysRequire) {
callback(null, null);
} else {
@ -125,7 +131,7 @@ void passwordCallback({
},
);
}
});
}, isSilent: true);
} else {
showDialog<AlertDialog>(
context: context,

View File

@ -9,8 +9,11 @@ final GoogleSignIn _googleSignIn = GoogleSignIn(
],
);
void googleSignIn(Function(String, String, String) callback) async {
final account = await _googleSignIn.signIn();
void googleSignIn(Function(String, String, String) callback,
{bool isSilent = false}) async {
final account = await (isSilent
? _googleSignIn.signInSilently()
: _googleSignIn.signIn());
if (account != null) {
account.authentication.then((GoogleSignInAuthentication value) {
callback(value.idToken, value.accessToken, value.serverAuthCode);

View File

@ -1,3 +1,3 @@
void googleSignIn(Function(String, String, String) callback) async {}
void googleSignIn(Function(String, String, String) callback, {bool isSilent = false}) async {}
void googleSignUp(Function(String, String, String) callback) async {}