修复xhj布局下增值服务购买后状态未刷新不能使用问题

This commit is contained in:
Daisy 2024-06-03 11:34:04 +08:00
parent 0d51c46393
commit 6114044991
5 changed files with 28 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class StarLockLoginLogic extends BaseGetXController {
deviceInfo: state.deviceInfoMap.value);
if (entity.errorCode!.codeIsSuccessful) {
Storage.saveLoginData(entity.data);
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
eventBus.fire(MineInfoChangeRefreshUI());
XSJPushProvider().bindDeviceID();
XSJPushProvider().initLocalNotification(isCancelLocalPush: false);

View File

@ -17,7 +17,7 @@ class StarLockMineLogic extends BaseGetXController {
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
if (entity.errorCode!.codeIsSuccessful) {
state.mineInfoData.value = entity.data!;
state.isVip.value = state.mineInfoData.value.isVip! == 0 ? false : true;
state.isVip.value = state.mineInfoData.value.isVip! == 1;
Storage.setBool(saveIsVip, state.isVip.value);
}
}

View File

@ -115,7 +115,7 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
if (canGoBack) {
await state.webBuyView.goBack();
} else if (state.allowReturn) {
Get.back();
Get.back(result: true);
} else {
if (_lastPressedAt == null ||
DateTime.now().difference(_lastPressedAt!) >

View File

@ -1,5 +1,7 @@
import 'dart:async';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_state.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
@ -12,4 +14,18 @@ class ValueAddedServicesListLogic extends BaseGetXController {
var entity = await ApiRepository.to.getServicePackageBuyUrl();
if (entity.errorCode!.codeIsSuccessful) {}
}
//
Future<void> getUserInfoRequest() async {
final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
if (entity.errorCode!.codeIsSuccessful) {
Storage.setBool(saveIsVip, entity.data!.isVip! == 1);
}
}
@override
Future<void> onReady() async {
super.onReady();
getUserInfoRequest();
}
}

View File

@ -66,14 +66,19 @@ class _ValueAddedServicesPageListState
_valueAddedServicesItem(
Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'),
TranslationLoader.lanKeys!.advancedFunction!.tr, () async {
bool? isVip = await Storage.getBool(saveIsVip);
final bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == null || !isVip) {
// if (CommonDataManage().currentKeyInfo.isLockOwner != 1) {
// logic.showToast('请先添加锁');
// } else {
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
'webBuyType': XSConstantMacro.webBuyTypeVip,
});
//
final result = await Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: <String, int>{
'webBuyType': XSConstantMacro.webBuyTypeVip,
});
if (result != null && result.isNotEmpty) {
logic.getUserInfoRequest();
}
// }
} else {
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);