Skip to content

Commit cb63db8

Browse files
committed
chore: Add required permission on iOS
1 parent 1f0282a commit cb63db8

File tree

4 files changed

+4
-22
lines changed

4 files changed

+4
-22
lines changed

samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Helpers/MediaGalleryHelperSamplePage.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<Button Command="{Binding Data.CheckAccessCommand}">Check access</Button>
2020
<Button Command="{Binding Data.SaveCommand}">Save UnoLogo.png to gallery</Button>
2121
<Button Command="{Binding Data.SaveRandomNameCommand}">Save with random name to gallery</Button>
22-
<Button Command="{Binding Data.SaveAndOverwriteCommand}">Save UnoLogo.png to gallery and overwrite</Button>
2322
</StackPanel>
2423
</DataTemplate>
2524
</sample:SamplePageLayout.DesignAgnosticTemplate>

samples/Uno.Toolkit.Samples/Uno.Toolkit.Samples.Shared/Content/Helpers/MediaGalleryHelperSamplePage.xaml.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,5 @@ public class MediaGalleryHelperSampleVM : ViewModelBase
109109
}.ShowAsync();
110110
}
111111
});
112-
113-
public ICommand SaveAndOverwriteCommand => new Command(async (_) =>
114-
{
115-
if (await MediaGallery.CheckAccessAsync())
116-
{
117-
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/UnoLogo.png", UriKind.Absolute));
118-
using var stream = await file.OpenStreamForReadAsync();
119-
await MediaGallery.SaveAsync(MediaFileType.Image, stream, "UnoLogo.png");
120-
}
121-
else
122-
{
123-
await new ContentDialog
124-
{
125-
Title = "Permission required",
126-
Content = "The app requires access to the device's gallery to save the image.",
127-
CloseButtonText = "OK"
128-
}.ShowAsync();
129-
}
130-
});
131112
#endif
132113
}

samples/Uno.Toolkit.WinUI.Samples/Uno.Toolkit.WinUI.Samples.Mobile/MacCatalyst/Info.plist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
</array>
1717
<key>XSAppIconAssets</key>
1818
<string>Assets.xcassets/iconapp.appiconset</string>
19-
19+
<key>NSPhotoLibraryAddUsageDescription</key>
20+
<string>This app would like to save photos to your gallery</string>
2021
<!--
2122
Adjust this to your application's encryption usage.
2223
<key>ITSAppUsesNonExemptEncryption</key>

samples/Uno.Toolkit.WinUI.Samples/Uno.Toolkit.WinUI.Samples.Mobile/iOS/Info.plist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
<string>Assets.xcassets/iconapp.appiconset</string>
5050
<key>UIApplicationSupportsIndirectInputEvents</key>
5151
<true/>
52-
52+
<key>NSPhotoLibraryAddUsageDescription</key>
53+
<string>This app would like to save photos to your gallery</string>
5354
<!--
5455
Adjust this to your application's encryption usage.
5556
<key>ITSAppUsesNonExemptEncryption</key>

0 commit comments

Comments
 (0)