merge main
This commit is contained in:
4
change_log/1.0.10.1016.md
Normal file
4
change_log/1.0.10.1016.md
Normal file
@ -0,0 +1,4 @@
|
||||
## 1.0.10
|
||||
|
||||
### 修复
|
||||
+ 长按倍速抬起后未恢复默认倍速
|
@ -5,6 +5,7 @@ import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/models/common/search_type.dart';
|
||||
@ -27,6 +28,11 @@ class VideoCardV extends StatelessWidget {
|
||||
this.longPressEnd,
|
||||
}) : super(key: key);
|
||||
|
||||
bool isStringNumeric(String str) {
|
||||
RegExp numericRegex = RegExp(r'^\d+$');
|
||||
return numericRegex.hasMatch(str);
|
||||
}
|
||||
|
||||
void onPushDetail(heroTag) async {
|
||||
String goto = videoItem.goto;
|
||||
switch (goto) {
|
||||
@ -64,11 +70,35 @@ class VideoCardV extends StatelessWidget {
|
||||
break;
|
||||
// 动态
|
||||
case 'picture':
|
||||
String dynamicType = 'picture';
|
||||
String uri = videoItem.uri;
|
||||
if (videoItem.uri.contains('bilibili://article/')) {
|
||||
dynamicType = 'article';
|
||||
RegExp regex = RegExp(r'\d+');
|
||||
Match match = regex.firstMatch(videoItem.uri)!;
|
||||
String matchedNumber = match.group(0)!;
|
||||
videoItem.param = 'cv' + matchedNumber;
|
||||
}
|
||||
if (uri.startsWith('http')) {
|
||||
String path = Uri.parse(uri).path;
|
||||
if (isStringNumeric(path.split('/')[1])) {
|
||||
// 请求接口
|
||||
var res = await DynamicsHttp.dynamicDetail(id: path.split('/')[1]);
|
||||
if (res['status']) {
|
||||
Get.toNamed('/dynamicDetail', arguments: {
|
||||
'item': res['data'],
|
||||
'floor': 1,
|
||||
'action': 'detail'
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': videoItem.uri,
|
||||
'url': uri,
|
||||
'title': videoItem.title,
|
||||
'id': videoItem.param.toString(),
|
||||
'dynamicType': 'picture'
|
||||
'dynamicType': dynamicType
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
@ -355,4 +355,9 @@ class Api {
|
||||
|
||||
static const String sessionMsg =
|
||||
'https://api.vc.bilibili.com/svr_sync/v1/svr_sync/fetch_session_msgs';
|
||||
// 获取某个动态详情
|
||||
// timezone_offset=-480
|
||||
// id=849312409672744983
|
||||
// features=itemOpusStyle
|
||||
static const String dynamicDetail = '/x/polymer/web-dynamic/v1/detail';
|
||||
}
|
||||
|
@ -86,4 +86,35 @@ class DynamicsHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static Future dynamicDetail({
|
||||
String? id,
|
||||
}) async {
|
||||
var res = await Request().get(Api.dynamicDetail, data: {
|
||||
'timezone_offset': -480,
|
||||
'id': id,
|
||||
'features': 'itemOpusStyle',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': DynamicItemModel.fromJson(res.data['data']['item']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': err.toString(),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,29 @@ class HtmlHttp {
|
||||
"https://www.bilibili.com/opus/$id",
|
||||
extra: {'ua': 'pc'},
|
||||
);
|
||||
|
||||
if (response.data.contains('Redirecting to')) {
|
||||
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
||||
Match match = regex.firstMatch(response.data)!;
|
||||
String matchedString = match.group(0)!;
|
||||
response = await Request().get(
|
||||
'https:$matchedString' + '/',
|
||||
extra: {'ua': 'pc'},
|
||||
);
|
||||
}
|
||||
try {
|
||||
Document rootTree = parse(response.data);
|
||||
// log(response.data.body.toString());
|
||||
Element body = rootTree.body!;
|
||||
Element appDom = body.querySelector('#app')!;
|
||||
Element authorHeader = appDom.querySelector('.fixed-author-header')!;
|
||||
// 头像
|
||||
String avatar = authorHeader.querySelector('img')!.attributes['src']!;
|
||||
avatar = 'https:${avatar.split('@')[0]}';
|
||||
String uname =
|
||||
authorHeader.querySelector('.fixed-author-header__author__name')!.text;
|
||||
String uname = authorHeader
|
||||
.querySelector('.fixed-author-header__author__name')!
|
||||
.text;
|
||||
|
||||
// 动态详情
|
||||
Element opusDetail = appDom.querySelector('.opus-detail')!;
|
||||
// 发布时间
|
||||
@ -26,6 +40,9 @@ class HtmlHttp {
|
||||
//
|
||||
String opusContent =
|
||||
opusDetail.querySelector('.opus-module-content')!.innerHtml;
|
||||
String test = opusDetail
|
||||
.querySelector('.horizontal-scroll-album__pic__img')!
|
||||
.innerHtml;
|
||||
String commentId = opusDetail
|
||||
.querySelector('.bili-comment-container')!
|
||||
.className
|
||||
@ -37,9 +54,12 @@ class HtmlHttp {
|
||||
'avatar': avatar,
|
||||
'uname': uname,
|
||||
'updateTime': updateTime,
|
||||
'content': opusContent,
|
||||
'content': test + opusContent,
|
||||
'commentId': int.parse(commentId)
|
||||
};
|
||||
} catch (err) {
|
||||
print('err: $err');
|
||||
}
|
||||
}
|
||||
|
||||
// read
|
||||
|
@ -139,7 +139,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.toNamed('/webview', parameters: {
|
||||
'url': 'https:$url',
|
||||
'url': url.startsWith('http') ? url : 'https:$url',
|
||||
'type': 'url',
|
||||
'pageTitle': title,
|
||||
});
|
||||
|
@ -577,7 +577,8 @@ class PlPlayerController {
|
||||
duration: (currentOption.duration / speed) * playbackSpeed);
|
||||
danmakuController!.updateOption(updatedOption);
|
||||
} catch (_) {}
|
||||
_playbackSpeed.value = speed;
|
||||
// fix 长按倍速后放开不恢复
|
||||
// _playbackSpeed.value = speed;
|
||||
}
|
||||
|
||||
/// 设置倍速
|
||||
|
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.9
|
||||
version: 1.0.10
|
||||
|
||||
environment:
|
||||
sdk: ">=2.19.6 <3.0.0"
|
||||
|
Reference in New Issue
Block a user