戴余标 2 years ago
commit 09f93e1996

@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.jetifier.blacklist=bcprov-jdk15on android.jetifier.blacklist=bcprov-jdk15on
keytool -list -v -keystore /Users/datang/project_telephony/recook/jks/recook.keystore

@ -10,13 +10,15 @@ class API {
return 'http://api.dxbs.vip'; return 'http://api.dxbs.vip';
} else { } 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 { static String get imageHost {
if (DevEV.instance.dev) { if (DevEV.instance.dev) {
return 'http://10.0.2.2:8088'; // return 'http://10.0.2.2:8088';
return 'http://api.dxbs.vip/';
} else { } else {
return 'http://api.dxbs.vip/'; return 'http://api.dxbs.vip/';
} }

@ -43,7 +43,7 @@ void main() async {
// FlutterError.presentError(details); // FlutterError.presentError(details);
// }; // };
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await initializeService();
// Workmanager().initialize( // Workmanager().initialize(
// callbackDispatcher, // The top level function, aka callbackDispatcher // 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 // isInDebugMode: true // If enabled it will post a notification whenever the task is running. Handy for debugging tasks
@ -74,7 +74,8 @@ class _MyAppState extends State<MyApp> {
// final service = FlutterBackgroundService(); // final service = FlutterBackgroundService();
_Getpermission(); _Getpermission();
registerWxApi( registerWxApi(
appId: "wxd930ea5d5a228f5f",universalLink:"https://your.univerallink.com/link/ " appId: "wxd930ea5d5a228f5f",
// universalLink:"http://api.dxbs.vip/ "
); );
} }

@ -15,6 +15,7 @@ class NetworkInterceptor extends Interceptor {
switch (code) { switch (code) {
// //
case 100000: case 100000:
// print("你超时了");
await userProvider.logout(); await userProvider.logout();
CloudToast.show(response.data['msg']); CloudToast.show(response.data['msg']);
await Get.offAll(() => const LoginPage()); await Get.offAll(() => const LoginPage());

@ -51,7 +51,7 @@ class UserProvider extends ChangeNotifier {
_userInfo = UserInfoModel.fromJson(base.data); _userInfo = UserInfoModel.fromJson(base.data);
} else { } else {
CloudToast.show(base.msg); CloudToast.show(base.msg);
_userInfo = UserInfoModel.fromJson(base.data); _userInfo = UserInfoModel.fail;
} }
notifyListeners(); notifyListeners();
} }

@ -48,29 +48,31 @@ void onStart(ServiceInstance service ) async {
DartPluginRegistrant.ensureInitialized(); DartPluginRegistrant.ensureInitialized();
int flag = 0; int flag = 0;
String? phoneNum=""; String? phoneNum="";
int? callRecords=0;
String callState; String callState;
Timer.periodic(const Duration(seconds: 1), (timer) async { Timer.periodic(const Duration(seconds: 1), (timer) async {
CallState state = await Telephony.instance.callState; CallState state = await Telephony.instance.callState;
callState = state.name; callState = state.name;
// print(callState!+" $flag"); // print(callState!+" $flag");
if (callState == "IDLE") { if (callState == "IDLE") {
if (flag != 0) { if (flag != 0) {
flag = 0; flag = 0;
// print("object"); // print("object");
final Iterable<CallLogEntry> entry = await CallLog.query(); final Iterable<CallLogEntry> entry = await CallLog.query();
phoneNum=entry.first.number; phoneNum=entry.first.number;
// print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');// callRecords = entry.first.duration;
// DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)
// print('DURATION : ${entry.first.duration}');/// // print('DURATION : ${entry.first.duration}');///
if(phoneNum!.isEmpty){ if(callRecords!=0){
print("At Least 1 Person or Message Required"); print("接通了");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
}else{ }else{
print("你好$phoneNum"); print("没接通");
// final inbox = telephony.getInboxSms(); Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "没接通");
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: "感谢来电"); // telephony.sendSms(to: phoneNum, message: "感谢来电");
// _sendSMS('',[phoneNum]); // _sendSMS('',[phoneNum]);
// print("你好123123$phoneNum"); // print("你好123123$phoneNum");
@ -78,10 +80,10 @@ void onStart(ServiceInstance service ) async {
} }
} else if (callState == "RINGING") { } else if (callState == "RINGING") {
flag++; flag++;
print('flag $flag'); // print('flag $flag');
} else if (callState == "OFFHOOK") { } else if (callState == "OFFHOOK") {
flag++; flag++;
print('flag $flag'); // print('flag $flag');
} }
}); });
} }

@ -136,7 +136,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
}, },
onLongPress: () { onLongPress: () {
if (content != "自定义短信内容") { if (content != "自定义短信内容") {
if (textListSMS.length == 1) { if (textListSMS.length == 2) {
BotToast.showText(text: '不能再删了'); BotToast.showText(text: '不能再删了');
} else { } else {
showDialog( showDialog(

@ -28,14 +28,18 @@ class ContentDetailsPage extends StatefulWidget {
class _ContentDetailsPageState extends State<ContentDetailsPage> { class _ContentDetailsPageState extends State<ContentDetailsPage> {
late TextEditingController _controller; late TextEditingController _controller;
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
String cText="";
final FocusNode verifyNode=FocusNode();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controller = TextEditingController(text: widget.content); _controller = TextEditingController(text: widget.content);
} }
@override
void dispose(){
super.dispose();
// verifyNode.unfocus();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -44,7 +48,7 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
title: Text( title: Text(
'编辑短信标签1', '编辑短信标签',
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize34, fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333, color: BaseStyle.color333333,
@ -54,8 +58,9 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
leading: const CloudBackButton(isSpecial: true), leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor), backgroundColor: kForeGroundColor),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Container( body:
height: 800.w, Container(
height: 960.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFF9F9F9), color: const Color(0xFFF9F9F9),
borderRadius: BorderRadius.circular(16.w), borderRadius: BorderRadius.circular(16.w),
@ -63,8 +68,13 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(30.w),
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w), margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w),
child: TextField( child: TextField(
focusNode: verifyNode,
maxLines: 100, maxLines: 100,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
onChanged: (text){
cText=text;
setState((){});
},
onEditingComplete: () { onEditingComplete: () {
setState(() {}); setState(() {});
// _refreshController.callRefresh(); // _refreshController.callRefresh();
@ -92,7 +102,7 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
), ),
bottomNavigationBar: PloneBottom( bottomNavigationBar: PloneBottom(
border: _controller.text.isEmpty, border: _controller.text.isEmpty,
opacity: _controller.text.isEmpty ? 1 : 0.4, opacity: cText.isNotEmpty ? 1 : 0.4,
onTap: () async { onTap: () async {
// print(_controller.text); // print(_controller.text);
BaseModel res = BaseModel res =

@ -19,6 +19,7 @@ import '../../model/network/api_client.dart';
import '../../providers/user_provider.dart'; import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart'; import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart'; import '../../utils/user_tool.dart';
import '../home/call.dart';
import 'content_details_page.dart'; import 'content_details_page.dart';
import '../home/home_page.dart'; import '../home/home_page.dart';
@ -35,27 +36,28 @@ final Telephony telephony = Telephony.instance;
class _UserPageState extends State<UserPage> { class _UserPageState extends State<UserPage> {
// bool vle = PermissionStatus.denied.isGranted; // bool vle = PermissionStatus.denied.isGranted;
//bool vle =PermissionStatus.denied.isGranted; //bool vle =PermissionStatus.denied.isGranted;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); // final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool vle = false;
bool isVip = false; bool isVip = false;
String? endDate; String? endDate;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (userProvider.isLogin) { if ( UserTool.userProvider.isLogin) {
if (userProvider.userInfo.isVip == 1) { if (UserTool.userProvider.userInfo.isVip == 1) {
isVip = true; isVip = true;
} else { } else {
isVip = false; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CloudScaffold( return CloudScaffold(
systemStyle: const SystemUiOverlayStyle( systemStyle: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
// systemNavigationBarColor: Colors.white, // systemNavigationBarColor: Colors.white,
@ -63,6 +65,7 @@ class _UserPageState extends State<UserPage> {
path: Assets.images.bg.path, path: Assets.images.bg.path,
bodyColor: Colors.white, bodyColor: Colors.white,
extendBody: true, extendBody: true,
body: Column(children: [ body: Column(children: [
_getUser(), _getUser(),
72.hb, 72.hb,
@ -74,7 +77,7 @@ class _UserPageState extends State<UserPage> {
_getSwitch(Assets.icons.sms.path, "短信标签", false), _getSwitch(Assets.icons.sms.path, "短信标签", false),
// const Spacer(), // const Spacer(),
182.hb, 182.hb,
userProvider.isLogin UserTool. userProvider.isLogin
? PloneBottom( ? PloneBottom(
border: false, border: false,
onTap: () async { onTap: () async {
@ -113,7 +116,8 @@ class _UserPageState extends State<UserPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
userProvider.isLogin ? userProvider.userInfo.name : "登录/注册", UserTool.userProvider.isLogin ?UserTool.userProvider.userInfo.name : "登录/注册",
// UserTool.userProvider.userInfo.name ,
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize48, fontSize: BaseStyle.fontSize48,
color: BaseStyle.color333333, color: BaseStyle.color333333,
@ -121,7 +125,7 @@ class _UserPageState extends State<UserPage> {
), ),
24.hb, 24.hb,
Text( Text(
userProvider.isLogin ? "欢迎您登录短信帮手" : "登录获取更多信息", UserTool.userProvider.isLogin ? "欢迎您登录短信帮手" : "登录获取更多信息",
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize28, fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333), color: BaseStyle.color333333),
@ -140,7 +144,7 @@ class _UserPageState extends State<UserPage> {
}, },
child: ClipOval( child: ClipOval(
child: Image.asset( 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, height: 128.w,
width: 128.w, width: 128.w,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -254,6 +258,7 @@ class _UserPageState extends State<UserPage> {
// //
_getSwitch(String url, String name, bool pd) { _getSwitch(String url, String name, bool pd) {
bool vle = true;
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
if (!pd) { if (!pd) {
@ -261,7 +266,7 @@ class _UserPageState extends State<UserPage> {
case "短信标签": case "短信标签":
Get.to(() => ContentDetailsPage( Get.to(() => ContentDetailsPage(
content: content:
userProvider.isLogin ? userProvider.userInfo.tag : "", UserTool.userProvider.isLogin ? UserTool.userProvider.userInfo.tag : "",
ploneBack: (String textContent) { ploneBack: (String textContent) {
// print("这是数据" + textContent); // print("这是数据" + textContent);
// textList.setAll(index, {textContent}); // textList.setAll(index, {textContent});
@ -302,7 +307,9 @@ class _UserPageState extends State<UserPage> {
? Switch( ? Switch(
value: vle, value: vle,
onChanged: (value) async { onChanged: (value) async {
await Permission.phone.request(); // vle=value;
// await initializeService();
// await Permission.phone.request();
// List<Permission> permissions = [ // List<Permission> permissions = [
// Permission.sms, // Permission.sms,
// Permission.phone, // Permission.phone,
@ -315,9 +322,9 @@ class _UserPageState extends State<UserPage> {
// print('onOpenSetting'); // print('onOpenSetting');
// openAppSettings(); // openAppSettings();
// }); // });
// setState(() { setState(() {
// vle = value; vle=value;
// }); });
}) })
: const Icon(Icons.keyboard_arrow_right)), : const Icon(Icons.keyboard_arrow_right)),
), ),

@ -82,7 +82,8 @@ class CloudScaffold extends StatelessWidget {
? AnnotatedRegion<SystemUiOverlayStyle>( ? AnnotatedRegion<SystemUiOverlayStyle>(
value: systemStyle, value: systemStyle,
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: false,
// resizeToAvoidBottomInset: true,
endDrawer: endDrawer, endDrawer: endDrawer,
backgroundColor: bodyColor, backgroundColor: bodyColor,
extendBodyBehindAppBar: extendBody, extendBodyBehindAppBar: extendBody,
@ -111,8 +112,8 @@ class CloudScaffold extends StatelessWidget {
: AnnotatedRegion<SystemUiOverlayStyle>( : AnnotatedRegion<SystemUiOverlayStyle>(
value: systemStyle, value: systemStyle,
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomInset:true , // resizeToAvoidBottomInset:true ,
endDrawer: endDrawer, endDrawer: endDrawer,
backgroundColor: bodyColor, backgroundColor: bodyColor,
extendBodyBehindAppBar: extendBody, extendBodyBehindAppBar: extendBody,

Loading…
Cancel
Save