Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] share placeholder with link when sharing 2nd draft

Aman Raj Singh Mourya7f816e80a2f2
diff --git a/mobile/lib/ui/actions/collection/collection_sharing_actions.dart b/mobile/lib/ui/actions/collection/collection_sharing_actions.dart
index 0d571c2d87..3328722dbe 100644
--- a/mobile/lib/ui/actions/collection/collection_sharing_actions.dart
+++ b/mobile/lib/ui/actions/collection/collection_sharing_actions.dart
@@ -110,7 +110,6 @@ class CollectionActions {
BuildContext context,
List<EnteFile> files,
) async {
- print("CREATED LINK");
final dialog = createProgressDialog(
context,
S.of(context).creatingLink,
diff --git a/mobile/lib/ui/sharing/show_images_prevew.dart b/mobile/lib/ui/sharing/show_images_prevew.dart
index 7b0632554a..e779df80d1 100644
--- a/mobile/lib/ui/sharing/show_images_prevew.dart
+++ b/mobile/lib/ui/sharing/show_images_prevew.dart
@@ -7,15 +7,15 @@ import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class ShowImagePreviewFromTap extends StatelessWidget {
const ShowImagePreviewFromTap({
- required this.tempEnteFile,
+ required this.ownedSelectedFiles,
super.key,
});
- final List<EnteFile> tempEnteFile;
+ final List<EnteFile> ownedSelectedFiles;
@override
Widget build(BuildContext context) {
- final int length = tempEnteFile.length;
+ final int length = ownedSelectedFiles.length;
Widget placeholderWidget = const SizedBox(
height: 300, // Adjusted height
width: 300, // Adjusted width
@@ -25,7 +25,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
placeholderWidget = AspectRatio(
aspectRatio: 1,
child: BackDrop(
- backDropImage: tempEnteFile[0],
+ backDropImage: ownedSelectedFiles[0],
children: [
Padding(
padding: const EdgeInsets.all(18.0),
@@ -54,7 +54,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
cornerSmoothing: 1,
),
child: ThumbnailWidget(
- tempEnteFile[0],
+ ownedSelectedFiles[0],
shouldShowArchiveStatus: false,
shouldShowSyncStatus: false,
),
@@ -68,7 +68,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
placeholderWidget = AspectRatio(
aspectRatio: 1,
child: BackDrop(
- backDropImage: tempEnteFile[0],
+ backDropImage: ownedSelectedFiles[0],
children: [
Positioned(
right: 20,
@@ -76,7 +76,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 190,
width: 190,
- collages: tempEnteFile[1],
+ collages: ownedSelectedFiles[1],
zIndex: 0.2,
),
),
@@ -86,7 +86,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 190,
width: 190,
- collages: tempEnteFile[0],
+ collages: ownedSelectedFiles[0],
zIndex: -0.2,
),
),
@@ -97,7 +97,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
placeholderWidget = AspectRatio(
aspectRatio: 1,
child: BackDrop(
- backDropImage: tempEnteFile[0],
+ backDropImage: ownedSelectedFiles[0],
children: [
//left image
Positioned(
@@ -106,7 +106,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 160,
width: 160,
- collages: tempEnteFile[1],
+ collages: ownedSelectedFiles[1],
zIndex: -0.3,
),
),
@@ -117,7 +117,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 160,
width: 160,
- collages: tempEnteFile[2],
+ collages: ownedSelectedFiles[2],
zIndex: 0.3,
),
),
@@ -128,7 +128,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 175,
width: 175,
- collages: tempEnteFile[0],
+ collages: ownedSelectedFiles[0],
zIndex: 0.0,
),
),
@@ -141,7 +141,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: AspectRatio(
aspectRatio: 1,
child: BackDrop(
- backDropImage: tempEnteFile[0],
+ backDropImage: ownedSelectedFiles[0],
children: [
Positioned(
top: 20,
@@ -149,7 +149,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 160,
width: 160,
- collages: tempEnteFile[1],
+ collages: ownedSelectedFiles[1],
zIndex: 0,
),
),
@@ -159,7 +159,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 160,
width: 160,
- collages: tempEnteFile[2],
+ collages: ownedSelectedFiles[2],
zIndex: 0,
),
),
@@ -169,7 +169,7 @@ class ShowImagePreviewFromTap extends StatelessWidget {
child: CustomImage(
height: 175,
width: 175,
- collages: tempEnteFile[0],
+ collages: ownedSelectedFiles[0],
zIndex: 0.0,
),
),
diff --git a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
index a6ad143d28..274ef87cd7 100644
--- a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -99,6 +99,7 @@ class _FileSelectionActionsWidgetState
@override
void dispose() {
widget.selectedFiles.removeListener(_selectFileChangeListener);
+ generatedPathNotifier.dispose();
super.dispose();
}
@@ -615,7 +616,7 @@ class _FileSelectionActionsWidgetState
final DateTime timeStamp = DateTime.now();
await Directory(directoryPath).create(recursive: true);
final String filePath = '$directoryPath/$timeStamp.jpg';
- final file = await File(filePath).writeAsBytes(bytes!);
+ final file = await File(filePath).writeAsBytes(bytes);
path = file.path;
} catch (e) {
debugPrint(e.toString());
@@ -624,22 +625,24 @@ class _FileSelectionActionsWidgetState
}
ValueNotifier<String?> generatedPathNotifier = ValueNotifier<String?>(null);
-//Future function to go to next page
- Future<String?> _nextPageForTesting(List<EnteFile> tempfile) async {
+
+ Future<String?> _selectedFilePlaceholderPath(
+ List<EnteFile> ownedSelectedFiles,
+ ) async {
final Widget imageWidget = ShowImagePreviewFromTap(
- tempEnteFile: tempfile,
+ ownedSelectedFiles: ownedSelectedFiles,
);
await Future.delayed(const Duration(milliseconds: 100));
final double pixelRatio = MediaQuery.of(context).devicePixelRatio;
final bytesOfImageToWidget = await screenshotController.captureFromWidget(
imageWidget,
pixelRatio: pixelRatio,
- targetSize: MediaQuery.of(context).size,
+ targetSize: MediaQuery.sizeOf(context),
delay: const Duration(milliseconds: 100),
);
- final String tempImagePath = await saveImage(bytesOfImageToWidget);
- return tempImagePath;
+ final String onCreateLinkTapped = await saveImage(bytesOfImageToWidget);
+ return onCreateLinkTapped;
}
Future<void> _onCreatedSharedLinkClicked() async {
@@ -653,7 +656,7 @@ class _FileSelectionActionsWidgetState
_cachedCollectionForSharedLink ??= await collectionActions
.createSharedCollectionLink(context, split.ownedByCurrentUser);
- final List<EnteFile> tempEnteFile = split.ownedByCurrentUser;
+ final List<EnteFile> ownedSelectedFiles = split.ownedByCurrentUser;
final actionResult = await showActionSheet(
context: context,
@@ -689,7 +692,8 @@ class _FileSelectionActionsWidgetState
);
if (actionResult?.action != null) {
if (actionResult!.action == ButtonAction.first) {
- generatedPathNotifier.value = await _nextPageForTesting(tempEnteFile);
+ generatedPathNotifier.value =
+ await _selectedFilePlaceholderPath(ownedSelectedFiles);
await _copyLink();
}
if (actionResult.action == ButtonAction.second) {
@@ -801,7 +805,6 @@ class _FileSelectionActionsWidgetState
}
Future<void> _copyLink() async {
- print("INSIDE COPY LINK");
if (_cachedCollectionForSharedLink != null) {
final String collectionKey = Base58Encode(
CollectionsService.instance
@@ -809,8 +812,7 @@ class _FileSelectionActionsWidgetState
);
final String url =
"${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
- //await shareText(url);
- await shareImageAndUrl(context, generatedPathNotifier.value!, url);
+ await shareImageAndUrl(generatedPathNotifier.value!, url);
await Clipboard.setData(ClipboardData(text: url));
showShortToast(context, S.of(context).linkCopiedToClipboard);
}
diff --git a/mobile/lib/utils/share_util.dart b/mobile/lib/utils/share_util.dart
index b94ac33235..aeb1e6bdab 100644
--- a/mobile/lib/utils/share_util.dart
+++ b/mobile/lib/utils/share_util.dart
@@ -220,7 +220,6 @@ void shareSelected(
}
Future<void> shareImageAndUrl(
- BuildContext context,
String imagePath,
String url,
) async {