refactoring
security update
This commit is contained in:
parent
1747ab0245
commit
78fe9e7b09
39 changed files with 289 additions and 132 deletions
|
@ -3,10 +3,9 @@ import 'dart:async';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:mc_gallery/features/core/data/extensions/value_notifier_extensions.dart';
|
||||
|
||||
import '/features/core/abstracts/base_view_model.dart';
|
||||
import '/features/core/services/logging_service.dart';
|
||||
import '/features/core/data/extensions/value_notifier_extensions.dart';
|
||||
import '/features/core/services/navigation_service.dart';
|
||||
import '/locator.dart';
|
||||
import '../../data/enums/search_option.dart';
|
||||
|
@ -20,17 +19,14 @@ class GalleryViewModel extends BaseViewModel {
|
|||
required ImagesService imagesService,
|
||||
required NavigationService navigationService,
|
||||
required ImageCacheManagerService imageCacheManagerService,
|
||||
required LoggingService loggingService,
|
||||
}) : _imagesService = imagesService,
|
||||
_navigationService = navigationService,
|
||||
_imageCacheManagerService = imageCacheManagerService,
|
||||
_loggingService = loggingService;
|
||||
_imageCacheManagerService = imageCacheManagerService;
|
||||
|
||||
final ImagesService _imagesService;
|
||||
final NavigationService _navigationService;
|
||||
//todo(mehul): Use to implement pull-to-refresh or an extra widget
|
||||
final ImageCacheManagerService _imageCacheManagerService;
|
||||
final LoggingService _loggingService;
|
||||
|
||||
final ValueNotifier<bool> _isDisplayingPressingPrompt = ValueNotifier(true);
|
||||
ValueListenable<bool> get isDisplayingPressingPrompt => _isDisplayingPressingPrompt;
|
||||
|
@ -59,7 +55,7 @@ class GalleryViewModel extends BaseViewModel {
|
|||
// If empty-string (from backspacing) -> reset state.
|
||||
if (searchTerm.isEmpty) {
|
||||
_imageSearchResultsNotifier.value = [];
|
||||
_loggingService.info('Clearing results on search string removal');
|
||||
log.info('Clearing results on search string removal');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,7 +78,7 @@ class GalleryViewModel extends BaseViewModel {
|
|||
// If transitioning from 'Searching', clear previous results immediately
|
||||
if (_isSearchingNotifier.value) {
|
||||
_imageSearchResultsNotifier.value = [];
|
||||
_loggingService.info('Clearing of results on view mode change');
|
||||
log.info('Clearing of results on view mode change');
|
||||
}
|
||||
|
||||
_isSearchingNotifier.flipValue();
|
||||
|
@ -92,10 +88,10 @@ class GalleryViewModel extends BaseViewModel {
|
|||
|
||||
void onSearchOptionChanged(SearchOption? option) {
|
||||
_searchOptionNotifier.value = option!;
|
||||
_loggingService.info('Switched over to $option search');
|
||||
log.info('Switched over to $option search');
|
||||
|
||||
_imageSearchResultsNotifier.value = [];
|
||||
_loggingService.info('Cleared resultsw from view');
|
||||
log.info('Cleared resultsw from view');
|
||||
|
||||
//todo(mehul): Either redo search or force user to type in new (trigger) by clearing field
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue