mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-17 06:40:13 +08:00
@@ -7,6 +7,7 @@ import 'package:PiliPlus/models/model_avatar.dart';
|
|||||||
import 'package:PiliPlus/models/model_owner.dart';
|
import 'package:PiliPlus/models/model_owner.dart';
|
||||||
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
|
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
|
||||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||||
|
import 'package:PiliPlus/utils/parse_string.dart';
|
||||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
|
|
||||||
@@ -429,7 +430,7 @@ class ModuleAuthorModel extends Avatar {
|
|||||||
pendant = null;
|
pendant = null;
|
||||||
}
|
}
|
||||||
isTop = json['is_top'];
|
isTop = json['is_top'];
|
||||||
badgeText = _parseString(json['icon_badge']?['text']);
|
badgeText = noneNullOrEmptyString(json['icon_badge']?['text']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,7 +683,9 @@ class Vote {
|
|||||||
Vote.fromJson(Map<String, dynamic> json) {
|
Vote.fromJson(Map<String, dynamic> json) {
|
||||||
joinNum = Utils.safeToInt(json['join_num']);
|
joinNum = Utils.safeToInt(json['join_num']);
|
||||||
voteId = Utils.safeToInt(json['vote_id']);
|
voteId = Utils.safeToInt(json['vote_id']);
|
||||||
title = _parseString(json['title']) ?? _parseString(json['desc']);
|
title =
|
||||||
|
noneNullOrEmptyString(json['title']) ??
|
||||||
|
noneNullOrEmptyString(json['desc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1170,18 +1173,13 @@ class Emoji {
|
|||||||
|
|
||||||
Emoji.fromJson(Map<String, dynamic> json) {
|
Emoji.fromJson(Map<String, dynamic> json) {
|
||||||
url =
|
url =
|
||||||
_parseString(json['webp_url']) ??
|
noneNullOrEmptyString(json['webp_url']) ??
|
||||||
_parseString(json['gif_url']) ??
|
noneNullOrEmptyString(json['gif_url']) ??
|
||||||
_parseString(json['icon_url']);
|
noneNullOrEmptyString(json['icon_url']);
|
||||||
size = json['size'] ?? 1;
|
size = json['size'] ?? 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _parseString(String? value) {
|
|
||||||
if (value == null || value.isEmpty) return null;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DynamicNoneModel {
|
class DynamicNoneModel {
|
||||||
DynamicNoneModel({
|
DynamicNoneModel({
|
||||||
this.tips,
|
this.tips,
|
||||||
@@ -1297,7 +1295,7 @@ class ModuleTag {
|
|||||||
String? text;
|
String? text;
|
||||||
|
|
||||||
ModuleTag.fromJson(Map<String, dynamic> json) {
|
ModuleTag.fromJson(Map<String, dynamic> json) {
|
||||||
text = _parseString(json['text']);
|
text = noneNullOrEmptyString(json['text']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/models_new/video/video_detail/stat.dart';
|
|||||||
import 'package:PiliPlus/models_new/video/video_detail/subtitle.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/subtitle.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_detail/user_garb.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/user_garb.dart';
|
||||||
|
import 'package:PiliPlus/utils/parse_string.dart';
|
||||||
|
|
||||||
class VideoDetailData {
|
class VideoDetailData {
|
||||||
String? bvid;
|
String? bvid;
|
||||||
@@ -177,6 +178,6 @@ class VideoDetailData {
|
|||||||
staff: (json["staff"] as List?)
|
staff: (json["staff"] as List?)
|
||||||
?.map((item) => Staff.fromJson(item))
|
?.map((item) => Staff.fromJson(item))
|
||||||
.toList(),
|
.toList(),
|
||||||
redirectUrl: json['redirect_url'],
|
redirectUrl: noneNullOrEmptyString(json['redirect_url']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,14 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
queryVideoTags();
|
queryVideoTags();
|
||||||
final res = await VideoHttp.videoIntro(bvid: bvid);
|
final res = await VideoHttp.videoIntro(bvid: bvid);
|
||||||
if (res case Success(:final response)) {
|
if (res case Success(:final response)) {
|
||||||
|
if (response.redirectUrl != null &&
|
||||||
|
videoDetailCtr.epId == null &&
|
||||||
|
videoDetailCtr.seasonId == null) {
|
||||||
|
if (!isClosed) {
|
||||||
|
PageUtils.viewPgcFromUri(response.redirectUrl!, off: true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
videoPlayerServiceHandler?.onVideoDetailChange(
|
videoPlayerServiceHandler?.onVideoDetailChange(
|
||||||
response,
|
response,
|
||||||
cid.value,
|
cid.value,
|
||||||
|
|||||||
@@ -1592,6 +1592,9 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
if (playerStatus.isPlaying) {
|
if (playerStatus.isPlaying) {
|
||||||
WakelockPlus.disable();
|
WakelockPlus.disable();
|
||||||
}
|
}
|
||||||
|
if (kDebugMode) {
|
||||||
|
debugPrint('dispose player');
|
||||||
|
}
|
||||||
_videoPlayerController?.dispose();
|
_videoPlayerController?.dispose();
|
||||||
_videoPlayerController = null;
|
_videoPlayerController = null;
|
||||||
_videoController = null;
|
_videoController = null;
|
||||||
|
|||||||
@@ -585,6 +585,7 @@ abstract final class PageUtils {
|
|||||||
bool isPgc = true,
|
bool isPgc = true,
|
||||||
int? progress, // milliseconds
|
int? progress, // milliseconds
|
||||||
int? aid,
|
int? aid,
|
||||||
|
bool off = false,
|
||||||
}) {
|
}) {
|
||||||
RegExpMatch? match = _pgcRegex.firstMatch(uri);
|
RegExpMatch? match = _pgcRegex.firstMatch(uri);
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
@@ -595,12 +596,14 @@ abstract final class PageUtils {
|
|||||||
seasonId: isSeason ? id : null,
|
seasonId: isSeason ? id : null,
|
||||||
epId: isSeason ? null : id,
|
epId: isSeason ? null : id,
|
||||||
progress: progress,
|
progress: progress,
|
||||||
|
off: off,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
viewPugv(
|
viewPugv(
|
||||||
seasonId: isSeason ? id : null,
|
seasonId: isSeason ? id : null,
|
||||||
epId: isSeason ? null : id,
|
epId: isSeason ? null : id,
|
||||||
aid: aid,
|
aid: aid,
|
||||||
|
off: off,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -628,6 +631,7 @@ abstract final class PageUtils {
|
|||||||
dynamic seasonId,
|
dynamic seasonId,
|
||||||
dynamic epId,
|
dynamic epId,
|
||||||
int? progress, // milliseconds
|
int? progress, // milliseconds
|
||||||
|
bool off = false,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
SmartDialog.showLoading(msg: '资源获取中');
|
SmartDialog.showLoading(msg: '资源获取中');
|
||||||
@@ -652,6 +656,7 @@ abstract final class PageUtils {
|
|||||||
'pgcApi': true,
|
'pgcApi': true,
|
||||||
'pgcItem': response,
|
'pgcItem': response,
|
||||||
},
|
},
|
||||||
|
off: off,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,6 +705,7 @@ abstract final class PageUtils {
|
|||||||
extraArguments: {
|
extraArguments: {
|
||||||
'pgcItem': response,
|
'pgcItem': response,
|
||||||
},
|
},
|
||||||
|
off: off,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -725,6 +731,7 @@ abstract final class PageUtils {
|
|||||||
dynamic seasonId,
|
dynamic seasonId,
|
||||||
dynamic epId,
|
dynamic epId,
|
||||||
int? aid,
|
int? aid,
|
||||||
|
bool off = false,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
SmartDialog.showLoading(msg: '资源获取中');
|
SmartDialog.showLoading(msg: '资源获取中');
|
||||||
@@ -752,6 +759,7 @@ abstract final class PageUtils {
|
|||||||
extraArguments: {
|
extraArguments: {
|
||||||
'pgcItem': response,
|
'pgcItem': response,
|
||||||
},
|
},
|
||||||
|
off: off,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('资源加载失败');
|
SmartDialog.showToast('资源加载失败');
|
||||||
|
|||||||
4
lib/utils/parse_string.dart
Normal file
4
lib/utils/parse_string.dart
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
String? noneNullOrEmptyString(String? value) {
|
||||||
|
if (value == null || value.isEmpty) return null;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user