Compare commits

..

No commits in common. 'e9a50f149639642b0a20c79428e10f093096f3b0' and 'ec5abdf5db8c5b88ccf28fbbd48ddad034e802b1' have entirely different histories.

@ -31,6 +31,7 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- 互联网权限-->
<uses-permission android:name="android.permission.SEND_SMS"/>

Binary file not shown.

@ -58,7 +58,7 @@ class _App {
///
String get updateSelect =>'/app/update/select';
///
///ban
String get updateAdd => '/manage/update/add';
///

@ -1,40 +0,0 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'update_model.g.dart';
@JsonSerializable()
class UpdateModel extends Equatable {
final int updateStatus;
final int versionCode;
final String versionName;
final String modifyContent;
final String downloadUrl;
final String apkSize;
final String apkMd5;
factory UpdateModel.fromJson(Map<String, dynamic> json) =>
_$UpdateModelFromJson(json);
const UpdateModel({
required this.updateStatus,
required this.versionCode,
required this.versionName,
required this.modifyContent,
required this.downloadUrl,
required this.apkSize,
required this.apkMd5,
});
@override
List<Object?> get props => [
updateStatus,
versionCode,
versionName,
modifyContent,
downloadUrl,
apkSize,
apkMd5,
];
}

@ -1,17 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UpdateModel _$UpdateModelFromJson(Map<String, dynamic> json) => UpdateModel(
updateStatus: json['updateStatus'] as int,
versionCode: json['versionCode'] as int,
versionName: json['versionName'] as String,
modifyContent: json['modifyContent'] as String,
downloadUrl: json['downloadUrl'] as String,
apkSize: json['apkSize'] as String,
apkMd5: json['apkMd5'] as String,
);

@ -1,18 +1,16 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:package_info/package_info.dart';
import 'package:flutter_xupdate/flutter_xupdate.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/ui/home/set/func/user_info_func.dart';
import 'package:project_telephony/ui/home/content_connect_page.dart';
import 'package:project_telephony/ui/home/content_refuse_page.dart';
import 'package:project_telephony/ui/home/set/phone_set_page.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../utils/toast/cloud_toast.dart';
import '../user/privacy_rights_page.dart';
import 'content_connect_page.dart';
import 'content_refuse_page.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@ -25,6 +23,7 @@ bool sms = false;
bool plone = false;
bool addressBook = false;
bool kg = false;
final service = FlutterBackgroundService();
@override
@ -32,8 +31,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
getUpdate();
// initXUpdate();
initXUpdate();
//
WidgetsBinding.instance.addObserver(this);
_listenForPermissionStatus();
@ -56,63 +54,45 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
setState(() {});
}
getUpdate() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.version; //
String buildNumber = packageInfo.buildNumber; //
var res = await UserInfoFunc.getUpdate();
print("版本号$version");
print('版本构建号$buildNumber');
print("服务器上的${res.versionCode}");
print("服务器上的${res.versionName}");
if (res.versionCode > int.parse(buildNumber)) {
// CloudToast.show("是否进行版本更新");
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text("版本更新"),
content: Text(res.modifyContent),
actions: [
_getBox('跳转官网下载', () async {
await launchUrl(Uri.parse('https://www.dxbs.vip/dxbs.apk'),
mode: LaunchMode.externalApplication);
Navigator.of(context).pop();
}),
_getBox('取消', () {
Navigator.of(context).pop();
}),
],
);
});
}
}
///
void initXUpdate() {
FlutterXUpdate.init(
_getBox(String text, VoidCallback ontap) {
return GestureDetector(
onTap: ontap,
// () async {
// await launchUrl(Uri.parse('https://www.dxbs.vip/dxbs.apk'),
// mode: LaunchMode.externalApplication);
// Navigator.of(context).pop();
// },
child: Container(
///
debug: true,
padding: EdgeInsets.symmetric(horizontal:24.w, vertical: 24.w),
margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: const Color(0xFF1890FF)),
child: Container(
alignment: Alignment.center,
width: 175.w,
child: Text(
text,
style:
const TextStyle(color: Colors.white, fontWeight: FontWeight.w600),
),
)),
);
///使post
isPost: false,
///postjson
isPostJson: false,
///
timeout: 25000,
///
isWifiOnly: false,
///
isAutoMode: false,
///
supportSilentInstall: false,
///
enableRetry: false)
.then((value) {
// CloudToast.show("初始化成功: $value");
}).catchError((error) {
print(error);
});
// FlutterXUpdate.setErrorHandler(
// onUpdateError: (Map<String, dynamic> message) async {
// print(message);
// setState(() {
// _message = "$message";
// });
// });
}
@override
@ -309,32 +289,23 @@ alignment: Alignment.center,
// void checkUpdateDefault() {
// FlutterXUpdate.checkUpdate(url: 'https://gitee.com/xuexiangjys/XUpdate/raw/master/jsonapi/update_test.json');
// }
_getContainer(String title, String text, String image, Color cl1, Color cl2) {
return GestureDetector(
onTap: () async {
// Get.to(()=>UpdatePage());
// FlutterXUpdate.checkUpdate(
// // topImageRes:'vipbanner',
// widthRatio: 0.8,
// heightRatio: 0.8,
// themeColor:"#FF1890FF",
// // https://www.dxbs.vip/telephony.json
// // https://gitee.com/xuexiangjys/XUpdate/raw/master/jsonapi/update_test.json
// url:
// 'https://www.dxbs.vip/telephony.json',);
FlutterXUpdate.checkUpdate(
url:'');
// PackageInfo packageInfo = await PackageInfo.fromPlatform();
// String version = packageInfo.version;//
// String buildNumber = packageInfo.buildNumber;//
// print(version);
// print(buildNumber); supportSilentInstall:
// print(buildNumber);
// print(title);
if (title == "接听后") {
Get.to(() => const ContentConnectPage());
} else {
Get.to(() => const ContentRefusePage());
// print("未接听");
}
// if (title == "接听后") {
// Get.to(() => const ContentConnectPage());
// } else {
// Get.to(() => const ContentRefusePage());
// // print("未接听");
// }
},
child: Container(
decoration: BoxDecoration(

@ -1,6 +1,5 @@
import 'package:project_telephony/model/network/api_client.dart';
import 'package:project_telephony/model/network/base_model.dart';
import 'package:project_telephony/model/update_model.dart';
import '../../../../constants/api.dart';
import '../../../../utils/toast/cloud_toast.dart';
@ -17,21 +16,4 @@ class UserInfoFunc {
return false;
}
}
static Future<UpdateModel> getUpdate() async {
BaseModel res = await apiClient.request(API.app.updateSelect);
if (res.code == 0) {
// CloudToast.show("")
return UpdateModel.fromJson(res.data);
} else {
return const UpdateModel(
versionCode: 0,
updateStatus: 0,
versionName: '',
modifyContent: '',
apkSize: '',
apkMd5: '',
downloadUrl: '');
}
}
}

@ -763,7 +763,7 @@ packages:
source: hosted
version: "1.8.1"
path_provider:
dependency: "direct main"
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"

@ -33,7 +33,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.5
cupertino_icons: ^1.0.2
telephony:
git:
url: https://git.oa00.com/wylyl22/telephony.git
@ -55,7 +55,6 @@ dependencies:
flutter_screenutil: ^5.5.3+2
# 路由相关
get: ^4.6.5
# 包的信息
package_info: ^2.0.0
# 本地化存储
@ -106,7 +105,6 @@ dependencies:
dio: ^4.0.6
# 版本跟新
flutter_xupdate: ^2.0.3
path_provider: ^2.0.11
## 生成适配器
# hive_generator: ^1.1.3
# # jdk

Loading…
Cancel
Save