mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: userInfoCache (#968)
This commit is contained in:
committed by
GitHub
parent
c75a68dacc
commit
e77fe2587c
@@ -28,7 +28,7 @@ import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/date_util.dart';
|
||||
import 'package:PiliPlus/utils/duration_util.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart' hide TabBarView;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -385,7 +385,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (episode.badge == "会员") {
|
||||
UserInfoData? userInfo = GStorage.userInfo.get('userInfoCache');
|
||||
UserInfoData? userInfo = Pref.userInfoCache;
|
||||
int vipStatus = userInfo?.vipStatus ?? 0;
|
||||
if (vipStatus != 1) {
|
||||
SmartDialog.showToast('需要大会员');
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/image_util.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
@@ -89,7 +90,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
..name.value = data.name!
|
||||
..face.value = data.face!;
|
||||
try {
|
||||
UserInfoData userInfo = GStorage.userInfo.get('userInfoCache')
|
||||
UserInfoData userInfo = Pref.userInfoCache!
|
||||
..uname = data.name
|
||||
..face = data.face;
|
||||
GStorage.userInfo.put('userInfoCache', userInfo);
|
||||
@@ -386,7 +387,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
..coins = data.coins! - 6;
|
||||
accountService.name.value = _textController.text;
|
||||
try {
|
||||
UserInfoData userInfo = GStorage.userInfo.get('userInfoCache')
|
||||
UserInfoData userInfo = Pref.userInfoCache!
|
||||
..uname = _textController.text;
|
||||
GStorage.userInfo.put('userInfoCache', userInfo);
|
||||
} catch (_) {}
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/login_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -82,7 +83,7 @@ class MineController
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
UserInfoData? userInfoCache = GStorage.userInfo.get('userInfoCache');
|
||||
UserInfoData? userInfoCache = Pref.userInfoCache;
|
||||
if (userInfoCache != null) {
|
||||
userInfo.value = userInfoCache;
|
||||
queryData();
|
||||
@@ -104,7 +105,9 @@ class MineController
|
||||
UserInfoData data = res.data;
|
||||
if (data.isLogin == true) {
|
||||
userInfo.value = data;
|
||||
GStorage.userInfo.put('userInfoCache', data);
|
||||
if (data != Pref.userInfoCache) {
|
||||
GStorage.userInfo.put('userInfoCache', data);
|
||||
}
|
||||
accountService
|
||||
..mid = data.mid!
|
||||
..name.value = data.uname!
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:PiliPlus/models_new/pgc/pgc_info_model/new_ep.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart'
|
||||
hide EpisodeItem;
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -50,7 +50,7 @@ class _PgcPanelState extends State<PgcPanel> {
|
||||
currentIndex = widget.pages.indexWhere((e) => e.cid == cid);
|
||||
scrollToIndex();
|
||||
|
||||
UserInfoData? userInfo = GStorage.userInfo.get('userInfoCache');
|
||||
UserInfoData? userInfo = Pref.userInfoCache;
|
||||
vipStatus = userInfo?.vipStatus ?? 0;
|
||||
|
||||
videoDetailCtr = Get.find<VideoDetailController>(tag: widget.heroTag);
|
||||
|
||||
@@ -4,10 +4,9 @@ import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
import 'package:PiliPlus/http/danmaku.dart';
|
||||
import 'package:PiliPlus/main.dart';
|
||||
import 'package:PiliPlus/models/common/publish_panel_type.dart';
|
||||
import 'package:PiliPlus/models/user/info.dart';
|
||||
import 'package:PiliPlus/pages/common/publish/common_text_pub_page.dart';
|
||||
import 'package:PiliPlus/pages/setting/slide_color_picker.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:canvas_danmaku/models/danmaku_content_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show LengthLimitingTextInputFormatter;
|
||||
@@ -72,8 +71,7 @@ class _SendDanmakuPanelState extends CommonTextPubPageState<SendDanmakuPanel> {
|
||||
_mode = (widget.dmConfig?.mode ?? 1).obs;
|
||||
_fontsize = (widget.dmConfig?.fontsize ?? 25).obs;
|
||||
_color = (widget.dmConfig?.color ?? Colors.white).obs;
|
||||
UserInfoData? userInfo = GStorage.userInfo.get('userInfoCache');
|
||||
if (userInfo?.vipStatus == 1) {
|
||||
if (Pref.userInfoCache?.vipStatus == 1) {
|
||||
_colorList.add(Colors.transparent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user