# Conflicts:
#	lib/providers/user_provider.dart
#	lib/ui/home/call.dart
#	lib/ui/user/user_page.dart
master
王亚玲 2 years ago
commit 722001072d

@ -75,13 +75,12 @@ class UserProvider extends ChangeNotifier {
Future updateConSms() async {
final prefs = await SharedPreferences.getInstance();
final service=FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 1});
if (base.code == 0) {
await prefs.remove('refSms');
await prefs.remove('conSms');
await prefs.setString('conSms', base.data['content']);
print(prefs.getString('action'));
// _contentCon = base.data['content'];
service.invoke("stopService");
} else {
CloudToast.show(base.msg);
}
@ -93,12 +92,12 @@ class UserProvider extends ChangeNotifier {
final service=FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 2});
if (base.code == 0) {
// await prefs.remove('refSms');
// print(base.data['content']);
await prefs.remove('refSms');
print(base.data['content']);
await prefs.setString('refSms', base.data['content']);
// print(prefs.getString('refSms'));
service.startService();
// _contentRef = base.data['content'];
print(prefs.getString('refSms'));
service.invoke("stopService");
} else {
CloudToast.show(base.msg);
}

@ -60,46 +60,21 @@ void onStart(ServiceInstance service) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
CallState state = await Telephony.instance.callState;
callState = state.name;
// print(callState+"$flag");
print(callState+"$flag");
String? ref = prefs.getString('refSms');
String? con = prefs.getString('conSms');
print("没接通$ref,接通$con");
print(con);
if (callState == "IDLE") {
if (flag != 0) {
// print("object");
final Iterable<CallLogEntry> entry = await CallLog.query();
phoneNum = entry.first.number;
callRecords = entry.first.duration;
// print(prefs.getString('action'));
// DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)
// print('DURATION : ${entry.first.duration}');///
// if(callRecords!=0){
// // if(kg!){
if (flag > 0) {
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);//
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: ref!);
} else {
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);//
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: con!);
}
// // }
// }else{
// print("没接通");
// if (callRecords != 0) {
// print("接通了");
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
// } else {
// print("没接通");
// Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
// if(kg!) {
// 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");
// }
flag = 0;
}
} else if (callState == "RINGING") {

@ -44,14 +44,13 @@ class _UserPageState extends State<UserPage> {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool isVip = false;
String? endDate;
late bool vle=false;
bool vle=false;
@override
void initState() {
super.initState();
if ( UserTool.userProvider.isLogin) {
print(UserTool.userProvider.userInfo.end*1000);
print(DateTime.now().millisecondsSinceEpoch);
if (UserTool.userProvider.userInfo.end*1000<=DateTime.now().millisecondsSinceEpoch ) {
isVip = false;
vle =false;
@ -290,10 +289,6 @@ class _UserPageState extends State<UserPage> {
onChanged: (value) async {
final service = FlutterBackgroundService();
final SharedPreferences prefs = await _prefs;
// if(value){
// WidgetsFlutterBinding.ensureInitialized();
// await initializeService();
// }
// if(!value){
//
// }
@ -309,13 +304,12 @@ class _UserPageState extends State<UserPage> {
print("true");
prefs.remove("kg");
prefs.setBool("kg", vle);
// service.startService();
service.startService();
// WidgetsFlutterBinding.ensureInitialized();
initializeService();
// UserTool.userProvider.setKg(vle)
// initializeService();
// UserTool.userProvider.setKg(vle)
// initializeService();
initializeService();
BotToast.showText(text: " 你开启了该功能");
// initializeService();
// print("这是数据${prefs.getBool("kg")}");

Loading…
Cancel
Save