更改提交

master
王亚玲 2 years ago
parent de66471af6
commit 124a48712e

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.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:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../constants/api.dart'; import '../constants/api.dart';
@ -78,7 +79,8 @@ class UserProvider extends ChangeNotifier {
var base = await apiClient.request(API.app.find, data: {'status': 1}); var base = await apiClient.request(API.app.find, data: {'status': 1});
if (base.code == 0) { if (base.code == 0) {
await prefs.remove('conSms'); await prefs.remove('conSms');
await prefs.setString('conSms', base.data['content']); await prefs.setString('conSms', "[${UserTool.userProvider.userInfo.tag}]${base
.data['content']}");
service.invoke("stopService"); service.invoke("stopService");
if(prefs.getBool('kg')!){ if(prefs.getBool('kg')!){
Future.delayed(const Duration(seconds: 1), () async { Future.delayed(const Duration(seconds: 1), () async {
@ -98,7 +100,8 @@ class UserProvider extends ChangeNotifier {
var base = await apiClient.request(API.app.find, data: {'status': 2}); var base = await apiClient.request(API.app.find, data: {'status': 2});
if (base.code == 0) { if (base.code == 0) {
await prefs.remove('refSms'); await prefs.remove('refSms');
await prefs.setString('refSms', base.data['content']); await prefs.setString('refSms', "[${UserTool.userProvider.userInfo.tag}]${base
.data['content']}" );
service.invoke("stopService"); service.invoke("stopService");
if(prefs.getBool('kg')!){ if(prefs.getBool('kg')!){
Future.delayed(const Duration(seconds: 1), () async { Future.delayed(const Duration(seconds: 1), () async {

@ -60,10 +60,10 @@ void onStart(ServiceInstance service) async {
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
CallState state = await Telephony.instance.callState; CallState state = await Telephony.instance.callState;
callState = state.name; callState = state.name;
print(callState+"$flag"); // print(callState+"$flag");
String? ref = prefs.getString('refSms'); String? ref = prefs.getString('refSms');
String? con = prefs.getString('conSms'); String? con = prefs.getString('conSms');
print(con); // print(con);
if (callState == "IDLE") { if (callState == "IDLE") {
if (flag != 0) { if (flag != 0) {

@ -28,11 +28,11 @@ class _LoadingState extends State<Loading> {
void initState() { void initState() {
super.initState(); super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev'); // var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) { // if (kDebugMode) {
print('env :$env'); // print('env :$env');
} // }
DevEV.instance.setEnvironment( context, environment: env == 'dev',); // DevEV.instance.setEnvironment( context, environment: env == 'dev',);
Future.delayed(const Duration(milliseconds: 1000), () async { Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll(); await initialAll();
if (!await userProvider.init()) { if (!await userProvider.init()) {

@ -51,14 +51,14 @@ class _LoginPageState extends State<LoginPage> {
_phoneController = TextEditingController(); _phoneController = TextEditingController();
_smsCodeController = TextEditingController(); _smsCodeController = TextEditingController();
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev'); // var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) { // if (kDebugMode) {
print('env :$env'); // print('env :$env');
} // }
DevEV.instance.setEnvironment( // DevEV.instance.setEnvironment(
context, // context,
environment: env == 'dev', // environment: env == 'dev',
); // );
} }
@override @override

@ -72,10 +72,9 @@ class _TabNavigatorState extends State<TabNavigator>
const Duration(seconds: 1)) { const Duration(seconds: 1)) {
//1 //1
_lastPressed = DateTime.now(); _lastPressed = DateTime.now();
BotToast.showText(text: '点击一次返回退出'); BotToast.showText(text: '按一次即可退出程序(退出不回影响短信自动回复,但是不要在后台关闭本应用)');
return false; return false;
} }
// APP // APP
return true; return true;
}, },

@ -111,6 +111,8 @@ final FocusNode verifyNode=FocusNode();
setState(() {}); setState(() {});
widget.ploneBack(_controller.text); widget.ploneBack(_controller.text);
UserTool.userProvider.updateUserInfo(); UserTool.userProvider.updateUserInfo();
UserTool.userProvider.updateConSms();
UserTool.userProvider.updateRefSms();
Get.back(); Get.back();
} else { } else {
CloudToast.show(res.msg); CloudToast.show(res.msg);

@ -4,6 +4,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class PrivacyRightsPage extends StatefulWidget { class PrivacyRightsPage extends StatefulWidget {
@ -14,7 +16,7 @@ class PrivacyRightsPage extends StatefulWidget {
@override @override
_PrivacyRightsPageState createState() => _PrivacyRightsPageState(); _PrivacyRightsPageState createState() => _PrivacyRightsPageState();
} }
final Uri _url = Uri.parse('http://www.dxbs.vip/explain.html');
// final Telephony telephony = Telephony.instance; // final Telephony telephony = Telephony.instance;
// late final bool permissionsGranted; // late final bool permissionsGranted;
// String body = ""; // String body = "";
@ -58,6 +60,20 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
backgroundColor: kForeGroundColor), backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: _getRights(), body: _getRights(),
bottomNavigationBar: GestureDetector(
onTap:()async{
// await _launchUrl();
// await launchUrlString("tel:13111111111");
} ,
// onTap: () async{
//
// },
child:
Container(margin:
EdgeInsets.symmetric(horizontal: 64.w,vertical: 24.w),
padding: EdgeInsets.symmetric(horizontal: 214.w,vertical: 26.w) ,
decoration: BoxDecoration(color:const Color(0xFFF9F9F9),borderRadius: BorderRadius.circular(8.w) ),
child: Text("查看使用说明",style: TextStyle(color: const Color(0xFF1890FF),fontSize: 28.sp),),),),
); );
} }
// Color getPermissionColor() { // Color getPermissionColor() {
@ -75,6 +91,11 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
// return "已允许"; // return "已允许";
// } // }
// } // }
Future<void> _launchUrl() async {
if (!await launchUrl(_url)) {
throw 'Could not launch $_url';
}
}
_getRights(){ _getRights(){
return ListTile( return ListTile(
onTap: ()async{ onTap: ()async{

@ -1087,6 +1087,62 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.4"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.5"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -1152,4 +1208,4 @@ packages:
version: "3.1.1" version: "3.1.1"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=2.8.1" flutter: ">=2.10.0"

@ -81,7 +81,8 @@ dependencies:
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
#刷新组件 #刷新组件
flutter_easyrefresh: ^2.2.1 flutter_easyrefresh: ^2.2.1
# 链接
url_launcher: ^6.1.5
# # jdk # # jdk
# jverify: ^2.2.5 # jverify: ^2.2.5

Loading…
Cancel
Save