Skip to content

Commit

Permalink
added logic for clearing selected files on back function
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-dor committed Aug 18, 2024
1 parent 111ed72 commit 320914e
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 43 deletions.
72 changes: 39 additions & 33 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ PODS:
- AppAuth/Core
- camera_avfoundation (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- emoji_picker_flutter (0.0.1):
- Flutter
- FBAEMKit (16.3.1):
Expand All @@ -22,20 +24,20 @@ PODS:
- Firebase/Crashlytics (10.25.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 10.25.0)
- firebase_core (2.31.0):
- firebase_core (2.32.0):
- Firebase/CoreOnly (= 10.25.0)
- Flutter
- firebase_crashlytics (3.5.5):
- firebase_crashlytics (3.5.7):
- Firebase/Crashlytics (= 10.25.0)
- firebase_core
- Flutter
- FirebaseCore (10.25.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreExtension (10.27.0):
- FirebaseCoreExtension (10.29.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.27.0):
- FirebaseCoreInternal (10.29.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.25.0):
- FirebaseCore (~> 10.5)
Expand All @@ -46,13 +48,13 @@ PODS:
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseInstallations (10.27.0):
- FirebaseInstallations (10.29.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseRemoteConfigInterop (10.27.0)
- FirebaseSessions (10.27.0):
- FirebaseRemoteConfigInterop (10.29.0)
- FirebaseSessions (10.29.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
Expand All @@ -70,9 +72,9 @@ PODS:
- Mantle
- SDWebImage
- SDWebImageWebPCoder
- flutter_webrtc (0.11.0):
- flutter_webrtc (0.11.3):
- Flutter
- WebRTC-SDK (= 125.6422.02)
- WebRTC-SDK (= 125.6422.04)
- fluttertoast (0.0.2):
- Flutter
- Toast
Expand Down Expand Up @@ -108,10 +110,10 @@ PODS:
- GTMAppAuth (4.1.1):
- AppAuth/Core (~> 1.7)
- GTMSessionFetcher/Core (< 4.0, >= 3.3)
- GTMSessionFetcher (3.4.1):
- GTMSessionFetcher/Full (= 3.4.1)
- GTMSessionFetcher/Core (3.4.1)
- GTMSessionFetcher/Full (3.4.1):
- GTMSessionFetcher (3.5.0):
- GTMSessionFetcher/Full (= 3.5.0)
- GTMSessionFetcher/Core (3.5.0)
- GTMSessionFetcher/Full (3.5.0):
- GTMSessionFetcher/Core
- image_picker_ios (0.0.1):
- Flutter
Expand Down Expand Up @@ -150,9 +152,9 @@ PODS:
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- SDWebImage (5.19.4):
- SDWebImage/Core (= 5.19.4)
- SDWebImage/Core (5.19.4)
- SDWebImage (5.19.6):
- SDWebImage/Core (= 5.19.6)
- SDWebImage/Core (5.19.6)
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
Expand All @@ -169,10 +171,11 @@ PODS:
- video_thumbnail (0.0.1):
- Flutter
- libwebp
- WebRTC-SDK (125.6422.02)
- WebRTC-SDK (125.6422.04)

DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
Expand Down Expand Up @@ -227,6 +230,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
emoji_picker_flutter:
:path: ".symlinks/plugins/emoji_picker_flutter/ios"
firebase_core:
Expand Down Expand Up @@ -270,53 +275,54 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
emoji_picker_flutter: fe2e6151c5b548e975d546e6eeb567daf0962a58
FBAEMKit: 6c7b5eb77c96861bb59e040842c6e55bf39512ce
FBSDKCoreKit: 5e4dd478947ab1bcc887e8cfadeae0727af1a942
FBSDKCoreKit_Basics: cd7b5f5d1e8868c26706917919d058999ca672c3
FBSDKLoginKit: 572cca0bc6c90067ef197187697cb3b584310c52
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
firebase_core: 0b39f4f424e02eecabb2356ddf331fa07b772af8
firebase_crashlytics: 5adb9a5ac7858811cef7a9447a011bb4dcb540c3
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreExtension: 4ec89dd0c6de93d6becde32122d68b7c35f6bf5d
FirebaseCoreInternal: 4b297a2d56063dbea2c1d0d04222d44a8d058862
FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
FirebaseCrashlytics: 4b96efb0ce73b38b2a85e8b8bd1bd8f63f09d015
FirebaseInstallations: 766dabca09fd94aef922538aaf144cc4a6fb6869
FirebaseRemoteConfigInterop: c55a739f5ab121792776e191d9fd437dc624a541
FirebaseSessions: 2fdf949f9e58295a57703ae8f2efc44f9fa3aa16
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_facebook_auth: c8700ab1770f3d8e5e7456220e4f3bbcdb831454
flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
flutter_webrtc: 76cc6996bc9562799a239c94c560d6348ba34ce5
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
flutter_webrtc: 75b868e4f9e817c7a9a42ca4b6169063de4eec9f
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
lecle_downloads_path_provider: b24e71004ad61a26c7e4422373627acdb01d9251
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
nanopb: 438bc412db1928dac798aa6fd75726007be04262
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
photo_manager: ff695c7a1dd5bc379974953a2b5c0a293f7c4c8a
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
SDWebImage: a79252b60f4678812d94316c91da69ec83089c9f
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1
WebRTC-SDK: 5319b8964f453c5ea6030d93c345082c4f40aa1c
WebRTC-SDK: c3d69a87e7185fad3568f6f3cff7c9ac5890acf3

PODFILE CHECKSUM: 4a34f2a7453090eeeb342bde9003c9d9593cf26e

Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:math';

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:yahay/core/app_settings/dio/dio_settings.dart';
import 'package:yahay/core/app_settings/dio/http_status_codes.dart';
import 'package:yahay/core/utils/shared_preferences/shared_preferences.dart';
Expand All @@ -24,6 +25,8 @@ class DebugImageCreatorInAppsFolder with FolderCreator {
Future<void> createImagesInAppsFolder() async {
final checkSet = _sharedPreferHelper.getBoolByKey(key: _key);

debugPrint("images saved: $checkSet");

if ((checkSet ?? false)) return;

await _sharedPreferHelper.setBoolByKey(key: _key, value: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TelegramFilePickerBottomButton {
child: const Center(
child: Icon(
Icons.image,
color: Colors.white,
),
),
),
Expand Down Expand Up @@ -72,6 +73,7 @@ class TelegramFilePickerBottomButton {
child: const Center(
child: Icon(
Icons.file_open_outlined,
color: Colors.white,
),
),
),
Expand Down Expand Up @@ -104,6 +106,7 @@ class TelegramFilePickerBottomButton {
child: const Center(
child: Icon(
Icons.file_open_outlined,
color: Colors.white,
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ class TelegramStorageFilePickerDataModel {
),
);

_telegramBloc.events.add(
const GetSpecificFolderDataEvent(
getGalleryData: true,
),
);
Future.delayed(const Duration(milliseconds: 300), () {
_telegramBloc.events.add(
const GetSpecificFolderDataEvent(
getGalleryData: true,
),
);
});
},
),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class TelegramFilePickerBloc {
yield* _recentFilesPaginationEvent(event);
} else if (event is SelectGalleryFileEvent) {
yield* _selectGalleryFileEvent(event);
} else if (event is ClearSelectedGalleryFileEvent) {
yield* _clearSelectedGalleryFileEvent(event);
} else if (event is BrowseInternalStorageAndSelectFilesEvent) {
yield* _browseInternalStorageAndSelectFilesEvent(event);
} else if (event is SelectScreenForFilesPickerScreenEvent) {
Expand Down Expand Up @@ -295,6 +297,13 @@ class TelegramFilePickerBloc {
yield* _emitter();
}

static Stream<TelegramFilePickerStates> _clearSelectedGalleryFileEvent(
ClearSelectedGalleryFileEvent event,
) async* {
_currentStateModel.clearPickedFiles();
yield* _emitter();
}

static Stream<TelegramFilePickerStates> _selectGalleryFileEvent(
SelectGalleryFileEvent event,
) async* {
Expand Down Expand Up @@ -384,13 +393,14 @@ class TelegramFilePickerBloc {
static Stream<TelegramFilePickerStates> _getSpecificFolderDataEvent(
GetSpecificFolderDataEvent event,
) async* {
if (_currentStateModel.getPathForGettingImagesFrom == null) return;
if (_currentStateModel.getPathForGettingImagesFrom == null && !event.getGalleryData) return;
_currentStateModel.clearSpecificFolderData();
_currentStateModel.closeSpecificFolderDataStream();
if (event.getGalleryData) {
_currentStateModel.initSpecificFolderDataStream(
_filePickerUseCase.getRecentImagesAndVideos().listen(
(data) {
debugPrint("path of data: ${data?.file.path}");
_events.add(SpecificFolderDataStreamHandlerEvent(data));
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ final class SelectGalleryFileEvent extends TelegramFilePickerEvents {
const SelectGalleryFileEvent(this.telegramFileImageEntity);
}

final class ClearSelectedGalleryFileEvent extends TelegramFilePickerEvents {
const ClearSelectedGalleryFileEvent();
}

@immutable
final class RecentFilesPaginationEvent extends TelegramFilePickerEvents {
const RecentFilesPaginationEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class _TelegramStorageFileWidgetState extends State<TelegramStorageFileWidget> {
child: const Center(
child: Icon(
Icons.check,
size: 20,
size: 18,
color: Colors.white,
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class _TelegramBrowseAppFolderScreenState extends State<TelegramBrowseAppFolderS
TelegramFileFolderEnum.recentDownloadsScreen,
),
);
Future.delayed(const Duration(milliseconds: 300), () {
_telegramFilePickerBloc.events.add(const ClearSelectedGalleryFileEvent());
});
},
title: "...",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ class _TelegramFilesPickerScreenState extends State<TelegramFilesPickerScreen> w
TelegramFileFolderEnum.browseTheAppsFolder,
),
);
Future.delayed(const Duration(milliseconds: 300), () {
_telegramFilePickerBloc.events.add(const ClearSelectedGalleryFileEvent());
});
},
child: AnimatedSlide(
curve: Curves.fastOutSlowIn,
Expand All @@ -205,6 +208,10 @@ class _TelegramFilesPickerScreenState extends State<TelegramFilesPickerScreen> w
TelegramFileFolderEnum.browseTheAppsFolder,
),
);
Future.delayed(const Duration(milliseconds: 300), () {
_telegramFilePickerBloc.events
.add(const ClearSelectedGalleryFileEvent());
});
},
),
),
Expand All @@ -229,6 +236,10 @@ class _TelegramFilesPickerScreenState extends State<TelegramFilesPickerScreen> w
TelegramFileFolderEnum.recentDownloadsScreen,
),
);

Future.delayed(const Duration(milliseconds: 300), () {
_telegramFilePickerBloc.events.add(const ClearSelectedGalleryFileEvent());
});
},
child: AnimatedSlide(
curve: Curves.fastOutSlowIn,
Expand All @@ -251,6 +262,10 @@ class _TelegramFilesPickerScreenState extends State<TelegramFilesPickerScreen> w
TelegramFileFolderEnum.recentDownloadsScreen,
),
);

Future.delayed(const Duration(milliseconds: 300), () {
_telegramFilePickerBloc.events.add(const ClearSelectedGalleryFileEvent());
});
},
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:yahay/core/app_settings/app_theme/app_theme_bloc.dart';
import 'package:yahay/features/telegram_file_picker_feature/data/models/data_models/telegram_storage_file_picker_data_model.dart';
import 'package:yahay/features/telegram_file_picker_feature/view/pages/screens/telegram_app_folder_screen/telegram_browse_app_folder_screen.dart';
import 'package:yahay/injections/injections.dart';

class TelegramFilesFromStoragesWidget extends StatefulWidget {
const TelegramFilesFromStoragesWidget({
Expand All @@ -13,12 +15,22 @@ class TelegramFilesFromStoragesWidget extends StatefulWidget {
}

class _TelegramFilesFromStoragesWidgetState extends State<TelegramFilesFromStoragesWidget> {
late AppThemeBloc _appThemeBloc;

@override
void initState() {
super.initState();
_appThemeBloc = snoopy<AppThemeBloc>();
}

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.blueGrey.shade900.withOpacity(0.5),
color: _appThemeBloc.theme.value.brightness == Brightness.dark
? Colors.blueGrey.shade900.withOpacity(0.5)
: Colors.white,
),
child: Column(
children: [
Expand Down
Loading

0 comments on commit 320914e

Please sign in to comment.