diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 882a27b..8966d8b 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -31,9 +31,11 @@
android:name="flutterEmbedding"
android:value="2" />
+
-
+
+
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/android/gradle.properties b/android/gradle.properties
index 94adc3a..a777f0e 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
+android.jetifier.blacklist=bcprov-jdk15on
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/main.dart b/lib/main.dart
index f528395..d76307e 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,5 +1,6 @@
import 'dart:async';
+
import 'package:bot_toast/bot_toast.dart';
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
@@ -7,7 +8,10 @@ import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_sms/flutter_sms.dart';
+import 'package:fluwx/fluwx.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
+import 'package:permission_handler/permission_handler.dart';
+import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:power_logger/power_logger.dart';
import 'package:project_telephony/providers/user_provider.dart';
@@ -16,13 +20,15 @@ import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart';
import 'package:project_telephony/utils/hive_store.dart';
-void _sendSMS(String message, List recipents) async {
- String _result = await sendSMS(message: message, recipients: recipents)
- .catchError((onError) {
- print(onError);
- });
- print(_result);
-}
+// void _sendSMS(String message, List recipients) async {
+// try{
+// String result =
+// await sendSMS(message: message, recipients: recipients, sendDirect: true);
+// print(result);
+// } on PlatformException catch(e){
+// print(e.toString());
+// }
+// }
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -30,81 +36,89 @@ void main() async {
LoggerData.addData(details);
FlutterError.presentError(details);
};
- await initializeService();
+ // await initializeService();
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
-Future initializeService() async {
- final service = FlutterBackgroundService();
- service.setNotificationInfo(title: '短信助手', content: '正在后台运行');
- await service.configure(
- androidConfiguration: AndroidConfiguration(
- onStart: onStart,
- autoStart: true,
- isForegroundMode: true,
- ),
- iosConfiguration: IosConfiguration(
- autoStart: true,
- onForeground: onStart,
- onBackground: onIosBackground,
- ),
- );
-}
-
-void onIosBackground() {
- WidgetsFlutterBinding.ensureInitialized();
- // print('FLUTTER BACKGROUND FETCH');
-}
-
-void onStart() {
- int flag = 0;
- String? phoneNum, callState;
- WidgetsFlutterBinding.ensureInitialized();
-
- 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 result = await CallLog.query();
- phoneNum = result.first.number;
- // print(phoneNum);
- // String message = "This is a test message!";
- // List recipents = ["10000", "10086"];
- // String _result = await sendSMS(message: message, recipients: recipents, sendDirect: true)
- // .catchError((onError) {
- // print(onError);
- // });
- // print(_result);
- phoneNum = result.first.number;
- print(phoneNum);
- final SmsSendStatusListener listener = (SendStatus status) {
- print(status);
- };
- Phone.telephony.sendSms(
- to: phoneNum!,
- message: "hello",
- statusListener: listener,
- isMultipart: true,
-
- );
- }
- } else if (callState == "RINGING") {
- flag++;
- } else if (callState == "OFFHOOK") {
- flag++;
- }
- });
-}
-
-class Phone {
- static Telephony telephony = Telephony.instance;
-}
+// Future initializeService() async {
+// final service = FlutterBackgroundService();
+// service.setNotificationInfo(title: '短信助手', content: '正在后台运行');
+// await service.configure(
+// androidConfiguration: AndroidConfiguration(
+// onStart: onStart,
+// autoStart: true,
+// isForegroundMode: true,
+// ),
+// iosConfiguration: IosConfiguration(
+// autoStart: true,
+// onForeground: onStart,
+// onBackground: onIosBackground,
+// ),
+// );
+// }
+
+// void onIosBackground() {
+// WidgetsFlutterBinding.ensureInitialized();
+// // print('FLUTTER BACKGROUND FETCH');
+// }
+//
+// void onStart() {
+// int flag = 0;
+// String phoneNum;
+// String callState;
+// WidgetsFlutterBinding.ensureInitialized();
+// 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 result = await CallLog.query();
+// // print(phoneNum);
+// // String message = "This is a test message!";
+// // List recipents = ["10000", "10086"];
+// // String _result = await sendSMS(message: message, recipients: recipents, sendDirect: true)
+// // .catchError((onError) {
+// // print(onError);
+// // });
+// // print(_result);
+// phoneNum = result.first.number!;
+// // List recipents=[
+// // phoneNum
+// // ];
+// if(phoneNum.isEmpty){
+// print("At Least 1 Person or Message Required");
+// }else{
+// print("你好"+phoneNum);
+// _sendSMS("你好", [phoneNum]);
+// print("你好"+phoneNum);
+// }
+// // final SmsSendStatusListener listener = (SendStatus status) {
+// // print(status);
+// // };
+// // Phone.telephony.sendSms(
+// // to: phoneNum!,
+// // message: "hello",
+// // statusListener: listener,
+// // isMultipart: true,
+// //
+// // );
+// }
+// } else if (callState == "RINGING") {
+// flag++;
+// } else if (callState == "OFFHOOK") {
+// flag++;
+// }
+// });
+// }
+//
+// class Phone {
+// static Telephony telephony = Telephony.instance;
+// }
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@@ -119,12 +133,20 @@ class _MyAppState extends State {
// the one in background.
final telephony = Telephony.instance;
@override
+ Future _Getpermission() async{
+ await [Permission.sms,Permission.phone,].request();
+}
void initState() {
super.initState();
+
final service = FlutterBackgroundService();
Future.delayed(const Duration(milliseconds: 0), () async {
//Hive.initFlutter;
+ _Getpermission();
await HiveStore.init();
+ registerWxApi(
+ appId: "wxd930ea5d5a228f5f",universalLink:"https://your.univerallink.com/link/ "
+ );
});
final inbox = Telephony.instance.getInboxSms();
// JPush jPush=JPush();
diff --git a/lib/model/hive/ContentHive.dart b/lib/model/hive/ContentHive.dart
new file mode 100644
index 0000000..0e3c3b4
--- /dev/null
+++ b/lib/model/hive/ContentHive.dart
@@ -0,0 +1,27 @@
+import 'package:hive/hive.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:equatable/equatable.dart';
+
+import 'content_list_model.dart';
+part 'ContentHive.g.dart';
+
+
+@JsonSerializable()
+@HiveType(typeId:2)
+class ContentHive extends Equatable{
+ @HiveField(0)
+ final int id;
+ @HiveField(1)
+ final String content;
+ @HiveField(2)
+ final List list;
+ factory ContentHive.fromJson(Map json) =>_$ContentHiveFromJson(json);
+
+ const ContentHive({
+ required this.id,
+ required this.content,
+ required this.list,
+ });
+ @override
+ List