Skip to content

Commit 344a6ad

Browse files
committed
Tweak Consent Dialog
1 parent 636b6bc commit 344a6ad

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ public ItemViewModel(string viewPath, Page p)
149149

150150
private async void DisplayConsentDialog()
151151
{
152-
MessageDialog message = new MessageDialog("This app is not able to access your files. You need to allow it to by granting permission in Settings.");
153-
message.Title = "Permission Denied";
154-
message.Commands.Add(new UICommand("Allow...", Interaction.GrantAccessPermissionHandler));
155-
await message.ShowAsync();
152+
await MainPage.permissionBox.ShowAsync();
156153
}
157154
string sort = "By_Name";
158155
SortEntry entry;
@@ -347,7 +344,7 @@ public async void MemoryFriendlyGetItemsAsync(string path, CancellationToken tok
347344
}
348345
else
349346
{
350-
MessageDialog unsupportedDevice = new MessageDialog("This device is unsupported. Please file an issue report in Settings - About containing what device we couldn't access. Technical information: " + e, "Unsupported Device");
347+
MessageDialog unsupportedDevice = new MessageDialog("This device may be unsupported. Please file an issue report in Settings - About containing what device we couldn't access. Technical information: " + e, "Unsupported Device");
351348
await unsupportedDevice.ShowAsync();
352349
}
353350
stopwatch.Stop();

Files UWP/MainPage.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,11 @@
452452

453453

454454
</UILib:NavigationView>
455-
455+
<ContentDialog PrimaryButtonClick="PermissionDialog_PrimaryButtonClick" PrimaryButtonText="Grant Permission" Name="PermissionDialog" Title="Welcome to Files UWP">
456+
<Grid>
457+
<TextBlock TextWrapping="WrapWholeWords" Text="To get started, we need you to grant us permission to show you your files. This will open a Settings page where you can grant us permission. Files will close in the process, so don't be afraid to come back! "/>
458+
</Grid>
459+
</ContentDialog>
456460
</Grid>
457461

458462

Files UWP/MainPage.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Windows.UI.Xaml.Controls;
1919
using Windows.UI.Xaml.Media.Animation;
2020
using Files.Filesystem;
21+
using Windows.System;
2122

2223
namespace Files
2324
{
@@ -34,6 +35,7 @@ public sealed partial class MainPage : Page
3435
string PicturesPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
3536
string MusicPath = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
3637
string VideosPath = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
38+
public static ContentDialog permissionBox;
3739

3840
public MainPage()
3941
{
@@ -49,6 +51,7 @@ public MainPage()
4951
nv = navView;
5052
accessibleAutoSuggestBox = auto_suggest;
5153
PopulateNavViewWithExternalDrives();
54+
permissionBox = PermissionDialog;
5255

5356
}
5457

@@ -226,6 +229,10 @@ private void NavView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
226229

227230
}
228231

232+
private async void PermissionDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
233+
{
234+
await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-broadfilesystemaccess"));
235+
}
229236
}
230237
public class SelectItem : INotifyPropertyChanged
231238
{

0 commit comments

Comments
 (0)