添加版本更新UI跟接口
This commit is contained in:
parent
ce9621d6bd
commit
fdc8a93fac
@ -127,28 +127,6 @@ void openBlueScan() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取版本号
|
|
||||||
void getVersionData() async {
|
|
||||||
// var entity = await ApiRepository.to.deletOwnerLockData(
|
|
||||||
// lockId: state.lockSetInfoData.value.lockId.toString(),
|
|
||||||
// );
|
|
||||||
// if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
// BlueManage().connectDeviceMacAddress = "";
|
|
||||||
// SchedulerBinding.instance.addPostFrameCallback((_) {
|
|
||||||
// eventBus.fire(RefreshLockListInfoDataEvent());
|
|
||||||
// });
|
|
||||||
// if(state.isOnlyOneData.value == true){
|
|
||||||
// Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
|
||||||
// Get.close(1);
|
|
||||||
// });
|
|
||||||
// }else{
|
|
||||||
// Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
|
||||||
// Get.close(2);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
///请求蓝牙权限
|
///请求蓝牙权限
|
||||||
Future<bool> getMicrophonePermission() async {
|
Future<bool> getMicrophonePermission() async {
|
||||||
// You can request multiple permissions at once.
|
// You can request multiple permissions at once.
|
||||||
|
|||||||
@ -865,4 +865,5 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
||||||
// _scanListDiscoveredDeviceSubscription.cancel();
|
// _scanListDiscoveredDeviceSubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
|||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
Obx(() => Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -68,7 +68,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
|||||||
style: TextStyle(fontSize: 20.sp),
|
style: TextStyle(fontSize: 20.sp),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Obx(() => Row(
|
Obx(() => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
|||||||
@ -38,11 +38,11 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
final state = Get.find<LockMainLogic>().state;
|
final state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
await logic.getStarLockInfo();
|
// await logic.getStarLockInfo();
|
||||||
setState(() {});
|
// setState(() {});
|
||||||
// logic.getStarLockInfo().then((LockListInfoEntity value) {
|
logic.getStarLockInfo().then((LockListInfoEntity value) {
|
||||||
// setState(() {});
|
setState(() {});
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1544,10 +1544,11 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取最新版本号
|
// 获取最新版本号
|
||||||
Future<Response> getVersionData(String messageId) => post(
|
Future<Response> getVersionData(String brandName, String currentVersion) => post(
|
||||||
getVersionURL.toUrl,
|
getVersionURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'id': messageId,
|
'brandName': brandName,
|
||||||
|
'currentVersion': currentVersion,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ import '../mine/minePersonInfo/minePersonInfoPage/minePersonGetUploadFileInfo_en
|
|||||||
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||||
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
||||||
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
||||||
|
import '../versionUndate/versionUndate_entity.dart';
|
||||||
import 'api_provider.dart';
|
import 'api_provider.dart';
|
||||||
|
|
||||||
class ApiRepository {
|
class ApiRepository {
|
||||||
@ -1556,4 +1557,13 @@ class ApiRepository {
|
|||||||
final res = await apiProvider.deletMessageLoadData(messageId);
|
final res = await apiProvider.deletMessageLoadData(messageId);
|
||||||
return MessageListEntity.fromJson(res.body);
|
return MessageListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取版本号
|
||||||
|
Future<VersionUndateEntity> getVersionData({
|
||||||
|
required String brandName,
|
||||||
|
required String currentVersion
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.getVersionData(brandName, currentVersion);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class VersionUndateWidget extends StatefulWidget {
|
|
||||||
const VersionUndateWidget({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<VersionUndateWidget> createState() => _VersionUndateWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _VersionUndateWidgetState extends State<VersionUndateWidget> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return const Placeholder();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
56
star_lock/lib/versionUndate/versionUndate_entity.dart
Normal file
56
star_lock/lib/versionUndate/versionUndate_entity.dart
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
class VersionUndateEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
VersionUndateEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
VersionUndateEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
int? isUpdate;
|
||||||
|
String? appDownloadUrl;
|
||||||
|
String? description;
|
||||||
|
int? isForceUpdate;
|
||||||
|
|
||||||
|
Data(
|
||||||
|
{this.isUpdate,
|
||||||
|
this.appDownloadUrl,
|
||||||
|
this.description,
|
||||||
|
this.isForceUpdate});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
isUpdate = json['isUpdate'];
|
||||||
|
appDownloadUrl = json['appDownloadUrl'];
|
||||||
|
description = json['description'];
|
||||||
|
isForceUpdate = json['isForceUpdate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['isUpdate'] = isUpdate;
|
||||||
|
data['appDownloadUrl'] = appDownloadUrl;
|
||||||
|
data['description'] = description;
|
||||||
|
data['isForceUpdate'] = isForceUpdate;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
88
star_lock/lib/versionUndate/versionUndate_logic.dart
Normal file
88
star_lock/lib/versionUndate/versionUndate_logic.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../network/api_repository.dart';
|
||||||
|
import 'versionUndate_state.dart';
|
||||||
|
|
||||||
|
class VersionUndateLogic extends BaseGetXController{
|
||||||
|
VersionUndateState state = VersionUndateState();
|
||||||
|
|
||||||
|
// 获取版本号
|
||||||
|
void getVersionData() async {
|
||||||
|
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
|
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
|
// print('androidInfo.manufacturer:${androidInfo.manufacturer}'
|
||||||
|
// 'androidInfo.device:${androidInfo.device}'
|
||||||
|
// 'androidInfo.model:${androidInfo.model}'
|
||||||
|
// 'androidInfo.product:${androidInfo.product}'
|
||||||
|
// 'androidInfo.version.release:${androidInfo.version.release}'
|
||||||
|
// 'androidInfo.version.sdkInt:${androidInfo.version.sdkInt}'
|
||||||
|
// 'androidInfo.version.securityPatch:${androidInfo.version.securityPatch}'
|
||||||
|
// 'androidInfo.version.incremental:${androidInfo.version.incremental}'
|
||||||
|
// 'androidInfo.version.codename:${androidInfo.version.codename}'
|
||||||
|
// 'androidInfo.version.baseOS:${androidInfo.version.baseOS}'
|
||||||
|
// 'androidInfo.board:${androidInfo.board}'
|
||||||
|
// 'androidInfo.bootloader:${androidInfo.bootloader}');
|
||||||
|
|
||||||
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
var version = packageInfo.version;
|
||||||
|
|
||||||
|
var entity = await ApiRepository.to.getVersionData(
|
||||||
|
brandName: androidInfo.manufacturer,
|
||||||
|
currentVersion: version,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.versionUndateEntity.value = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showUpdateAlertDialog() {
|
||||||
|
// showCupertinoDialog(
|
||||||
|
// context: Get.context!,
|
||||||
|
// builder: (context) {
|
||||||
|
// return CupertinoAlertDialog(
|
||||||
|
// content: const Text('重置后,该锁的指纹都将被删除哦,确认要重置吗?'),
|
||||||
|
// actions: [
|
||||||
|
// CupertinoDialogAction(
|
||||||
|
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// CupertinoDialogAction(
|
||||||
|
// child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
// onPressed: () {
|
||||||
|
//
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
getVersionData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
38
star_lock/lib/versionUndate/versionUndate_page.dart
Normal file
38
star_lock/lib/versionUndate/versionUndate_page.dart
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/versionUndate/versionUndate_logic.dart';
|
||||||
|
|
||||||
|
class VersionUndatePage extends StatefulWidget {
|
||||||
|
const VersionUndatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<VersionUndatePage> createState() => _VersionUndatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _VersionUndatePageState extends State<VersionUndatePage> {
|
||||||
|
final logic = Get.put(VersionUndateLogic());
|
||||||
|
final state = Get.find<VersionUndateLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
// color: AppColors.mainColor,
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
height: 50.h,
|
||||||
|
child: Text('版本更新', style: TextStyle(fontSize: 28.sp, color: Colors.blue),)
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left:20.w, right: 20.w, top: 10.h),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text('1、修复了一些bug \n2、优化了部分问题 \n3、修补了设置模块bug \n4、优化了部分问题 \n5、修补了设置模块bug', textAlign:TextAlign.start, style: TextStyle(fontSize: 20.sp))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
star_lock/lib/versionUndate/versionUndate_state.dart
Normal file
9
star_lock/lib/versionUndate/versionUndate_state.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'versionUndate_entity.dart';
|
||||||
|
|
||||||
|
class VersionUndateState{
|
||||||
|
final versionUndateEntity = VersionUndateEntity().obs;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user