|
|
@@ -56,6 +56,7 @@ class ImagePickerUtil {
|
|
|
static final Rx<int> similarPhotosSize = 0.obs;
|
|
|
|
|
|
static var similarResult = <ClassifiedImageGroup>[].obs;
|
|
|
+ static var allSimilarResult =<ClassifiedImageGroup>[].obs;
|
|
|
static var peopleResult = <ClassifiedImage>[].obs;
|
|
|
static var screenshotResult = <ClassifiedImage>[].obs;
|
|
|
static var blurryResult = <ClassifiedImage>[].obs;
|
|
|
@@ -71,7 +72,7 @@ class ImagePickerUtil {
|
|
|
|
|
|
static loadClassifiedPhotoData(ClassificationResult result) async {
|
|
|
if (result.similarGroups != null) {
|
|
|
- similarResult.assignAll(result.similarGroups ?? []);
|
|
|
+ similarResult(result.similarGroups ?? []);
|
|
|
await newUpdatePhotoGroups("similar", similarResult);
|
|
|
}
|
|
|
|
|
|
@@ -259,12 +260,15 @@ class ImagePickerUtil {
|
|
|
.removeWhere((element) => selectedPhotosIds.contains(element.assetsId));
|
|
|
blurrySize.value =
|
|
|
blurryResult.fold(0, (sum, image) => sum + image.fileSize);
|
|
|
- similarResult.map((group) => group.images.removeWhere(
|
|
|
- (element) => selectedPhotosIds.contains(element.assetsId)));
|
|
|
- similarPhotoCount.value =
|
|
|
- similarResult.fold(0, (sum, group) => sum + group.groupImageCount);
|
|
|
- similarPhotosSize.value =
|
|
|
- similarResult.fold(0, (sum, group) => sum + group.groupFileSize);
|
|
|
+ similarPhotosSize.value=0;
|
|
|
+ similarPhotoCount.value=0;
|
|
|
+ for (var group in allSimilarResult) {
|
|
|
+ group.images.removeWhere(
|
|
|
+ (element) => selectedPhotosIds.contains(element.assetsId));
|
|
|
+
|
|
|
+ similarPhotosSize.value += group.images.fold(0, (sum, image) => sum + image.fileSize);
|
|
|
+ similarPhotoCount.value += group.images.length;
|
|
|
+ }
|
|
|
|
|
|
debugPrint("ImagePickerUtil3 updatePhotoData $selectedPhotosIds");
|
|
|
CalendarState.removePhotosData(selectedPhotosIds);
|
|
|
@@ -320,11 +324,15 @@ class ImagePickerUtil {
|
|
|
similarPhotos.add(await _newConvertToAssetEntities(group.images));
|
|
|
similarPhotosSize.value += group.groupFileSize;
|
|
|
similarPhotoCount.value += group.groupImageCount;
|
|
|
+ allSimilarResult.add(group);
|
|
|
+
|
|
|
}
|
|
|
for (final group in ImagePickerUtil.similarPhotos) {
|
|
|
for (final asset in group) {
|
|
|
if (PhotoScanHandler.similarPhotos.length >= 4) break;
|
|
|
+ if(PhotoScanHandler.similarPhotos.contains(asset)) continue;
|
|
|
PhotoScanHandler.similarPhotos.add(asset);
|
|
|
+
|
|
|
}
|
|
|
if (PhotoScanHandler.similarPhotos.length >= 4) break;
|
|
|
}
|
|
|
@@ -353,8 +361,10 @@ class ImagePickerUtil {
|
|
|
peoplePhotos.assignAll(await _newConvertToAssetEntities(photoGroup));
|
|
|
peopleSize.value =
|
|
|
photoGroup.fold(0, (sum, image) => sum + image.fileSize);
|
|
|
+
|
|
|
for (final person in ImagePickerUtil.peoplePhotos) {
|
|
|
if (PhotoScanHandler.peoplePhotos.length >= 2) break;
|
|
|
+ if(PhotoScanHandler.peoplePhotos.contains(person)) continue;
|
|
|
PhotoScanHandler.peoplePhotos.add(person);
|
|
|
}
|
|
|
|