diff --git a/lib/core/utils/image_comporessor/image_compressor.dart b/lib/core/utils/image_comporessor/image_compressor.dart index 85d6a2d..4e6e365 100644 --- a/lib/core/utils/image_comporessor/image_compressor.dart +++ b/lib/core/utils/image_comporessor/image_compressor.dart @@ -28,6 +28,7 @@ abstract final class ImageCompressor { originalPath: file.path, isImage: true, ); + return result; } } diff --git a/lib/features/telegram_file_picker_feature/data/models/telegram_path_folder_file_model.dart b/lib/features/telegram_file_picker_feature/data/models/telegram_path_folder_file_model.dart index 546a20e..4997914 100644 --- a/lib/features/telegram_file_picker_feature/data/models/telegram_path_folder_file_model.dart +++ b/lib/features/telegram_file_picker_feature/data/models/telegram_path_folder_file_model.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:yahay/features/telegram_file_picker_feature/domain/entities/telegram_path_folder_file.dart'; final class TelegramPathFolderFileModel extends TelegramPathFolderFile { @@ -11,6 +13,25 @@ final class TelegramPathFolderFileModel extends TelegramPathFolderFile { super.fileName, }); + TelegramPathFolderFileModel clone({ + File? file, + String? originalPath, + bool? isFolder, + bool? isImage, + bool? isVideo, + String? fileExtension, + String? fileName, + }) => + TelegramPathFolderFileModel( + file ?? this.file, + originalPath: originalPath ?? this.originalPath, + isFolder: isFolder ?? this.isFolder, + isImage: isImage ?? this.isImage, + isVideo: isVideo ?? this.isVideo, + fileExtension: fileExtension ?? this.fileExtension, + fileName: fileName ?? this.fileName, + ); + TelegramPathFolderFileModel? fromEntity( TelegramPathFolderFile? entity, ) { diff --git a/lib/features/telegram_file_picker_feature/mixins/app_storage_file_mixin/app_storage_file_mixin.dart b/lib/features/telegram_file_picker_feature/mixins/app_storage_file_mixin/app_storage_file_mixin.dart index d5c7695..c95d837 100644 --- a/lib/features/telegram_file_picker_feature/mixins/app_storage_file_mixin/app_storage_file_mixin.dart +++ b/lib/features/telegram_file_picker_feature/mixins/app_storage_file_mixin/app_storage_file_mixin.dart @@ -67,15 +67,19 @@ mixin class AppStorageFileMixin { TelegramPathFolderFileModel? model = TelegramPathFolderFileModel( File(each.path), fileExtension: p.extension(each.path), - fileName: p.basenameWithoutExtension(each.path), + fileName: p.basename(each.path), ); if (FileSystemEntity.isDirectorySync(each.path)) { model.isFolder = true; } else if (reusables.isImageFile(each.path)) { - model = await ImageCompressor.compressedImageFile( + model = (await ImageCompressor.compressedImageFile( file: model.file, directoryPath: tempPath.path, + )) + ?.clone( + fileExtension: model.fileExtension, + fileName: model.fileName, ); } else if (reusables.isVideoFile(each.path)) { model.isVideo = true; diff --git a/lib/features/telegram_file_picker_feature/view/bloc/state_model/telegram_file_picker_state_model.dart b/lib/features/telegram_file_picker_feature/view/bloc/state_model/telegram_file_picker_state_model.dart index 7182e15..9345e02 100644 --- a/lib/features/telegram_file_picker_feature/view/bloc/state_model/telegram_file_picker_state_model.dart +++ b/lib/features/telegram_file_picker_feature/view/bloc/state_model/telegram_file_picker_state_model.dart @@ -148,7 +148,7 @@ class TelegramFilePickerStateModel { void addToFolderDataList(TelegramFileImageEntity value) { _specificFolderFilesAll.add(value); if (_specificFolderFilesPagination.length < Constants.perPage) { - _recentFilesPagination.add(value); + _specificFolderFilesPagination.add(value); } } diff --git a/lib/features/telegram_file_picker_feature/view/bloc/telegram_file_picker_bloc.dart b/lib/features/telegram_file_picker_feature/view/bloc/telegram_file_picker_bloc.dart index 074e53a..498f45d 100644 --- a/lib/features/telegram_file_picker_feature/view/bloc/telegram_file_picker_bloc.dart +++ b/lib/features/telegram_file_picker_feature/view/bloc/telegram_file_picker_bloc.dart @@ -388,7 +388,6 @@ class TelegramFilePickerBloc { .getSpecificFolderData(_currentStateModel.getPathForGettingImagesFrom!) .listen( (data) { - debugPrint("coming file: ${data?.file}"); _events.add(SpecificFolderDataStreamHandlerEvent(data)); }, ), @@ -400,6 +399,8 @@ class TelegramFilePickerBloc { SpecificFolderDataStreamHandlerEvent event, ) async* { if (event.file == null) return; + debugPrint("coming file 2: ${event.file?.file}"); + final value = TelegramFileImageEntity( file: event.file!.file, videoPlayerController: diff --git a/lib/features/telegram_file_picker_feature/view/pages/screens/telegram_app_folder_screen/telegram_browse_folder_data_screen.dart b/lib/features/telegram_file_picker_feature/view/pages/screens/telegram_app_folder_screen/telegram_browse_folder_data_screen.dart index 8b6f3d1..64bae1a 100644 --- a/lib/features/telegram_file_picker_feature/view/pages/screens/telegram_app_folder_screen/telegram_browse_folder_data_screen.dart +++ b/lib/features/telegram_file_picker_feature/view/pages/screens/telegram_app_folder_screen/telegram_browse_folder_data_screen.dart @@ -38,6 +38,7 @@ class _TelegramBrowseFolderDataScreenState extends State