Skip to content

Commit

Permalink
5.0.1 Initialize Set variables in the constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drawner committed Mar 29, 2020
1 parent 606637c commit 4f1c792
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 5.0.1
- Initialize Set variables in the constructor.

## 5.0.0
- Separate 'web version' in auth_web.dart

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
43 changes: 23 additions & 20 deletions lib/src/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class Auth {
String _key;
String _secret;

Set<FireBaseListener> _fireBaseListeners = Set();
bool _firebaseRunning = false;
Set<FireBaseListener> _fireBaseListeners;
bool _firebaseRunning;

Set<GoogleListener> _googleListeners = Set();
bool _googleRunning = false;
Set<GoogleListener> _googleListeners;
bool _googleRunning;

List<Exception> _eventErrors = List();
List<Exception> _eventErrors;

factory Auth({
SignInOption signInOption = SignInOption.standard,
Expand All @@ -92,9 +92,8 @@ class Auth {
List<String> permissions,
String key,
String secret,
}) {
if (_this == null) {
_this = Auth._(
}) =>
_this ??= Auth._(
signInOption: signInOption,
scopes: scopes,
hostedDomain: hostedDomain,
Expand All @@ -104,11 +103,6 @@ class Auth {
key: key,
secret: secret,
);
}

/// Any subsequent instantiations are ignored.
return _this;
}

Auth._({
SignInOption signInOption,
Expand All @@ -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) {
Expand Down Expand Up @@ -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<bool> signInWithGoogleSilently({
void listen(GoogleSignInAccount user),
bool suppressErrors = true}) async {
Future<bool> signInWithGoogleSilently(
{void listen(GoogleSignInAccount user),
bool suppressErrors = true}) async {
_initListen(listen: listen);

// Attempt to get the currently authenticated user
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -1286,7 +1288,8 @@ class Auth {
}

// firebaseUser = true will check if logged in Firebase
Future<bool> _setFireBaseUserFromGoogle(GoogleSignInAccount googleUser) async {
Future<bool> _setFireBaseUserFromGoogle(
GoogleSignInAccount googleUser) async {
final GoogleSignInAuthentication auth = await googleUser?.authentication;

FirebaseUser user;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
homepage: https://github.com/AndriousSolutions/auth
repository: https://github.com/AndriousSolutions/auth
Expand Down

0 comments on commit 4f1c792

Please sign in to comment.