feat : role And permission
This commit is contained in:
@@ -3,7 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_app/data/model/app_info_model.dart';
|
||||
import 'package:rasadyar_app/infrastructure/service/local_storage_service.dart';
|
||||
import 'package:rasadyar_app/infrastructure/utils/local_storage_utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
@@ -17,8 +17,9 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
final RxnString _updateFilePath = RxnString();
|
||||
final platform = MethodChannel('apk_installer');
|
||||
final Dio _dio = Dio();
|
||||
var gService = Get.find<GService>();
|
||||
var tokenService = Get.find<TokenStorageService>();
|
||||
var localService = Get.find<LocalStorageService>();
|
||||
|
||||
AppInfoModel? appInfoModel;
|
||||
|
||||
@override
|
||||
@@ -153,18 +154,20 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
try {
|
||||
final isUpdateNeeded = await checkVersion();
|
||||
if (isUpdateNeeded) return;
|
||||
tokenService.getModule();
|
||||
final module = tokenService.appModule.value;
|
||||
final target = localService.getTargetPage(module);
|
||||
|
||||
final module = gService.getSelectedModule();
|
||||
final target = gService.getTargetPage(module);
|
||||
if (module != null) {
|
||||
tokenService.setGlobalTokenAndRefToken(module);
|
||||
}
|
||||
|
||||
if (target != null) {
|
||||
var funs = localService.getFunctionsList(target.functions);
|
||||
await Future.wait(funs ?? []);
|
||||
|
||||
var mFuns = getFunctionsList(target.functions);
|
||||
await Future.wait(mFuns ?? []);
|
||||
Get.offAndToNamed(target.route!);
|
||||
}
|
||||
} catch (e, st) {
|
||||
debugPrint("onReady error: $e\n$st");
|
||||
eLog("onReady error: $e\n$st");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -239,11 +242,9 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
Future<void> installApk() async {
|
||||
try {
|
||||
eLog(_updateFilePath.value);
|
||||
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
await platform.invokeMethod('apk_installer', {'appPath': _updateFilePath.value});
|
||||
} catch (e) {
|
||||
print("خطا در نصب: $e");
|
||||
eLog(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user