添加更新云用户时区偏移与语言功能
This commit is contained in:
parent
626e9561b1
commit
a4e93f7794
@ -136,6 +136,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
super.didChangeAppLifecycleState(state);
|
super.didChangeAppLifecycleState(state);
|
||||||
|
// AppLog.log('App--->state:$state');
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case AppLifecycleState.inactive:
|
case AppLifecycleState.inactive:
|
||||||
// AppLog.log('App--->进入非活动状态');
|
// AppLog.log('App--->进入非活动状态');
|
||||||
@ -148,7 +149,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
// AppLog.log('App--->进入前台');
|
// AppLog.log('App--->进入前台');
|
||||||
if (Get.isRegistered<LockMainLogic>()) {
|
if (Get.isRegistered<LockMainLogic>()) {
|
||||||
//进入前台刷新如果存在锁列表则刷新,顺便判断 token 是否过期
|
//进入前台刷新如果存在锁列表则刷新,顺便判断 token 是否过期
|
||||||
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
Get.find<LockMainLogic>().updateZoneOffsetsAndLanguages();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.detached:
|
case AppLifecycleState.detached:
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
_groupDataList = <GroupList>[];
|
_groupDataList = <GroupList>[];
|
||||||
}
|
}
|
||||||
_groupDataList.addAll(entity.groupList!);
|
_groupDataList.addAll(entity.groupList!);
|
||||||
AppLog.log('_groupDataList[0].lockList!.length:${_groupDataList[0].lockList!.length}');
|
// AppLog.log('_groupDataList[0].lockList!.length:${_groupDataList[0].lockList!.length}');
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
@ -43,6 +44,17 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<LoginEntity> updateZoneOffsetsAndLanguages() async {
|
||||||
|
final LoginEntity entity = await ApiRepository.to.updateZoneOffsetsAndLanguages(
|
||||||
|
timezoneOffset: DateTime.now().timeZoneOffset.inSeconds,
|
||||||
|
// language: ''
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> loadMainDataLogic(LockListInfoGroupEntity entity) async {
|
Future<void> loadMainDataLogic(LockListInfoGroupEntity entity) async {
|
||||||
final bool every = entity.groupList?.every((GroupList list) =>
|
final bool every = entity.groupList?.every((GroupList list) =>
|
||||||
(list.lockList ?? <LockListInfoItemEntity>[]).isEmpty) ??
|
(list.lockList ?? <LockListInfoItemEntity>[]).isEmpty) ??
|
||||||
@ -60,7 +72,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
state.dataLength.value = 2;
|
state.dataLength.value = 2;
|
||||||
}
|
}
|
||||||
state.lockListInfoGroupEntity.value = entity;
|
state.lockListInfoGroupEntity.value = entity;
|
||||||
AppLog.log('entity:$entity state.lockListInfoGroupEntity.value.groupList!.length:${state.lockListInfoGroupEntity.value.groupList![0].lockList!.length}');
|
// AppLog.log('entity:$entity state.lockListInfoGroupEntity.value.groupList!.length:${state.lockListInfoGroupEntity.value.groupList![0].lockList!.length}');
|
||||||
//检测控制器是否存在
|
//检测控制器是否存在
|
||||||
if (Get.isRegistered<LockListLogic>()) {
|
if (Get.isRegistered<LockListLogic>()) {
|
||||||
//设置控制器数据并刷新
|
//设置控制器数据并刷新
|
||||||
@ -287,6 +299,9 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
checkWhetherPushIsEnabled();
|
checkWhetherPushIsEnabled();
|
||||||
_initSubscription();
|
_initSubscription();
|
||||||
connectListener();
|
connectListener();
|
||||||
|
|
||||||
|
// AppLog.log('onInit() updateZoneOffsetsAndLanguages');
|
||||||
|
updateZoneOffsetsAndLanguages();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -265,4 +265,6 @@ abstract class Api {
|
|||||||
final String keyNoticeSubmitURL = '/v2/key/noticeSubmit'; //发送短信、邮件通知
|
final String keyNoticeSubmitURL = '/v2/key/noticeSubmit'; //发送短信、邮件通知
|
||||||
final String lockUpdateLockInfo = '/lock/updateLockInfo'; //更新锁固件版本
|
final String lockUpdateLockInfo = '/lock/updateLockInfo'; //更新锁固件版本
|
||||||
final String exportLockRecordsURL = '/lockRecords/export'; //导出锁操作记录
|
final String exportLockRecordsURL = '/lockRecords/export'; //导出锁操作记录
|
||||||
|
|
||||||
|
final String updateZoneOffsetsAndLanguagesURL = '/cloudUser/updateSettings'; //更新云用户时区偏移与语言
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2479,6 +2479,19 @@ class ApiProvider extends BaseProvider {
|
|||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 获取锁信息列表
|
||||||
|
Future<Response> updateZoneOffsetsAndLanguages(
|
||||||
|
int timezoneOffset,
|
||||||
|
// String language
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
updateZoneOffsetsAndLanguagesURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{
|
||||||
|
'timezone_offset': timezoneOffset,
|
||||||
|
// 'language': language,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -2473,4 +2473,16 @@ class ApiRepository {
|
|||||||
await apiProvider.batchExportLockRecords(lockIds, startDate, endDate);
|
await apiProvider.batchExportLockRecords(lockIds, startDate, endDate);
|
||||||
return ExportRecordEntity.fromJson(res.body);
|
return ExportRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新云用户时区偏移与语言
|
||||||
|
Future<LoginEntity> updateZoneOffsetsAndLanguages(
|
||||||
|
{
|
||||||
|
required int timezoneOffset,
|
||||||
|
// required String language
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.updateZoneOffsetsAndLanguages(timezoneOffset,
|
||||||
|
// language
|
||||||
|
);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,11 +25,11 @@ case $environment in
|
|||||||
api_prefix='https://pre.lock.star-lock.cn'
|
api_prefix='https://pre.lock.star-lock.cn'
|
||||||
;;
|
;;
|
||||||
sky)
|
sky)
|
||||||
main_file="lib/main_sky.dart"
|
main_file="lib/main_sky_full.dart"
|
||||||
api_prefix='https://lock.skychip.top'
|
api_prefix='https://lock.skychip.top'
|
||||||
;;
|
;;
|
||||||
xhj)
|
xhj)
|
||||||
main_file="lib/main_xhj.dart"
|
main_file="lib/main_xhj_full.dart"
|
||||||
api_prefix='https://lock.xhjcn.ltd'
|
api_prefix='https://lock.xhjcn.ltd'
|
||||||
;;
|
;;
|
||||||
local)
|
local)
|
||||||
|
|||||||
@ -77,8 +77,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.67+2024062501:xhj 线上环境,提交测试:回归 测试部门bug
|
# 1.0.67+2024062501:xhj 线上环境,提交测试:回归 测试部门bug
|
||||||
# 1.0.69+2024070301:xhj 线上环境,提交测试:周常 bug 修复
|
# 1.0.69+2024070301:xhj 线上环境,提交测试:周常 bug 修复
|
||||||
# 1.0.69+2024070302:xhj 线上环境,提交测试:周常 bug 修复
|
# 1.0.69+2024070302:xhj 线上环境,提交测试:周常 bug 修复
|
||||||
|
# 1.0.70+2024072401:xhj 线上环境,提交测试:周常 bug 修复
|
||||||
|
|
||||||
version: 1.0.70+2024072401
|
version: 1.0.70+2024072402
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user