Skip to content

Commit d171eb7

Browse files
committed
fix:修复子账户搜索时路径显示可能正确的问题
1 parent 6631bc5 commit d171eb7

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

lib/screen/file_list/file_list_screen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ class _FileListScreenState extends State<FileListScreen>
146146
}
147147
});
148148
}
149-
_userController.loadSettings();
150149
LogUtil.d("initState", tag: tag);
151150
}
152151

lib/screen/file_search_screen.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class FileSearchScreen extends StatelessWidget {
9292
GestureDetector(
9393
onTap: () => Get.back(),
9494
child: Padding(
95-
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
95+
padding:
96+
const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
9697
child: Text(Intl.fileSearchScreen_cancel.tr),
9798
),
9899
)
@@ -175,8 +176,21 @@ class FileSearchController extends GetxController {
175176
DioUtils.instance.requestNetwork<FileSearchResp>(Method.post, "fs/search",
176177
params: body, onSuccess: (data) {
177178
if (textEditingController.text.trim() == text) {
179+
UserController userController = Get.find<UserController>();
180+
var user = userController.user.value;
181+
if (user.basePath != null &&
182+
user.basePath != '' &&
183+
user.basePath != '/') {
184+
data?.content?.forEach((element) {
185+
element.parent = element.parent?.substring(user.basePath!.length);
186+
});
187+
}
178188
list.value = data?.content ?? [];
179189
}
190+
}, onError: (code, msg) {
191+
if (textEditingController.text.trim() == text) {
192+
SmartDialog.showToast(msg);
193+
}
180194
}, cancelToken: _cancelToken);
181195
}
182196

lib/util/user_controller.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:alist/entity/public_settings_resp.dart';
33
import 'package:alist/net/dio_utils.dart';
44
import 'package:dio/dio.dart';
55
import 'package:flustars/flustars.dart';
6+
import 'package:flutter/cupertino.dart';
67
import 'package:get/get.dart';
78

89
import 'constant.dart';
@@ -27,6 +28,7 @@ class UserController extends GetxController {
2728
if (fromCache || user.basePath == null || user.basePath!.isEmpty) {
2829
requestBasePath(user);
2930
}
31+
loadSettings();
3032
}
3133

3234
void loadSettings() {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 1.0.8+9
19+
version: 1.0.9+10
2020

2121
environment:
2222
sdk: '>=2.19.6 <3.0.0'

0 commit comments

Comments
 (0)