Skip to content

Commit

Permalink
Fix bug with file search
Browse files Browse the repository at this point in the history
修复文件搜索时的相关bug
  • Loading branch information
jiangtian616 committed May 4, 2024
1 parent f2231a0 commit a724f94
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions changelog/v7.5.3+208.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- 修复文件搜索时的相关bug

------------------------------------------------------------------------------------------

- Fix bug with file search
18 changes: 13 additions & 5 deletions lib/src/pages/search/mixin/search_page_logic_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ mixin SearchPageLogicMixin on BasePageLogic {
Future<void> handleFileSearch() async {
FilePickerResult? result;
try {
result = await FilePicker.platform.pickFiles(type: FileType.image);
result = await FilePicker.platform.pickFiles(
type: FileType.image,
allowCompression: false,
compressionQuality: 0,
);
} on Exception catch (e) {
Log.error('Pick file failed', e);
return;
}

if (result == null) {
Expand All @@ -114,7 +119,7 @@ mixin SearchPageLogicMixin on BasePageLogic {

state.loadingState = LoadingState.loading;
state.searchConfig.keyword = null;
update();
updateSafely();

try {
state.redirectUrl = await EHRequest.requestLookup(
Expand All @@ -125,18 +130,21 @@ mixin SearchPageLogicMixin on BasePageLogic {
} on DioException catch (e) {
Log.error('fileSearchFailed'.tr, e.errorMsg);
snack('fileSearchFailed'.tr, e.errorMsg ?? '');
state.hasSearched = false;
state.loadingState = LoadingState.idle;
update([loadingStateId]);
updateSafely();
return;
} on EHSiteException catch (e) {
Log.error('fileSearchFailed'.tr, e.message);
snack('fileSearchFailed'.tr, e.message);
state.hasSearched = false;
state.loadingState = LoadingState.idle;
update([loadingStateId]);
updateSafely();
return;
} on CheckException catch (_) {
state.hasSearched = false;
state.loadingState = LoadingState.idle;
update([loadingStateId]);
updateSafely();
rethrow;
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: jhentai
description: A flutter app for E-Hentai/EXHentai

publish_to: 'none'
version: 7.5.3+207
version: 7.5.3+208

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down

0 comments on commit a724f94

Please sign in to comment.