From 4f1c7926ed11c8155f152ede02d88fcc2b8e9cfb Mon Sep 17 00:00:00 2001 From: Drawner Date: Sun, 29 Mar 2020 16:50:43 -0500 Subject: [PATCH] 5.0.1 Initialize Set variables in the constructor. --- CHANGELOG.md | 3 +++ README.md | 2 +- lib/src/auth.dart | 43 +++++++++++++++++++++++-------------------- pubspec.yaml | 2 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fd3f4c..2682dba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 5.0.1 +- Initialize Set variables in the constructor. + ## 5.0.0 - Separate 'web version' in auth_web.dart diff --git a/README.md b/README.md index 566d1b7..7331fda 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ And so, in this case, add this to your package's pubspec.yaml file instead: ```yaml dependencies: - auth:^4.0.0 + auth:^5.0.0 ``` For more information on this topic, read the article, [The importance of semantic versioning](https://medium.com/@xabaras/the-importance-of-semantic-versioning-9b78e8e59bba). diff --git a/lib/src/auth.dart b/lib/src/auth.dart index 60d7de5..86674d5 100644 --- a/lib/src/auth.dart +++ b/lib/src/auth.dart @@ -75,13 +75,13 @@ class Auth { String _key; String _secret; - Set _fireBaseListeners = Set(); - bool _firebaseRunning = false; + Set _fireBaseListeners; + bool _firebaseRunning; - Set _googleListeners = Set(); - bool _googleRunning = false; + Set _googleListeners; + bool _googleRunning; - List _eventErrors = List(); + List _eventErrors; factory Auth({ SignInOption signInOption = SignInOption.standard, @@ -92,9 +92,8 @@ class Auth { List permissions, String key, String secret, - }) { - if (_this == null) { - _this = Auth._( + }) => + _this ??= Auth._( signInOption: signInOption, scopes: scopes, hostedDomain: hostedDomain, @@ -104,11 +103,6 @@ class Auth { key: key, secret: secret, ); - } - - /// Any subsequent instantiations are ignored. - return _this; - } Auth._({ SignInOption signInOption, @@ -120,6 +114,14 @@ class Auth { String key, String secret, }) { + _fireBaseListeners = Set(); + _firebaseRunning = false; + + _googleListeners = Set(); + _googleRunning = false; + + _eventErrors = List(); + _initFireBase(listener: listener); if (_mobGoogleSignIn == null) { @@ -584,9 +586,9 @@ class Auth { /// returned Future completes with [PlatformException] whose `code` can be /// either [kSignInRequiredError] (when there is no authenticated user) or /// [kSignInFailedError] (when an unknown error occurred). - Future signInWithGoogleSilently({ - void listen(GoogleSignInAccount user), - bool suppressErrors = true}) async { + Future signInWithGoogleSilently( + {void listen(GoogleSignInAccount user), + bool suppressErrors = true}) async { _initListen(listen: listen); // Attempt to get the currently authenticated user @@ -652,8 +654,8 @@ class Auth { bool firebaseUser = true, }) async { /// Attempt to sign in without user interaction - bool logIn = await signInWithGoogleSilently( - listen: listen, suppressErrors: true); + bool logIn = + await signInWithGoogleSilently(listen: listen, suppressErrors: true); if (!logIn) { /// Force the user to interactively sign in @@ -967,7 +969,7 @@ class Auth { suppressAsserts: true, ); - /// Sign into Firebase by logging into Facebook + /// Sign into Firebase by logging into Twitter /// /// https://pub.dev/packages/flutter_twitter /// @@ -1286,7 +1288,8 @@ class Auth { } // firebaseUser = true will check if logged in Firebase - Future _setFireBaseUserFromGoogle(GoogleSignInAccount googleUser) async { + Future _setFireBaseUserFromGoogle( + GoogleSignInAccount googleUser) async { final GoogleSignInAuthentication auth = await googleUser?.authentication; FirebaseUser user; diff --git a/pubspec.yaml b/pubspec.yaml index 358fb1f..8f55127 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: auth description: Authorization Library Package to log into Google, Facebook, or by Username and Password. -version: 5.0.0 +version: 5.0.1 author: Greg Perry homepage: https://github.com/AndriousSolutions/auth repository: https://github.com/AndriousSolutions/auth