修复退出登录后依然可以收到本地呼叫通知问题

This commit is contained in:
Daisy 2024-04-16 18:04:17 +08:00
parent e94be5a718
commit 3422033ed4
4 changed files with 25 additions and 9 deletions

View File

@ -106,9 +106,10 @@ class CallTalk {
//
if (iframe!.bagNum == iframe!.bagReceive) {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print(
// '播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
DateTime now = DateTime.now();
// DateTime now = DateTime.now();
// String formattedTime = "${now.hour}:${now.minute}:${now.second}";
// print('$formattedTime得到了一张图片共${iframe!.bagReceive}个数据包');
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));

View File

@ -43,16 +43,30 @@ class UdpHelp {
var uid = await Storage.getUid();
udpHeartTimer = Timer.periodic(1.seconds, (timer) async {
UDPSenderManage.sendHeart(
userName: uid,
ipList: serversList,
tokenStr: "b989fa15f75c2ac02718b7c9bb64f80e",
);
// print('发送心跳了');
getLoginStatus().then((value) {
if (value) {
UDPSenderManage.sendHeart(
userName: uid,
ipList: serversList,
tokenStr: "b989fa15f75c2ac02718b7c9bb64f80e",
);
// print('发送心跳了');
} else {
timer.cancel();
}
});
});
}
}
Future<bool> getLoginStatus() async {
final data = await Storage.getString(saveUserLoginData);
if (data != null && data.isNotEmpty) {
return true;
}
return false;
}
void closeUDP() {
if (udpHeartTimer != null) {
udpHeartTimer!.cancel();

View File

@ -103,7 +103,7 @@ class UDPManage {
} catch (e) {}
}
bool exit() {
bool exitUdpSocket() {
if (null != _udpSocket) {
print('❌ Udp ----> close');
_udpSocket?.close();

View File

@ -59,6 +59,7 @@ class XSJPushProvider {
}
}
// isCancelLocalPush
initLocalNotification(bool isCancelLocalPush) async {
WidgetsFlutterBinding.ensureInitialized();
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =