opt account

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-10 11:42:50 +08:00
parent 5f77a8aa19
commit 4c758bb1a3
51 changed files with 342 additions and 299 deletions

View File

@@ -9,6 +9,7 @@ import 'package:PiliPlus/models_new/follow/list.dart';
import 'package:PiliPlus/pages/common/common_controller.dart';
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
import 'package:PiliPlus/pages/dynamics_tab/view.dart';
import 'package:PiliPlus/services/account_service.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:easy_debounce/easy_throttle.dart';
@@ -27,9 +28,6 @@ class DynamicsController extends GetxController
late TabController tabController;
Set<int> tempBannedList = <int>{};
late List<Widget> tabsPageList;
RxBool isLogin = false.obs;
dynamic ownerMid;
dynamic face;
List<UpItem> hasUpdatedUps = <UpItem>[];
int allFollowedUpsPage = 1;
int allFollowedUpsTotal = 0;
@@ -39,6 +37,8 @@ class DynamicsController extends GetxController
final upPanelPosition = GStorage.upPanelPosition;
AccountService accountService = Get.find<AccountService>();
DynamicsTabController? get controller {
try {
return Get.find<DynamicsTabController>(
@@ -51,12 +51,6 @@ class DynamicsController extends GetxController
@override
void onInit() {
super.onInit();
dynamic userInfo = GStorage.userInfo.get('userInfoCache');
ownerMid = userInfo?.mid;
face = userInfo?.face;
isLogin.value = userInfo != null;
tabController = TabController(
length: DynamicsTabType.values.length,
vsync: this,
@@ -76,7 +70,7 @@ class DynamicsController extends GetxController
return;
}
var res = await FollowHttp.followings(
vmid: ownerMid,
vmid: accountService.mid,
pn: allFollowedUpsPage,
ps: 50,
orderType: 'attention',
@@ -107,7 +101,7 @@ class DynamicsController extends GetxController
Future<void> queryFollowUp({String type = 'init'}) async {
if (isQuerying) return;
isQuerying = true;
if (!isLogin.value) {
if (!accountService.isLogin.value) {
upData
..value.errMsg = '账号未登录'
..refresh();
@@ -118,7 +112,7 @@ class DynamicsController extends GetxController
allFollowedUpsPage = 1;
final f1 = DynamicsHttp.followUp();
final f2 = FollowHttp.followings(
vmid: ownerMid,
vmid: accountService.mid,
pn: allFollowedUpsPage,
ps: 50,
orderType: 'attention',

View File

@@ -39,7 +39,7 @@ class _DynamicsPageState extends State<DynamicsPage>
}),
),
onPressed: () {
if (_dynamicsController.isLogin.value) {
if (_dynamicsController.accountService.isLogin.value) {
CreateDynPanel.onCreateDyn(context);
}
},

View File

@@ -30,7 +30,7 @@ class _UpPanelState extends State<UpPanel> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
if (!widget.dynamicsController.isLogin.value) {
if (!widget.dynamicsController.accountService.isLogin.value) {
return const SizedBox.shrink();
}
return CustomScrollView(
@@ -102,12 +102,14 @@ class _UpPanelState extends State<UpPanel> {
child: upItemBuild(theme, UpItem(face: '', uname: '全部动态', mid: -1)),
),
SliverToBoxAdapter(
child: upItemBuild(
theme,
UpItem(
uname: '',
face: widget.dynamicsController.face,
mid: widget.dynamicsController.ownerMid,
child: Obx(
() => upItemBuild(
theme,
UpItem(
uname: '',
face: widget.dynamicsController.accountService.face.value,
mid: widget.dynamicsController.accountService.mid,
),
),
),
),