Compare commits
8 Commits
e6c63982a0
...
0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cccfaf7cd9 | ||
|
|
d34ebc84ab | ||
|
|
19ee5746f4 | ||
|
|
4b7635c939 | ||
|
|
de0e8b80d7 | ||
|
|
8bacf63388 | ||
|
|
27e4b9b46a | ||
|
|
38e182bbda |
@@ -309,6 +309,10 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
bridge.sendToFlutter(
|
||||
ToFlutterAppEnum.lovingDayChooseFriend.code, {});
|
||||
}),
|
||||
_buildMethodTile("恩爱节我的邀请页面", "恩爱节我的邀请页面", () {
|
||||
bridge
|
||||
.sendToFlutter(ToFlutterAppEnum.lovingDayMyInvite.code, {});
|
||||
}),
|
||||
ListTile(
|
||||
title: const Text('跳转到网页',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
@@ -539,7 +543,7 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
_buildMethodTile(
|
||||
'发红包',
|
||||
'触发前往语音房任务 && 发红包',
|
||||
() => bridge.commonInteraction({
|
||||
() => bridge.commonInteraction({
|
||||
"interactionType": "TaskKeySendRedPack",
|
||||
}),
|
||||
),
|
||||
@@ -588,7 +592,7 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
_buildMethodTile(
|
||||
'其他页面',
|
||||
'进入其他h5页面',
|
||||
() => bridge.commonInteraction({
|
||||
() => bridge.commonInteraction({
|
||||
"interactionType": WebInteractionType
|
||||
.taskKeyOtherPage.code, // taskKeyReplayTimeline
|
||||
|
||||
@@ -598,7 +602,7 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
_buildMethodTile(
|
||||
'我的钱包页面',
|
||||
'我的钱包页面',
|
||||
() => bridge.commonInteraction({
|
||||
() => bridge.commonInteraction({
|
||||
"interactionType": WebInteractionType
|
||||
.taskKeyMineWallet.code, // taskKeyReplayTimeline
|
||||
|
||||
@@ -608,7 +612,7 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
_buildMethodTile(
|
||||
'我的背包',
|
||||
'我的装扮背包页面(或者是称号)',
|
||||
() => bridge.commonInteraction({
|
||||
() => bridge.commonInteraction({
|
||||
"interactionType": WebInteractionType
|
||||
.taskKeyMineBackpack.code, // taskKeyReplayTimeline
|
||||
|
||||
@@ -645,6 +649,11 @@ class _WebToolsExamplePageState extends State<WebToolsExamplePage> {
|
||||
"updateType": "1" // 1 刷新整个挂件数据,2刷新观时礼的宝箱列表数据
|
||||
}),
|
||||
),
|
||||
_buildMethodTile(
|
||||
'刷新当前网页',
|
||||
'刷新当前网页',
|
||||
() => bridge.sendToFlutter(ToFlutterAppEnum.reload.code, {}),
|
||||
),
|
||||
_buildMethodTile(
|
||||
'翻译',
|
||||
'多语言翻译',
|
||||
|
||||
@@ -19,6 +19,7 @@ enum ToFlutterAppEnum {
|
||||
toRecharge('toRecharge'),
|
||||
playing('playing'),
|
||||
toRedDiamond('toRedDiamond'),
|
||||
toHalfRecharge('toHalfRecharge'),
|
||||
gameType('gameType'),
|
||||
jumpToH5('jumpToH5'),
|
||||
toHomepage('toHomepage'),
|
||||
@@ -52,6 +53,8 @@ enum ToFlutterAppEnum {
|
||||
shouldSendPrivateMessage('shouldSendPrivateMessage'),
|
||||
//发布n条动态
|
||||
shouldPostFeed('shouldPostFeed'),
|
||||
// 发布动态页面
|
||||
shouldPublishDynamic('shouldPublishDynamic'),
|
||||
//分享n次直播间或聊天室至任意平台
|
||||
shouldShareRoom('shouldShareRoom'),
|
||||
//佩戴任意装扮
|
||||
@@ -75,8 +78,25 @@ enum ToFlutterAppEnum {
|
||||
//跳转至网页
|
||||
showToWebViewPage('toWebViewPage'),
|
||||
|
||||
// 保存图片到相册
|
||||
saveMediaToGallery('saveMediaToGallery'),
|
||||
|
||||
// 进入指定房间
|
||||
enterRoom('enterRoom'),
|
||||
// 进入我的房间(创建房间)
|
||||
createMyRoom('createMyRoom'),
|
||||
// 发泼水节胜利消息
|
||||
sendWaterFestVictoryMessage('sendWaterFestVictoryMessage'),
|
||||
|
||||
///通用交互 别往这下面加,👆🏻加
|
||||
commonInteraction('commonInteraction'),
|
||||
|
||||
/// 已在房则回当前房;否则进热门开播房;无房或失败则走创建房间(同 createMyRoom)
|
||||
enterHotRoomOrCreateMyRoom('enterHotRoomOrCreateMyRoom'),
|
||||
|
||||
/// 已在房则回当前房;否则热门推荐里随机进 PK 中房间;
|
||||
/// 无 PK 房或失败则走创建房间(同 createMyRoom)
|
||||
enterPkRoomOrCreateMyRoom('enterPkRoomOrCreateMyRoom'),
|
||||
defaultCode('');
|
||||
|
||||
const ToFlutterAppEnum(this.code);
|
||||
@@ -133,6 +153,10 @@ enum FromFlutterAppEnum {
|
||||
//送戒指后回调,传入type参数
|
||||
// type: 1 cp戒指赠送成功,2恩爱节告白礼物赠送成功
|
||||
cpSendRingCallBack('cp_send_ring_callback'),
|
||||
|
||||
// 动态发布成功
|
||||
publishDynamicSuccess("publishDynamicSuccess"),
|
||||
|
||||
defaultCode('');
|
||||
|
||||
const FromFlutterAppEnum(this.code);
|
||||
@@ -254,7 +278,7 @@ class FlutterBridge {
|
||||
print("All listeners for '$type' have been removed.");
|
||||
}
|
||||
}
|
||||
// =========================================================
|
||||
// =========================================================
|
||||
// 👇 🆕 [新增] 核心通用请求方法 (替代了旧的 requestTranslate)
|
||||
// =========================================================
|
||||
|
||||
@@ -277,11 +301,9 @@ class FlutterBridge {
|
||||
}
|
||||
|
||||
// 2. 入队
|
||||
_requestQueues[responseKey]!.add(_RequestTask(
|
||||
sendType.code,
|
||||
params,
|
||||
onSuccess,
|
||||
));
|
||||
_requestQueues[responseKey]!.add(
|
||||
_RequestTask(sendType.code, params, onSuccess),
|
||||
);
|
||||
|
||||
// 3. 调度执行
|
||||
_processRequestQueue(responseKey);
|
||||
@@ -331,7 +353,7 @@ class FlutterBridge {
|
||||
// 发送消息给 App(通过 WebView 调用 JS 方法)
|
||||
void sendToFlutter(String type, Map<String, dynamic> data) {
|
||||
final dataStr = jsonEncode({'type': type, 'data': data});
|
||||
print('$dataStr');
|
||||
print(dataStr);
|
||||
sendMessageToNative(dataStr);
|
||||
}
|
||||
|
||||
@@ -431,35 +453,71 @@ class FlutterBridge {
|
||||
sendToFlutter(ToFlutterAppEnum.toApplyAdmissionPage.code, {});
|
||||
void shouLiveBookingPicker() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouLiveBookingPicker.code, {});
|
||||
/** 完善个人信息 */
|
||||
|
||||
/// 完善个人信息
|
||||
void shouldCompleteProfile() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldCompleteProfile.code, {});
|
||||
/** 在直播间或聊天室停留观看n分钟 */
|
||||
|
||||
/// 在直播间或聊天室停留观看n分钟
|
||||
void shouldWatchDuration() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldWatchDuration.code, {});
|
||||
/** 在直播间或聊天室发送n条公屏消息 */
|
||||
|
||||
/// 在直播间或聊天室发送n条公屏消息
|
||||
void shouldSendPublicMessage() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldSendPublicMessage.code, {});
|
||||
/** 在直播间或聊天室上麦互动n分钟 */
|
||||
|
||||
/// 在直播间或聊天室上麦互动n分钟
|
||||
void shouldMicInteraction() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldMicInteraction.code, {});
|
||||
/** 向任意用户,发送n条信息*/
|
||||
|
||||
/// 向任意用户,发送n条信息
|
||||
void shouldSendPrivateMessage() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldSendPrivateMessage.code, {});
|
||||
/** 发布n条动态*/
|
||||
|
||||
/// 发布n条动态
|
||||
void shouldPostFeed() =>
|
||||
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() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldShareRoom.code, {});
|
||||
/** 佩戴任意装扮 */
|
||||
|
||||
/// 佩戴任意装扮
|
||||
void shouldWearDecoration() =>
|
||||
sendToFlutter(ToFlutterAppEnum.shouldWearDecoration.code, {});
|
||||
/** 前往语音房 */
|
||||
|
||||
/// 前往语音房
|
||||
void shouldGoToVoiceRoom() =>
|
||||
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) =>
|
||||
sendToFlutter(ToFlutterAppEnum.commonInteraction.code, data);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: web_tools
|
||||
description: "A new Flutter package project."
|
||||
version: 0.0.5
|
||||
version: 0.0.9
|
||||
publish_to: 'none' # 不发布到pub.dev
|
||||
homepage: https://gitea.sdws.shop/xim/web_tools.git
|
||||
|
||||
|
||||
Reference in New Issue
Block a user