Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [62.1.4]
- [Gallery] Fixed issue where only one of multiple image rotations was retained.

## [62.1.3]
- [Dictation][Android] The dictation microphone now shows above the keyboard when the focused field is in a modal or a bottom sheet, instead of being hidden behind it.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace DIPS.Mobile.UI.API.Camera.Gallery.BottomSheet;
internal partial class GalleryBottomSheet : ContentPage, IGalleryDefaultStateObserver, IImageEditStateObserver
{
private readonly Action<int> m_onRemoveImage;
private readonly Action m_updateImages;
private readonly Action<IReadOnlyList<CapturedImage>> m_updateImages;
private readonly Button m_navigatePreviousImageButton;
private readonly Button m_navigateNextImageButton;
private readonly ContentView m_carouselViewWrapperView = new();
Expand All @@ -54,7 +54,7 @@ internal partial class GalleryBottomSheet : ContentPage, IGalleryDefaultStateObs
private int? m_positionBeforeRemoval;
private int? m_positionBeforeEdit;

public GalleryBottomSheet(List<CapturedImage> images, int startingIndex, Action<int> onRemoveImage, Action updateImages)
public GalleryBottomSheet(List<CapturedImage> images, int startingIndex, Action<int> onRemoveImage, Action<IReadOnlyList<CapturedImage>> updateImages)
{
Background = Microsoft.Maui.Graphics.Colors.Black;

Expand Down Expand Up @@ -432,7 +432,7 @@ void IImageEditStateObserver.OnSaveButtonTapped()
Images[m_carouselView!.Position] = m_currentlyRotatedCaptureImageDisplayed;
m_currentlyCapturedImageDisplayed = m_currentlyRotatedCaptureImageDisplayed;
GoToDefaultState();
m_updateImages.Invoke();
m_updateImages.Invoke(Images);
}

void IImageEditStateObserver.OnCancelButtonTapped()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ private void OnTappedImage(int imageIndex)
Shell.Current.Navigation.PushModalAsync(new NavigationPage(new GalleryBottomSheet(Images, imageIndex, OnRemoveImage, UpdateImages)));
}

private void UpdateImages()
internal void UpdateImages(IReadOnlyList<CapturedImage> images)
{
var copyOfImages = Images.ToList();
Images = copyOfImages;
Images = images.ToList();
}

private void OnRemoveImage(int imageIndex)
Expand Down
26 changes: 26 additions & 0 deletions src/tests/unittests/API/Camera/Gallery/GalleryThumbnailsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Linq;
using DIPS.Mobile.UI.API.Camera.Gallery;
using DIPS.Mobile.UI.API.Camera.ImageCapturing;

namespace DIPS.Mobile.UI.UnitTests.API.Camera.Gallery;

public class GalleryThumbnailsTests
{
[Fact]
public void UpdateImages_MultipleEditsFromOpenGallery_RetainsEveryEdit()
{
var firstImage = new CapturedImage();
var secondImage = new CapturedImage();
var firstEditedImage = new CapturedImage();
var secondEditedImage = new CapturedImage();
var imagesBeingEdited = new List<CapturedImage> { firstImage, secondImage };
var gallery = new GalleryThumbnails { Images = imagesBeingEdited.ToList() };

imagesBeingEdited[0] = firstEditedImage;
gallery.UpdateImages(imagesBeingEdited);
imagesBeingEdited[1] = secondEditedImage;
gallery.UpdateImages(imagesBeingEdited);

gallery.Images.Should().Equal(firstEditedImage, secondEditedImage);
}
}
11 changes: 11 additions & 0 deletions wiki/Media/ImageCapture.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ private void OnImageCaptured(CapturedImage capturedImage)

In multi-capture this method is called once per image, in capture order. Pair it with `OnImageRemoved` so your list reflects every add and every removal the user makes.

## Reviewing captured images after capture

Use `GalleryThumbnails` to display a list of captured images after the camera closes:

```xaml
<dui:GalleryThumbnails Images="{Binding Images}"
CameraButtonTapped="OnCameraButtonTapped" />
```

Tapping a thumbnail opens a full-screen preview where the user can browse, rotate, inspect, or remove images. Saving a rotation updates `Images` immediately. Multiple images can be rotated during the same preview session, and every saved rotation is retained in the bound list.

## Handling camera failures

```csharp
Expand Down