From 375cba91ecee3249ae01d0e338cb22db26284e16 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Fri, 19 Aug 2022 15:09:00 +0800 Subject: [PATCH] telephone --- lib/constants/api.dart | 10 +---- lib/providers/user_provider.dart | 2 +- lib/ui/home/content_page.dart | 27 -------------- lib/ui/login/login_page.dart | 8 ++-- lib/ui/user/user_page.dart | 2 +- pubspec.lock | 63 -------------------------------- pubspec.yaml | 7 +--- 7 files changed, 9 insertions(+), 110 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index c213128..ec7c29a 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -6,19 +6,13 @@ class API { ///HOST static String get host { if (DevEV.instance.dev) { - return 'http://10.0.2.2:8088'; + return 'http://api.dxbs.vip'; } else { return 'https://api.yunyunwenche.com'; } } - static String get imageHost { - if (DevEV.instance.dev) { - return 'http://10.0.2.2:8088'; - } else { - return 'https://static.yunyunwenche.com'; - } - } + static const int networkTimeOut = 10000; static String get baseURL => host; diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index 1601a47..3c9612c 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -51,7 +51,7 @@ class UserProvider extends ChangeNotifier { _userInfo = UserInfoModel.fromJson(base.data); } else { CloudToast.show(base.msg); - _userInfo = UserInfoModel.fail; + _userInfo = UserInfoModel.fromJson(base.data); } notifyListeners(); } diff --git a/lib/ui/home/content_page.dart b/lib/ui/home/content_page.dart index ab0363b..2ff0801 100644 --- a/lib/ui/home/content_page.dart +++ b/lib/ui/home/content_page.dart @@ -2,7 +2,6 @@ import 'package:call_log/call_log.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_sms/flutter_sms.dart'; import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/ui/home/content_details_page.dart'; @@ -73,32 +72,6 @@ class _ContentPageState extends State { } else { final Iterable result = await CallLog.query(); phoneNum = result.first.number!; - await sendSMS(message:content, recipients: [phoneNum], sendDirect: true); - // bool? permissionsGranted = await telephony.requestPhonePermissions; - // print(permissionsGranted); - // if(permissionsGranted!){ - // print(content); - // // sendSms(content); - // telephony.sendSms( - // to: "13395740386", - // message: content, - // ); - // }else{ - // print(content); - // } - // print(content); - // // sendSms(content); - // telephony.sendSms( - // to: "13395740386", - // message: content, - // isMultipart: true - // ); - // List recipents=[ - // phoneNum - // ]; - // _sendSMS(content,recipents); - // String phoneNumber = await GetPhoneNumber().get(); - // print('getPhoneNumber result: $phoneNumber'); } setState(() {}); // print("这是数据" + textList[_s lect]); diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index b6113a9..1028d92 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -39,7 +39,7 @@ class _LoginPageState extends State { int _countDownNum = 59; late TextEditingController _phoneController; late TextEditingController _smsCodeController; - late FocusNode _phoneFocusNode; + late FocusNode _phoneFocusNode ; late FocusNode _smsCodeFocusNode; bool _cantSelected = false; @@ -63,8 +63,8 @@ class _LoginPageState extends State { @override void dispose() { - _phoneFocusNode.dispose(); - _smsCodeFocusNode.dispose(); + _phoneFocusNode.unfocus(); + _smsCodeFocusNode.unfocus(); _phoneController.dispose(); _smsCodeController.dispose(); super.dispose(); @@ -132,7 +132,7 @@ class _LoginPageState extends State { data: {'phone': _phoneController.text, 'code': _smsCodeController.text}); if (base.code == 0) { await UserTool.userProvider.setToken(base.data['token']); - Get.to(() => const TabNavigator()); + Get.offAll(() => const TabNavigator()); } else { CloudToast.show(base.msg); } diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 79dec11..dfedac4 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -274,7 +274,7 @@ class _UserPageState extends State { onChanged: (value) async{ vle=value; if(vle) { - Telephony.backgroundInstance.sendSms(to: "13395740386", message: "啦啦啦啦啦"); + // Telephony.backgroundInstance.sendSms(to: "13395740386", message: "啦啦啦啦啦"); // Workmanager().registerOneOffTask("task-identifier", "simpleTask"); } setState((){}); diff --git a/pubspec.lock b/pubspec.lock index 1913dc9..b0ed806 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -405,13 +405,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.5.3+2" - flutter_sms: - dependency: "direct main" - description: - name: flutter_sms - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.3" flutter_test: dependency: "direct dev" description: flutter @@ -1087,62 +1080,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" - url_launcher: - dependency: transitive - 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.6" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e60787d..43e8c0a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,13 +37,11 @@ dependencies: telephony: git: url: https://git.oa00.com/wylyl22/telephony.git -## 获取来电状态 -# provider: ^6.0.3 + # 获取通话记录 call_log: ^4.0.0 permission_handler: ^10.0.0 # 后台设置 - flutter_background_service: ^2.1.3 flutter_background_service_android: ^2.0.3 device_info_plus: any @@ -75,16 +73,13 @@ dependencies: permission_handler_platform_interface: ^3.7.0 provider: ^6.0.3 equatable: any - #日志输出 power_logger: ^1.2.2 # 短信 - flutter_sms: ^2.3.3 get_phone_number: ^2.0.1 # 存取数据 shared_preferences: ^2.0.15 -# flutter_telephony: any # # jdk # jverify: ^2.2.5