Compare commits

..

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

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

Binary file not shown.

@ -58,7 +58,7 @@ class _App {
/// ///
String get updateSelect =>'/app/update/select'; String get updateSelect =>'/app/update/select';
/// ///ban
String get updateAdd => '/manage/update/add'; 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 'dart:async';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_background_service/flutter_background_service.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: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/home/set/phone_set_page.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.dart'; import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:project_telephony/utils/headers.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 '../user/privacy_rights_page.dart';
import 'content_connect_page.dart';
import 'content_refuse_page.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key); const HomePage({Key? key}) : super(key: key);
@ -25,6 +23,7 @@ bool sms = false;
bool plone = false; bool plone = false;
bool addressBook = false; bool addressBook = false;
bool kg = false; bool kg = false;
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
@override @override
@ -32,8 +31,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getUpdate(); initXUpdate();
// initXUpdate();
// //
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
_listenForPermissionStatus(); _listenForPermissionStatus();
@ -56,63 +54,45 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
setState(() {}); setState(() {});
} }
getUpdate() async { ///
PackageInfo packageInfo = await PackageInfo.fromPlatform(); void initXUpdate() {
String version = packageInfo.version; // FlutterXUpdate.init(
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();
}),
],
);
});
}
}
_getBox(String text, VoidCallback ontap) { ///
return GestureDetector( debug: true,
onTap: ontap,
// () async {
// await launchUrl(Uri.parse('https://www.dxbs.vip/dxbs.apk'),
// mode: LaunchMode.externalApplication);
// Navigator.of(context).pop();
// },
child: Container(
padding: EdgeInsets.symmetric(horizontal:24.w, vertical: 24.w), ///使post
margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.w), isPost: false,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), ///postjson
color: const Color(0xFF1890FF)), isPostJson: false,
child: Container(
alignment: Alignment.center, ///
width: 175.w, timeout: 25000,
child: Text(
text, ///
style: isWifiOnly: false,
const TextStyle(color: Colors.white, fontWeight: FontWeight.w600),
), ///
)), 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 @override
@ -309,32 +289,23 @@ alignment: Alignment.center,
// void checkUpdateDefault() { // void checkUpdateDefault() {
// FlutterXUpdate.checkUpdate(url: 'https://gitee.com/xuexiangjys/XUpdate/raw/master/jsonapi/update_test.json'); // 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) { _getContainer(String title, String text, String image, Color cl1, Color cl2) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
// Get.to(()=>UpdatePage()); FlutterXUpdate.checkUpdate(
// FlutterXUpdate.checkUpdate( url:'');
// // 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',);
// PackageInfo packageInfo = await PackageInfo.fromPlatform(); // PackageInfo packageInfo = await PackageInfo.fromPlatform();
// String version = packageInfo.version;// // String version = packageInfo.version;//
// String buildNumber = packageInfo.buildNumber;// // String buildNumber = packageInfo.buildNumber;//
// print(version); // print(version);
// print(buildNumber); supportSilentInstall: // print(buildNumber);
// print(title); // print(title);
if (title == "接听后") { // if (title == "接听后") {
Get.to(() => const ContentConnectPage()); // Get.to(() => const ContentConnectPage());
} else { // } else {
Get.to(() => const ContentRefusePage()); // Get.to(() => const ContentRefusePage());
// print("未接听"); // // print("未接听");
} // }
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(

@ -1,6 +1,5 @@
import 'package:project_telephony/model/network/api_client.dart'; import 'package:project_telephony/model/network/api_client.dart';
import 'package:project_telephony/model/network/base_model.dart'; import 'package:project_telephony/model/network/base_model.dart';
import 'package:project_telephony/model/update_model.dart';
import '../../../../constants/api.dart'; import '../../../../constants/api.dart';
import '../../../../utils/toast/cloud_toast.dart'; import '../../../../utils/toast/cloud_toast.dart';
@ -9,29 +8,12 @@ class UserInfoFunc {
static Future<bool> getAddVip(String code) async { static Future<bool> getAddVip(String code) async {
BaseModel res = BaseModel res =
await apiClient.request(API.content.redeemVip, data: {"code": code}); await apiClient.request(API.content.redeemVip, data: {"code": code});
if (res.code == 0) { if(res.code==0){
CloudToast.show("卡密兑换成功"); CloudToast.show("卡密兑换成功");
return true; return true;
} else { }else{
CloudToast.show(res.msg); CloudToast.show(res.msg);
return false; 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 source: hosted
version: "1.8.1" version: "1.8.1"
path_provider: path_provider:
dependency: "direct main" dependency: transitive
description: description:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"

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

Loading…
Cancel
Save