49 lines
1.2 KiB
Dart
49 lines
1.2 KiB
Dart
|
|
import 'package:aman_kassa_flutter/core/base/base_service.dart';
|
|
import 'package:aman_kassa_flutter/core/models/session.dart';
|
|
import 'package:aman_kassa_flutter/core/models/user.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'ApiService.dart';
|
|
|
|
class AuthenticationService extends BaseService {
|
|
|
|
final ApiService _api;
|
|
|
|
AuthenticationService({ApiService api}) : _api = api;
|
|
|
|
User _currentUser;
|
|
User get currentUser => _currentUser;
|
|
|
|
Session _session;
|
|
Session get currentSession => _session;
|
|
|
|
// Future loginWithEmail({
|
|
// @required String email,
|
|
// @required String password,
|
|
// }) async {
|
|
// try {
|
|
// User result = await _api.getUserProfile(123);
|
|
// _currentUser = result;
|
|
// return result != null;
|
|
// } catch (e) {
|
|
// return e.message;
|
|
// }
|
|
// }
|
|
|
|
Future<bool> isUserLoggedIn(token) async {
|
|
Session session = await _api.isActive(token);
|
|
if("OK" == session.message){
|
|
_session = session;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Future<bool> isUserLoggedIn() async {
|
|
// var user = await _firebaseAuth.currentUser();
|
|
// await _populateCurrentUser(user);
|
|
// return user != null;
|
|
// }
|
|
}
|