This commit is contained in:
wyf
2025-08-12 17:22:11 +08:00
parent b528ab950d
commit fcd3a281cf
20 changed files with 297 additions and 233 deletions

View File

@@ -5,8 +5,11 @@ import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/model/api_response.dart';
part 'device_type_controller.g.dart'; // 由json_serializable自动生成的部分
@@ -48,9 +51,15 @@ class DeviceTypeController extends GetControllerEx<DeviceTypeModel> {
String serviceApi = ServiceConstant.device_type;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {

View File

@@ -88,40 +88,4 @@ class ExperienceStoreListController
});
}
//determinePosition() async {
// bool serviceEnabled;
// LocationPermission permission;
// // Test if location services are enabled.
// serviceEnabled = await Geolocator.isLocationServiceEnabled();
// if (!serviceEnabled) {
// // Location services are not enabled don't continue
// // accessing the position and request users of the
// // App to enable the location services.
// return Future.error('Location services are disabled.');
// }
// permission = await Geolocator.checkPermission();
// if (permission == LocationPermission.denied) {
// permission = await Geolocator.requestPermission();
// if (permission == LocationPermission.denied) {
// // Permissions are denied, next time you could try
// // requesting permissions again (this is also where
// // Android's shouldShowRequestPermissionRationale
// // returned true. According to Android guidelines
// // your App should show an explanatory UI now.
// return Future.error('Location permissions are denied');
// }
// }
// if (permission == LocationPermission.deniedForever) {
// // Permissions are denied forever, handle appropriately.
// return Future.error(
// 'Location permissions are permanently denied, we cannot request permissions.');
// }
// // When we reach here, permissions are granted and we can
// // continue accessing the position of the device.
// position = await Geolocator.getCurrentPosition();
//}
}

View File

@@ -191,8 +191,14 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
String serviceApi = ServiceConstant.user_info;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {

View File

@@ -123,7 +123,6 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
} catch (e) {
ef.log("$e");
}
// permission = await Geolocator.checkPermission();
try {
// 2⃣ 检查权限(系统弹窗)—— 此时你的提示框仍然显示
permission = await Geolocator.checkPermission();
@@ -136,12 +135,9 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
Navigator.of(Get.context!, rootNavigator: true).pop();
}
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
if (permission == LocationPermission.denied) {
return Future.error('位置权限被拒绝');
}
}
if (permission == LocationPermission.deniedForever) {
return Future.error('位置权限被永久拒绝');