mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
opt: handle pm share type
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -67,7 +67,7 @@ class VideoCardV extends StatelessWidget {
|
|||||||
if (uri.startsWith('http')) {
|
if (uri.startsWith('http')) {
|
||||||
String id = Uri.parse(uri).path.split('/')[1];
|
String id = Uri.parse(uri).path.split('/')[1];
|
||||||
if (isStringNumeric(id)) {
|
if (isStringNumeric(id)) {
|
||||||
PageUtils.pushDynFromId(id);
|
PageUtils.pushDynFromId(id: id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ class HtmlHttp {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (response.data.contains('Redirecting to')) {
|
if (response.data.contains('Redirecting to')) {
|
||||||
String? cvid = RegExp(r'cv\d+').firstMatch(response.data)?.group(0);
|
RegExpMatch? cvid =
|
||||||
if (cvid != null) {
|
RegExp(r'/([a-zA-Z]+)/(cv\d+)').firstMatch(response.data);
|
||||||
return await reqReadHtml(cvid, dynamicType, false);
|
if (cvid?.group(2) != null) {
|
||||||
|
return await reqReadHtml(cvid?.group(2), cvid?.group(1), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
||||||
@@ -185,6 +186,7 @@ class HtmlHttp {
|
|||||||
'updateTime': '',
|
'updateTime': '',
|
||||||
'content': opusContent,
|
'content': opusContent,
|
||||||
'isJsonContent': isJsonContent,
|
'isJsonContent': isJsonContent,
|
||||||
|
'commentType': 12,
|
||||||
'commentId': int.parse(number),
|
'commentId': int.parse(number),
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ class HtmlRenderController extends ReplyController<MainListReply> {
|
|||||||
if (dynamicType == 'opus' || dynamicType == 'picture') {
|
if (dynamicType == 'opus' || dynamicType == 'picture') {
|
||||||
res = await HtmlHttp.reqHtml(id, dynamicType);
|
res = await HtmlHttp.reqHtml(id, dynamicType);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
|
if (res['commentType'] is int) {
|
||||||
type = res['commentType'];
|
type = res['commentType'];
|
||||||
|
}
|
||||||
if (res['favorite'] != null) {
|
if (res['favorite'] != null) {
|
||||||
favStat.addAll({
|
favStat.addAll({
|
||||||
'status': true,
|
'status': true,
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ class _SysMsgPageState extends State<SysMsgPage> {
|
|||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
try {
|
try {
|
||||||
PageUtils.pushDynFromId(match[4]);
|
PageUtils.pushDynFromId(id: match[4]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.showToast(err.toString());
|
SmartDialog.showToast(err.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,17 +176,21 @@ class ChatItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case MsgType.share_v2:
|
case MsgType.share_v2:
|
||||||
return Column(
|
String? type;
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
GestureTapCallback onTap;
|
||||||
children: [
|
switch (content['source']) {
|
||||||
GestureDetector(
|
// album
|
||||||
onTap: () async {
|
case 2:
|
||||||
if (content['source'] == 16) {
|
type = '相簿';
|
||||||
PageUtils.viewBangumi(epId: content['id']);
|
onTap = () {
|
||||||
return;
|
PageUtils.pushDynFromId(rid: content['id']);
|
||||||
}
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
if (content['source'] == 5) {
|
// video
|
||||||
|
case 5:
|
||||||
|
type = '视频';
|
||||||
|
onTap = () async {
|
||||||
dynamic aid = content['id'];
|
dynamic aid = content['id'];
|
||||||
if (aid is String) {
|
if (aid is String) {
|
||||||
aid = int.tryParse(aid);
|
aid = int.tryParse(aid);
|
||||||
@@ -194,7 +198,6 @@ class ChatItem extends StatelessWidget {
|
|||||||
dynamic bvid = content["bvid"];
|
dynamic bvid = content["bvid"];
|
||||||
if (aid == null && bvid == null) {
|
if (aid == null && bvid == null) {
|
||||||
SmartDialog.showToast('null');
|
SmartDialog.showToast('null');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
bvid ??= IdUtils.av2bv(aid);
|
bvid ??= IdUtils.av2bv(aid);
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
@@ -208,12 +211,51 @@ class ChatItem extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return;
|
};
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
// article
|
||||||
|
case 6:
|
||||||
|
type = '专栏';
|
||||||
|
onTap = () {
|
||||||
|
Get.toNamed(
|
||||||
|
'/htmlRender',
|
||||||
|
parameters: {
|
||||||
|
'url': 'www.bilibili.com/opus/cv${content['id']}',
|
||||||
|
'title': '',
|
||||||
|
'id': 'cv${content['id']}',
|
||||||
|
'dynamicType': 'read'
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
// dynamic
|
||||||
|
case 11:
|
||||||
|
type = '动态';
|
||||||
|
onTap = () {
|
||||||
|
PageUtils.pushDynFromId(id: content['id']);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
// pgc
|
||||||
|
case 16:
|
||||||
|
onTap = () {
|
||||||
|
PageUtils.viewBangumi(epId: content['id']);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
onTap = () {
|
||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
'unsupported source type: ${content['source']}');
|
'unsupported source type: ${content['source']}');
|
||||||
},
|
};
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
width: 220,
|
width: 220,
|
||||||
height: 220 * 9 / 16,
|
height: 220 * 9 / 16,
|
||||||
@@ -230,9 +272,23 @@ class ChatItem extends StatelessWidget {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (content['source'] == 6 &&
|
||||||
|
(content['headline'] as String?)?.isNotEmpty == true) ...[
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
Text(
|
Text(
|
||||||
content['author'] ?? "",
|
content['headline'],
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
height: 1.5,
|
||||||
|
color: textColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (content['author'] != null) ...[
|
||||||
|
const SizedBox(height: 1),
|
||||||
|
Text(
|
||||||
|
'${content['author']}${type != null ? ' · $type' : ''}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
letterSpacing: 0.6,
|
letterSpacing: 0.6,
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
@@ -241,6 +297,7 @@ class ChatItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
],
|
||||||
);
|
);
|
||||||
case MsgType.archive_card:
|
case MsgType.archive_card:
|
||||||
return Column(
|
return Column(
|
||||||
@@ -451,6 +508,56 @@ class ChatItem extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
case MsgType.common_share:
|
||||||
|
if (content['source'] == '直播') {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed('/liveRoom?roomid=${content['sourceID']}');
|
||||||
|
},
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
width: 220,
|
||||||
|
height: 220 * 9 / 16,
|
||||||
|
src: content['cover'],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
content['title'] ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
height: 1.5,
|
||||||
|
color: textColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
|
Text(
|
||||||
|
'${content['author']} · 直播',
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
height: 1.5,
|
||||||
|
color: textColor().withOpacity(0.6),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Text(
|
||||||
|
content != null && content != ''
|
||||||
|
? (content['content'] ?? content.toString())
|
||||||
|
: '不支持的消息类型',
|
||||||
|
style: TextStyle(
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
height: 1.5,
|
||||||
|
color: textColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return Text(
|
return Text(
|
||||||
content != null && content != ''
|
content != null && content != ''
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:PiliPlus/http/dynamics.dart';
|
|
||||||
import 'package:PiliPlus/models/common/reply_type.dart';
|
import 'package:PiliPlus/models/common/reply_type.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
@@ -437,22 +436,7 @@ class PiliScheme {
|
|||||||
case 'album':
|
case 'album':
|
||||||
String? rid = uriDigitRegExp.firstMatch(path)?.group(1);
|
String? rid = uriDigitRegExp.firstMatch(path)?.group(1);
|
||||||
if (rid != null) {
|
if (rid != null) {
|
||||||
SmartDialog.showLoading();
|
PageUtils.pushDynFromId(rid: rid, off: off);
|
||||||
dynamic res = await DynamicsHttp.dynamicDetail(rid: rid, type: 2);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
if (res['status']) {
|
|
||||||
PageUtils.toDupNamed(
|
|
||||||
'/dynamicDetail',
|
|
||||||
arguments: {
|
|
||||||
'item': res['data'],
|
|
||||||
'floor': 1,
|
|
||||||
'action': 'detail'
|
|
||||||
},
|
|
||||||
off: off,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -708,7 +692,7 @@ class PiliScheme {
|
|||||||
static Future<bool> _onPushDynDetail(path, off) async {
|
static Future<bool> _onPushDynDetail(path, off) async {
|
||||||
String? id = uriDigitRegExp.firstMatch(path)?.group(1);
|
String? id = uriDigitRegExp.firstMatch(path)?.group(1);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
PageUtils.pushDynFromId(id, off: off);
|
PageUtils.pushDynFromId(id: id, off: off);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -271,9 +271,13 @@ class PageUtils {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future pushDynFromId(id, {bool off = false}) async {
|
static Future pushDynFromId({id, rid, bool off = false}) async {
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
dynamic res = await DynamicsHttp.dynamicDetail(
|
||||||
|
id: id,
|
||||||
|
rid: rid,
|
||||||
|
type: rid != null ? 2 : null,
|
||||||
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
DynamicItemModel data = res['data'];
|
DynamicItemModel data = res['data'];
|
||||||
|
|||||||
Reference in New Issue
Block a user