@@ -19,6 +19,7 @@ enum ToFlutterAppEnum {
toRecharge ( ' toRecharge ' ) ,
toRecharge ( ' toRecharge ' ) ,
playing ( ' playing ' ) ,
playing ( ' playing ' ) ,
toRedDiamond ( ' toRedDiamond ' ) ,
toRedDiamond ( ' toRedDiamond ' ) ,
toHalfRecharge ( ' toHalfRecharge ' ) ,
gameType ( ' gameType ' ) ,
gameType ( ' gameType ' ) ,
jumpToH5 ( ' jumpToH5 ' ) ,
jumpToH5 ( ' jumpToH5 ' ) ,
toHomepage ( ' toHomepage ' ) ,
toHomepage ( ' toHomepage ' ) ,
@@ -52,6 +53,8 @@ enum ToFlutterAppEnum {
shouldSendPrivateMessage ( ' shouldSendPrivateMessage ' ) ,
shouldSendPrivateMessage ( ' shouldSendPrivateMessage ' ) ,
//发布n条动态
//发布n条动态
shouldPostFeed ( ' shouldPostFeed ' ) ,
shouldPostFeed ( ' shouldPostFeed ' ) ,
// 发布动态页面
shouldPublishDynamic ( ' shouldPublishDynamic ' ) ,
//分享n次直播间或聊天室至任意平台
//分享n次直播间或聊天室至任意平台
shouldShareRoom ( ' shouldShareRoom ' ) ,
shouldShareRoom ( ' shouldShareRoom ' ) ,
//佩戴任意装扮
//佩戴任意装扮
@@ -75,8 +78,27 @@ enum ToFlutterAppEnum {
//跳转至网页
//跳转至网页
showToWebViewPage ( ' toWebViewPage ' ) ,
showToWebViewPage ( ' toWebViewPage ' ) ,
// 保存图片到相册
saveMediaToGallery ( ' saveMediaToGallery ' ) ,
// 进入指定房间
enterRoom ( ' enterRoom ' ) ,
// 进入我的房间(创建房间)
createMyRoom ( ' createMyRoom ' ) ,
// 发泼水节胜利消息
sendWaterFestVictoryMessage ( ' sendWaterFestVictoryMessage ' ) ,
// 泼水节泼水游戏显示统计透明view
showWaterFestGameStatisticsView ( ' showWaterFestGameStatisticsView ' ) ,
///通用交互 别往这下面加,👆🏻加
///通用交互 别往这下面加,👆🏻加
commonInteraction ( ' commonInteraction ' ) ,
commonInteraction ( ' commonInteraction ' ) ,
/// 已在房则回当前房;否则进热门开播房;无房或失败则走创建房间(同 createMyRoom)
enterHotRoomOrCreateMyRoom ( ' enterHotRoomOrCreateMyRoom ' ) ,
/// 已在房则回当前房;否则热门推荐里随机进 PK 中房间;
/// 无 PK 房或失败则走创建房间(同 createMyRoom)
enterPkRoomOrCreateMyRoom ( ' enterPkRoomOrCreateMyRoom ' ) ,
defaultCode ( ' ' ) ;
defaultCode ( ' ' ) ;
const ToFlutterAppEnum ( this . code ) ;
const ToFlutterAppEnum ( this . code ) ;
@@ -133,6 +155,15 @@ enum FromFlutterAppEnum {
//送戒指后回调,传入type参数
//送戒指后回调,传入type参数
// type: 1 cp戒指赠送成功, 2恩爱节告白礼物赠送成功
// type: 1 cp戒指赠送成功, 2恩爱节告白礼物赠送成功
cpSendRingCallBack ( ' cp_send_ring_callback ' ) ,
cpSendRingCallBack ( ' cp_send_ring_callback ' ) ,
// 动态发布成功
publishDynamicSuccess ( " publishDynamicSuccess " ) ,
// 传回 泼水节泼水游戏隐藏统计透明view 点击次数
waterFestGameSendStatistics ( ' waterFestGameSendStatistics ' ) ,
// 隐藏泼水节泼水游戏统计透明view
hideWaterFestGameStatisticsView ( ' hideWaterFestGameStatisticsView ' ) ,
defaultCode ( ' ' ) ;
defaultCode ( ' ' ) ;
const FromFlutterAppEnum ( this . code ) ;
const FromFlutterAppEnum ( this . code ) ;
@@ -254,7 +285,7 @@ class FlutterBridge {
print ( " All listeners for ' $ type ' have been removed. " ) ;
print ( " All listeners for ' $ type ' have been removed. " ) ;
}
}
}
}
// =========================================================
// =========================================================
// 👇 🆕 [新增] 核心通用请求方法 (替代了旧的 requestTranslate)
// 👇 🆕 [新增] 核心通用请求方法 (替代了旧的 requestTranslate)
// =========================================================
// =========================================================
@@ -277,11 +308,9 @@ class FlutterBridge {
}
}
// 2. 入队
// 2. 入队
_requestQueues [ responseKey ] ! . add ( _RequestTask (
_requestQueues [ responseKey ] ! . add (
sendType . code ,
_RequestTask ( sendType . code , params , onSuccess ) ,
params ,
) ;
onSuccess ,
) ) ;
// 3. 调度执行
// 3. 调度执行
_processRequestQueue ( responseKey ) ;
_processRequestQueue ( responseKey ) ;
@@ -331,7 +360,7 @@ class FlutterBridge {
// 发送消息给 App( 通过 WebView 调用 JS 方法)
// 发送消息给 App( 通过 WebView 调用 JS 方法)
void sendToFlutter ( String type , Map < String , dynamic > data ) {
void sendToFlutter ( String type , Map < String , dynamic > data ) {
final dataStr = jsonEncode ( { ' type ' : type , ' data ' : data } ) ;
final dataStr = jsonEncode ( { ' type ' : type , ' data ' : data } ) ;
print ( ' $ dataStr ' ) ;
print ( dataStr ) ;
sendMessageToNative ( dataStr ) ;
sendMessageToNative ( dataStr ) ;
}
}
@@ -431,35 +460,71 @@ class FlutterBridge {
sendToFlutter ( ToFlutterAppEnum . toApplyAdmissionPage . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . toApplyAdmissionPage . code , { } ) ;
void shouLiveBookingPicker ( ) = >
void shouLiveBookingPicker ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouLiveBookingPicker . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouLiveBookingPicker . code , { } ) ;
/** 完善个人信息 */
/// 完善个人信息
void shouldCompleteProfile ( ) = >
void shouldCompleteProfile ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldCompleteProfile . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldCompleteProfile . code , { } ) ;
/** 在直播间或聊天室停留观看n分钟 */
/// 在直播间或聊天室停留观看n分钟
void shouldWatchDuration ( ) = >
void shouldWatchDuration ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldWatchDuration . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldWatchDuration . code , { } ) ;
/** 在直播间或聊天室发送n条公屏消息 */
/// 在直播间或聊天室发送n条公屏消息
void shouldSendPublicMessage ( ) = >
void shouldSendPublicMessage ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldSendPublicMessage . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldSendPublicMessage . code , { } ) ;
/** 在直播间或聊天室上麦互动n分钟 */
/// 在直播间或聊天室上麦互动n分钟
void shouldMicInteraction ( ) = >
void shouldMicInteraction ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldMicInteraction . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldMicInteraction . code , { } ) ;
/** 向任意用户, 发送n条信息*/
/// 向任意用户, 发送n条信息
void shouldSendPrivateMessage ( ) = >
void shouldSendPrivateMessage ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldSendPrivateMessage . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldSendPrivateMessage . code , { } ) ;
/** 发布n条动态*/
/// 发布n条动态
void shouldPostFeed ( ) = >
void shouldPostFeed ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldPostFeed . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldPostFeed . code , { } ) ;
/** 分享n次直播间或聊天室至任意平台 */
/// param activityNum: 用于区分不同页面进入发布页之后对应的各自操作 默认值: 0 不做任何操作, 比如 柬埔寨 为1, 其他活动参考 s1 项目 PublishFromType
/// 发布动态
void shouldPublishDynamic ( { int activityNum = 0 } ) = > sendToFlutter (
ToFlutterAppEnum . shouldPublishDynamic . code ,
{ " activityNum " : activityNum } ,
) ;
/// 分享n次直播间或聊天室至任意平台
void shouldShareRoom ( ) = >
void shouldShareRoom ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldShareRoom . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldShareRoom . code , { } ) ;
/** 佩戴任意装扮 */
/// 佩戴任意装扮
void shouldWearDecoration ( ) = >
void shouldWearDecoration ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldWearDecoration . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldWearDecoration . code , { } ) ;
/** 前往语音房 */
/// 前往语音房
void shouldGoToVoiceRoom ( ) = >
void shouldGoToVoiceRoom ( ) = >
sendToFlutter ( ToFlutterAppEnum . shouldGoToVoiceRoom . code , { } ) ;
sendToFlutter ( ToFlutterAppEnum . shouldGoToVoiceRoom . code , { } ) ;
/** 通用封装方法 无需传参可直接调用, 需要传参需要调用sendToFlutter*/
/// 保存图片到相册
void saveMediaToGallery ( { required String mediaUrl , bool isVideo = false } ) = >
sendToFlutter ( ToFlutterAppEnum . saveMediaToGallery . code , {
" isVideo " : isVideo ,
" mediaUrl " : mediaUrl ,
} ) ;
/// 进入指定房间
void enterRoom ( String roomId ) = >
sendToFlutter ( ToFlutterAppEnum . enterRoom . code , { ' roomId ' : roomId } ) ;
/// 进入我的房间(创建房间)
void createMyRoom ( ) = > sendToFlutter ( ToFlutterAppEnum . createMyRoom . code , { } ) ;
/// 发泼水节胜利消息
void sendWaterFestVictoryMessage ( String targetId ) = > sendToFlutter (
ToFlutterAppEnum . sendWaterFestVictoryMessage . code ,
{ ' targetId ' : targetId } ,
) ;
/// 通用封装方法 无需传参可直接调用, 需要传参需要调用sendToFlutter
void commonInteraction ( Map < String , dynamic > data ) = >
void commonInteraction ( Map < String , dynamic > data ) = >
sendToFlutter ( ToFlutterAppEnum . commonInteraction . code , data ) ;
sendToFlutter ( ToFlutterAppEnum . commonInteraction . code , data ) ;
}
}