Начальный коммит

This commit is contained in:
2026-01-30 21:54:00 +07:00
parent 51de113db5
commit 3881248187
81 changed files with 5424 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import 'package:Stocky/services/local/StorageService.dart';
import 'package:get/get.dart';
class SplashScreenController extends GetxController {
late Future<bool> _authCheck;
@override
void onInit() {
super.onInit();
_authCheck = _checkAuthentication();
}
Future<bool> _checkAuthentication() async {
final LocalStorageService settings = Get.find<LocalStorageService>();
final accessToken = settings.getAccessToken();
if (accessToken != null && accessToken.isNotEmpty) {
return true;
}
return false;
}
Future<void> navigateBasedOnAuth() async {
final isAuthenticated = await _authCheck;
if (isAuthenticated) {
Get.offAllNamed('/home');
} else {
Get.offAllNamed('/login');
}
}
}