Merge branch 'design'

This commit is contained in:
guozhigq
2024-10-19 15:46:22 +08:00
46 changed files with 782 additions and 783 deletions

View File

@ -15,6 +15,7 @@ class GlobalDataCache {
late FullScreenGestureMode fullScreenGestureMode;
late bool enablePlayerControlAnimation;
late List<String> actionTypeSort;
late double sheetHeight;
String? wWebid;
/// 播放器相关
@ -44,6 +45,10 @@ class GlobalDataCache {
late List<double> speedsList;
// 用户信息
UserInfoData? userInfo;
// 搜索历史
late List historyCacheList;
//
late bool enableSearchSuggest = true;
// 私有构造函数
GlobalDataCache._();
@ -103,5 +108,9 @@ class GlobalDataCache {
speedsList.addAll(playSpeedSystem);
userInfo = userInfoCache.get('userInfoCache');
sheetHeight = localCache.get('sheetHeight', defaultValue: 0.0);
historyCacheList = localCache.get('cacheList', defaultValue: []);
enableSearchSuggest =
setting.get(SettingBoxKey.enableSearchSuggest, defaultValue: true);
}
}

View File

@ -5,7 +5,6 @@ import 'package:pilipala/models/user/info.dart';
class GStrorage {
static late final Box<dynamic> userInfo;
static late final Box<dynamic> historyword;
static late final Box<dynamic> localCache;
static late final Box<dynamic> setting;
static late final Box<dynamic> video;
@ -26,18 +25,11 @@ class GStrorage {
localCache = await Hive.openBox(
'localCache',
compactionStrategy: (int entries, int deletedEntries) {
return deletedEntries > 4;
return deletedEntries > 10;
},
);
// 设置
setting = await Hive.openBox('setting');
// 搜索历史
historyword = await Hive.openBox(
'historyWord',
compactionStrategy: (int entries, int deletedEntries) {
return deletedEntries > 10;
},
);
// 视频设置
video = await Hive.openBox('video');
}
@ -52,8 +44,6 @@ class GStrorage {
// user.close();
userInfo.compact();
userInfo.close();
historyword.compact();
historyword.close();
localCache.compact();
localCache.close();
setting.compact();
@ -117,6 +107,7 @@ class SettingBoxKey {
replySortType = 'replySortType',
defaultDynamicType = 'defaultDynamicType',
enableHotKey = 'enableHotKey',
enableSearchSuggest = 'enableSearchSuggest',
enableQuickFav = 'enableQuickFav',
enableWordRe = 'enableWordRe',
enableSearchWord = 'enableSearchWord',

View File

@ -351,6 +351,9 @@ class Utils {
// 时间戳转时间
static tampToSeektime(number) {
if (number is String && int.tryParse(number) == null) {
return number;
}
int hours = number ~/ 60;
int minutes = number % 60;