-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirects issue fixed for auth flow (#7)
* Redirects added for navigation based on auth session * Movie details passes through provider instead of constructor * Feature to allow user directly go to home after signup added * Redirects issue fixed
- Loading branch information
1 parent
8bc7787
commit f08d170
Showing
19 changed files
with
279 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
enum SocialAuthType { facebook, google } | ||
enum SocialAuthType { email, facebook, google } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:yts_mobile/core/core.dart'; | ||
|
||
class LogoutAlertDialogue { | ||
static Future<bool?> showAlert( | ||
BuildContext context, | ||
) async { | ||
return showDialog<bool?>( | ||
context: context, | ||
useRootNavigator: true, | ||
barrierDismissible: false, | ||
builder: (context) => AlertDialog( | ||
shape: const RoundedRectangleBorder( | ||
borderRadius: BorderRadius.all(Radius.circular(20)), | ||
), | ||
title: Text('Logout ?'.hardcoded), | ||
content: const Text(''), | ||
actions: <Widget>[ | ||
TextButton( | ||
style: TextButton.styleFrom( | ||
foregroundColor: Colors.red, | ||
), | ||
child: Text('Confirm'.hardcoded), | ||
onPressed: () => Navigator.pop(context, true), | ||
), | ||
TextButton( | ||
child: Text('Cancel'.hardcoded), | ||
onPressed: () => Navigator.pop(context, false), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,37 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:yts_mobile/features/auth/auth.dart'; | ||
|
||
final authStatusProvider = StreamProvider<User?>((ref) { | ||
return ref.read(firebaseAuthProvider).authStateChanges(); | ||
final authStatusProvider = ChangeNotifierProvider<GoRouterRefreshStream>((ref) { | ||
return GoRouterRefreshStream( | ||
ref.read(firebaseAuthProvider).authStateChanges(), | ||
); | ||
}); | ||
final skippedProvider = StateProvider<bool>((ref) { | ||
return false; | ||
}); | ||
|
||
class GoRouterRefreshStream extends ChangeNotifier { | ||
GoRouterRefreshStream(Stream<User?> stream) { | ||
notifyListeners(); | ||
_subscription = stream.asBroadcastStream().listen( | ||
(user) { | ||
_isLoggedIn = user != null; | ||
notifyListeners(); | ||
}, | ||
); | ||
} | ||
|
||
late final StreamSubscription<User?> _subscription; | ||
bool _isLoggedIn = false; | ||
bool get loggedInStatus => _isLoggedIn; | ||
|
||
@override | ||
void dispose() { | ||
_subscription.cancel(); | ||
super.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.