mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 23:56:13 +08:00
opt view pgc
Closes #1155 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactivevie
|
|||||||
import 'package:PiliPlus/grpc/im.dart';
|
import 'package:PiliPlus/grpc/im.dart';
|
||||||
import 'package:PiliPlus/http/dynamics.dart';
|
import 'package:PiliPlus/http/dynamics.dart';
|
||||||
import 'package:PiliPlus/http/search.dart';
|
import 'package:PiliPlus/http/search.dart';
|
||||||
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||||
import 'package:PiliPlus/models/common/video/video_type.dart';
|
import 'package:PiliPlus/models/common/video/video_type.dart';
|
||||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||||
@@ -418,14 +419,30 @@ class PageUtils {
|
|||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'DYNAMIC_TYPE_AV':
|
case 'DYNAMIC_TYPE_AV':
|
||||||
final archive = item.modules.moduleDynamic!.major!.archive!;
|
final archive = item.modules.moduleDynamic!.major!.archive!;
|
||||||
|
// pgc
|
||||||
if (archive.type == 2) {
|
if (archive.type == 2) {
|
||||||
String? redirectUrl = await UrlUtils.parseRedirectUrl(
|
// jumpUrl
|
||||||
archive.jumpUrl!.http2https,
|
if (archive.jumpUrl case String jumpUrl) {
|
||||||
false,
|
if (viewPgcFromUri(jumpUrl)) {
|
||||||
);
|
return;
|
||||||
if (redirectUrl != null) {
|
}
|
||||||
viewPgcFromUri(redirectUrl);
|
}
|
||||||
return;
|
// redirectUrl from intro
|
||||||
|
final res = await VideoHttp.videoIntro(bvid: archive.bvid!);
|
||||||
|
if (res.dataOrNull?.redirectUrl case String redirectUrl) {
|
||||||
|
if (viewPgcFromUri(redirectUrl)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// redirectUrl from jumpUrl
|
||||||
|
if (await UrlUtils.parseRedirectUrl(
|
||||||
|
archive.jumpUrl.http2https,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
case String redirectUrl) {
|
||||||
|
if (viewPgcFromUri(redirectUrl)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -809,6 +826,23 @@ class PageUtils {
|
|||||||
final hasEpisode = episodes != null && episodes.isNotEmpty;
|
final hasEpisode = episodes != null && episodes.isNotEmpty;
|
||||||
|
|
||||||
EpisodeItem? episode;
|
EpisodeItem? episode;
|
||||||
|
|
||||||
|
void viewSection(EpisodeItem episode) {
|
||||||
|
toVideoPage(
|
||||||
|
videoType: VideoType.ugc,
|
||||||
|
bvid: episode.bvid!,
|
||||||
|
cid: episode.cid!,
|
||||||
|
seasonId: data.seasonId,
|
||||||
|
epId: episode.epId,
|
||||||
|
cover: episode.cover,
|
||||||
|
progress: progress == null ? null : int.tryParse(progress),
|
||||||
|
extraArguments: {
|
||||||
|
'pgcApi': true,
|
||||||
|
'pgcItem': data,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (epId != null) {
|
if (epId != null) {
|
||||||
epId = epId.toString();
|
epId = epId.toString();
|
||||||
if (hasEpisode) {
|
if (hasEpisode) {
|
||||||
@@ -827,21 +861,7 @@ class PageUtils {
|
|||||||
for (var episode in episodes) {
|
for (var episode in episodes) {
|
||||||
if (episode.epId.toString() == epId) {
|
if (episode.epId.toString() == epId) {
|
||||||
// view as ugc
|
// view as ugc
|
||||||
toVideoPage(
|
viewSection(episode);
|
||||||
videoType: VideoType.ugc,
|
|
||||||
bvid: episode.bvid!,
|
|
||||||
cid: episode.cid!,
|
|
||||||
seasonId: data.seasonId,
|
|
||||||
epId: episode.epId,
|
|
||||||
cover: episode.cover,
|
|
||||||
progress: progress == null
|
|
||||||
? null
|
|
||||||
: int.tryParse(progress),
|
|
||||||
extraArguments: {
|
|
||||||
'pgcApi': true,
|
|
||||||
'pgcItem': data,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -870,6 +890,12 @@ class PageUtils {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
episode ??= data.section?.firstOrNull?.episodes?.firstOrNull;
|
||||||
|
if (episode != null) {
|
||||||
|
viewSection(episode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SmartDialog.showToast('资源加载失败');
|
SmartDialog.showToast('资源加载失败');
|
||||||
|
|||||||
Reference in New Issue
Block a user