mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-06 02:30:12 +08:00
@@ -146,21 +146,16 @@ Future<void> showMemberReportDialog(
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
if (reason.isEmpty) {
|
||||
SmartDialog.showToast('至少选择一项作为举报内容');
|
||||
} else {
|
||||
Get.back();
|
||||
final result = await MemberHttp.reportMember(
|
||||
MemberHttp.reportMember(
|
||||
mid,
|
||||
reason: reason.join(','),
|
||||
reasonV2: reasonV2 != null ? reasonV2! + 1 : null,
|
||||
);
|
||||
if (result['msg'] is String && result['msg'].isNotEmpty) {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
} else {
|
||||
SmartDialog.showToast('举报失败');
|
||||
}
|
||||
}
|
||||
},
|
||||
child: const Text('确定'),
|
||||
|
||||
@@ -18,21 +18,8 @@ void imageSaveDialog({
|
||||
SmartDialog.show(
|
||||
animationType: SmartAnimationType.centerScale_otherSlide,
|
||||
builder: (context) {
|
||||
const iconSize = 20.0;
|
||||
final theme = Theme.of(context);
|
||||
|
||||
Widget iconBtn({
|
||||
String? tooltip,
|
||||
required Icon icon,
|
||||
required VoidCallback? onPressed,
|
||||
}) {
|
||||
return iconButton(
|
||||
icon: icon,
|
||||
iconSize: 20,
|
||||
tooltip: tooltip,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: imgWidth,
|
||||
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
@@ -94,19 +81,19 @@ void imageSaveDialog({
|
||||
else
|
||||
const Spacer(),
|
||||
if (aid != null || bvid != null)
|
||||
iconBtn(
|
||||
iconButton(
|
||||
iconSize: iconSize,
|
||||
tooltip: '稍后再看',
|
||||
onPressed: () => {
|
||||
SmartDialog.dismiss(),
|
||||
UserHttp.toViewLater(aid: aid, bvid: bvid).then(
|
||||
(res) => SmartDialog.showToast(res['msg']),
|
||||
),
|
||||
UserHttp.toViewLater(aid: aid, bvid: bvid),
|
||||
},
|
||||
icon: const Icon(Icons.watch_later_outlined),
|
||||
),
|
||||
if (cover != null && cover.isNotEmpty) ...[
|
||||
if (PlatformUtils.isMobile)
|
||||
iconBtn(
|
||||
iconButton(
|
||||
iconSize: iconSize,
|
||||
tooltip: '分享',
|
||||
onPressed: () {
|
||||
SmartDialog.dismiss();
|
||||
@@ -114,7 +101,8 @@ void imageSaveDialog({
|
||||
},
|
||||
icon: const Icon(Icons.share),
|
||||
),
|
||||
iconBtn(
|
||||
iconButton(
|
||||
iconSize: iconSize,
|
||||
tooltip: '保存封面图',
|
||||
onPressed: () async {
|
||||
bool saveStatus = await ImageUtils.downloadImg([cover]);
|
||||
|
||||
@@ -327,9 +327,9 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
child: Hero(
|
||||
tag: item.url,
|
||||
child: switch (item.sourceType) {
|
||||
SourceType.fileImage => Image(
|
||||
SourceType.fileImage => Image.file(
|
||||
File(item.url),
|
||||
filterQuality: FilterQuality.low,
|
||||
image: FileImage(File(item.url)),
|
||||
),
|
||||
SourceType.networkImage => CachedNetworkImage(
|
||||
fadeInDuration: Duration.zero,
|
||||
|
||||
@@ -70,12 +70,7 @@ class VideoPopupMenu extends StatelessWidget {
|
||||
_VideoCustomAction(
|
||||
'稍后再看',
|
||||
const Icon(MdiIcons.clockTimeEightOutline, size: 16),
|
||||
() async {
|
||||
final res = await UserHttp.toViewLater(
|
||||
bvid: videoItem.bvid,
|
||||
);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
() => UserHttp.toViewLater(bvid: videoItem.bvid),
|
||||
),
|
||||
if (videoItem.cid != null && Pref.enableAi)
|
||||
_VideoCustomAction(
|
||||
|
||||
@@ -173,8 +173,8 @@ abstract final class DynamicsHttp {
|
||||
queryParameters: {
|
||||
'platform': 'web',
|
||||
'csrf': Accounts.main.csrf,
|
||||
'x-bili-device-req-json': {"platform": "web", "device": "pc"},
|
||||
'x-bili-web-req-json': {"spm_id": "333.999"},
|
||||
'x-bili-device-req-json': '{"platform": "web", "device": "pc"}',
|
||||
'x-bili-web-req-json': '{"spm_id": "333.999"}',
|
||||
},
|
||||
data: {
|
||||
"dyn_req": {
|
||||
|
||||
@@ -673,7 +673,7 @@ abstract final class FavHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState> copyOrMoveFav({
|
||||
static Future<LoadingState<Null>> copyOrMoveFav({
|
||||
required bool isCopy,
|
||||
required bool isFav,
|
||||
required dynamic srcMediaId,
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/models/common/live/live_search_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_list.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_contribution_rank/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_danmaku/danmaku_msg.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_dm_block/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_dm_block/shield_info.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_dm_block/shield_user_list.dart';
|
||||
@@ -122,7 +123,9 @@ abstract final class LiveHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future liveRoomDanmaPrefetch({required Object roomId}) async {
|
||||
static Future<LoadingState<List<DanmakuMsg>?>> liveRoomDmPrefetch({
|
||||
required Object roomId,
|
||||
}) async {
|
||||
final res = await Request().get(
|
||||
Api.liveRoomDmPrefetch,
|
||||
queryParameters: {'roomid': roomId},
|
||||
@@ -134,9 +137,17 @@ abstract final class LiveHttp {
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']?['room']};
|
||||
try {
|
||||
return Success(
|
||||
(res.data['data']?['room'] as List?)
|
||||
?.map((e) => DanmakuMsg.fromPrefetch(e))
|
||||
.toList(),
|
||||
);
|
||||
} catch (e) {
|
||||
return Error(e.toString());
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@ import 'package:PiliPlus/utils/app_sign.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
abstract final class MemberHttp {
|
||||
static Future reportMember(
|
||||
static Future<void> reportMember(
|
||||
dynamic mid, {
|
||||
String? reason,
|
||||
int? reasonV2,
|
||||
@@ -46,10 +47,11 @@ abstract final class MemberHttp {
|
||||
},
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
return {
|
||||
'status': res.data['status'],
|
||||
'msg': res.data['message'] ?? res.data['data'],
|
||||
};
|
||||
if (res.data['status'] == true) {
|
||||
SmartDialog.showToast('举报成功');
|
||||
} else {
|
||||
SmartDialog.showToast('举报失败');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<SpaceArticleData>> spaceArticle({
|
||||
@@ -205,48 +207,48 @@ abstract final class MemberHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState> spaceStory({
|
||||
required Object mid,
|
||||
required Object aid,
|
||||
required Object beforeSize,
|
||||
required Object afterSize,
|
||||
required Object cid,
|
||||
required Object contain,
|
||||
required Object index,
|
||||
}) async {
|
||||
final params = {
|
||||
'aid': aid,
|
||||
'before_size': beforeSize,
|
||||
'after_size': afterSize,
|
||||
'cid': cid,
|
||||
'contain': contain,
|
||||
'index': index,
|
||||
'build': 8430300,
|
||||
'version': '8.43.0',
|
||||
'c_locale': 'zh_CN',
|
||||
'channel': 'master',
|
||||
'mobi_app': 'android',
|
||||
'platform': 'android',
|
||||
's_locale': 'zh_CN',
|
||||
'statistics': Constants.statisticsApp,
|
||||
'vmid': mid,
|
||||
};
|
||||
final res = await Request().get(
|
||||
Api.spaceStory,
|
||||
queryParameters: params,
|
||||
options: Options(
|
||||
headers: {
|
||||
'bili-http-engine': 'cronet',
|
||||
'user-agent': Constants.userAgentApp,
|
||||
},
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
// static Future<LoadingState> spaceStory({
|
||||
// required Object mid,
|
||||
// required Object aid,
|
||||
// required Object beforeSize,
|
||||
// required Object afterSize,
|
||||
// required Object cid,
|
||||
// required Object contain,
|
||||
// required Object index,
|
||||
// }) async {
|
||||
// final params = {
|
||||
// 'aid': aid,
|
||||
// 'before_size': beforeSize,
|
||||
// 'after_size': afterSize,
|
||||
// 'cid': cid,
|
||||
// 'contain': contain,
|
||||
// 'index': index,
|
||||
// 'build': 8430300,
|
||||
// 'version': '8.43.0',
|
||||
// 'c_locale': 'zh_CN',
|
||||
// 'channel': 'master',
|
||||
// 'mobi_app': 'android',
|
||||
// 'platform': 'android',
|
||||
// 's_locale': 'zh_CN',
|
||||
// 'statistics': Constants.statisticsApp,
|
||||
// 'vmid': mid,
|
||||
// };
|
||||
// final res = await Request().get(
|
||||
// Api.spaceStory,
|
||||
// queryParameters: params,
|
||||
// options: Options(
|
||||
// headers: {
|
||||
// 'bili-http-engine': 'cronet',
|
||||
// 'user-agent': Constants.userAgentApp,
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// if (res.data['code'] == 0) {
|
||||
// return Success(res.data['data']);
|
||||
// } else {
|
||||
// return Error(res.data['message']);
|
||||
// }
|
||||
// }
|
||||
|
||||
static Future<LoadingState<SpaceData>> space({
|
||||
int? mid,
|
||||
@@ -315,15 +317,15 @@ abstract final class MemberHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future memberStat({int? mid}) async {
|
||||
static Future<LoadingState<Map>> memberStat({int? mid}) async {
|
||||
final res = await Request().get(
|
||||
Api.userStat,
|
||||
queryParameters: {'vmid': mid},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,15 +634,15 @@ abstract final class MemberHttp {
|
||||
}
|
||||
|
||||
// 获取up播放数、点赞数
|
||||
static Future memberView({required int mid}) async {
|
||||
static Future<LoadingState<Map>> memberView({required int mid}) async {
|
||||
final res = await Request().get(
|
||||
Api.getMemberViewApi,
|
||||
queryParameters: {'mid': mid},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ abstract final class MsgHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future uploadImage({
|
||||
static Future<LoadingState<Map>> uploadImage({
|
||||
required dynamic path,
|
||||
required String bucket,
|
||||
required String dir,
|
||||
@@ -167,15 +167,9 @@ abstract final class MsgHttp {
|
||||
}),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,15 +243,15 @@ abstract final class PgcHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future seasonStatus(Object seasonId) async {
|
||||
static Future<LoadingState<Map>> seasonStatus(Object seasonId) async {
|
||||
final res = await Request().get(
|
||||
Api.seasonStatus,
|
||||
queryParameters: {'season_id': seasonId},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['result']};
|
||||
return Success(res.data['result']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,19 +230,19 @@ abstract final class SearchHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState> episodeInfo({dynamic epId}) async {
|
||||
final res = await Request().get(
|
||||
Api.episodeInfo,
|
||||
queryParameters: {
|
||||
'ep_id': ?epId,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
// static Future<LoadingState> episodeInfo({dynamic epId}) async {
|
||||
// final res = await Request().get(
|
||||
// Api.episodeInfo,
|
||||
// queryParameters: {
|
||||
// 'ep_id': ?epId,
|
||||
// },
|
||||
// );
|
||||
// if (res.data['code'] == 0) {
|
||||
// return Success(res.data['data']);
|
||||
// } else {
|
||||
// return Error(res.data['message']);
|
||||
// }
|
||||
// }
|
||||
|
||||
static Future<LoadingState<SearchTrendingData>> searchTrending({
|
||||
int limit = 30,
|
||||
|
||||
@@ -19,19 +19,20 @@ import 'package:PiliPlus/utils/app_sign.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
abstract final class UserHttp {
|
||||
static Future<dynamic> userStat({required int mid}) async {
|
||||
final res = await Request().get(
|
||||
Api.userStat,
|
||||
queryParameters: {'vmid': mid},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false};
|
||||
}
|
||||
}
|
||||
// static Future<dynamic> userStat({required int mid}) async {
|
||||
// final res = await Request().get(
|
||||
// Api.userStat,
|
||||
// queryParameters: {'vmid': mid},
|
||||
// );
|
||||
// if (res.data['code'] == 0) {
|
||||
// return {'status': true, 'data': res.data['data']};
|
||||
// } else {
|
||||
// return {'status': false};
|
||||
// }
|
||||
// }
|
||||
|
||||
static Future<LoadingState<UserInfoData>> userInfo() async {
|
||||
final res = await Request().get(Api.userInfo);
|
||||
@@ -164,7 +165,7 @@ abstract final class UserHttp {
|
||||
}
|
||||
|
||||
// 稍后再看
|
||||
static Future toViewLater({
|
||||
static Future<LoadingState<Null>> toViewLater({
|
||||
String? bvid,
|
||||
Object? aid,
|
||||
}) async {
|
||||
@@ -179,14 +180,16 @@ abstract final class UserHttp {
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!稍后再看'};
|
||||
SmartDialog.showToast('yeah!稍后再看');
|
||||
return const Success(null);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
SmartDialog.showToast(res.data['message'].toString());
|
||||
return const Error(null);
|
||||
}
|
||||
}
|
||||
|
||||
// 移除已观看
|
||||
static Future toViewDel({required String aids}) async {
|
||||
static Future<LoadingState<Null>> toViewDel({required String aids}) async {
|
||||
final Map<String, dynamic> params = {
|
||||
'csrf': Accounts.main.csrf,
|
||||
'resources': aids,
|
||||
@@ -197,9 +200,11 @@ abstract final class UserHttp {
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||
SmartDialog.showToast('yeah!成功移除');
|
||||
return const Success(null);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
SmartDialog.showToast(res.data['message'].toString());
|
||||
return const Error(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +269,7 @@ abstract final class UserHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future hasFollow(int mid) async {
|
||||
static Future<LoadingState<Map>> hasFollow(int mid) async {
|
||||
final res = await Request().get(
|
||||
Api.relation,
|
||||
queryParameters: {
|
||||
@@ -272,9 +277,9 @@ abstract final class UserHttp {
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'package:PiliPlus/http/api.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
abstract final class ValidateHttp {
|
||||
static Future gaiaVgateRegister(String vVoucher) async {
|
||||
static Future<LoadingState<Map?>> gaiaVgateRegister(String vVoucher) async {
|
||||
final res = await Request().post(
|
||||
Api.gaiaVgateRegister,
|
||||
queryParameters: {
|
||||
@@ -18,13 +19,13 @@ abstract final class ValidateHttp {
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future gaiaVgateValidate({
|
||||
static Future<LoadingState<Map?>> gaiaVgateValidate({
|
||||
required dynamic challenge,
|
||||
required dynamic seccode,
|
||||
required dynamic token,
|
||||
@@ -43,9 +44,9 @@ abstract final class ValidateHttp {
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ abstract final class VideoHttp {
|
||||
static bool enableFilter = zoneRegExp.pattern.isNotEmpty;
|
||||
|
||||
// 首页推荐视频
|
||||
static Future<LoadingState> rcmdVideoList({
|
||||
static Future<LoadingState<List<RecVideoItemModel>>> rcmdVideoList({
|
||||
required int ps,
|
||||
required int freshIdx,
|
||||
}) async {
|
||||
@@ -78,7 +78,9 @@ abstract final class VideoHttp {
|
||||
}
|
||||
|
||||
// 添加额外的loginState变量模拟未登录状态
|
||||
static Future<LoadingState> rcmdVideoListApp({required int freshIdx}) async {
|
||||
static Future<LoadingState<List<RecVideoItemAppModel>>> rcmdVideoListApp({
|
||||
required int freshIdx,
|
||||
}) async {
|
||||
final params = {
|
||||
'build': 2001100,
|
||||
'c_locale': 'zh_CN',
|
||||
@@ -532,7 +534,7 @@ abstract final class VideoHttp {
|
||||
// parent num 父评论rpid 非必要 二级评论同根评论id 大于二级评论为要回复的评论id
|
||||
// message str 发送评论内容 必要 最大1000字符
|
||||
// plat num 发送平台标识 非必要 1:web端 2:安卓客户端 3:ios客户端 4:wp客户端
|
||||
static Future replyAdd({
|
||||
static Future<LoadingState<Map>> replyAdd({
|
||||
required int type,
|
||||
required int oid,
|
||||
required String message,
|
||||
@@ -542,9 +544,6 @@ abstract final class VideoHttp {
|
||||
bool syncToDynamic = false,
|
||||
Map<String, int>? atNameToMid,
|
||||
}) async {
|
||||
if (message == '') {
|
||||
return {'status': false, 'msg': '请输入评论内容'};
|
||||
}
|
||||
final data = {
|
||||
'type': type,
|
||||
'oid': oid,
|
||||
@@ -563,9 +562,9 @@ abstract final class VideoHttp {
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return Success(res.data['data']);
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,7 +922,7 @@ abstract final class VideoHttp {
|
||||
}
|
||||
|
||||
// pgc 排行
|
||||
static Future<LoadingState> pgcRankList({
|
||||
static Future<LoadingState<List<PgcRankItemModel>?>> pgcRankList({
|
||||
int day = 3,
|
||||
required int seasonType,
|
||||
}) async {
|
||||
@@ -946,7 +945,7 @@ abstract final class VideoHttp {
|
||||
}
|
||||
|
||||
// pgc season 排行
|
||||
static Future<LoadingState> pgcSeasonRankList({
|
||||
static Future<LoadingState<List<PgcRankItemModel>?>> pgcSeasonRankList({
|
||||
int day = 3,
|
||||
required int seasonType,
|
||||
}) async {
|
||||
|
||||
@@ -65,6 +65,24 @@ class _AboutPageState extends State<AboutPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showDialog() => showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
constraints: StyleString.dialogFixedConstraints,
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
onSubmitted: (value) {
|
||||
Get.back();
|
||||
if (value.isNotEmpty) {
|
||||
PageUtils.handleWebview(value, inApp: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
@@ -88,25 +106,10 @@ class _AboutPageState extends State<AboutPage> {
|
||||
_pressCount++;
|
||||
if (_pressCount == 5) {
|
||||
_pressCount = 0;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
constraints: StyleString.dialogFixedConstraints,
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
onSubmitted: (value) {
|
||||
Get.back();
|
||||
if (value.isNotEmpty) {
|
||||
PageUtils.handleWebview(value, inApp: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
_showDialog();
|
||||
}
|
||||
},
|
||||
onSecondaryTap: PlatformUtils.isDesktop ? _showDialog : null,
|
||||
child: ExcludeSemantics(
|
||||
child: Image.asset(
|
||||
width: 150,
|
||||
|
||||
@@ -152,8 +152,7 @@ abstract class CommonIntroController extends GetxController
|
||||
final res = await (hasLater.value
|
||||
? UserHttp.toViewDel(aids: IdUtils.bv2av(bvid).toString())
|
||||
: UserHttp.toViewLater(bvid: bvid));
|
||||
if (res['status']) hasLater.value = !hasLater.value;
|
||||
SmartDialog.showToast(res['msg']);
|
||||
if (res.isSuccess) hasLater.value = !hasLater.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -303,14 +303,9 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
if (bvid != null)
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
onTap: () {
|
||||
Get.back();
|
||||
try {
|
||||
final res = await UserHttp.toViewLater(bvid: bvid);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
} catch (err) {
|
||||
SmartDialog.showToast('出错了:${err.toString()}');
|
||||
}
|
||||
UserHttp.toViewLater(bvid: bvid);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
||||
|
||||
@@ -154,11 +154,11 @@ class _CreateFavPageState extends State<CreateFavPage> {
|
||||
dir: 'cover',
|
||||
).then((res) {
|
||||
if (context.mounted) {
|
||||
if (res['status']) {
|
||||
_cover = res['data']['location'];
|
||||
if (res case Success(:final response)) {
|
||||
_cover = response['location'];
|
||||
(context as Element).markNeedsBuild();
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
if (PlatformUtils.isMobile) {
|
||||
|
||||
@@ -218,12 +218,8 @@ class HistoryItem extends StatelessWidget {
|
||||
business != 'live' &&
|
||||
business?.contains('article') != true)
|
||||
PopupMenuItem(
|
||||
onTap: () async {
|
||||
final res = await UserHttp.toViewLater(
|
||||
bvid: item.history.bvid,
|
||||
);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
onTap: () =>
|
||||
UserHttp.toViewLater(bvid: item.history.bvid),
|
||||
height: 38,
|
||||
child: const Row(
|
||||
children: [
|
||||
|
||||
@@ -36,12 +36,11 @@ mixin BaseLaterController
|
||||
final res = await UserHttp.toViewDel(
|
||||
aids: removeList.map((item) => item.aid).join(','),
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
updateCount?.call(removeList.length);
|
||||
afterDelete(removeList);
|
||||
}
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -70,13 +69,12 @@ mixin BaseLaterController
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
final res = await UserHttp.toViewDel(aids: aid.toString());
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
loadingState
|
||||
..value.data!.removeAt(index)
|
||||
..refresh();
|
||||
updateCount?.call(1);
|
||||
}
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
child: const Text('确认移除'),
|
||||
),
|
||||
|
||||
@@ -331,15 +331,11 @@ class LiveRoomController extends GetxController {
|
||||
|
||||
@pragma('vm:notify-debugger-on-exception')
|
||||
Future<void> prefetch() async {
|
||||
final res = await LiveHttp.liveRoomDanmaPrefetch(roomId: roomId);
|
||||
if (res['status']) {
|
||||
if (res['data'] case List list) {
|
||||
try {
|
||||
messages.addAll(
|
||||
list.cast<Map<String, dynamic>>().map(DanmakuMsg.fromPrefetch),
|
||||
);
|
||||
scrollToBottom();
|
||||
} catch (_) {}
|
||||
final res = await LiveHttp.liveRoomDmPrefetch(roomId: roomId);
|
||||
if (res case Success(:final response)) {
|
||||
if (response != null && response.isNotEmpty) {
|
||||
messages.addAll(response);
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,13 +776,13 @@ void _showQualityDialog({
|
||||
});
|
||||
}
|
||||
|
||||
const _minUiScale = 0.5;
|
||||
const _maxUiScale = 2.0;
|
||||
|
||||
void _showUiScaleDialog(
|
||||
BuildContext context,
|
||||
VoidCallback setState,
|
||||
) {
|
||||
const minUiScale = 0.5;
|
||||
const maxUiScale = 2.0;
|
||||
|
||||
double uiScale = Pref.uiScale;
|
||||
final textController = TextEditingController(
|
||||
text: uiScale.toStringAsFixed(2),
|
||||
@@ -804,10 +804,10 @@ void _showUiScaleDialog(
|
||||
Slider(
|
||||
padding: .zero,
|
||||
value: uiScale,
|
||||
min: _minUiScale,
|
||||
max: _maxUiScale,
|
||||
min: minUiScale,
|
||||
max: maxUiScale,
|
||||
secondaryTrackValue: 1.0,
|
||||
divisions: ((_maxUiScale - _minUiScale) * 20).toInt(),
|
||||
divisions: ((maxUiScale - minUiScale) * 20).toInt(),
|
||||
label: textController.text,
|
||||
onChanged: (value) => setDialogState(() {
|
||||
uiScale = value.toPrecision(2);
|
||||
@@ -831,8 +831,8 @@ void _showUiScaleDialog(
|
||||
onChanged: (value) {
|
||||
final parsed = double.tryParse(value);
|
||||
if (parsed != null &&
|
||||
parsed >= _minUiScale &&
|
||||
parsed <= _maxUiScale) {
|
||||
parsed >= minUiScale &&
|
||||
parsed <= maxUiScale) {
|
||||
setDialogState(() {
|
||||
uiScale = parsed;
|
||||
});
|
||||
|
||||
@@ -435,10 +435,9 @@ class VideoDetailController extends GetxController
|
||||
final res = await UserHttp.toViewDel(
|
||||
aids: item.aid.toString(),
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
mediaList.removeAt(index);
|
||||
}
|
||||
SmartDialog.showToast(res['msg']);
|
||||
} else {
|
||||
final res = await FavHttp.favVideo(
|
||||
resources: '${item.aid}:${item.type}',
|
||||
|
||||
@@ -480,10 +480,9 @@ class PgcIntroController extends CommonIntroController {
|
||||
// });
|
||||
|
||||
final res = await PgcHttp.seasonStatus(seasonId!);
|
||||
if (res['status']) {
|
||||
final Map<String, dynamic> data = res['data'];
|
||||
isFollowed.value = data['follow'] == 1;
|
||||
followStatus.value = data['follow_status'];
|
||||
if (res case Success(:final response)) {
|
||||
isFollowed.value = response['follow'] == 1;
|
||||
followStatus.value = response['follow_status'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -408,11 +408,10 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
if (videoDetail.owner == null || videoDetail.staff?.isNotEmpty == true) {
|
||||
return;
|
||||
}
|
||||
final result = await UserHttp.hasFollow(videoDetail.owner!.mid!);
|
||||
if (result['status']) {
|
||||
Map data = result['data'];
|
||||
if (data['special'] == 1) data['attribute'] = -10;
|
||||
followStatus.value = data;
|
||||
final res = await UserHttp.hasFollow(videoDetail.owner!.mid!);
|
||||
if (res case Success(:final response)) {
|
||||
if (response['special'] == 1) response['attribute'] = -10;
|
||||
followStatus.value = response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ class HorizontalMemberPageController
|
||||
|
||||
Future<void> getMemberStat() async {
|
||||
final res = await MemberHttp.memberStat(mid: mid);
|
||||
if (res['status']) {
|
||||
userStat.addAll(res['data']);
|
||||
if (res case Success(:final response)) {
|
||||
userStat.addAll(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ class HorizontalMemberPageController
|
||||
return;
|
||||
}
|
||||
final res = await MemberHttp.memberView(mid: mid);
|
||||
if (res['status']) {
|
||||
userStat.addAll(res['data']);
|
||||
if (res case Success(:final response)) {
|
||||
userStat.addAll(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/common/widgets/flutter/text_field/text_field.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
show ReplyInfo;
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/main.dart';
|
||||
import 'package:PiliPlus/models/common/publish_panel_type.dart';
|
||||
@@ -416,7 +417,7 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
|
||||
}
|
||||
}
|
||||
String message = editController.rawText;
|
||||
final result = await VideoHttp.replyAdd(
|
||||
final res = await VideoHttp.replyAdd(
|
||||
type: widget.replyType,
|
||||
oid: widget.oid,
|
||||
root: widget.root,
|
||||
@@ -428,12 +429,12 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
|
||||
pictures: pictures,
|
||||
syncToDynamic: _syncToDynamic.value,
|
||||
);
|
||||
if (result['status']) {
|
||||
if (res case Success(:final response)) {
|
||||
hasPub = true;
|
||||
SmartDialog.showToast(result['data']['success_toast']);
|
||||
Get.back(result: result['data']['reply']);
|
||||
SmartDialog.showToast(response['success_toast']);
|
||||
Get.back(result: response['reply']);
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class ChatItem extends StatelessWidget {
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
width: 220,
|
||||
height: 220 * 9 / 16,
|
||||
height: 123.75,
|
||||
src: content['cover'],
|
||||
),
|
||||
),
|
||||
@@ -259,7 +259,7 @@ class ChatItem extends StatelessWidget {
|
||||
for (final i in content['image_urls'])
|
||||
NetworkImgLayer(
|
||||
width: 130,
|
||||
height: 130 * 9 / 16,
|
||||
height: 73.125,
|
||||
src: i,
|
||||
),
|
||||
],
|
||||
@@ -348,7 +348,7 @@ class ChatItem extends StatelessWidget {
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 130,
|
||||
height: 130 * 9 / 16,
|
||||
height: 73.125,
|
||||
src: i['cover_url'],
|
||||
),
|
||||
Expanded(
|
||||
@@ -544,7 +544,7 @@ class ChatItem extends StatelessWidget {
|
||||
onTap: onTap,
|
||||
child: NetworkImgLayer(
|
||||
width: 220,
|
||||
height: 220 * 9 / 16,
|
||||
height: 123.75,
|
||||
src: content['thumb'],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -121,11 +121,11 @@ abstract final class RequestUtils {
|
||||
}
|
||||
} else {
|
||||
if (followStatus?['tag'] == null) {
|
||||
Map<String, dynamic> result = await UserHttp.hasFollow(mid);
|
||||
if (result['status']) {
|
||||
followStatus = result['data'];
|
||||
final res = await UserHttp.hasFollow(mid);
|
||||
if (res case Success(:final response)) {
|
||||
followStatus = response;
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
res.toast();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -494,12 +494,12 @@ abstract final class RequestUtils {
|
||||
}
|
||||
|
||||
final res = await ValidateHttp.gaiaVgateRegister(vVoucher);
|
||||
if (!res['status']) {
|
||||
SmartDialog.showToast("${res['msg']}");
|
||||
if (!res.isSuccess) {
|
||||
res.toast();
|
||||
return;
|
||||
}
|
||||
|
||||
final resData = res['data'];
|
||||
final resData = res.data;
|
||||
if (resData == null) {
|
||||
SmartDialog.showToast("null data");
|
||||
return;
|
||||
@@ -507,10 +507,10 @@ abstract final class RequestUtils {
|
||||
|
||||
CaptchaDataModel captchaData = CaptchaDataModel();
|
||||
|
||||
final geetest = resData?['geetest'];
|
||||
final geetest = resData['geetest'];
|
||||
String? gt = geetest?['gt'];
|
||||
String? challenge = geetest?['challenge'];
|
||||
captchaData.token = resData?['token'];
|
||||
captchaData.token = resData['token'];
|
||||
|
||||
bool isGeeArgumentValid() {
|
||||
return gt?.isNotEmpty == true &&
|
||||
@@ -530,9 +530,9 @@ abstract final class RequestUtils {
|
||||
token: captchaData.token,
|
||||
validate: captchaData.validate,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res['data']?['is_valid'] == 1) {
|
||||
final griskId = res['data']?['grisk_id'];
|
||||
if (res case Success(:final response)) {
|
||||
if (response?['is_valid'] == 1) {
|
||||
final griskId = response?['grisk_id'];
|
||||
if (griskId != null) {
|
||||
onSuccess(griskId);
|
||||
}
|
||||
@@ -540,7 +540,7 @@ abstract final class RequestUtils {
|
||||
SmartDialog.showToast('invalid');
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user