mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-26 03:56:45 +08:00
opt: userInfoCache (#968)
This commit is contained in:
committed by
GitHub
parent
c75a68dacc
commit
e77fe2587c
@@ -17,6 +17,7 @@ import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart' as web;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -57,7 +58,9 @@ class LoginUtils {
|
||||
..isLogin.value = true;
|
||||
|
||||
SmartDialog.showToast('main登录成功');
|
||||
await GStorage.userInfo.put('userInfoCache', data);
|
||||
if (data != Pref.userInfoCache) {
|
||||
await GStorage.userInfo.put('userInfoCache', data);
|
||||
}
|
||||
|
||||
try {
|
||||
Get.find<MineController>().onRefresh();
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class GStorage {
|
||||
static late final Box<dynamic> userInfo;
|
||||
static late final Box<UserInfoData> userInfo;
|
||||
static late final Box<dynamic> historyWord;
|
||||
static late final Box<dynamic> localCache;
|
||||
static late final Box<dynamic> setting;
|
||||
@@ -25,7 +25,7 @@ class GStorage {
|
||||
await Hive.initFlutter('$path/hive');
|
||||
regAdapter();
|
||||
// 登录用户信息
|
||||
userInfo = await Hive.openBox(
|
||||
userInfo = await Hive.openBox<UserInfoData>(
|
||||
'userInfo',
|
||||
compactionStrategy: (int entries, int deletedEntries) {
|
||||
return deletedEntries > 2;
|
||||
|
||||
@@ -17,6 +17,7 @@ import 'package:PiliPlus/models/common/video/subtitle_pref_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/models/user/danmaku_rule.dart';
|
||||
import 'package:PiliPlus/models/user/info.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
@@ -34,6 +35,9 @@ class Pref {
|
||||
static final Box _video = GStorage.video;
|
||||
static final Box _localCache = GStorage.localCache;
|
||||
|
||||
static UserInfoData? get userInfoCache =>
|
||||
GStorage.userInfo.get('userInfoCache');
|
||||
|
||||
static List<double> get dynamicDetailRatio => List<double>.from(
|
||||
_setting.get(
|
||||
SettingBoxKey.dynamicDetailRatio,
|
||||
|
||||
Reference in New Issue
Block a user