Compare commits

...

2 Commits

Author SHA1 Message Date
Prateek Sunal
b25ffbe700 chore: lint fixes 2025-07-03 01:58:05 +05:30
Prateek Sunal
45731e7150 fix: only share image link when using Send Link 2025-07-03 01:52:31 +05:30

View File

@@ -13,13 +13,11 @@ import "package:photos/generated/l10n.dart";
import "package:photos/models/collection/collection.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import "package:photos/ui/sharing/show_images_prevew.dart";
import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/exif_util.dart';
import 'package:photos/utils/file_util.dart';
import 'package:photos/utils/standalone/date_time.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import "package:screenshot/screenshot.dart";
import 'package:share_plus/share_plus.dart';
import "package:uuid/uuid.dart";
@@ -253,7 +251,6 @@ Future<void> shareAlbumLinkWithPlaceholder(
String url,
GlobalKey key,
) async {
final ScreenshotController screenshotController = ScreenshotController();
final List<EnteFile> filesInCollection =
(await FilesDB.instance.getFilesInCollection(
collection.id,
@@ -274,15 +271,9 @@ Future<void> shareAlbumLinkWithPlaceholder(
await shareText(url);
return;
} else {
final placeholderBytes = await _createAlbumPlaceholder(
filesInCollection,
screenshotController,
context,
);
await dialog.hide();
await shareImageAndUrl(
placeholderBytes,
await shareText(
url,
context: context,
key: key,
@@ -303,21 +294,3 @@ Rect _sharePosOrigin(BuildContext? context, GlobalKey? key) {
}
return rect;
}
Future<Uint8List> _createAlbumPlaceholder(
List<EnteFile> files,
ScreenshotController screenshotController,
BuildContext context,
) async {
final Widget imageWidget = LinkPlaceholder(
files: files,
);
final double pixelRatio = MediaQuery.devicePixelRatioOf(context);
final bytesOfImageToWidget = await screenshotController.captureFromWidget(
imageWidget,
pixelRatio: pixelRatio,
targetSize: MediaQuery.sizeOf(context),
delay: const Duration(milliseconds: 300),
);
return bytesOfImageToWidget;
}