Compare commits
No commits in common. "a1484c6d4fccff0c76cdf80827095ddb18b46611" and "7fadc0c64dbb6e38b2461aea99a9a744e8b45d71" have entirely different histories.
a1484c6d4f
...
7fadc0c64d
|
@ -2,7 +2,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||
|
||||
class SessionManager {
|
||||
static final SessionManager _instance = SessionManager._();
|
||||
static const String _loggedInKey = 'isloggedin';
|
||||
static const String _loggedInKey = 'loggedIn';
|
||||
|
||||
factory SessionManager() {
|
||||
return _instance;
|
||||
|
@ -27,10 +27,6 @@ class SessionManager {
|
|||
|
||||
Future<void> logoutSession(bool value) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
//secretkey
|
||||
|
||||
await prefs.setBool("isloggedin", value);
|
||||
await prefs.setBool("isloggedout", true);
|
||||
await prefs.setBool(_loggedInKey, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
late Future<String> _domain;
|
||||
late Future<String> _key;
|
||||
late Future<bool> _login;
|
||||
late Future<bool> _logout;
|
||||
String platform = "android";
|
||||
var provider;
|
||||
@override
|
||||
|
@ -64,16 +63,13 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
// _domain = _prefs.then((SharedPreferences prefs) {
|
||||
// return prefs.getString('domain') ?? "";
|
||||
// });
|
||||
// _key = _prefs.then((SharedPreferences prefs) {
|
||||
// secretKeyTextConrtroller.text = prefs.getString('secretkey') ?? "";
|
||||
// return prefs.getString('secretkey') ?? "";
|
||||
// });
|
||||
_key = _prefs.then((SharedPreferences prefs) {
|
||||
secretKeyTextConrtroller.text = prefs.getString('secretkey') ?? "";
|
||||
return prefs.getString('secretkey') ?? "";
|
||||
});
|
||||
_login = _prefs.then((SharedPreferences prefs) {
|
||||
return prefs.getBool('isloggedin') ?? false;
|
||||
});
|
||||
_logout = _prefs.then((SharedPreferences prefs) {
|
||||
return prefs.getBool('isloggedout') ?? false;
|
||||
});
|
||||
}
|
||||
|
||||
init() async {
|
||||
|
@ -244,29 +240,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
|
||||
if (textFieldsValidation(provider).isEmpty) {
|
||||
print("email:${emailTextController.text}");
|
||||
// if (await _logout) {
|
||||
// print("LOGOUT");
|
||||
// provider.code = secretKeyTextConrtroller.text;
|
||||
// Map<String, dynamic> resp = await provider.verifyCode(
|
||||
// emailTextController.text, secretKeyTextConrtroller.text);
|
||||
// if (resp["code"] == "1200") {
|
||||
// provider.loading = false;
|
||||
// provider.showCodeField = false;
|
||||
// provider.showMessage = true;
|
||||
// _displaySnackBar("You have logged in successfully");
|
||||
// _saveprefs(resp["token"], emailTextController.text,
|
||||
// secretKeyTextConrtroller.text, true)
|
||||
// .then((value) {
|
||||
// Navigator.of(context).pushReplacement(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => NavigationHomeScreen()),
|
||||
// );
|
||||
// });
|
||||
// } else {
|
||||
// provider.message = resp["message"];
|
||||
// }
|
||||
// } else {
|
||||
print("FIRST LOGIN");
|
||||
if (!provider.showCodeField) {
|
||||
provider.email = emailTextController.text;
|
||||
String encoded =
|
||||
|
@ -318,7 +291,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
secretKeyTextConrtroller.text = provider.code!;
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
//_joinMeeting(roomText.text, "demo meet2");
|
||||
// _saveprefs(
|
||||
|
@ -362,7 +334,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
|
||||
final String secretkey = (prefs.getString('secretkey') ?? '');
|
||||
final bool isloggedin = (prefs.getBool('isloggedin') ?? false);
|
||||
final bool isloggedout = (prefs.getBool('isloggedout') ?? false);
|
||||
setState(() {
|
||||
_useremail = prefs.setString('useremail', email).then((bool success) {
|
||||
return useremail;
|
||||
|
@ -377,11 +348,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||
_login = prefs.setBool('isloggedin', login).then((bool success) {
|
||||
return isloggedin;
|
||||
});
|
||||
_logout = prefs.setBool('isloggedout', false).then((bool success) {
|
||||
return isloggedout;
|
||||
SessionManager().setLoggedIn(isloggedin);
|
||||
});
|
||||
});
|
||||
await SessionManager().setLoggedIn(isloggedin);
|
||||
// UserData userData =
|
||||
// UserData(email: email, name: token, domainUrl: domain, secretkey: key);
|
||||
// await provider.saveUserData(userData);
|
||||
|
|
Loading…
Reference in New Issue