# Conflicts:
#	lib/ui/home/call.dart
master
戴余标 2 years ago
commit fec140e11d

@ -5,6 +5,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -45,8 +46,7 @@ void main() async {
// };
WidgetsFlutterBinding.ensureInitialized();
// await initializeService();
// Workmanager().initialize(
// Workmanager().initialize(
// 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
// );

@ -79,7 +79,8 @@ class UserProvider extends ChangeNotifier {
var base = await apiClient.request(API.app.find, data: {'status': 1});
if (base.code == 0) {
await prefs.remove('conSms');
await prefs.setString('conSms', "[${UserTool.userProvider.userInfo.tag}]${base
await prefs.setString('conSms', (UserTool.userProvider.userInfo.tag)==""?"${base
.data['content']}":"[${UserTool.userProvider.userInfo.tag}]${base
.data['content']}");
service.invoke("stopService");
if(prefs.getBool('kg')!){
@ -100,7 +101,8 @@ class UserProvider extends ChangeNotifier {
var base = await apiClient.request(API.app.find, data: {'status': 2});
if (base.code == 0) {
await prefs.remove('refSms');
await prefs.setString('refSms', "[${UserTool.userProvider.userInfo.tag}]${base
await prefs.setString('refSms', (UserTool.userProvider.userInfo.tag)==""?"${base
.data['content']}":"[${UserTool.userProvider.userInfo.tag}]${base
.data['content']}" );
service.invoke("stopService");
if(prefs.getBool('kg')!){

@ -6,13 +6,17 @@ import 'package:call_log/call_log.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_background_service_android/flutter_background_service_android.dart';
import 'package:flutter_background_service_android/flutter_background_service_android.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:telephony/telephony.dart';
Future<void> initializeService() async {
// SharedPreferences preferences = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
await service.configure(
androidConfiguration: AndroidConfiguration(
// this will be executed when app is in foreground or background in separated isolate
@ -41,6 +45,7 @@ bool onIosBackground(ServiceInstance service) {
}
void onStart(ServiceInstance service) async {
DartPluginRegistrant.ensureInitialized();
int flag = 0;
String? phoneNum = "";
int? callRecords = 0;
@ -48,6 +53,11 @@ void onStart(ServiceInstance service) async {
service.on('stopService').listen((event) {
service.stopSelf();
});
// setForegroundNotificationInfo(title: "你好", content: "再见");
// AndroidServiceInstance.
// service.setNotificationInfo("").listen((event){
//
// });
// Telephony.backgroundInstance.sendSms(to: "13486828191", message: "123123");
Timer.periodic(const Duration(seconds: 1), (timer) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
@ -79,7 +89,7 @@ void onStart(ServiceInstance service) async {
print('通话');
} else if (callState == "OFFHOOK") {
if (flag > 0) flag *= -1;
print('');
print('');
}
});
}

@ -27,7 +27,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
List<String> textListSMS = [];
int isCheck=0;
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
@ -94,6 +94,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
controller: _easyRefreshController,
onRefresh: () async {
await UserTool.userProvider.updateUserInfo();
userProvider.updateConSms();
updateList();
setState(() {});
},

@ -94,6 +94,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
controller: _easyRefreshController,
onRefresh: () async {
await userProvider.updateUserInfo();
userProvider.updateRefSms();
updateList();
setState(() {});
},
@ -128,6 +129,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
Get.to(AddSmsPage(
status: 2,
ploneBack: (String textContent) {
_easyRefreshController.callRefresh();
},
));

@ -1,6 +1,8 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/ui/home/content_connect_page.dart';
import 'package:project_telephony/ui/home/content_refuse_page.dart';
@ -9,6 +11,7 @@ import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:project_telephony/utils/headers.dart';
import '../tab_navigator.dart';
import '../user/privacy_rights_page.dart';
class HomePage extends StatefulWidget {
@ -20,7 +23,8 @@ class HomePage extends StatefulWidget {
bool sms = false;
bool plone = false;
bool kg=false;
final service = FlutterBackgroundService();
@override
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override
@ -43,6 +47,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
sms = await Permission.sms.request().isGranted;
plone = await Permission.phone.request().isGranted;
callLog = await Permission.callLog.request().isGranted;
kg = await service.isRunning();
setState(() {});
}
@ -90,16 +95,38 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
// return false;
// }
// }
// String _text(){
// if(!(sms && plone && callLog && kg)){
// if(!(sms && plone && callLog )){
// return "";
// // return "必须权限没有授予本APP无法正常使用";
// }if(!kg){
// return "功能开关未开启";
// }
// }else{
// return "";
// }
// }
_warning() {
return Offstage(
offstage: (sms && plone && callLog),
offstage: (sms && plone && callLog && kg),
child: GestureDetector(
onTap: () {
if(!(sms && plone && callLog && kg)){
if(!kg){
BotToast.showText(text: '功能开关未开启');
Get.to(()=>const TabNavigator(index: 1,));
}else{
Get.to(()=>const PrivacyRightsPage(name: "权限说明"));
}
}
// print();
openAppSettings();
// openAppSettings();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 64.w),
child:
Container(
// width: 622.w,
margin: EdgeInsets.only(left:!kg? 200.w:64.w,right: 64.w),
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
height: 88.w,
decoration: BoxDecoration(
@ -115,7 +142,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
),
16.wb,
Text(
"必须权限没有授予本APP无法正常使用",
!kg ? "功能开关未开启":"必须权限没有授予本APP无法正常使用",
style:
TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp),
),

@ -17,6 +17,7 @@ import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart';
import '../tab_navigator.dart';
import '../user/content_authority_page.dart';
import '../widget/image_scaffold.dart';
import '../widget/plone_bottom.dart';
@ -334,26 +335,30 @@ class _LoginPageState extends State<LoginPage> {
: const Icon(CupertinoIcons.checkmark_circle,
size: 18, color: Colors.blue),
),
RichText(
GestureDetector(onTap: (){
Get.to(()=>const ContentAuthorityPage());
},child: RichText(
text: TextSpan(
text: "我已阅读并同意",
style: TextStyle(
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [
TextSpan(
text: '《用户服务协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 2)),
TextSpan(
text: "",
style: TextStyle(
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
),
// TextSpan(
// text: '《用户服务协议》',
// style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
// recognizer: _recognizer(context, 2)),
// TextSpan(
// text: "",
// style: TextStyle(
// color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
// ),
TextSpan(
text: '《隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 1)),
])),
])),)
,
],
),
);

@ -72,7 +72,7 @@ class _TabNavigatorState extends State<TabNavigator>
const Duration(seconds: 1)) {
//1
_lastPressed = DateTime.now();
BotToast.showText(text: '再按一次即可退出程序(退出不回影响短信自动回复,但是不要在后台关闭本应用)');
BotToast.showText(text: '再按一次即可退出程序');
return false;
}
// APP

@ -1,4 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

@ -34,11 +34,11 @@ List<dynamic>? data;
final List<ChooseItems> _piceList = [
ChooseItems(
month: 12,
pice: 10,
pice: 0.1,
),
ChooseItems(
month: 1,
pice: 1,
pice: 0.01,
),
];
ChooseItems? _chooseItem = _piceList[0];
@ -52,7 +52,7 @@ List payWay = [
];
class _MembersPageState extends State<MembersPage> {
int nowPrice = 1;
double nowPrice = 0.01;
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@override
@ -61,6 +61,20 @@ class _MembersPageState extends State<MembersPage> {
super.dispose();
}
@override
void initState(){
PayUtil().wxPayAddListener(
paySuccess:_paySuccess,
payError: (event) {
BotToast.closeAllLoading();
}
);
super.initState();
}
void _paySuccess() {
_easyRefreshController.callRefresh();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -107,7 +121,8 @@ class _MembersPageState extends State<MembersPage> {
Get.snackbar('提示', "请先选择充值月份");
} else {
if (_selectIndex == 0) {
_wxPayFunc();
print("这是数据${_piceList[_selectIndex].pice}");
_wxPayFunc(_piceList[_selectIndex].pice);
} else {
var result =
await isAliPayInstalled(); //
@ -234,14 +249,14 @@ class _MembersPageState extends State<MembersPage> {
);
}
Future _wxPayFunc() async {
Future _wxPayFunc(double pay) async {
bool isInstalled = await fluwx.isWeChatInstalled;
if (!isInstalled) {
BotToast.showText(text: "请先安装微信");
return;
}
//
_wxPay();
_wxPay(pay);
// var wxPayModel = WxPayModel.fromJson({
// "prepayId": "wx121434071826969924754d7d3309520000",
// "partnerId": "1622850618",
@ -278,8 +293,8 @@ class _MembersPageState extends State<MembersPage> {
//
Future _aliPay() async {
var base = await apiClient.request(API.pay.alipay, data: {
// 'amount': nowPrice,//
'amount': 0.01,
'amount': nowPrice,//
// 'amount': 0.01,
});
if (base.code == 0) {
await PayUtil().callAliPay(base.data);
@ -289,10 +304,10 @@ class _MembersPageState extends State<MembersPage> {
}
}
Future _wxPay() async {
Future _wxPay(double pay) async {
var base = await apiClient.request(API.pay.wxpay, data: {
// 'amount': nowPrice,//
'amount': 0.01,
'amount': pay,//
// 'amount': 0.01,
});
if (base.code == 0) {
var wxPayModel = WxPayModel.fromJson(base.data);

@ -49,9 +49,7 @@ class _UserPageState extends State<UserPage> {
late bool vle = false;
_load() async {
vle = await service.isRunning();
}
final EasyRefreshController _easyRefreshController = EasyRefreshController();
@ -60,24 +58,25 @@ class _UserPageState extends State<UserPage> {
_easyRefreshController.dispose();
super.dispose();
}
// _load() async {
// vle = await service.isRunning();
// }
@override
void initState() {
super.initState();
UserTool.userProvider.updateUserInfo();
Future.delayed(
const Duration(milliseconds: 0),
() => setState(() {
() => setState(() async{
if (UserTool.userProvider.isLogin) {
print(UserTool.userProvider.userInfo.end * 1000);
print(DateTime.now().millisecondsSinceEpoch);
if (UserTool.userProvider.userInfo.end * 1000 >
DateTime.now().microsecondsSinceEpoch) {
// print(UserTool.userProvider.userInfo.end * 1000);
// print(DateTime.now().millisecondsSinceEpoch);
if (UserTool.userProvider.userInfo.isVip != 1) {
isVip = false;
vle = false;
} else {
isVip = true;
_load();
vle = await service.isRunning();
}
//service.isRunning() as bool;
endDate = DateUtil.formatDateMs(
@ -360,7 +359,6 @@ class _UserPageState extends State<UserPage> {
prefs.remove("kg");
prefs.setBool("kg", vle);
service.invoke("stopService");
///
// exit(0);
// UserTool.userProvider.setKg(vle);
@ -371,7 +369,7 @@ class _UserPageState extends State<UserPage> {
// print("这是数据${prefs.getBool("kg")}");
}
} else {
BotToast.showText(text: "还没有开通会员,不可使用功能");
BotToast.showText(text: "还没有开通会员,不可使用功能");
}
});
}),

@ -6,7 +6,7 @@ typedef ItemCallback = Function(ChooseItems item, int index);
class ChooseItems {
int month;
int pice;
double pice;
bool isChoose;
ChooseItems({

Loading…
Cancel
Save