You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
790 B
37 lines
790 B
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
import 'package:supplier_new/common/settings.dart';
|
|
|
|
class AuthManager {
|
|
|
|
static final FlutterSecureStorage storage = FlutterSecureStorage(
|
|
aOptions: AndroidOptions(
|
|
resetOnError: true,
|
|
encryptedSharedPreferences: true,
|
|
),
|
|
);
|
|
|
|
static Future<String> decideStartScreen() async {
|
|
|
|
String? token = await storage.read(key: 'authToken');
|
|
|
|
if(token == null){
|
|
return "login";
|
|
}
|
|
|
|
await AppSettings.loadDataFromMemory();
|
|
|
|
String? onboarding = await storage.read(key: 'onboardingCompleted');
|
|
|
|
if(onboarding == null){
|
|
await storage.write(
|
|
key: 'onboardingCompleted',
|
|
value: 'true',
|
|
);
|
|
|
|
return "resources";
|
|
}
|
|
|
|
return "dashboard";
|
|
}
|
|
|
|
} |