提交更新

master
王亚玲 2 years ago
parent 634a3fcdd1
commit e8a6602425

@ -0,0 +1,81 @@
import 'package:hive/hive.dart';
@HiveType(typeId: 0)
class PhoneNumberHive{
@HiveField(0)
int? id;
@HiveField(1)
String? title;
@HiveField(2)
String? time;
@HiveField(3)
bool? state;
@HiveField(4)
List<PhoneNumModel>? phoneList;
PhoneNumberHive({
this.id,
this.title,
this.time,
this.state,
this.phoneList,
});
PhoneNumberHive.fromJson(Map<String,dynamic> json){
id=json['id'];
title=json['title'];
time=json['time'];
state=json['state'];
if(json['phoneList'] !=null){
phoneList=json['phoneList'].map((e) => PhoneNumModel.from(e)).toList();
}else{
phoneList=[];
}
}
Map<String,dynamic> toJson(){
final Map<String,dynamic> data= <String,dynamic>{};
data['id'] =id;
data['title']=title;
data['time']=time;
data['state']=state;
if(phoneList!=null){
data['phoneList']=phoneList!.map((e) => e.toJson()).toList();
}
return data;
}
}
@HiveType(typeId: 1)
class PhoneNumModel{
@HiveField(0)
int? id;
@HiveField(1)
String? name;
@HiveField(2)
String? phone;
@HiveField(3)
bool? state;
PhoneNumModel({
this.id,
this.name,
this.phone,
this.state,
});
PhoneNumModel.from(Map<String,dynamic> json){
id=json['id'];
name=json['name'];
phone=json['phone'];
state=json['state'];
}
Map<String,dynamic> toJson(){
final Map<String,dynamic> data=<String,dynamic>{};
data["id"]=id;
data['name']=name;
data['phone']=phone;
data['state']=state;
return data;
}
}

@ -6,10 +6,8 @@ import 'package:project_telephony/utils/user_tool.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../constants/api.dart';
import '../model/exclude_phone_model.dart';
import '../model/login_info_model.dart';
import '../model/network/api_client.dart';
import '../model/phone_num_model.dart';
import '../model/user_info_model.dart';
import '../ui/home/set/func/exclude_contacts_func.dart';
import '../utils/hive_store.dart';

@ -73,7 +73,7 @@ class _TextMePageState extends State<TextMePage> {
64.hb,
PloneBottom(
onTap: () async {
final Telephony telephony = Telephony.instance;
// final Telephony telephony = Telephony.instance;
if (_controller.text.isEmpty &&
_phoneController.text.isEmpty &&
signatureText.isEmpty) {
@ -82,20 +82,20 @@ class _TextMePageState extends State<TextMePage> {
print(_controller.text);
print(_phoneController.text);
print(signatureText);
// await sendSMS(
// message: _controller.text,
// recipients: [
// "13395740386",
// "13486828191",
// "18815060992",
// "18294841148"
// ],
// sendDirect: true);
await sendSMS(
message:"$signatureText${_controller.text}",
recipients: [
"13395740386",
"13486828191",
// "18815060992",
// "18294841148"
],
sendDirect: true);
await telephony.sendSms(
to: "13486828191,13395740386;18815060992;18294841148",
message: "$signatureText${_controller.text}"
);
// await telephony.sendSms(
// to: "13486828191;13395740386;18815060992;18294841148",
// message: "$signatureText${_controller.text}"
// );
CloudToast.show("发送成功");
// Telephony.sendSms(to: phoneNum!, message: idle);
}
@ -162,7 +162,15 @@ class _TextMePageState extends State<TextMePage> {
// focusNode: verifyNode,
maxLines: 100,
keyboardType: TextInputType.text,
onChanged: (text) {
// onChanged: (text) {
// if (title == "短信内容") {
// _controller.text = text;
// } else {
// _phoneController.text = text;
// }
// setState(() {});
// },
onSubmitted: (text){
if (title == "短信内容") {
_controller.text = text;
} else {

@ -59,7 +59,7 @@ void onStart(ServiceInstance service) async {
String? idle = prefs.getString('idleSms');
bool? callSw = prefs.getBool('callSwitch');
bool? idleSw = prefs.getBool('idleSwitch');
int? numberSet = prefs.getInt("numIndex");
int? numberSet = prefs.getInt("numIndex") ?? 0;
List<String>? numberList = prefs.getStringList("addressList") ;
List<String>? noNumberList = prefs.getStringList("specified");
print("号码设置$numberSet 通讯列表$numberList 指定不发送$noNumberList");
@ -69,6 +69,7 @@ void onStart(ServiceInstance service) async {
phoneNum = entry.first.number;
callRecords = entry.first.duration;
print(phoneNum);
// if()
switch (numberSet) {
case 0:
if (!(noNumberList!.contains(phoneNum))) {

@ -2,6 +2,8 @@ import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
import '../model/hive/phone_number_hive.dart';
class HiveStore {
static Box? _appBox;
@ -17,7 +19,8 @@ class HiveStore {
if (!kIsWeb) {
var dir = await getApplicationDocumentsDirectory();
Hive.init(dir.path);
// Hive.registerAdapter(()); //HiveTypeId:0
// Hive.registerAdapter(MyObjectAdapter());
// Hive.registerAdapter(PhoneNumberHive()); //HiveTypeId:0
_appBox = await Hive.openBox('app');
_userBox = await Hive.openBox('userBox');
_dataBox = await Hive.openBox('dataBox');

@ -99,6 +99,8 @@ dependencies:
common_utils: ^2.1.0
# 群发号码
flutter_sms: ^2.3.3
## 生成适配器
# hive_generator: ^1.1.3
# # jdk
# jverify: ^2.2.5
## pub 集成

Loading…
Cancel
Save