diff --git a/lib/pages/about/view.dart b/lib/pages/about/view.dart index 9f72987f8..221169d56 100644 --- a/lib/pages/about/view.dart +++ b/lib/pages/about/view.dart @@ -43,12 +43,12 @@ class _AboutPageState extends State { getCurrentApp(); } - Future getCacheSize() async { + Future getCacheSize() async { cacheSize.value = CacheManage.formatSize(await CacheManage().loadApplicationCache()); } - Future getCurrentApp() async { + Future getCurrentApp() async { var currentInfo = await PackageInfo.fromPlatform(); String buildNumber = currentInfo.buildNumber; currentVersion.value = "${currentInfo.version}+$buildNumber"; diff --git a/lib/pages/article/controller.dart b/lib/pages/article/controller.dart index 01e41d618..357e63274 100644 --- a/lib/pages/article/controller.dart +++ b/lib/pages/article/controller.dart @@ -149,7 +149,7 @@ class ArticleController extends ReplyController { } // 请求动态内容 - Future _queryContent() async { + Future _queryContent() async { if (type != 'read') { isLoaded.value = await queryOpus(id); } else { @@ -182,7 +182,7 @@ class ArticleController extends ReplyController { ); } - Future onFav() async { + Future onFav() async { bool isFav = stats.value?.favorite?.status == true; final res = type == 'read' ? isFav @@ -204,7 +204,7 @@ class ArticleController extends ReplyController { } } - Future onLike() async { + Future onLike() async { bool isLike = stats.value?.like?.status == true; final res = await DynamicsHttp.thumbDynamic( dynamicId: opusData?.idStr ?? articleData?.dynIdStr, diff --git a/lib/pages/bangumi/controller.dart b/lib/pages/bangumi/controller.dart index 6b24d027f..5d8e47c8d 100644 --- a/lib/pages/bangumi/controller.dart +++ b/lib/pages/bangumi/controller.dart @@ -36,7 +36,7 @@ class BangumiController extends CommonListController< } @override - Future onRefresh() { + Future onRefresh() { if (isLogin.value) { followPage = 1; followEnd = false; @@ -61,13 +61,13 @@ class BangumiController extends CommonListController< late Rx?>> timelineState = LoadingState?>.loading().obs; - Future queryPgcTimeline() async { + Future queryPgcTimeline() async { final res = await BangumiHttp.pgcTimeline(types: 1, before: 6, after: 6); timelineState.value = res; } // 我的订阅 - Future queryBangumiFollow([bool isRefresh = true]) async { + Future queryBangumiFollow([bool isRefresh = true]) async { if (isLogin.value.not || followLoading || (isRefresh.not && followEnd)) { return; } diff --git a/lib/pages/common/common_controller.dart b/lib/pages/common/common_controller.dart index 1e138d4a1..74f9ba350 100644 --- a/lib/pages/common/common_controller.dart +++ b/lib/pages/common/common_controller.dart @@ -54,7 +54,7 @@ abstract class CommonController extends GetxController void checkIsEnd(int length) {} - Future queryData([bool isRefresh = true]) async { + Future queryData([bool isRefresh = true]) async { if (isLoading || (isRefresh.not && isEnd)) return; isLoading = true; LoadingState response = await customGetData(); diff --git a/lib/pages/common/common_publish_page.dart b/lib/pages/common/common_publish_page.dart index 8fd8597bf..66e3cae1c 100644 --- a/lib/pages/common/common_publish_page.dart +++ b/lib/pages/common/common_publish_page.dart @@ -159,7 +159,7 @@ abstract class CommonPublishPageState return false; } - Future onPublish() async { + Future onPublish() async { feedBack(); List>? pictures; if (pathList.isNotEmpty) { @@ -194,7 +194,7 @@ abstract class CommonPublishPageState onCustomPublish(message: editController.text, pictures: pictures); } - Future onCustomPublish({required String message, List? pictures}); + Future onCustomPublish({required String message, List? pictures}); void onChooseEmote(emote) { enablePublish.value = true; diff --git a/lib/pages/common/common_search_controller.dart b/lib/pages/common/common_search_controller.dart index d5fdd0beb..e835142ec 100644 --- a/lib/pages/common/common_search_controller.dart +++ b/lib/pages/common/common_search_controller.dart @@ -15,7 +15,7 @@ abstract class CommonSearchController extends CommonListController { } @override - Future onRefresh() { + Future onRefresh() { if (editController.value.text.isEmpty) { return Future.value(); } diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index f31420c31..25e8d7348 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -91,7 +91,7 @@ abstract class ReplyController extends CommonListController { } @override - Future onRefresh() { + Future onRefresh() { cursorNext = null; paginationReply = null; return super.onRefresh(); diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index c8ee6a4ec..a91ca6d5f 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -73,7 +73,7 @@ class DynamicsController extends GetxController initialValue.value = value; } - Future queryFollowing2() async { + Future queryFollowing2() async { if (upData.value.upList != null && upData.value.upList!.length >= allFollowedUpsTotal) { return; @@ -108,7 +108,7 @@ class DynamicsController extends GetxController } late bool isQuerying = false; - Future queryFollowUp({type = 'init'}) async { + Future queryFollowUp({type = 'init'}) async { if (isQuerying) return; isQuerying = true; if (!isLogin.value) { diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 4ae2e35da..406688982 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -31,7 +31,7 @@ class _ActionPanelState extends State { } // 动态点赞 - Future onLikeDynamic() async { + Future onLikeDynamic() async { feedBack(); final item = widget.item; String dynamicId = item.idStr!; diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index 0736d56ab..bab9a8681 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -459,7 +459,8 @@ class _CreateDynPanelState extends CommonPublishPageState { Widget? get customPanel => EmotePanel(onChoose: onChooseEmote); @override - Future onCustomPublish({required String message, List? pictures}) async { + Future onCustomPublish( + {required String message, List? pictures}) async { SmartDialog.showLoading(msg: '正在发布'); dynamic result = await MsgHttp.createDynamic( mid: Accounts.main.mid, diff --git a/lib/pages/dynamics_repost/view.dart b/lib/pages/dynamics_repost/view.dart index 6a90ebc50..b56c93849 100644 --- a/lib/pages/dynamics_repost/view.dart +++ b/lib/pages/dynamics_repost/view.dart @@ -342,7 +342,8 @@ class _RepostPanelState extends CommonPublishPageState { Widget? get customPanel => EmotePanel(onChoose: onChooseEmote); @override - Future onCustomPublish({required String message, List? pictures}) async { + Future onCustomPublish( + {required String message, List? pictures}) async { dynamic result = await MsgHttp.createDynamic( mid: Accounts.main.mid, dynIdStr: widget.item?.idStr ?? widget.dynIdStr, diff --git a/lib/pages/dynamics_tab/controller.dart b/lib/pages/dynamics_tab/controller.dart index 813ff0afe..d8f415815 100644 --- a/lib/pages/dynamics_tab/controller.dart +++ b/lib/pages/dynamics_tab/controller.dart @@ -25,7 +25,7 @@ class DynamicsTabController } @override - Future onRefresh() { + Future onRefresh() { if (dynamicsType == 'all') { mainController.setCount(); } @@ -54,7 +54,7 @@ class DynamicsTabController mid: dynamicsType == "up" ? mid : -1, ); - Future onRemove(dynamic dynamicId) async { + Future onRemove(dynamic dynamicId) async { var res = await MsgHttp.removeDynamic(dynIdStr: dynamicId); if (res['status']) { loadingState.value.data!.removeWhere((item) => item.idStr == dynamicId); @@ -65,7 +65,7 @@ class DynamicsTabController } } - Future onSetTop(bool isTop, dynamic dynamicId) async { + Future onSetTop(bool isTop, dynamic dynamicId) async { var res = await DynamicsHttp.setTop(dynamicId: dynamicId); if (res['status']) { SmartDialog.showToast('${isTop ? '取消' : ''}置顶成功'); @@ -75,7 +75,7 @@ class DynamicsTabController } @override - Future onReload() { + Future onReload() { scrollController.jumpToTop(); return super.onReload(); } diff --git a/lib/pages/fan/controller.dart b/lib/pages/fan/controller.dart index e0c11f012..3de6664a8 100644 --- a/lib/pages/fan/controller.dart +++ b/lib/pages/fan/controller.dart @@ -31,7 +31,7 @@ class FansController orderType: 'attention', ); - Future onRemoveFan(int index, int mid) async { + Future onRemoveFan(int index, int mid) async { final res = await VideoHttp.relationMod( mid: mid, act: 7, diff --git a/lib/pages/fav/pgc/controller.dart b/lib/pages/fav/pgc/controller.dart index 24cd8a418..5e09b7a54 100644 --- a/lib/pages/fav/pgc/controller.dart +++ b/lib/pages/fav/pgc/controller.dart @@ -54,7 +54,7 @@ class FavPgcController } // 取消追番 - Future bangumiDel(index, seasonId) async { + Future bangumiDel(index, seasonId) async { var result = await VideoHttp.bangumiDel(seasonId: seasonId); if (result['status']) { loadingState.value.data!.removeAt(index); @@ -63,7 +63,7 @@ class FavPgcController SmartDialog.showToast(result['msg']); } - Future onUpdateList(followStatus) async { + Future onUpdateList(followStatus) async { List dataList = (loadingState.value as Success).response as List; Set updateList = @@ -92,7 +92,7 @@ class FavPgcController SmartDialog.showToast(res['msg']); } - Future onUpdate(index, followStatus, seasonId) async { + Future onUpdate(index, followStatus, seasonId) async { var result = await VideoHttp.bangumiUpdate( seasonId: [seasonId], status: followStatus, diff --git a/lib/pages/fav/video/controller.dart b/lib/pages/fav/video/controller.dart index afc670781..10fea8bcf 100644 --- a/lib/pages/fav/video/controller.dart +++ b/lib/pages/fav/video/controller.dart @@ -15,7 +15,7 @@ class FavController } @override - Future queryData([bool isRefresh = true]) { + Future queryData([bool isRefresh = true]) { if (mid == 0) { loadingState.value = LoadingState.error('账号未登录'); return Future.value(); diff --git a/lib/pages/fav_detail/controller.dart b/lib/pages/fav_detail/controller.dart index 99f82fafc..4da58cfc7 100644 --- a/lib/pages/fav_detail/controller.dart +++ b/lib/pages/fav_detail/controller.dart @@ -173,7 +173,7 @@ class FavDetailController } @override - Future onReload() { + Future onReload() { scrollController.jumpToTop(); return super.onReload(); } diff --git a/lib/pages/follow/controller.dart b/lib/pages/follow/controller.dart index 0b2491797..979049a6a 100644 --- a/lib/pages/follow/controller.dart +++ b/lib/pages/follow/controller.dart @@ -30,7 +30,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } } - Future queryFollowUpTags() async { + Future queryFollowUpTags() async { var res = await MemberHttp.followUpTags(); if (res['status']) { tabs @@ -59,7 +59,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { super.onClose(); } - Future onCreateTag(String tagName) async { + Future onCreateTag(String tagName) async { final res = await MemberHttp.createFollowTag(tagName); if (res['status']) { followState.value = LoadingState.loading(); @@ -70,7 +70,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } } - Future onUpdateTag(int index, tagid, String tagName) async { + Future onUpdateTag(int index, tagid, String tagName) async { final res = await MemberHttp.updateFollowTag(tagid, tagName); if (res['status']) { tabs[index].name = tagName; @@ -81,7 +81,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin { } } - Future onDelTag(tagid) async { + Future onDelTag(tagid) async { final res = await MemberHttp.delFollowTag(tagid); if (res['status']) { followState.value = LoadingState.loading(); diff --git a/lib/pages/history/controller.dart b/lib/pages/history/controller.dart index d7440ae5f..f288c2d10 100644 --- a/lib/pages/history/controller.dart +++ b/lib/pages/history/controller.dart @@ -30,7 +30,7 @@ class HistoryController extends MultiSelectController } @override - Future onRefresh() { + Future onRefresh() { max = null; viewAt = null; return super.onRefresh(); @@ -91,7 +91,7 @@ class HistoryController extends MultiSelectController } // 观看历史暂停状态 - Future historyStatus() async { + Future historyStatus() async { var res = await UserHttp.historyStatus(); if (res['status']) { baseCtr.pauseStatus.value = res['data']; @@ -194,7 +194,7 @@ class HistoryController extends MultiSelectController } @override - Future onReload() { + Future onReload() { scrollController.jumpToTop(); return super.onReload(); } diff --git a/lib/pages/history_search/controller.dart b/lib/pages/history_search/controller.dart index 8af46451d..7584f77df 100644 --- a/lib/pages/history_search/controller.dart +++ b/lib/pages/history_search/controller.dart @@ -17,7 +17,7 @@ class HistorySearchController return response.list; } - Future onDelHistory(index, kid, business) async { + Future onDelHistory(index, kid, business) async { String resKid = 'archive_$kid'; if (business == 'live') { resKid = 'live_$kid'; diff --git a/lib/pages/later/controller.dart b/lib/pages/later/controller.dart index 1f15e6cb3..b517bbeca 100644 --- a/lib/pages/later/controller.dart +++ b/lib/pages/later/controller.dart @@ -233,7 +233,7 @@ class LaterController extends MultiSelectController { } @override - Future onReload() { + Future onReload() { scrollController.jumpToTop(); return super.onReload(); } diff --git a/lib/pages/later_search/controller.dart b/lib/pages/later_search/controller.dart index 0b8f8acd6..4dd6b44a0 100644 --- a/lib/pages/later_search/controller.dart +++ b/lib/pages/later_search/controller.dart @@ -22,7 +22,7 @@ class LaterSearchController return response['list']; } - Future toViewDel(BuildContext context, int index, aid) async { + Future toViewDel(BuildContext context, int index, aid) async { var res = await UserHttp.toViewDel(aids: [aid]); if (res['status']) { loadingState.value.data!.removeAt(index); diff --git a/lib/pages/live_room/controller.dart b/lib/pages/live_room/controller.dart index 4c650c86d..158fd1cd1 100644 --- a/lib/pages/live_room/controller.dart +++ b/lib/pages/live_room/controller.dart @@ -77,7 +77,7 @@ class LiveRoomController extends GetxController { final RxBool isPortrait = false.obs; - Future queryLiveInfo() async { + Future queryLiveInfo() async { if (currentQn == null) { await Connectivity().checkConnectivity().then((res) { currentQn = res.contains(ConnectivityResult.wifi) @@ -122,7 +122,7 @@ class LiveRoomController extends GetxController { } } - Future queryLiveInfoH5() async { + Future queryLiveInfoH5() async { var res = await LiveHttp.liveRoomInfoH5(roomId: roomId); if (res['status']) { roomInfoH5.value = res['data']; diff --git a/lib/pages/live_room/send_danmaku/view.dart b/lib/pages/live_room/send_danmaku/view.dart index 2b40bbdf9..c28af9fc4 100644 --- a/lib/pages/live_room/send_danmaku/view.dart +++ b/lib/pages/live_room/send_danmaku/view.dart @@ -188,7 +188,7 @@ class _ReplyPageState extends CommonPublishPageState { } @override - Future onCustomPublish({ + Future onCustomPublish({ required String message, List? pictures, int? dmType, diff --git a/lib/pages/login/controller.dart b/lib/pages/login/controller.dart index bbe20ac21..81db86bae 100644 --- a/lib/pages/login/controller.dart +++ b/lib/pages/login/controller.dart @@ -656,7 +656,7 @@ class LoginPageController extends GetxController } } - static Future switchAccountDialog(BuildContext context) { + static Future switchAccountDialog(BuildContext context) { if (Accounts.account.isEmpty) { return SmartDialog.showToast('请先登录'); } diff --git a/lib/pages/main/controller.dart b/lib/pages/main/controller.dart index b3beb66fe..81c05a027 100644 --- a/lib/pages/main/controller.dart +++ b/lib/pages/main/controller.dart @@ -78,7 +78,7 @@ class MainController extends GetxController { } } - Future queryUnreadMsg() async { + Future queryUnreadMsg() async { if (isLogin.value.not || homeIndex == -1 || msgUnReadTypes.isEmpty) { msgUnReadCount.value = ''; return; diff --git a/lib/pages/member/controller.dart b/lib/pages/member/controller.dart index b3fd8a279..d3ca9e7d4 100644 --- a/lib/pages/member/controller.dart +++ b/lib/pages/member/controller.dart @@ -225,7 +225,7 @@ class MemberController extends CommonDataController super.onClose(); } - Future onRemoveFan() async { + Future onRemoveFan() async { final res = await VideoHttp.relationMod( mid: mid, act: 7, diff --git a/lib/pages/member_dynamics/controller.dart b/lib/pages/member_dynamics/controller.dart index a408dc3ab..995f359a3 100644 --- a/lib/pages/member_dynamics/controller.dart +++ b/lib/pages/member_dynamics/controller.dart @@ -20,13 +20,13 @@ class MemberDynamicsController } @override - Future onRefresh() { + Future onRefresh() { offset = ''; return super.onRefresh(); } @override - Future queryData([bool isRefresh = true]) { + Future queryData([bool isRefresh = true]) { if (isRefresh.not && (isEnd || offset == '-1')) { return Future.value(); } @@ -56,7 +56,7 @@ class MemberDynamicsController mid: mid, ); - Future onRemove(dynamicId) async { + Future onRemove(dynamicId) async { var res = await MsgHttp.removeDynamic(dynIdStr: dynamicId); if (res['status']) { loadingState.value.data!.removeWhere((item) => item.idStr == dynamicId); @@ -67,7 +67,7 @@ class MemberDynamicsController } } - Future onSetTop(bool isTop, dynamic dynamicId) async { + Future onSetTop(bool isTop, dynamic dynamicId) async { var res = await DynamicsHttp.setTop(dynamicId: dynamicId); if (res['status']) { List list = (loadingState.value as Success).response; diff --git a/lib/pages/member_favorite/controller.dart b/lib/pages/member_favorite/controller.dart index 214f14cfe..175e84163 100644 --- a/lib/pages/member_favorite/controller.dart +++ b/lib/pages/member_favorite/controller.dart @@ -32,7 +32,7 @@ class MemberFavoriteCtr extends CommonDataController { } @override - Future onRefresh() { + Future onRefresh() { page = 2; page1 = 2; return super.onRefresh(); @@ -56,7 +56,7 @@ class MemberFavoriteCtr extends CommonDataController { return true; } - Future userfavFolder() async { + Future userfavFolder() async { var res = await Request().get(Api.userFavFolder, queryParameters: { 'pn': page, 'ps': 20, @@ -80,7 +80,7 @@ class MemberFavoriteCtr extends CommonDataController { } } - Future userSubFolder() async { + Future userSubFolder() async { var res = await Request().get(Api.userSubFolder, queryParameters: { 'up_mid': mid, 'ps': 20, diff --git a/lib/pages/member_video/controller.dart b/lib/pages/member_video/controller.dart index fb8e69d2c..748b13589 100644 --- a/lib/pages/member_video/controller.dart +++ b/lib/pages/member_video/controller.dart @@ -44,7 +44,7 @@ class MemberVideoCtr bool? hasPrev; @override - Future onRefresh() async { + Future onRefresh() async { if (isLocating == true) { if (hasPrev == true) { isLoadPrevious = true; @@ -220,7 +220,7 @@ class MemberVideoCtr } @override - Future onReload() { + Future onReload() { isLocating = null; return super.onReload(); } diff --git a/lib/pages/mine/controller.dart b/lib/pages/mine/controller.dart index b87195c78..1bb1402ad 100644 --- a/lib/pages/mine/controller.dart +++ b/lib/pages/mine/controller.dart @@ -50,9 +50,9 @@ class MineController extends GetxController { } } - Future queryUserInfo() async { + Future queryUserInfo() async { if (!isLogin.value) { - return {'status': false}; + return; } var res = await UserHttp.userInfo(); if (res['status']) { @@ -74,7 +74,7 @@ class MineController extends GetxController { queryUserStatOwner(); } - Future queryUserStatOwner() async { + Future queryUserStatOwner() async { var res = await UserHttp.userStatOwner(); if (res['status']) { userStat.value = res['data']; diff --git a/lib/pages/msg_feed_top/at_me/controller.dart b/lib/pages/msg_feed_top/at_me/controller.dart index 2e574a315..9c605ad06 100644 --- a/lib/pages/msg_feed_top/at_me/controller.dart +++ b/lib/pages/msg_feed_top/at_me/controller.dart @@ -31,7 +31,7 @@ class AtMeController extends CommonListController { } @override - Future onRefresh() { + Future onRefresh() { cursor = -1; cursorTime = -1; return super.onRefresh(); @@ -41,7 +41,7 @@ class AtMeController extends CommonListController { Future> customGetData() => MsgHttp.msgFeedAtMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index) async { + Future onRemove(dynamic id, int index) async { try { var res = await MsgHttp.delMsgfeed(2, id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/like_me/controller.dart b/lib/pages/msg_feed_top/like_me/controller.dart index 8a19526f8..ed636b9a0 100644 --- a/lib/pages/msg_feed_top/like_me/controller.dart +++ b/lib/pages/msg_feed_top/like_me/controller.dart @@ -39,7 +39,7 @@ class LikeMeController extends CommonDataController { } @override - Future onRefresh() { + Future onRefresh() { cursor = -1; cursorTime = -1; return super.onRefresh(); @@ -49,7 +49,7 @@ class LikeMeController extends CommonDataController { Future> customGetData() => MsgHttp.msgFeedLikeMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index, bool isLatest) async { + Future onRemove(dynamic id, int index, bool isLatest) async { try { var res = await MsgHttp.delMsgfeed(0, id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/reply_me/controller.dart b/lib/pages/msg_feed_top/reply_me/controller.dart index c6f1d86d8..9f6226116 100644 --- a/lib/pages/msg_feed_top/reply_me/controller.dart +++ b/lib/pages/msg_feed_top/reply_me/controller.dart @@ -32,7 +32,7 @@ class ReplyMeController } @override - Future onRefresh() { + Future onRefresh() { cursor = -1; cursorTime = -1; return super.onRefresh(); @@ -42,7 +42,7 @@ class ReplyMeController Future> customGetData() => MsgHttp.msgFeedReplyMe(cursor: cursor, cursorTime: cursorTime); - Future onRemove(dynamic id, int index) async { + Future onRemove(dynamic id, int index) async { try { var res = await MsgHttp.delMsgfeed(1, id); if (res['status']) { diff --git a/lib/pages/msg_feed_top/sys_msg/controller.dart b/lib/pages/msg_feed_top/sys_msg/controller.dart index b19e60bf3..553724cce 100644 --- a/lib/pages/msg_feed_top/sys_msg/controller.dart +++ b/lib/pages/msg_feed_top/sys_msg/controller.dart @@ -34,12 +34,12 @@ class SysMsgController } @override - Future onRefresh() { + Future onRefresh() { cursor = -1; return super.onRefresh(); } - Future onRemove(dynamic id, int index) async { + Future onRemove(dynamic id, int index) async { try { var res = await MsgHttp.delSysMsg(id); if (res['status']) { diff --git a/lib/pages/pgc_index/controller.dart b/lib/pages/pgc_index/controller.dart index 597f3454f..861451876 100644 --- a/lib/pages/pgc_index/controller.dart +++ b/lib/pages/pgc_index/controller.dart @@ -19,7 +19,7 @@ class PgcIndexController extends CommonListController { getPgcIndexCondition(); } - Future getPgcIndexCondition() async { + Future getPgcIndexCondition() async { dynamic res = await BangumiHttp.pgcIndexCondition( seasonType: indexType == null ? 1 : null, type: 0, diff --git a/lib/pages/rcmd/controller.dart b/lib/pages/rcmd/controller.dart index 52021437d..4d5d1f402 100644 --- a/lib/pages/rcmd/controller.dart +++ b/lib/pages/rcmd/controller.dart @@ -44,7 +44,7 @@ class RcmdController extends CommonListController { } @override - Future onRefresh() { + Future onRefresh() { currentPage = 0; isEnd = false; return queryData(); diff --git a/lib/pages/search/controller.dart b/lib/pages/search/controller.dart index 14e8edcdc..32e38aaa7 100644 --- a/lib/pages/search/controller.dart +++ b/lib/pages/search/controller.dart @@ -129,11 +129,11 @@ class SSearchController extends GetxController { } // 获取热搜关键词 - Future queryHotSearchList() async { + Future queryHotSearchList() async { loadingState.value = await SearchHttp.searchTrending(limit: 10); } - Future queryRecommendList() async { + Future queryRecommendList() async { recommendData.value = await SearchHttp.searchRecommend(); } @@ -145,7 +145,7 @@ class SSearchController extends GetxController { submit(); } - Future querySearchSuggest(String value) async { + Future querySearchSuggest(String value) async { var result = await SearchHttp.searchSuggest(term: value); if (result['status']) { if (result['data'] is SearchSuggestModel) { diff --git a/lib/pages/search_panel/controller.dart b/lib/pages/search_panel/controller.dart index 78ec8fcca..092b36676 100644 --- a/lib/pages/search_panel/controller.dart +++ b/lib/pages/search_panel/controller.dart @@ -72,7 +72,7 @@ class SearchPanelController, T> ); @override - Future onReload() { + Future onReload() { scrollController.jumpToTop(); return super.onReload(); } diff --git a/lib/pages/subscription/controller.dart b/lib/pages/subscription/controller.dart index 62f49a030..811dc7d30 100644 --- a/lib/pages/subscription/controller.dart +++ b/lib/pages/subscription/controller.dart @@ -19,7 +19,7 @@ class SubController } @override - Future queryData([bool isRefresh = true]) { + Future queryData([bool isRefresh = true]) { if (mid == 0) { loadingState.value = LoadingState.error('账号未登录'); return Future.value(); diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index 1304303dc..43c48d8a5 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -664,7 +664,7 @@ class VideoDetailController extends GetxController ); } - Future _querySponsorBlock() async { + Future _querySponsorBlock() async { positionSubscription?.cancel(); videoLabel.value = ''; segmentList.clear(); @@ -1053,7 +1053,7 @@ class VideoDetailController extends GetxController playerInit(); } - Future playerInit({ + Future playerInit({ video, audio, seekToTime, @@ -1115,7 +1115,7 @@ class VideoDetailController extends GetxController bool isQuerying = false; // 视频链接 - Future queryVideoUrl([Duration? defaultST]) async { + Future queryVideoUrl([Duration? defaultST]) async { if (isQuerying) { return; } @@ -1427,7 +1427,7 @@ class VideoDetailController extends GetxController late bool continuePlayingPart = GStorage.continuePlayingPart; - Future _querySubtitles() async { + Future _querySubtitles() async { var res = await VideoHttp.subtitlesJson(bvid: bvid, cid: cid.value); if (res['status']) { // interactive video diff --git a/lib/pages/video/introduction/pgc/controller.dart b/lib/pages/video/introduction/pgc/controller.dart index 4a73a9f25..676a5fd12 100644 --- a/lib/pages/video/introduction/pgc/controller.dart +++ b/lib/pages/video/introduction/pgc/controller.dart @@ -95,12 +95,12 @@ class BangumiIntroController } @override - Future queryData([bool isRefresh = true]) async { + Future queryData([bool isRefresh = true]) async { await queryVideoTags(); return super.queryData(isRefresh); } - Future queryVideoTags() async { + Future queryVideoTags() async { var result = await UserHttp.videoTags(bvid: bvid); if (result['status']) { videoTags = result['data']; @@ -120,7 +120,7 @@ class BangumiIntroController SearchHttp.bangumiInfoNew(seasonId: seasonId, epId: epId); // 获取点赞/投币/收藏状态 - Future queryBangumiLikeCoinFav() async { + Future queryBangumiLikeCoinFav() async { var result = await VideoHttp.bangumiLikeCoinFav(epId: epId); if (result['status']) { hasLike.value = result["data"]['like'] == 1; @@ -132,7 +132,7 @@ class BangumiIntroController } // (取消)点赞 - Future actionLikeVideo() async { + Future actionLikeVideo() async { var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value); if (result['status']) { SmartDialog.showToast(!hasLike.value ? result['data']['toast'] : '取消赞'); @@ -167,7 +167,7 @@ class BangumiIntroController } // 投币 - Future actionCoinVideo() async { + Future actionCoinVideo() async { if (userInfo == null) { SmartDialog.showToast('账号未登录'); return; @@ -190,7 +190,7 @@ class BangumiIntroController } // (取消)收藏 bangumi - Future actionFavVideo({type = 'choose'}) async { + Future actionFavVideo({type = 'choose'}) async { // 收藏至默认文件夹 if (type == 'default') { SmartDialog.showLoading(msg: '请求中'); @@ -438,7 +438,7 @@ class BangumiIntroController } // 追番 - Future bangumiAdd() async { + Future bangumiAdd() async { var result = await VideoHttp.bangumiAdd( seasonId: (loadingState.value as Success).response.seasonId); if (result['status']) { @@ -449,7 +449,7 @@ class BangumiIntroController } // 取消追番 - Future bangumiDel() async { + Future bangumiDel() async { var result = await VideoHttp.bangumiDel( seasonId: (loadingState.value as Success).response.seasonId); if (result['status']) { @@ -458,7 +458,7 @@ class BangumiIntroController SmartDialog.showToast(result['msg']); } - Future bangumiUpdate(status) async { + Future bangumiUpdate(status) async { var result = await VideoHttp.bangumiUpdate( seasonId: [(loadingState.value as Success).response.seasonId], status: status, @@ -562,7 +562,7 @@ class BangumiIntroController } // 一键三连 - Future actionOneThree() async { + Future actionOneThree() async { feedBack(); if (userInfo == null) { SmartDialog.showToast('账号未登录'); @@ -590,7 +590,7 @@ class BangumiIntroController RxBool isFollowed = false.obs; RxInt followStatus = (-1).obs; - Future queryIsFollowed() async { + Future queryIsFollowed() async { try { dynamic result = await Request().get( 'https://www.bilibili.com/bangumi/play/ss$seasonId', diff --git a/lib/pages/video/introduction/ugc/controller.dart b/lib/pages/video/introduction/ugc/controller.dart index c7425e563..2b680cf6e 100644 --- a/lib/pages/video/introduction/ugc/controller.dart +++ b/lib/pages/video/introduction/ugc/controller.dart @@ -8,7 +8,6 @@ import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/http/search.dart'; import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/http/video.dart'; -import 'package:PiliPlus/models/model_hot_video_item.dart'; import 'package:PiliPlus/models/user/fav_folder.dart'; import 'package:PiliPlus/models/video/ai.dart'; import 'package:PiliPlus/models/video_detail_res.dart'; @@ -136,7 +135,7 @@ class VideoIntroController extends GetxController { } // 获取视频简介&分p - Future queryVideoIntro() async { + Future queryVideoIntro() async { queryVideoTags(); var result = await VideoHttp.videoIntro(bvid: bvid); if (result['status']) { @@ -187,7 +186,7 @@ class VideoIntroController extends GetxController { } } - Future queryVideoTags() async { + Future queryVideoTags() async { var result = await UserHttp.videoTags(bvid: bvid); if (result['status']) { videoTags = result['data']; @@ -195,7 +194,7 @@ class VideoIntroController extends GetxController { } // 获取up主粉丝数 - Future queryUserStat() async { + Future queryUserStat() async { if (videoItem['staff']?.isNotEmpty == true) { Request().get( Api.relations, @@ -236,7 +235,7 @@ class VideoIntroController extends GetxController { } // 一键三连 - Future actionOneThree() async { + Future actionOneThree() async { feedBack(); if (userInfo == null) { SmartDialog.showToast('账号未登录'); @@ -262,7 +261,7 @@ class VideoIntroController extends GetxController { } // (取消)点赞 - Future actionLikeVideo() async { + Future actionLikeVideo() async { if (userInfo == null) { SmartDialog.showToast('账号未登录'); return; @@ -287,7 +286,7 @@ class VideoIntroController extends GetxController { } } - Future actionDislikeVideo() async { + Future actionDislikeVideo() async { if (userInfo == null) { SmartDialog.showToast('账号未登录'); return; @@ -308,7 +307,7 @@ class VideoIntroController extends GetxController { } } - Future viewLater() async { + Future viewLater() async { var res = await (hasLater.value ? UserHttp.toViewDel(aids: [IdUtils.bv2av(bvid)]) : await UserHttp.toViewLater(bvid: bvid)); @@ -316,7 +315,7 @@ class VideoIntroController extends GetxController { SmartDialog.showToast(res['msg']); } - Future coinVideo(int coin, [bool selectLike = false]) async { + Future coinVideo(int coin, [bool selectLike = false]) async { if (videoDetail.value.stat?.coin == null) { // not init return; @@ -341,7 +340,7 @@ class VideoIntroController extends GetxController { } // 投币 - Future actionCoinVideo() async { + Future actionCoinVideo() async { if (userInfo == null) { SmartDialog.showToast('账号未登录'); return; @@ -367,7 +366,7 @@ class VideoIntroController extends GetxController { } // (取消)收藏 - Future actionFavVideo({type = 'choose'}) async { + Future actionFavVideo({type = 'choose'}) async { // 收藏至默认文件夹 if (type == 'default') { SmartDialog.showLoading(msg: '请求中'); @@ -559,7 +558,7 @@ class VideoIntroController extends GetxController { } // 查询关注状态 - Future queryFollowStatus() async { + Future queryFollowStatus() async { if (videoDetail.value.owner == null) { return; } @@ -572,7 +571,7 @@ class VideoIntroController extends GetxController { } // 关注/取关up - Future actionRelationMod(BuildContext context) async { + Future actionRelationMod(BuildContext context) async { if (userInfo == null) { SmartDialog.showToast('账号未登录'); return; @@ -682,7 +681,7 @@ class VideoIntroController extends GetxController { } // 查看同时在看人数 - Future queryOnlineTotal() async { + Future queryOnlineTotal() async { if (isShowOnlineTotal.not) { return; } @@ -843,46 +842,44 @@ class VideoIntroController extends GetxController { } bool playRelated() { - late RelatedController relatedCtr; - try { + RelatedController relatedCtr; + if (Get.isRegistered(tag: heroTag)) { relatedCtr = Get.find(tag: heroTag); - if (relatedCtr.loadingState.value is! Success) { - return false; - } - if ((relatedCtr.loadingState.value as Success).response.isEmpty == true) { - SmartDialog.showToast('暂无相关视频,停止连播'); - return false; - } - } catch (_) { - relatedCtr = Get.put(RelatedController(), tag: heroTag); - relatedCtr.queryData().then((value) { - if (value['status']) { + } else { + relatedCtr = Get.put(RelatedController(false), tag: heroTag) + ..queryData().then((_) { playRelated(); - } - }); + }); return false; } - final HotVideoItemModel videoItem = - (relatedCtr.loadingState.value as Success).response[0]; + if (relatedCtr.loadingState.value is! Success) { + return false; + } + + if (relatedCtr.loadingState.value.data.isNullOrEmpty) { + SmartDialog.showToast('暂无相关视频,停止连播'); + return false; + } + + final firstItem = relatedCtr.loadingState.value.data!.first; try { - if (videoItem.cid != null) { + if (firstItem.cid != null) { changeSeasonOrbangu( null, - videoItem.bvid, - videoItem.cid, - videoItem.aid, - videoItem.pic, + firstItem.bvid, + firstItem.cid, + firstItem.aid, + firstItem.pic, ); } else { - SearchHttp.ab2c(aid: videoItem.aid, bvid: videoItem.bvid).then( - (cid) => PageUtils.toVideoPage( - 'bvid=${videoItem.bvid}&cid=${videoItem.cid}', - arguments: { - 'videoItem': videoItem, - 'heroTag': heroTag, - }, - off: true, + SearchHttp.ab2c(aid: firstItem.aid, bvid: firstItem.bvid).then( + (cid) => changeSeasonOrbangu( + null, + firstItem.bvid, + cid, + firstItem.aid, + firstItem.pic, ), ); } diff --git a/lib/pages/video/member/controller.dart b/lib/pages/video/member/controller.dart index 1142e6ee4..5832ba7e4 100644 --- a/lib/pages/video/member/controller.dart +++ b/lib/pages/video/member/controller.dart @@ -24,7 +24,7 @@ class HorizontalMemberPageController extends CommonDataController { queryData(); } - Future getUserInfo() async { + Future getUserInfo() async { dynamic res = await MemberHttp.memberInfo(mid: mid); if (res['status']) { userState.value = LoadingState.success(res['data']); @@ -34,7 +34,7 @@ class HorizontalMemberPageController extends CommonDataController { } } - Future getMemberStat() async { + Future getMemberStat() async { var res = await MemberHttp.memberStat(mid: mid); if (res['status']) { userStat.value = res['data']; @@ -42,7 +42,7 @@ class HorizontalMemberPageController extends CommonDataController { } } - Future getMemberView() async { + Future getMemberView() async { var res = await MemberHttp.memberView(mid: mid); if (res['status']) { userStat.addAll(res['data']); @@ -97,7 +97,7 @@ class HorizontalMemberPageController extends CommonDataController { ); @override - Future onRefresh() { + Future onRefresh() { currentPage = 0; hasPrev = true; hasNext = true; diff --git a/lib/pages/video/related/controller.dart b/lib/pages/video/related/controller.dart index 4fe2945ba..14af3fab3 100644 --- a/lib/pages/video/related/controller.dart +++ b/lib/pages/video/related/controller.dart @@ -6,13 +6,17 @@ import 'package:get/get.dart'; class RelatedController extends CommonListController?, HotVideoItemModel> { + RelatedController([this.autoQuery]); // 视频aid String bvid = Get.parameters['bvid'] ?? ""; + final bool? autoQuery; @override void onInit() { super.onInit(); - queryData(); + if (autoQuery != false) { + queryData(); + } } @override diff --git a/lib/pages/video/reply/widgets/zan_grpc.dart b/lib/pages/video/reply/widgets/zan_grpc.dart index 5fc99a610..c3cdd1c35 100644 --- a/lib/pages/video/reply/widgets/zan_grpc.dart +++ b/lib/pages/video/reply/widgets/zan_grpc.dart @@ -24,7 +24,7 @@ class ZanButtonGrpc extends StatefulWidget { } class _ZanButtonGrpcState extends State { - Future onHateReply() async { + Future onHateReply() async { feedBack(); final int oid = widget.replyItem.oid.toInt(); final int rpid = widget.replyItem.id.toInt(); @@ -57,7 +57,7 @@ class _ZanButtonGrpcState extends State { } // 评论点赞 - Future onLikeReply() async { + Future onLikeReply() async { feedBack(); final int oid = widget.replyItem.oid.toInt(); final int rpid = widget.replyItem.id.toInt(); diff --git a/lib/pages/video/reply_new/view.dart b/lib/pages/video/reply_new/view.dart index 330838770..300af8ead 100644 --- a/lib/pages/video/reply_new/view.dart +++ b/lib/pages/video/reply_new/view.dart @@ -240,7 +240,8 @@ class _ReplyPageState extends CommonPublishPageState { } @override - Future onCustomPublish({required String message, List? pictures}) async { + Future onCustomPublish( + {required String message, List? pictures}) async { var result = await VideoHttp.replyAdd( type: widget.replyType ?? ReplyType.video, oid: widget.oid!, diff --git a/lib/pages/video/reply_reply/controller.dart b/lib/pages/video/reply_reply/controller.dart index 5fe3425f2..7a4f882b9 100644 --- a/lib/pages/video/reply_reply/controller.dart +++ b/lib/pages/video/reply_reply/controller.dart @@ -51,7 +51,7 @@ class VideoReplyReplyController extends ReplyController } @override - Future onRefresh() { + Future onRefresh() { paginationReply = null; return super.onRefresh(); } diff --git a/lib/pages/video/send_danmaku/view.dart b/lib/pages/video/send_danmaku/view.dart index 5cc0c3fd1..ea6dfe48d 100644 --- a/lib/pages/video/send_danmaku/view.dart +++ b/lib/pages/video/send_danmaku/view.dart @@ -471,7 +471,8 @@ class _SendDanmakuPanelState extends CommonPublishPageState { } @override - Future onCustomPublish({required String message, List? pictures}) async { + Future onCustomPublish( + {required String message, List? pictures}) async { SmartDialog.showLoading(msg: '发送中...'); bool isColorful = _color.value == Colors.transparent; final res = await DanmakuHttp.shootDanmaku( diff --git a/lib/pages/webdav/webdav.dart b/lib/pages/webdav/webdav.dart index d781ea9c6..b4e074ae5 100644 --- a/lib/pages/webdav/webdav.dart +++ b/lib/pages/webdav/webdav.dart @@ -54,7 +54,7 @@ class WebDav { : 'piliplus_settings_phone.json'; } - Future backup() async { + Future backup() async { if (_client == null) { final res = await init(); if (res.first == false) { @@ -76,7 +76,7 @@ class WebDav { } } - Future restore() async { + Future restore() async { if (_client == null) { final res = await init(); if (res.first == false) { diff --git a/lib/pages/whisper/controller.dart b/lib/pages/whisper/controller.dart index b7dceea82..f899117c6 100644 --- a/lib/pages/whisper/controller.dart +++ b/lib/pages/whisper/controller.dart @@ -55,7 +55,7 @@ class WhisperController queryData(); } - Future queryMsgFeedUnread() async { + Future queryMsgFeedUnread() async { var res = await MsgHttp.msgFeedUnread(); if (res['status']) { final data = MsgFeedUnread.fromJson(res['data']); @@ -83,7 +83,7 @@ class WhisperController return super.onRefresh(); } - Future onRemove(int index, int? talkerId) async { + Future onRemove(int index, int? talkerId) async { var res = await MsgHttp.removeMsg(talkerId); if (res['status']) { loadingState.value.data!.removeAt(index); @@ -94,7 +94,7 @@ class WhisperController } } - Future onSetTop(int index, bool isTop, int? talkerId) async { + Future onSetTop(int index, bool isTop, int? talkerId) async { var res = await MsgHttp.setTop( talkerId: talkerId, opType: isTop ? 1 : 0, diff --git a/lib/pages/whisper_detail/controller.dart b/lib/pages/whisper_detail/controller.dart index 6c179ed82..966f6fd66 100644 --- a/lib/pages/whisper_detail/controller.dart +++ b/lib/pages/whisper_detail/controller.dart @@ -61,7 +61,7 @@ class WhisperDetailController } // 消息标记已读 - Future ackSessionMsg(int? msgSeqno) async { + Future ackSessionMsg(int? msgSeqno) async { var res = await MsgHttp.ackSessionMsg( talkerId: talkerId, ackSeqno: msgSeqno, @@ -71,7 +71,7 @@ class WhisperDetailController } } - Future sendMsg({ + Future sendMsg({ required String message, Map? picMsg, required VoidCallback onClearText, diff --git a/lib/pages/whisper_detail/view.dart b/lib/pages/whisper_detail/view.dart index ad57e305b..37bdad0b2 100644 --- a/lib/pages/whisper_detail/view.dart +++ b/lib/pages/whisper_detail/view.dart @@ -321,7 +321,7 @@ class _WhisperDetailPageState Widget? get customPanel => EmotePanel(onChoose: onChooseEmote); @override - Future onCustomPublish({required String message, List? pictures}) { + Future onCustomPublish({required String message, List? pictures}) { throw UnimplementedError(); } } diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index f2d9a5e2a..156a7ab20 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -825,7 +825,7 @@ class PlPlayerController { } // 开始播放 - Future _initializePlayer() async { + Future _initializePlayer() async { if (_instance == null) return; // 设置倍速 if (videoType.value == 'live') { @@ -1413,7 +1413,7 @@ class PlPlayerController { _statusListeners.remove(listener); /// 截屏 - Future screenshot() async { + Future screenshot() async { final Uint8List? screenshot = await _videoPlayerController!.screenshot(format: 'image/png'); return screenshot; @@ -1428,7 +1428,7 @@ class PlPlayerController { } // 记录播放记录 - Future makeHeartBeat( + Future makeHeartBeat( int progress, { type = 'playing', bool isManual = false, diff --git a/lib/services/audio_handler.dart b/lib/services/audio_handler.dart index 5c485a20d..f1860f274 100644 --- a/lib/services/audio_handler.dart +++ b/lib/services/audio_handler.dart @@ -9,7 +9,7 @@ import 'package:audio_service/audio_service.dart'; import 'package:get/get_utils/get_utils.dart'; Future initAudioService() async { - return await AudioService.init( + return AudioService.init( builder: () => VideoPlayerServiceHandler(), config: const AudioServiceConfig( androidNotificationChannelId: 'com.example.piliplus.audio', diff --git a/lib/tcp/live.dart b/lib/tcp/live.dart index 673014173..c1a9ebf4d 100644 --- a/lib/tcp/live.dart +++ b/lib/tcp/live.dart @@ -194,7 +194,7 @@ class LiveMessageStream { Future getSocket() async { for (final server in servers) { try { - return await WebSocket.connect( + return WebSocket.connect( server, headers: MineController.anonymity.value ? {'cookie': ''} : null, ); diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index dde6f766b..3890724c6 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -44,7 +44,7 @@ class PiliScheme { } else if (RegExp(r'^\S+://').hasMatch(url).not) { url = 'https://$url'; } - return await routePush( + return routePush( Uri.parse(url), selfHandle: selfHandle, off: off, @@ -454,7 +454,7 @@ class PiliScheme { return false; } case 'http' || 'https': - return await _fullPathPush( + return _fullPathPush( uri, selfHandle: selfHandle, off: off, diff --git a/lib/utils/cache_manage.dart b/lib/utils/cache_manage.dart index 5693701c3..df5536170 100644 --- a/lib/utils/cache_manage.dart +++ b/lib/utils/cache_manage.dart @@ -76,7 +76,7 @@ class CacheManage { } /// 清除 Documents 目录下的 DioCache.db - Future clearApplicationCache() async { + Future clearApplicationCache() async { Directory directory = await getApplicationDocumentsDirectory(); if (directory.existsSync()) { String dioCacheFileName = @@ -89,7 +89,7 @@ class CacheManage { } // 清除 Library/Caches 目录及文件缓存 - static Future clearLibraryCache() async { + static Future clearLibraryCache() async { var appDocDir = await getTemporaryDirectory(); if (appDocDir.existsSync()) { // await appDocDir.delete(recursive: true); @@ -102,7 +102,7 @@ class CacheManage { } /// 递归方式删除目录及文件 - Future deleteDirectory(FileSystemEntity file) async { + Future deleteDirectory(FileSystemEntity file) async { if (file is Directory) { final List children = file.listSync(); for (final FileSystemEntity child in children) { diff --git a/lib/utils/data.dart b/lib/utils/data.dart index a0f67a7a2..6fc1fd040 100644 --- a/lib/utils/data.dart +++ b/lib/utils/data.dart @@ -2,11 +2,7 @@ import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/utils/storage.dart'; class Data { - static Future init() async { - await historyStatus(); - } - - static Future historyStatus() async { + static Future init() async { if (!Accounts.main.isLogin) { return; } diff --git a/lib/utils/download.dart b/lib/utils/download.dart index 5e566da4b..35a9d1f3e 100644 --- a/lib/utils/download.dart +++ b/lib/utils/download.dart @@ -91,15 +91,15 @@ class DownloadUtils { final androidInfo = await DeviceInfoPlugin().androidInfo; if (androidInfo.version.sdkInt <= 32) { if (!context.mounted) return false; - return await requestStoragePer(context); + return requestStoragePer(context); } else { - return await requestPhotoPer(); + return requestPhotoPer(); } } - return await requestStoragePer(context); + return requestStoragePer(context); } - static Future downloadLivePhoto({ + static Future downloadLivePhoto({ required BuildContext context, required String url, required String liveUrl, @@ -108,7 +108,7 @@ class DownloadUtils { }) async { try { if (!await checkPermissionDependOnSdkInt(context)) { - return; + return false; } SmartDialog.showLoading(msg: '正在下载'); @@ -168,12 +168,12 @@ class DownloadUtils { } } - static Future downloadImg( + static Future downloadImg( BuildContext context, List imgList, { String imgType = 'cover', }) async { - if (!await checkPermissionDependOnSdkInt(context)) return; + if (!await checkPermissionDependOnSdkInt(context)) return false; final cancelToken = CancelToken(); SmartDialog.showLoading( msg: '正在下载原图', diff --git a/lib/utils/login_utils.dart b/lib/utils/login_utils.dart index a6f7af505..9381cd84c 100644 --- a/lib/utils/login_utils.dart +++ b/lib/utils/login_utils.dart @@ -25,7 +25,7 @@ import 'package:webview_cookie_manager/webview_cookie_manager.dart'; class LoginUtils { static final random = Random(); - static Future onLoginMain() async { + static Future onLoginMain() async { final account = Accounts.main; GrpcRepo.updateHeaders(account.accessKey); try { @@ -112,7 +112,7 @@ class LoginUtils { } } - static Future onLogoutMain() async { + static Future onLogoutMain() async { GrpcRepo.updateHeaders(null); await Future.wait([ diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index 7903251e2..e0cf54c16 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -261,7 +261,7 @@ class PageUtils { ); } - static Future pushDynFromId({id, rid, bool off = false}) async { + static Future pushDynFromId({id, rid, bool off = false}) async { SmartDialog.showLoading(); dynamic res = await DynamicsHttp.dynamicDetail( id: id, diff --git a/lib/utils/request_utils.dart b/lib/utils/request_utils.dart index 866d123a0..eaec11873 100644 --- a/lib/utils/request_utils.dart +++ b/lib/utils/request_utils.dart @@ -45,7 +45,7 @@ class RequestUtils { // 16:番剧(id 为 epid) // 17:番剧 // https://github.com/SocialSisterYi/bilibili-API-collect/tree/master/docs/message/private_msg_content.md - static Future pmShare({ + static Future pmShare({ required int receiverId, required Map content, String? message, @@ -86,7 +86,7 @@ class RequestUtils { SmartDialog.dismiss(); } - static Future actionRelationMod({ + static Future actionRelationMod({ required BuildContext context, required dynamic mid, required bool isFollow, @@ -260,7 +260,7 @@ class RequestUtils { // } // } - static Future insertCreatedDyn(result) async { + static Future insertCreatedDyn(result) async { try { dynamic id = result['data']['dyn_id']; if (id != null) { @@ -285,7 +285,7 @@ class RequestUtils { } } - static Future checkCreatedDyn({id, dynText, isManual}) async { + static Future checkCreatedDyn({id, dynText, isManual}) async { if (isManual == true || GStorage.enableCreateDynAntifraud) { try { if (id != null) { @@ -310,7 +310,7 @@ class RequestUtils { } // 动态点赞 - static Future onLikeDynamic( + static Future onLikeDynamic( DynamicItemModel item, VoidCallback callback) async { feedBack(); String dynamicId = item.idStr!; @@ -437,7 +437,7 @@ class RequestUtils { }); } - static Future validate( + static Future validate( String vVoucher, ValueChanged onSuccess) async { final res = await ValidateHttp.gaiaVgateRegister(vVoucher); if (!res['status']) { diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index b177b7743..78dfaac8f 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -590,7 +590,7 @@ class Utils { } // 下载适用于当前系统的安装包 - static Future onDownload(data) async { + static Future onDownload(data) async { await SmartDialog.dismiss(); try { void download(plat) {