diff --git a/android/app/build.gradle b/android/app/build.gradle index c497b2d..fee774f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -58,6 +58,11 @@ android { // signingConfig signingConfigs.release // } } + lintOptions { + disable 'InvalidPackage' + checkReleaseBuilds false + abortOnError false + } } flutter { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 882a27b..7c45efc 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,9 +30,9 @@ - - + + diff --git a/android/app/src/main/res/ic_launcher.png b/android/app/src/main/res/ic_launcher.png new file mode 100644 index 0000000..7325a57 Binary files /dev/null and b/android/app/src/main/res/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4..ab4708f 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-ldpi/ic_launcher.png b/android/app/src/main/res/mipmap-ldpi/ic_launcher.png new file mode 100644 index 0000000..36a6abb Binary files /dev/null and b/android/app/src/main/res/mipmap-ldpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b7..c36cfc6 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d4391..eb524ff 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..4ee0905 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..b13fdb6 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/assets/icons/sms.png b/assets/icons/sms.png new file mode 100644 index 0000000..617b2c6 Binary files /dev/null and b/assets/icons/sms.png differ diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index 377f5e6..06adb78 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -35,6 +35,9 @@ class $AssetsIconsGen { /// File path: assets/icons/privacy.png AssetGenImage get privacy => const AssetGenImage('assets/icons/privacy.png'); + /// File path: assets/icons/sms.png + AssetGenImage get sms => const AssetGenImage('assets/icons/sms.png'); + /// File path: assets/icons/switch1.png AssetGenImage get switch1 => const AssetGenImage('assets/icons/switch1.png'); diff --git a/lib/gen/fonts.gen.dart b/lib/gen/fonts.gen.dart new file mode 100644 index 0000000..35a90c7 --- /dev/null +++ b/lib/gen/fonts.gen.dart @@ -0,0 +1,18 @@ +/// GENERATED CODE - DO NOT MODIFY BY HAND +/// ***************************************************** +/// FlutterGen +/// ***************************************************** + +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: directives_ordering,unnecessary_import + +class FontFamily { + FontFamily._(); + + /// Font family: BlackItalic + static const String blackItalic = 'BlackItalic'; + + /// Font family: SemiBold + static const String semiBold = 'SemiBold'; +} diff --git a/lib/main.dart b/lib/main.dart index 9136dc2..a213478 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -105,6 +105,7 @@ class _MyAppState extends State { @override void initState() { super.initState(); + // PowerLogger.start(context, debug: true); final service = FlutterBackgroundService(); // JPush jPush=JPush(); // jPush.setup( diff --git a/lib/ui/home/content_page.dart b/lib/ui/home/content_page.dart index d08d20a..339ea56 100644 --- a/lib/ui/home/content_page.dart +++ b/lib/ui/home/content_page.dart @@ -1,10 +1,18 @@ +// import 'dart:async'; +// import android.app.PendingIntent; +// import android.telephony.SmsManager; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/ui/home/content_details_page.dart'; import 'package:project_telephony/ui/widget/centertipsalterwidget.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/utils/headers.dart'; +import 'package:telephony/telephony.dart'; + +import '../user/privacy_rights_page.dart'; class ContentPage extends StatefulWidget { final bool? isAnswer; //true接听false未接听 @@ -15,6 +23,17 @@ class ContentPage extends StatefulWidget { } class _ContentPageState extends State { + // static const platform=const MethodChannel("sendSms"); + // Future sendSms( String text) async{ + // print("sendSMS"); + // try{ + // final String result=await platform.invokeMethod('send', {"phone":"+8613486828191","msg":text}); + // print(result); + // } on PlatformException catch(e){ + // print(e.toString()); + // } + // } + // SmsManager smsManager = SmsManager.getDefault(); int _select = 0; List textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容']; List textList1 = ['自定义短信内容']; @@ -60,7 +79,26 @@ class _ContentPageState extends State { textList.setAll(index, {textContent}); }, )); - } else {} + } else { + 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: "13486828191", + message: content, + ); + } setState(() {}); // print("这是数据" + textList[_s lect]); diff --git a/lib/ui/user/privacy_rights_page.dart b/lib/ui/user/privacy_rights_page.dart index 42c8cf3..b4be750 100644 --- a/lib/ui/user/privacy_rights_page.dart +++ b/lib/ui/user/privacy_rights_page.dart @@ -15,6 +15,7 @@ class PrivacyRightsPage extends StatefulWidget { } final Telephony telephony = Telephony.instance; + // late final bool permissionsGranted; // String body = ""; // @override @@ -90,11 +91,11 @@ class _PrivacyRightsPageState extends State { // } _getRights(bool pd) { return ListView( - children: Permission.values + children: Permission.values .where((permission) { - return permission == Permission.phone || - permission == Permission.sms; - }) + return permission == Permission.phone || + permission == Permission.sms; + }) .map((permission) => PermissionWidget(permission)) .toList()); } @@ -165,11 +166,11 @@ class _PermissionState extends State { Widget build(BuildContext context) { return ListTile( title: Text( - _permission.value==8?title[0]:title[1], + _permission.value == 8 ? title[0] : title[1], style: Theme.of(context).textTheme.titleMedium, ), subtitle: Text( - _permission.value==8?sub[0]:sub[1], + _permission.value == 8 ? sub[0] : sub[1], ), trailing: Wrap( children: [ @@ -201,4 +202,4 @@ class _PermissionState extends State { print(_permissionStatus); }); } -} \ No newline at end of file +} diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 6c69ccb..c519c03 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -30,11 +30,11 @@ final Telephony telephony = Telephony.instance; class _UserPageState extends State { bool vle = false; - bool tooken = true; + bool tooken = false; @override void initState() { super.initState(); - PowerLogger.start(context, debug: true); + } @override @@ -55,8 +55,10 @@ class _UserPageState extends State { _getSwitch(Assets.icons.switch1.path, "功能开关", true), _getSwitch(Assets.icons.privacy.path, "隐私政策", false), _getSwitch(Assets.icons.permissions.path, "权限说明", false), + _getSwitch(Assets.icons.sms.path, "短信标签", false), // const Spacer(), 182.hb, + tooken? PloneBottom( border: false, onTap: () { @@ -66,7 +68,7 @@ class _UserPageState extends State { color1: const Color(0xFFEBF5FF), color2: const Color(0xFFEBF5FF), text: "退出登录", - ) + ):const SizedBox(), ]), ); } diff --git a/pubspec.yaml b/pubspec.yaml index da95813..8cab645 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -96,7 +96,7 @@ dev_dependencies: pub_semver: ^2.1.0 flutter_gen_runner: ^4.1.3 flutter_lints: ^2.0.0 - # patgh: ^1.8.1 +# patgh: ^1.8.1 #脚本工具 grinder: ^0.9.1 flutter_native_splash: ^1.1.8+4 diff --git a/tool/_build.dart b/tool/_build.dart index 249976d..9354b5c 100644 --- a/tool/_build.dart +++ b/tool/_build.dart @@ -37,10 +37,15 @@ buildApkDev() async { 'BUILD_TYPE=Dev', ], ); + String date = DateUtil.formatDate(DateTime.now(), format: 'yy_MM_dd_HH_mm'); + String version = await getVersion(); + await runAsync('rm', arguments: ['-rf', Config.apkDevDir]); + await runAsync('mkdir', arguments: ['-p', Config.apkDevDir]); + await runAsync('mv', arguments: [ Config.buildPath, '${Config.apkDevDir}/${Config.packageName}_${version}_beta_$date.apk'