Compare commits

..

2 Commits

Author SHA1 Message Date
bggRGjQaUbCoE
ed191e20b4 fix import history
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-08-21 15:12:40 +08:00
bggRGjQaUbCoE
ba14e56ceb fix #1061
opt `FollowingsFollowedUpper` url

Closes #1061
Closes #1062

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-08-21 14:51:06 +08:00
7 changed files with 39 additions and 20 deletions

View File

@@ -244,6 +244,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
if (Accounts.main.isLogin) { if (Accounts.main.isLogin) {
await LoginUtils.onLoginMain(); await LoginUtils.onLoginMain();
} }
return true;
}, },
), ),
), ),
@@ -313,7 +314,7 @@ Future<void> showInportExportDialog<T>(
required String title, required String title,
String? label, String? label,
required String Function() toJson, required String Function() toJson,
required FutureOr<void> Function(T json) fromJson, required FutureOr<bool> Function(T json) fromJson,
}) => showDialog( }) => showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
@@ -426,8 +427,9 @@ Future<void> showInportExportDialog<T>(
onPressed: () async { onPressed: () async {
Get.back(); Get.back();
try { try {
await fromJson(json); if (await fromJson(json)) {
SmartDialog.showToast('导入成功'); SmartDialog.showToast('导入成功');
}
} catch (e) { } catch (e) {
SmartDialog.showToast('导入失败:$e'); SmartDialog.showToast('导入失败:$e');
} }

View File

@@ -171,13 +171,16 @@ class _EmotePanelState extends State<EmotePanel>
.withValues(alpha: 0.8), .withValues(alpha: 0.8),
bgColor: Colors.transparent, bgColor: Colors.transparent,
context: context, context: context,
onPressed: () => Get.toNamed( onPressed: () {
'/webview', final isDark = Get.isDarkMode;
parameters: { Get.toNamed(
'url': '/webview',
'https://www.bilibili.com/h5/mall/emoji-package/home?navhide=1&native.theme=1&night=${Get.isDarkMode ? 1 : 0}', parameters: {
}, 'url':
), 'https://www.bilibili.com/h5/mall/emoji-package/home?navhide=1&native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}',
},
);
},
icon: Icons.settings, icon: Icons.settings,
), ),
), ),

View File

@@ -645,7 +645,12 @@ class UserInfoCard extends StatelessWidget {
); );
if (item.jumpUrl?.isNotEmpty == true) { if (item.jumpUrl?.isNotEmpty == true) {
return GestureDetector( return GestureDetector(
onTap: () => PageUtils.handleWebview(item.jumpUrl!), onTap: () {
final isDark = Get.isDarkMode;
PageUtils.handleWebview(
'${item.jumpUrl}&native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}',
);
},
child: child, child: child,
); );
} }

View File

@@ -150,6 +150,7 @@ class SSearchController extends GetxController
historyList historyList
..remove(controller.text) ..remove(controller.text)
..insert(0, controller.text); ..insert(0, controller.text);
GStorage.historyWord.put('cacheList', historyList);
} }
searchFocusNode.unfocus(); searchFocusNode.unfocus();
@@ -197,6 +198,7 @@ class SSearchController extends GetxController
void onLongSelect(String word) { void onLongSelect(String word) {
historyList.remove(word); historyList.remove(word);
GStorage.historyWord.put('cacheList', historyList);
} }
void onClearHistory() { void onClearHistory() {
@@ -205,13 +207,13 @@ class SSearchController extends GetxController
title: '确定清空搜索历史?', title: '确定清空搜索历史?',
onConfirm: () { onConfirm: () {
historyList.clear(); historyList.clear();
GStorage.historyWord.delete('cacheList');
}, },
); );
} }
@override @override
void onClose() { void onClose() {
GStorage.historyWord.put('cacheList', historyList);
subDispose(); subDispose();
searchFocusNode.dispose(); searchFocusNode.dispose();
controller.dispose(); controller.dispose();

View File

@@ -14,6 +14,7 @@ import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/storage_key.dart'; import 'package:PiliPlus/utils/storage_key.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart' hide ContextExtensionss; import 'package:get/get.dart' hide ContextExtensionss;
class SearchPage extends StatefulWidget { class SearchPage extends StatefulWidget {
@@ -394,15 +395,21 @@ class _SearchPageState extends State<SearchPage> {
Icons.import_export_outlined, Icons.import_export_outlined,
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.8), color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.8),
), ),
style: IconButton.styleFrom( style: IconButton.styleFrom(padding: EdgeInsets.zero),
padding: EdgeInsets.zero,
),
onPressed: () => showInportExportDialog<List>( onPressed: () => showInportExportDialog<List>(
context, context,
title: '历史记录', title: '历史记录',
toJson: () => jsonEncode(_searchController.historyList), toJson: () => jsonEncode(_searchController.historyList),
fromJson: (json) { fromJson: (json) {
_searchController.historyList.value = json.cast<String>(); try {
final list = List<String>.from(json);
_searchController.historyList.value = list;
GStorage.historyWord.put('cacheList', list);
return true;
} catch (e) {
SmartDialog.showToast(e.toString());
return false;
}
}, },
), ),
), ),

View File

@@ -38,7 +38,6 @@ class _WebDavSettingPageState extends State<WebDavSettingPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
EdgeInsets padding = MediaQuery.viewPaddingOf(context); EdgeInsets padding = MediaQuery.viewPaddingOf(context);
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: widget.showAppBar,
appBar: !widget.showAppBar appBar: !widget.showAppBar
? null ? null
: AppBar(title: const Text('WebDAV 设置')), : AppBar(title: const Text('WebDAV 设置')),

View File

@@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart';
class GStorage { class GStorage {
static late final Box<UserInfoData> userInfo; static late final Box<UserInfoData> userInfo;
static late final Box<List<String>> historyWord; static late final Box<dynamic> historyWord;
static late final Box<dynamic> localCache; static late final Box<dynamic> localCache;
static late final Box<dynamic> setting; static late final Box<dynamic> setting;
static late final Box<dynamic> video; static late final Box<dynamic> video;
@@ -41,7 +41,7 @@ class GStorage {
// 设置 // 设置
setting = await Hive.openBox('setting'); setting = await Hive.openBox('setting');
// 搜索历史 // 搜索历史
historyWord = await Hive.openBox<List<String>>( historyWord = await Hive.openBox(
'historyWord', 'historyWord',
compactionStrategy: (int entries, int deletedEntries) { compactionStrategy: (int entries, int deletedEntries) {
return deletedEntries > 10; return deletedEntries > 10;
@@ -63,11 +63,12 @@ class GStorage {
static Future<void> importAllSettings(String data) => static Future<void> importAllSettings(String data) =>
importAllJsonSettings(jsonDecode(data)); importAllJsonSettings(jsonDecode(data));
static Future<void> importAllJsonSettings(Map<String, dynamic> map) async { static Future<bool> importAllJsonSettings(Map<String, dynamic> map) async {
await setting.clear(); await setting.clear();
await video.clear(); await video.clear();
await setting.putAll(map[setting.name]); await setting.putAll(map[setting.name]);
await video.putAll(map[video.name]); await video.putAll(map[video.name]);
return true;
} }
static void regAdapter() { static void regAdapter() {