mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix #1061
opt `FollowingsFollowedUpper` url Closes #1061 Closes #1062 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -244,6 +244,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
|
||||
if (Accounts.main.isLogin) {
|
||||
await LoginUtils.onLoginMain();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -313,7 +314,7 @@ Future<void> showInportExportDialog<T>(
|
||||
required String title,
|
||||
String? label,
|
||||
required String Function() toJson,
|
||||
required FutureOr<void> Function(T json) fromJson,
|
||||
required FutureOr<bool> Function(T json) fromJson,
|
||||
}) => showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
@@ -426,8 +427,9 @@ Future<void> showInportExportDialog<T>(
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
try {
|
||||
await fromJson(json);
|
||||
SmartDialog.showToast('导入成功');
|
||||
if (await fromJson(json)) {
|
||||
SmartDialog.showToast('导入成功');
|
||||
}
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('导入失败:$e');
|
||||
}
|
||||
|
||||
@@ -171,13 +171,16 @@ class _EmotePanelState extends State<EmotePanel>
|
||||
.withValues(alpha: 0.8),
|
||||
bgColor: Colors.transparent,
|
||||
context: context,
|
||||
onPressed: () => Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url':
|
||||
'https://www.bilibili.com/h5/mall/emoji-package/home?navhide=1&native.theme=1&night=${Get.isDarkMode ? 1 : 0}',
|
||||
},
|
||||
),
|
||||
onPressed: () {
|
||||
final isDark = Get.isDarkMode;
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -645,7 +645,12 @@ class UserInfoCard extends StatelessWidget {
|
||||
);
|
||||
if (item.jumpUrl?.isNotEmpty == true) {
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ class SSearchController extends GetxController
|
||||
historyList
|
||||
..remove(controller.text)
|
||||
..insert(0, controller.text);
|
||||
GStorage.historyWord.put('cacheList', historyList);
|
||||
}
|
||||
|
||||
searchFocusNode.unfocus();
|
||||
@@ -197,6 +198,7 @@ class SSearchController extends GetxController
|
||||
|
||||
void onLongSelect(String word) {
|
||||
historyList.remove(word);
|
||||
GStorage.historyWord.put('cacheList', historyList);
|
||||
}
|
||||
|
||||
void onClearHistory() {
|
||||
@@ -205,13 +207,13 @@ class SSearchController extends GetxController
|
||||
title: '确定清空搜索历史?',
|
||||
onConfirm: () {
|
||||
historyList.clear();
|
||||
GStorage.historyWord.delete('cacheList');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
GStorage.historyWord.put('cacheList', historyList);
|
||||
subDispose();
|
||||
searchFocusNode.dispose();
|
||||
controller.dispose();
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
|
||||
class SearchPage extends StatefulWidget {
|
||||
@@ -394,15 +395,19 @@ class _SearchPageState extends State<SearchPage> {
|
||||
Icons.import_export_outlined,
|
||||
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.8),
|
||||
),
|
||||
style: IconButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
style: IconButton.styleFrom(padding: EdgeInsets.zero),
|
||||
onPressed: () => showInportExportDialog<List>(
|
||||
context,
|
||||
title: '历史记录',
|
||||
toJson: () => jsonEncode(_searchController.historyList),
|
||||
fromJson: (json) {
|
||||
_searchController.historyList.value = json.cast<String>();
|
||||
try {
|
||||
_searchController.historyList.value = List<String>.from(json);
|
||||
return true;
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
return false;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -38,7 +38,6 @@ class _WebDavSettingPageState extends State<WebDavSettingPage> {
|
||||
Widget build(BuildContext context) {
|
||||
EdgeInsets padding = MediaQuery.viewPaddingOf(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: widget.showAppBar,
|
||||
appBar: !widget.showAppBar
|
||||
? null
|
||||
: AppBar(title: const Text('WebDAV 设置')),
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class GStorage {
|
||||
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> setting;
|
||||
static late final Box<dynamic> video;
|
||||
@@ -41,7 +41,7 @@ class GStorage {
|
||||
// 设置
|
||||
setting = await Hive.openBox('setting');
|
||||
// 搜索历史
|
||||
historyWord = await Hive.openBox<List<String>>(
|
||||
historyWord = await Hive.openBox(
|
||||
'historyWord',
|
||||
compactionStrategy: (int entries, int deletedEntries) {
|
||||
return deletedEntries > 10;
|
||||
@@ -63,11 +63,12 @@ class GStorage {
|
||||
static Future<void> importAllSettings(String 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 video.clear();
|
||||
await setting.putAll(map[setting.name]);
|
||||
await video.putAll(map[video.name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void regAdapter() {
|
||||
|
||||
Reference in New Issue
Block a user