mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-24 04:22:39 +08:00
opt: LoadingState (#1776)
This commit is contained in:
committed by
GitHub
parent
3741fe54ff
commit
17883eb77e
@@ -107,8 +107,8 @@ abstract class CommonIntroController extends GetxController
|
||||
bvid: bvid,
|
||||
cid: cid.value,
|
||||
);
|
||||
if (result['status']) {
|
||||
total.value = result['data'];
|
||||
if (result case Success(:final response)) {
|
||||
total.value = response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ abstract class CommonIntroController extends GetxController
|
||||
multiply: coin,
|
||||
selectLike: selectLike ? 1 : 0,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
SmartDialog.showToast('投币成功');
|
||||
coinNum.value += coin;
|
||||
GlobalData().afterCoin(coin);
|
||||
@@ -138,7 +138,7 @@ abstract class CommonIntroController extends GetxController
|
||||
hasLike.value = true;
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ abstract class CommonIntroController extends GetxController
|
||||
Future<void> viewLater() async {
|
||||
var res = await (hasLater.value
|
||||
? UserHttp.toViewDel(aids: IdUtils.bv2av(bvid).toString())
|
||||
: await UserHttp.toViewLater(bvid: bvid));
|
||||
: UserHttp.toViewLater(bvid: bvid));
|
||||
if (res['status']) hasLater.value = !hasLater.value;
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
@@ -236,12 +236,12 @@ mixin FavMixin on TripleMixin {
|
||||
addIds: favFolderId.toString(),
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
if (result.isSuccess) {
|
||||
updateFavCount(hasFav ? -1 : 1);
|
||||
this.hasFav.value = !hasFav;
|
||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
res.toast();
|
||||
}
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
@@ -275,7 +275,7 @@ mixin FavMixin on TripleMixin {
|
||||
delIds: delMediaIdsNew.join(','),
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
if (result.isSuccess) {
|
||||
Get.back();
|
||||
final newVal =
|
||||
addMediaIdsNew.isNotEmpty || favIds?.length != delMediaIdsNew.length;
|
||||
@@ -285,7 +285,7 @@ mixin FavMixin on TripleMixin {
|
||||
}
|
||||
SmartDialog.showToast('操作成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
result.toast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,15 @@ abstract class CommonWhisperController<R>
|
||||
extends CommonListController<R, Session> {
|
||||
SessionPageType get sessionPageType;
|
||||
|
||||
Future<void> onRemove(int index, int? talkerId) async {
|
||||
Future<void> onRemove(int index, int talkerId) async {
|
||||
var res = await MsgHttp.removeMsg(talkerId);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
loadingState
|
||||
..value.data!.removeAt(index)
|
||||
..refresh();
|
||||
SmartDialog.showToast('删除成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ abstract class CommonWhisperController<R>
|
||||
setting: isMuted ? 0 : 1,
|
||||
dndUid: talkerUid,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
item.isMuted = !isMuted;
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('操作成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import 'package:PiliPlus/models/common/publish_panel_type.dart';
|
||||
import 'package:PiliPlus/models_new/dynamic/dyn_mention/item.dart';
|
||||
import 'package:PiliPlus/models_new/emote/emote.dart' as e;
|
||||
import 'package:PiliPlus/models_new/live/live_emote/emoticon.dart';
|
||||
import 'package:PiliPlus/models_new/upload_bfs/data.dart';
|
||||
import 'package:PiliPlus/pages/common/publish/common_publish_page.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_mention/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -462,14 +461,13 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
try {
|
||||
pictures = await Future.wait<Map<String, dynamic>>(
|
||||
pathList.map((path) async {
|
||||
Map result = await MsgHttp.uploadBfs(
|
||||
final result = await MsgHttp.uploadBfs(
|
||||
path: path,
|
||||
category: 'daily',
|
||||
biz: 'new_dyn',
|
||||
cancelToken: cancelToken,
|
||||
);
|
||||
if (!result['status']) throw HttpException(result['msg']);
|
||||
UploadBfsResData data = result['data'];
|
||||
final data = result.data;
|
||||
return {
|
||||
'img_width': data.imageWidth,
|
||||
'img_height': data.imageHeight,
|
||||
|
||||
@@ -252,7 +252,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
||||
rpid: item.id,
|
||||
isUpTop: isUpTop,
|
||||
);
|
||||
if (res['status']) {
|
||||
if (res.isSuccess) {
|
||||
List<ReplyInfo> list = loadingState.value.data!;
|
||||
item.replyControl.isUpTop = !isUpTop;
|
||||
if (!isUpTop && index != 0) {
|
||||
@@ -263,7 +263,7 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('${isUpTop ? '取消' : ''}置顶成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user