mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 16:46:22 +08:00
@@ -4,6 +4,7 @@ import 'package:PiliPlus/models/live/follow.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:get/get_rx/src/rx_types/rx_types.dart';
|
||||
|
||||
@@ -18,9 +19,27 @@ class LiveController
|
||||
}
|
||||
}
|
||||
|
||||
String? gaiaVtoken;
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<LiveItemModel>?>> customGetData() =>
|
||||
LiveHttp.liveList(pn: currentPage);
|
||||
LiveHttp.liveList(pn: currentPage, gaiaVtoken: gaiaVtoken);
|
||||
|
||||
@override
|
||||
bool handleError(String? errMsg) {
|
||||
if (errMsg?.startsWith('voucher') == true) {
|
||||
RequestUtils.validate(
|
||||
errMsg!,
|
||||
(gaiaVtoken) {
|
||||
this.gaiaVtoken = gaiaVtoken;
|
||||
onReload();
|
||||
},
|
||||
);
|
||||
loadingState.value = LoadingState.error(' -352 ');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future onRefresh() {
|
||||
@@ -28,6 +47,17 @@ class LiveController
|
||||
return super.onRefresh();
|
||||
}
|
||||
|
||||
@override
|
||||
Future onReload() {
|
||||
if (loadingState.value is Error) {
|
||||
String? errMsg = (loadingState.value as Error).errMsg;
|
||||
if (errMsg == '-352') {
|
||||
gaiaVtoken = null;
|
||||
}
|
||||
}
|
||||
return super.onReload();
|
||||
}
|
||||
|
||||
late RxBool isLogin = Accounts.main.isLogin.obs;
|
||||
late Rx<LoadingState> followListState = LoadingState.loading().obs;
|
||||
late int followPage = 1;
|
||||
|
||||
Reference in New Issue
Block a user