Skip to content

Commit 63e6944

Browse files
authored
Fix: Fixed issue where the prompt to review would crash the app (#10686)
1 parent 9f87582 commit 63e6944

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/Files.App/Views/MainPage.xaml.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ public MainPage()
7373
ToggleCompactOverlayCommand = new RelayCommand(ToggleCompactOverlay);
7474
SetCompactOverlayCommand = new RelayCommand<bool>(SetCompactOverlay);
7575

76-
if (SystemInformation.Instance.TotalLaunchCount >= 15 & Package.Current.Id.Name == "49306atecsolution.FilesUWP" && !UserSettingsService.ApplicationSettingsService.WasPromptedToReview)
77-
{
78-
PromptForReview();
79-
UserSettingsService.ApplicationSettingsService.WasPromptedToReview = true;
80-
}
81-
8276
UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent;
8377

8478
DispatcherQueue.TryEnqueue(async () => await LoadSelectedTheme());
@@ -90,17 +84,17 @@ private async Task LoadSelectedTheme()
9084
await App.ExternalResourcesHelper.LoadSelectedTheme();
9185
}
9286

93-
private async void PromptForReview()
87+
private async Task PromptForReview()
9488
{
95-
var AskForReviewDialog = new ContentDialog
89+
var promptForReviewDialog = new ContentDialog
9690
{
9791
Title = "ReviewFiles".ToLocalized(),
9892
Content = "ReviewFilesContent".ToLocalized(),
9993
PrimaryButtonText = "Yes".ToLocalized(),
10094
SecondaryButtonText = "No".ToLocalized()
10195
};
10296

103-
var result = await this.SetContentDialogRoot(AskForReviewDialog).ShowAsync();
97+
var result = await this.SetContentDialogRoot(promptForReviewDialog).ShowAsync();
10498

10599
if (result == ContentDialogResult.Primary)
106100
{
@@ -111,6 +105,8 @@ private async void PromptForReview()
111105
}
112106
catch (Exception) { }
113107
}
108+
109+
UserSettingsService.ApplicationSettingsService.WasPromptedToReview = true;
114110
}
115111

116112
// WINUI3
@@ -328,6 +324,17 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
328324
FindName(nameof(InnerNavigationToolbar));
329325
FindName(nameof(horizontalMultitaskingControl));
330326
FindName(nameof(NavToolbar));
327+
328+
// Prompt user to review app in the Store
329+
if
330+
(
331+
SystemInformation.Instance.TotalLaunchCount >= 15 &
332+
Package.Current.Id.Name == "49306atecsolution.FilesUWP" &&
333+
!UserSettingsService.ApplicationSettingsService.WasPromptedToReview
334+
)
335+
{
336+
DispatcherQueue.TryEnqueue(async () => await PromptForReview());
337+
}
331338
}
332339

333340
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)

0 commit comments

Comments
 (0)