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(createStoreGroupsMiddleware())
..addAll(createStorePersistenceMiddleware()) ..addAll(createStorePersistenceMiddleware())
//..addAll(isTesting || kReleaseMode //..addAll(isTesting || kReleaseMode
..addAll(isTesting ..addAll(isTesting // TODO remove this
? [] ? []
: [ : [
LoggingMiddleware<dynamic>.printer( LoggingMiddleware<dynamic>.printer(

View File

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

View File

@ -106,6 +106,12 @@ void passwordCallback({
bool alwaysRequire = false, bool alwaysRequire = false,
}) { }) {
final state = StoreProvider.of<AppState>(context).state; 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) { if (state.authState.hasRecentlyEnteredPassword && !alwaysRequire) {
callback(null, null); callback(null, null);
} else { } else {
@ -125,7 +131,7 @@ void passwordCallback({
}, },
); );
} }
}); }, isSilent: true);
} else { } else {
showDialog<AlertDialog>( showDialog<AlertDialog>(
context: context, context: context,

View File

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