From 92bdef35cabac0ef62b7d204f61785bd45c182b2 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Tue, 23 Aug 2022 18:28:23 +0800 Subject: [PATCH] w --- android/gradle.properties | 1 + lib/constants/api.dart | 11 ++++---- lib/main.dart | 5 ++-- lib/model/network/net_interceptor.dart | 1 + lib/providers/user_provider.dart | 2 +- lib/ui/home/call.dart | 28 +++++++++++---------- lib/ui/home/content_refuse_page.dart | 2 +- lib/ui/login/login_page.dart | 2 +- lib/ui/user/content_details_page.dart | 24 ++++++++++++------ lib/ui/user/user_page.dart | 35 +++++++++++++++----------- lib/ui/widget/image_scaffold.dart | 7 +++--- 11 files changed, 71 insertions(+), 47 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index a777f0e..d08ea18 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true android.jetifier.blacklist=bcprov-jdk15on +keytool -list -v -keystore /Users/datang/project_telephony/recook/jks/recook.keystore \ No newline at end of file diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 7c8f5f6..c8dc7e2 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -6,18 +6,19 @@ class API { ///HOST static String get host { if (DevEV.instance.dev) { - return 'http://10.0.2.2:8088/'; - // return 'http://api.dxbs.vip'; + // return 'http://10.0.2.2:8088/'; + return 'http://api.dxbs.vip'; } else { - return 'http://10.0.2.2:8088/'; + // return 'http://10.0.2.2:8088/'; - // return 'http://api.dxbs.vip/'; + return 'http://api.dxbs.vip/'; } } static String get imageHost { if (DevEV.instance.dev) { - return 'http://10.0.2.2:8088'; + // return 'http://10.0.2.2:8088'; + return 'http://api.dxbs.vip/'; } else { return 'http://api.dxbs.vip/'; } diff --git a/lib/main.dart b/lib/main.dart index f48df6c..a622996 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -43,7 +43,7 @@ void main() async { // FlutterError.presentError(details); // }; WidgetsFlutterBinding.ensureInitialized(); - await initializeService(); + // Workmanager().initialize( // callbackDispatcher, // The top level function, aka callbackDispatcher // isInDebugMode: true // If enabled it will post a notification whenever the task is running. Handy for debugging tasks @@ -78,7 +78,8 @@ class _MyAppState extends State { _Getpermission(); HiveStore.init(); registerWxApi( - appId: "wxd930ea5d5a228f5f",universalLink:"https://your.univerallink.com/link/ " + appId: "wxd930ea5d5a228f5f", + // universalLink:"http://api.dxbs.vip/ " ); } diff --git a/lib/model/network/net_interceptor.dart b/lib/model/network/net_interceptor.dart index 2d77fcb..fd925bb 100644 --- a/lib/model/network/net_interceptor.dart +++ b/lib/model/network/net_interceptor.dart @@ -15,6 +15,7 @@ class NetworkInterceptor extends Interceptor { switch (code) { //登录超时 case 100000: + // print("你超时了"); await userProvider.logout(); CloudToast.show(response.data['msg']); await Get.offAll(() => const LoginPage()); diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index 3c9612c..1601a47 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.fromJson(base.data); + _userInfo = UserInfoModel.fail; } notifyListeners(); } diff --git a/lib/ui/home/call.dart b/lib/ui/home/call.dart index 5ba9db2..012b409 100644 --- a/lib/ui/home/call.dart +++ b/lib/ui/home/call.dart @@ -48,29 +48,31 @@ void onStart(ServiceInstance service ) async { DartPluginRegistrant.ensureInitialized(); int flag = 0; String? phoneNum=""; - + int? callRecords=0; String callState; Timer.periodic(const Duration(seconds: 1), (timer) async { - CallState state = await Telephony.instance.callState; callState = state.name; - // print(callState!+" $flag"); if (callState == "IDLE") { if (flag != 0) { flag = 0; // print("object"); - final Iterable entry = await CallLog.query(); - phoneNum = entry.first.number; - // print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');//拨通时间 + phoneNum=entry.first.number; + callRecords = entry.first.duration; + // DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!) // print('DURATION : ${entry.first.duration}');///通话时长 - if(phoneNum!.isEmpty){ - print("At Least 1 Person or Message Required"); + if(callRecords!=0){ + print("接通了"); + Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了"); }else{ - print("你好$phoneNum"); - // final inbox = telephony.getInboxSms(); - Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦"); + print("没接通"); + Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "没接通"); + // print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');//拨通时间 + // print("你好$phoneNum"); + // // final inbox = telephony.getInboxSms(); + // Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "啦啦啦啦啦"); // telephony.sendSms(to: phoneNum, message: "感谢来电"); // _sendSMS('',[phoneNum]); // print("你好123123$phoneNum"); @@ -78,10 +80,10 @@ void onStart(ServiceInstance service ) async { } } else if (callState == "RINGING") { flag++; - print('flag $flag'); + // print('flag $flag'); } else if (callState == "OFFHOOK") { flag++; - print('flag $flag'); + // print('flag $flag'); } }); } diff --git a/lib/ui/home/content_refuse_page.dart b/lib/ui/home/content_refuse_page.dart index 1d86274..09a97cf 100644 --- a/lib/ui/home/content_refuse_page.dart +++ b/lib/ui/home/content_refuse_page.dart @@ -136,7 +136,7 @@ class _ContentRefusePageState extends State { }, onLongPress: () { if (content != "自定义短信内容") { - if (textListSMS.length == 1) { + if (textListSMS.length == 2) { BotToast.showText(text: '不能再删了'); } else { showDialog( diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index deb6dbb..e6fcc92 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -132,7 +132,7 @@ class _LoginPageState extends State { data: {'phone': _phoneController.text, 'code': _smsCodeController.text}); if (base.code == 0) { print(base.data['token']); - await UserTool.userProvider.setToken(base.data['token']); + await UserTool.userProvider.setToken(base.data['token']); Get.offAll(() => const TabNavigator()); } else { CloudToast.show(base.msg); diff --git a/lib/ui/user/content_details_page.dart b/lib/ui/user/content_details_page.dart index aaf5f82..c7a69b6 100644 --- a/lib/ui/user/content_details_page.dart +++ b/lib/ui/user/content_details_page.dart @@ -28,14 +28,18 @@ class ContentDetailsPage extends StatefulWidget { class _ContentDetailsPageState extends State { late TextEditingController _controller; // final userProvider = Provider.of(Get.context!, listen: false); - - +String cText=""; +final FocusNode verifyNode=FocusNode(); @override void initState() { super.initState(); _controller = TextEditingController(text: widget.content); } - +@override + void dispose(){ + super.dispose(); + // verifyNode.unfocus(); +} @override Widget build(BuildContext context) { @@ -44,7 +48,7 @@ class _ContentDetailsPageState extends State { appBar: AppBar( elevation: 0, title: Text( - '编辑短信标签1', + '编辑短信标签', style: TextStyle( fontSize: BaseStyle.fontSize34, color: BaseStyle.color333333, @@ -54,8 +58,9 @@ class _ContentDetailsPageState extends State { leading: const CloudBackButton(isSpecial: true), backgroundColor: kForeGroundColor), backgroundColor: Colors.white, - body: Container( - height: 800.w, + body: + Container( + height: 960.w, decoration: BoxDecoration( color: const Color(0xFFF9F9F9), borderRadius: BorderRadius.circular(16.w), @@ -63,8 +68,13 @@ class _ContentDetailsPageState extends State { padding: EdgeInsets.all(30.w), margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w), child: TextField( + focusNode: verifyNode, maxLines: 100, keyboardType: TextInputType.text, + onChanged: (text){ + cText=text; + setState((){}); + }, onEditingComplete: () { setState(() {}); // _refreshController.callRefresh(); @@ -92,7 +102,7 @@ class _ContentDetailsPageState extends State { ), bottomNavigationBar: PloneBottom( border: _controller.text.isEmpty, - opacity: _controller.text.isEmpty ? 1 : 0.4, + opacity: cText.isNotEmpty ? 1 : 0.4, onTap: () async { // print(_controller.text); BaseModel res = diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 23481da..5e16542 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -18,6 +18,7 @@ import '../../model/network/api_client.dart'; import '../../providers/user_provider.dart'; import '../../utils/toast/cloud_toast.dart'; import '../../utils/user_tool.dart'; +import '../home/call.dart'; import 'content_details_page.dart'; import '../home/home_page.dart'; @@ -34,27 +35,28 @@ final Telephony telephony = Telephony.instance; class _UserPageState extends State { // bool vle = PermissionStatus.denied.isGranted; //bool vle =PermissionStatus.denied.isGranted; - final userProvider = Provider.of(Get.context!, listen: false); - bool vle = false; + // final userProvider = Provider.of(Get.context!, listen: false); + bool isVip = false; String? endDate; @override void initState() { super.initState(); - if (userProvider.isLogin) { - if (userProvider.userInfo.isVip == 1) { + if ( UserTool.userProvider.isLogin) { + if (UserTool.userProvider.userInfo.isVip == 1) { isVip = true; } else { isVip = false; } - endDate=DateUtil.formatDateMs(userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d); + endDate=DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d); } } @override Widget build(BuildContext context) { return CloudScaffold( + systemStyle: const SystemUiOverlayStyle( statusBarIconBrightness: Brightness.dark, // systemNavigationBarColor: Colors.white, @@ -62,6 +64,7 @@ class _UserPageState extends State { path: Assets.images.bg.path, bodyColor: Colors.white, extendBody: true, + body: Column(children: [ _getUser(), 72.hb, @@ -73,7 +76,7 @@ class _UserPageState extends State { _getSwitch(Assets.icons.sms.path, "短信标签", false), // const Spacer(), 182.hb, - userProvider.isLogin + UserTool. userProvider.isLogin ? PloneBottom( border: false, onTap: () async { @@ -110,7 +113,8 @@ class _UserPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - userProvider.isLogin ? userProvider.userInfo.name : "登录/注册", + UserTool.userProvider.isLogin ?UserTool.userProvider.userInfo.name : "登录/注册", + // UserTool.userProvider.userInfo.name , style: TextStyle( fontSize: BaseStyle.fontSize48, color: BaseStyle.color333333, @@ -118,7 +122,7 @@ class _UserPageState extends State { ), 24.hb, Text( - userProvider.isLogin ? "欢迎您登录短信帮手" : "登录获取更多信息", + UserTool.userProvider.isLogin ? "欢迎您登录短信帮手" : "登录获取更多信息", style: TextStyle( fontSize: BaseStyle.fontSize28, color: BaseStyle.color333333), @@ -137,7 +141,7 @@ class _UserPageState extends State { }, child: ClipOval( child: Image.asset( - userProvider.isLogin?Assets.images.portraitDeep.path:Assets.images.portrait.path, + UserTool.userProvider.isLogin?Assets.images.portraitDeep.path:Assets.images.portrait.path, height: 128.w, width: 128.w, fit: BoxFit.cover, @@ -248,6 +252,7 @@ class _UserPageState extends State { //内容 _getSwitch(String url, String name, bool pd) { + bool vle = true; return GestureDetector( onTap: () async { if (!pd) { @@ -255,7 +260,7 @@ class _UserPageState extends State { case "短信标签": Get.to(() => ContentDetailsPage( content: - userProvider.isLogin ? userProvider.userInfo.tag : "", + UserTool.userProvider.isLogin ? UserTool.userProvider.userInfo.tag : "", ploneBack: (String textContent) { // print("这是数据" + textContent); // textList.setAll(index, {textContent}); @@ -296,7 +301,9 @@ class _UserPageState extends State { ? Switch( value: vle, onChanged: (value) async { - await Permission.phone.request(); + // vle=value; + // await initializeService(); + // await Permission.phone.request(); // List permissions = [ // Permission.sms, // Permission.phone, @@ -309,9 +316,9 @@ class _UserPageState extends State { // print('onOpenSetting'); // openAppSettings(); // }); - // setState(() { - // vle = value; - // }); + setState(() { + vle=value; + }); }) : const Icon(Icons.keyboard_arrow_right)), ), diff --git a/lib/ui/widget/image_scaffold.dart b/lib/ui/widget/image_scaffold.dart index c864e98..f7f50d8 100644 --- a/lib/ui/widget/image_scaffold.dart +++ b/lib/ui/widget/image_scaffold.dart @@ -82,7 +82,8 @@ class CloudScaffold extends StatelessWidget { ? AnnotatedRegion( value: systemStyle, child: Scaffold( - resizeToAvoidBottomInset: true, + resizeToAvoidBottomInset: false, + // resizeToAvoidBottomInset: true, endDrawer: endDrawer, backgroundColor: bodyColor, extendBodyBehindAppBar: extendBody, @@ -111,8 +112,8 @@ class CloudScaffold extends StatelessWidget { : AnnotatedRegion( value: systemStyle, child: Scaffold( - - resizeToAvoidBottomInset:true , + resizeToAvoidBottomInset: false, + // resizeToAvoidBottomInset:true , endDrawer: endDrawer, backgroundColor: bodyColor, extendBodyBehindAppBar: extendBody,