mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-04 00:59:50 +08:00
@@ -6,7 +6,6 @@ import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pb.dart'
|
||||
show
|
||||
DetailItem,
|
||||
PlayURLResp,
|
||||
PlaylistResp,
|
||||
PlaylistSource,
|
||||
PlayInfo,
|
||||
ThumbUpReq_ThumbType,
|
||||
@@ -14,6 +13,7 @@ import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pb.dart'
|
||||
DashItem,
|
||||
ResponseUrl;
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/ua_type.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart'
|
||||
show FavMixin;
|
||||
@@ -174,28 +174,27 @@ class AudioController extends GetxController
|
||||
extraId: extraId,
|
||||
order: order,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
final PlaylistResp data = res.data;
|
||||
if (res case Success(:final response)) {
|
||||
if (isInit) {
|
||||
late final paginationReply = data.paginationReply;
|
||||
_prev = data.reachStart ? null : paginationReply.prev;
|
||||
_next = data.reachEnd ? null : paginationReply.next;
|
||||
final index = data.list.indexWhere((e) => e.item.oid == oid);
|
||||
late final paginationReply = response.paginationReply;
|
||||
_prev = response.reachStart ? null : paginationReply.prev;
|
||||
_next = response.reachEnd ? null : paginationReply.next;
|
||||
final index = response.list.indexWhere((e) => e.item.oid == oid);
|
||||
if (index != -1) {
|
||||
this.index = index;
|
||||
_updateCurrItem(data.list[index]);
|
||||
playlist = data.list;
|
||||
_updateCurrItem(response.list[index]);
|
||||
playlist = response.list;
|
||||
}
|
||||
} else if (isLoadPrev) {
|
||||
_prev = data.reachStart ? null : data.paginationReply.prev;
|
||||
if (data.list.isNotEmpty) {
|
||||
index += data.list.length;
|
||||
playlist?.insertAll(0, data.list);
|
||||
_prev = response.reachStart ? null : response.paginationReply.prev;
|
||||
if (response.list.isNotEmpty) {
|
||||
index += response.list.length;
|
||||
playlist?.insertAll(0, response.list);
|
||||
}
|
||||
} else if (isLoadNext) {
|
||||
_next = data.reachEnd ? null : data.paginationReply.next;
|
||||
if (data.list.isNotEmpty) {
|
||||
playlist?.addAll(data.list);
|
||||
_next = response.reachEnd ? null : response.paginationReply.next;
|
||||
if (response.list.isNotEmpty) {
|
||||
playlist?.addAll(response.list);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -209,8 +208,8 @@ class AudioController extends GetxController
|
||||
oid: oid,
|
||||
subId: subId,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
_onPlay(res.data);
|
||||
if (res case Success(:final response)) {
|
||||
_onPlay(response);
|
||||
return true;
|
||||
} else {
|
||||
res.toast();
|
||||
@@ -343,7 +342,7 @@ class AudioController extends GetxController
|
||||
? ThumbUpReq_ThumbType.LIKE
|
||||
: ThumbUpReq_ThumbType.CANCEL_LIKE,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
if (res case Success(:final response)) {
|
||||
hasLike.value = newVal;
|
||||
try {
|
||||
audioItem.value!.stat
|
||||
@@ -351,7 +350,7 @@ class AudioController extends GetxController
|
||||
..like += newVal ? 1 : -1;
|
||||
audioItem.refresh();
|
||||
} catch (_) {}
|
||||
SmartDialog.showToast(res.data.message);
|
||||
SmartDialog.showToast(response.message);
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
@@ -368,10 +367,9 @@ class AudioController extends GetxController
|
||||
subId: subId,
|
||||
itemType: itemType,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
final data = res.data;
|
||||
if (res case Success(:final response)) {
|
||||
hasLike.value = true;
|
||||
if (data.coinOk && !hasCoin) {
|
||||
if (response.coinOk && !hasCoin) {
|
||||
coinNum.value = 2;
|
||||
GlobalData().afterCoin(2);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user