From 3cfe50277ee5746dd3e07f6717517b1609d5b4de Mon Sep 17 00:00:00 2001 From: Liuyf Date: Thu, 20 Feb 2025 17:01:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20fcm=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 5 +++++ android/app/src/main/AndroidManifest.xml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 41903854..0386ff73 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -357,4 +357,9 @@ dependencies { implementation 'com.umeng.umsdk:common:9.7.9' implementation 'com.umeng.umsdk:asms:1.8.5' // + // + implementation 'cn.jiguang.sdk.plugin:fcm:5.2.3' + implementation 'com.google.firebase:firebase-messaging:23.0.5' + // + } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index db2e332c..236a8fbe 100755 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -78,6 +78,8 @@ + From 63ce6b10709436a06c1865a971847cb327f921f5 Mon Sep 17 00:00:00 2001 From: Liuyf Date: Fri, 21 Feb 2025 14:15:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=20=20feat=EF=BC=9Ajpush=E4=B8=AD=E5=90=84?= =?UTF-8?q?=E4=B8=AA=E5=8E=82=E5=95=86token=E6=88=AA=E5=8F=96=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E4=BB=A5=E5=8F=8A=E5=8E=9F=E7=94=9Fnative=E5=B1=82?= =?UTF-8?q?=E8=8E=B7=E5=8F=96token=E6=8E=A5=E5=8F=A3=E6=A1=A5=E6=8E=A5?= =?UTF-8?q?=E5=88=B0flutter=E5=B1=82=E4=BE=9B=E4=B8=9A=E5=8A=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- lib/tools/push/xs_jPhush.dart | 12 ++++++++++++ pubspec.lock | 9 +++++---- pubspec.yaml | 5 ++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index acdb013d..6671c0fb 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -61,7 +61,7 @@ FutureOr main() async { ], child: MyApp(isLogin: isLogin))); // runApp(MyApp(isLogin: isLogin)); }, onException: (FlutterErrorDetails details) async { - debugPrint("FlutterErrorDetails $details"); + debugPrint('FlutterErrorDetails ${details.exceptionAsString()}'); }); if (AppPlatform.isAndroid) { diff --git a/lib/tools/push/xs_jPhush.dart b/lib/tools/push/xs_jPhush.dart index bbeaa07a..3ce9adf3 100755 --- a/lib/tools/push/xs_jPhush.dart +++ b/lib/tools/push/xs_jPhush.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:jpush_flutter/jpush_flutter.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart'; @@ -49,28 +50,39 @@ class XSJPushProvider { //极光推送事件处理方法 void addJPushEventHandler() { jpush.addEventHandler( + onCommandResult: (Map message) async { + AppLog.log('onCommandResult: $message'); + debugPrint("addJPushEventHandler onCommandResult:$message"); + }, onReceiveNotification: (Map message) async { AppLog.log('onReceiveNotification: $message'); + debugPrint("addJPushEventHandler onReceiveNotification:$message"); // showCustomNotification(message); }, onOpenNotification: (Map message) async { AppLog.log('onOpenNotification: $message'); + debugPrint("addJPushEventHandler onOpenNotification:$message"); }, onReceiveMessage: (Map message) async { AppLog.log('onReceiveMessage: $message'); + debugPrint("addJPushEventHandler onReceiveMessage:$message"); //这里接收自定义消息 MessageManagement.shunting(message); }, onReceiveNotificationAuthorization: (Map message) async { AppLog.log('onReceiveNotificationAuthorization: $message'); + debugPrint( + "addJPushEventHandler onReceiveNotificationAuthorization:$message"); }, onInAppMessageShow: (Map message) async { AppLog.log('onInAppMessageShow: $message'); + debugPrint("addJPushEventHandler onInAppMessageShow:$message"); }, onConnected: (Map message) async { //绑定设备id final String rid = await jpush.getRegistrationID(); AppLog.log('onConnected registration id : $rid'); + debugPrint("addJPushEventHandler onConnected:$message"); await Storage.setString(pushDeviceID, rid); await pushBindDeviceID(rid); diff --git a/pubspec.lock b/pubspec.lock index 1f831260..f09c8feb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -991,10 +991,11 @@ packages: jpush_flutter: dependency: "direct main" description: - name: jpush_flutter - sha256: bb29ce650c6765a54ecbdd8f448840ecea83b4e24564e554d11eba20ed3b37d9 - url: "https://pub.dev" - source: hosted + path: "." + ref: main + resolved-ref: aa93729f48762421658675800be68aee27b6d8fb + url: "git@code-internal.star-lock.cn:StarlockTeam/jpush_flutter.git" + source: git version: "2.5.8" js: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index 5473124e..9109e0a9 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -211,7 +211,10 @@ dependencies: cached_network_image: ^3.2.0 webview_flutter: ^4.5.0 - jpush_flutter: ^2.5.1 + jpush_flutter: + git: + url: git@code-internal.star-lock.cn:StarlockTeam/jpush_flutter.git + ref: main #视频播放器 video_player: ^2.9.2 From 35d22fd8ab7f24c0d34298414ed93f6e38651419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDaisyWu=E2=80=9D?= <“18682150237@163.com”> Date: Fri, 21 Feb 2025 14:30:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=AE=89?= =?UTF-8?q?=E5=8D=93=E5=A3=B0=E9=9F=B3=E5=8D=A1=E9=A1=BF=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handle/impl/udp_talk_request_handler.dart | 28 ++++++++++--------- .../views/talkView/talk_view_logic.dart | 13 +++++++-- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart b/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart index d9a8c2db..f6c90d0e 100644 --- a/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart +++ b/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart @@ -81,22 +81,24 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle // 收到来电请求时进行本地通知 Future _showTalkRequestNotification( {required String talkObjectName}) async { - final Map message = { - 'platform': 'all', - 'audience': 'all', - 'notification': >{ - 'android': { - 'title': '呼叫提醒'.tr, - 'alert': '${'收到来自'.tr}($talkObjectName)${'锁的呼叫'.tr}。', - 'extras': { - 'image_url': - 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=视频通话图标&step_word=&hs=0&pn=18&spn=0&di=7456461798821068801&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=3670633426%2C2210940696&os=2119936476%2C3383901310&simid=3670633426%2C2210940696&adpicid=0&lpn=0&ln=1216&fr=&fmq=1738909566404_R&fm=&ic=undefined&s=undefined&hd=undefined&latest=undefined©right=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=https%3A%2F%2Ftenfei03.cfp.cn%2Fcreative%2Fvcg%2Fnowarter800%2Fnew%2FVCG211249198901.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bev2_z%26e3Bv54AzdH3Fv6jwptejAzdH3F8dnla9lla0&gsm=1e&rpstart=0&rpnum=0&islist=&querylist=&nojc=undefined&dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5&lid=9610633549467928081' + if (Platform.isAndroid) { + final Map message = { + 'platform': 'all', + 'audience': 'all', + 'notification': >{ + 'android': { + 'title': '呼叫提醒'.tr, + 'alert': '${'收到来自'.tr}($talkObjectName)${'锁的呼叫'.tr}。', + 'extras': { + 'image_url': + 'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=视频通话图标&step_word=&hs=0&pn=18&spn=0&di=7456461798821068801&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=3670633426%2C2210940696&os=2119936476%2C3383901310&simid=3670633426%2C2210940696&adpicid=0&lpn=0&ln=1216&fr=&fmq=1738909566404_R&fm=&ic=undefined&s=undefined&hd=undefined&latest=undefined©right=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=https%3A%2F%2Ftenfei03.cfp.cn%2Fcreative%2Fvcg%2Fnowarter800%2Fnew%2FVCG211249198901.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bev2_z%26e3Bv54AzdH3Fv6jwptejAzdH3F8dnla9lla0&gsm=1e&rpstart=0&rpnum=0&islist=&querylist=&nojc=undefined&dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5&lid=9610633549467928081' + } } } - } - }; + }; - XSJPushProvider().showCustomNotification(message); + XSJPushProvider().showCustomNotification(message); + } /* const AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails('1', 'flutter_channel', diff --git a/lib/talk/starChart/views/talkView/talk_view_logic.dart b/lib/talk/starChart/views/talkView/talk_view_logic.dart index f947d584..4d468fe8 100644 --- a/lib/talk/starChart/views/talkView/talk_view_logic.dart +++ b/lib/talk/starChart/views/talkView/talk_view_logic.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'dart:ui' as ui; import 'dart:math'; // Import the math package to use sqrt +import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_pcm_sound/flutter_pcm_sound.dart'; @@ -576,12 +577,18 @@ class TalkViewLogic extends BaseGetXController { } } +// 音频帧处理 Future _onFrame(List frame) async { + // 预处理和转码操作放到异步计算线程 + // final processedFrame = await compute(preprocessAudio, frame); + // final list = listLinearToALaw(processedFrame); final List processedFrame = preprocessAudio(frame); final List list = listLinearToALaw(processedFrame); + final int ms = DateTime.now().millisecondsSinceEpoch - state.startRecordingAudioTime.value.millisecondsSinceEpoch; - // 发送音频数据 + + // 发送音频数据到UDP await StartChartManage().sendTalkDataMessage( talkData: TalkData( content: list, @@ -591,8 +598,8 @@ class TalkViewLogic extends BaseGetXController { ); } +// 错误监听 void _onError(VoiceProcessorException error) { - // state.errorMessage.value = error.message!; AppLog.log(error.message!); } @@ -601,7 +608,7 @@ class TalkViewLogic extends BaseGetXController { final List processedList = []; for (int pcmVal in pcmList) { // 简单的降噪示例:将小于阈值的信号置为0 - if (pcmVal.abs() < 300) { + if (pcmVal.abs() < 200) { pcmVal = 0; } processedList.add(pcmVal); From 9aac85f20ecaba421a9a3f095b32dcb1bba30042 Mon Sep 17 00:00:00 2001 From: Liuyf Date: Fri, 21 Feb 2025 14:36:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix=EF=BC=9A=20=E5=9B=BD=E5=AE=B6=E5=8C=96?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lan/lan_hk.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lan/lan_hk.json b/lan/lan_hk.json index 74281ce1..bd9baa49 100644 --- a/lan/lan_hk.json +++ b/lan/lan_hk.json @@ -603,7 +603,7 @@ "开门方式": "開門方法", "请选择": "請選擇", "家人": "家人", - "保存": "救", + "保存": "保存", "APP推送": "APP推送", "管理员": "管理", "未启用": "未啟用",