upgrade photos_manager pkg

This commit is contained in:
Neeraj Gupta 2022-05-12 08:57:32 +05:30
parent 971484e795
commit 22babe31e6
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
8 changed files with 30 additions and 27 deletions

View file

@ -139,7 +139,7 @@ PODS:
- Flutter
- "permission_handler (5.1.0+2)":
- Flutter
- photo_manager (1.0.0):
- photo_manager (2.0.0):
- Flutter
- FlutterMacOS
- PromisesObjC (2.0.0)
@ -370,7 +370,7 @@ SPEC CHECKSUMS:
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
photo_manager: 84fa94fbeb82e607333ea9a13c43b58e0903a463
photo_manager: 4f6810b7dfc4feb03b461ac1a70dacf91fba7604
PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
@ -392,4 +392,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 58fb802948678e2071d210cfc8aab09d85c8341b
COCOAPODS: 1.11.3
COCOAPODS: 1.11.2

View file

@ -82,7 +82,7 @@ class File {
}
}
file.modificationTime = asset.modifiedDateTime.microsecondsSinceEpoch;
file.fileSubType = asset.subTypes;
file.fileSubType = asset.subtype;
file.metadataVersion = kCurrentMetadataVersion;
return file;
}
@ -94,9 +94,9 @@ class File {
type = FileType.image;
// PHAssetMediaSubtype.photoLive.rawValue is 8
// This hack should go away once photos_manager support livePhotos
if (asset.subTypes != null &&
asset.subTypes > -1 &&
(asset.subTypes & 8) != 0) {
if (asset.subtype != null &&
asset.subtype > -1 &&
(asset.subtype & 8) != 0) {
type = FileType.livePhoto;
}
break;
@ -142,7 +142,7 @@ class File {
final asset = await getAsset();
// asset can be null for files shared to app
if (asset != null) {
fileSubType = asset.subTypes;
fileSubType = asset.subtype;
if (fileType == FileType.video) {
duration = asset.duration;
}

View file

@ -232,7 +232,8 @@ class LocalSyncService {
updatedFiles
.removeWhere((file) => downloadedFileIDs.contains(file.localID));
if (updatedFiles.isNotEmpty) {
_logger.info(updatedFiles.length.toString() + " local files were updated.");
_logger.info(
updatedFiles.length.toString() + " local files were updated.");
}
for (final file in updatedFiles) {
await _db.updateUploadedFile(

View file

@ -28,10 +28,12 @@ Future<List<File>> getDeviceFiles(
}
Future<List<LocalAsset>> getAllLocalAssets() async {
final filterOptionGroup = FilterOptionGroup(
imageOption: FilterOption(sizeConstraint: ignoreSizeConstraint),
videoOption: FilterOption(sizeConstraint: ignoreSizeConstraint),
createTimeCond: DateTimeCond.def().copyWith(ignore: true));
final filterOptionGroup = FilterOptionGroup();
filterOptionGroup.setOption(
AssetType.image, FilterOption(sizeConstraint: ignoreSizeConstraint));
filterOptionGroup.setOption(
AssetType.video, FilterOption(sizeConstraint: ignoreSizeConstraint));
filterOptionGroup.createTimeCond = DateTimeCond.def().copyWith(ignore: true);
final assetPaths = await PhotoManager.getAssetPathList(
hasAll: true,
type: RequestType.common,
@ -39,7 +41,8 @@ Future<List<LocalAsset>> getAllLocalAssets() async {
);
final List<LocalAsset> assets = [];
for (final assetPath in assetPaths) {
for (final asset in await assetPath.assetList) {
for (final asset
in await assetPath.getAssetListPaged(page: 0, size: 10000)) {
assets.add(LocalAsset(asset.id, assetPath.name));
}
}
@ -131,7 +134,7 @@ Future<List<File>> _computeFiles(AssetPathEntity pathEntity, int fromTime,
List<File> files, Computer computer) async {
final args = Map<String, dynamic>();
args["pathEntity"] = pathEntity;
args["assetList"] = await pathEntity.assetList;
args["assetList"] = await pathEntity.getAssetListPaged(page: 0, size: 10000);
args["fromTime"] = fromTime;
args["files"] = files;
return await computer.compute(_getFiles, param: args);

View file

@ -95,9 +95,8 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(ente.File file) async {
sourceFile = io.File(livePhotoPath);
}
thumbnailData = await asset.thumbDataWithSize(
kThumbnailLargeSize,
kThumbnailLargeSize,
thumbnailData = await asset.thumbnailDataWithSize(
ThumbnailSize(kThumbnailLargeSize, kThumbnailLargeSize),
quality: kThumbnailQuality,
);
if (thumbnailData == null) {

View file

@ -6,6 +6,7 @@ import 'dart:typed_data';
import 'package:dio/dio.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:logging/logging.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/core/cache/thumbnail_cache.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/constants.dart';
@ -82,7 +83,9 @@ Future<Uint8List> getThumbnailFromLocal(File file,
if (asset == null || !(await asset.exists)) {
return null;
}
return asset.thumbDataWithSize(size, size, quality: quality).then((data) {
return asset
.thumbnailDataWithSize(ThumbnailSize(size, size), quality: quality)
.then((data) {
ThumbnailLruCache.put(file, data, size);
return data;
});

View file

@ -838,12 +838,10 @@ packages:
photo_manager:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "474fe1df8504307f98a8390032693203f2f47997"
url: "https://github.com/ente-io/flutter_photo_manager.git"
source: git
version: "1.3.6"
name: photo_manager
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
photo_view:
dependency: "direct main"
description:

View file

@ -77,8 +77,7 @@ dependencies:
page_transition: ^2.0.2
path_provider: ^2.0.1
pedantic: ^1.9.2
photo_manager:
git: "https://github.com/ente-io/flutter_photo_manager.git"
photo_manager: ^2.0.8
photo_view: ^0.13.0
pie_chart:
git: "https://github.com/apgapg/pie_chart.git"