diff --git a/src/Files.App/Constants.cs b/src/Files.App/Constants.cs
index b92eb22f08a0..a8d191705981 100644
--- a/src/Files.App/Constants.cs
+++ b/src/Files.App/Constants.cs
@@ -205,7 +205,7 @@ public static class ExternalUrl
public const string FeatureRequestUrl = @"https://github.com/files-community/Files/issues/new?labels=feature+request&template=feature_request.yml";
public const string BugReportUrl = @"https://github.com/files-community/Files/issues/new?labels=bug&template=bug_report.yml";
public const string PrivacyPolicyUrl = @"https://files.community/privacy";
- public const string SupportUsUrl = @"https://github.com/sponsors/yaira2";
+ public const string SupportUsUrl = @"https://github.com/files-community/Files?sponsor";
public const string CrowdinUrl = @"https://crowdin.com/project/files-app";
public static readonly string ReleaseNotesUrl= $"https://files.community/blog/posts/v{Package.Current.Id.Version.Major}-{Package.Current.Id.Version.Minor}-{Package.Current.Id.Version.Build}?minimal";
}
diff --git a/src/Files.App/Data/Contracts/IApplicationSettingsService.cs b/src/Files.App/Data/Contracts/IApplicationSettingsService.cs
index 312434583600..df7535e83b8e 100644
--- a/src/Files.App/Data/Contracts/IApplicationSettingsService.cs
+++ b/src/Files.App/Data/Contracts/IApplicationSettingsService.cs
@@ -6,9 +6,14 @@ namespace Files.App.Data.Contracts
public interface IApplicationSettingsService : IBaseSettingsService
{
///
- /// Gets or sets a value indicating whether or not the user clicked to review the app.
+ /// Gets or sets a value indicating whether or not the user clicked the 'review' prompt.
///
- bool ClickedToReviewApp { get; set; }
+ bool HasClickedReviewPrompt { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether or not the user clicked the 'sponsor' prompt.
+ ///
+ bool HasClickedSponsorPrompt { get; set; }
///
/// Gets or sets a value indicating whether or not to display a prompt when running the app as administrator.
diff --git a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs
index 6537d6943e4a..9be8c4bd051f 100644
--- a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs
+++ b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs
@@ -61,7 +61,8 @@ static AppLifecycleHelper()
{
IsAppUpdated = version.ToString() != AppVersion.ToString();
}
- TotalLaunchCount = launchCount is long l ? l + 1 : 1;
+
+ TotalLaunchCount = long.TryParse(launchCount?.ToString(), out var v) ? v + 1 : 1;
infoKey.SetValue("LastLaunchVersion", AppVersion.ToString());
infoKey.SetValue("TotalLaunchCount", TotalLaunchCount);
}
diff --git a/src/Files.App/Services/Settings/ApplicationSettingsService.cs b/src/Files.App/Services/Settings/ApplicationSettingsService.cs
index 898bcce492f1..769995db9368 100644
--- a/src/Files.App/Services/Settings/ApplicationSettingsService.cs
+++ b/src/Files.App/Services/Settings/ApplicationSettingsService.cs
@@ -8,7 +8,13 @@ namespace Files.App.Services.Settings
{
internal sealed partial class ApplicationSettingsService : BaseObservableJsonSettings, IApplicationSettingsService
{
- public bool ClickedToReviewApp
+ public bool HasClickedReviewPrompt
+ {
+ get => Get(false);
+ set => Set(value);
+ }
+
+ public bool HasClickedSponsorPrompt
{
get => Get(false);
set => Set(value);
diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw
index acef44a16ef4..c0ba4fad97f7 100644
--- a/src/Files.App/Strings/en-US/Resources.resw
+++ b/src/Files.App/Strings/en-US/Resources.resw
@@ -2012,11 +2012,17 @@
Behaviors
-
+
Hello!
Enjoying Files? Please consider reviewing in the Microsoft Store.
+
+
+ Enjoying Files? Please consider supporting the project on GitHub.
+
+
+ Sponsor
Rate us
diff --git a/src/Files.App/ViewModels/MainPageViewModel.cs b/src/Files.App/ViewModels/MainPageViewModel.cs
index 432f52939cab..de2098cfcd79 100644
--- a/src/Files.App/ViewModels/MainPageViewModel.cs
+++ b/src/Files.App/ViewModels/MainPageViewModel.cs
@@ -8,7 +8,6 @@
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.UI.Xaml.Navigation;
using System.Windows.Input;
-using Windows.ApplicationModel;
using Windows.Services.Store;
using Windows.System;
using WinRT.Interop;
@@ -134,11 +133,23 @@ public bool ShowReviewPrompt
{
get
{
- var isTargetPackage = Package.Current.Id.Name == "49306atecsolution.FilesUWP" || Package.Current.Id.Name == "49306atecsolution.FilesPreview";
- var hasNotClickedReview = !UserSettingsService.ApplicationSettingsService.ClickedToReviewApp;
+ var isTargetEnvironment = AppLifecycleHelper.AppEnvironment is AppEnvironment.StoreStable or AppEnvironment.StorePreview;
+ var hasClickedReviewPrompt = UserSettingsService.ApplicationSettingsService.HasClickedReviewPrompt;
var launchCountReached = AppLifecycleHelper.TotalLaunchCount == 30;
- return isTargetPackage && hasNotClickedReview && launchCountReached;
+ return isTargetEnvironment && !hasClickedReviewPrompt && launchCountReached;
+ }
+ }
+
+ public bool ShowSponsorPrompt
+ {
+ get
+ {
+ var isTargetEnvironment = AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev or AppEnvironment.SideloadStable or AppEnvironment.SideloadPreview;
+ var hasClickedSponsorPrompt = UserSettingsService.ApplicationSettingsService.HasClickedSponsorPrompt;
+ var launchCountReached = AppLifecycleHelper.TotalLaunchCount == 30;
+
+ return isTargetEnvironment && !hasClickedSponsorPrompt && launchCountReached;
}
}
@@ -147,6 +158,8 @@ public bool ShowReviewPrompt
public ICommand NavigateToNumberedTabKeyboardAcceleratorCommand { get; }
public ICommand ReviewAppCommand { get; }
public ICommand DismissReviewPromptCommand { get; }
+ public ICommand SponsorCommand { get; }
+ public ICommand DismissSponsorPromptCommand { get; }
// Constructor
@@ -155,6 +168,8 @@ public MainPageViewModel()
NavigateToNumberedTabKeyboardAcceleratorCommand = new RelayCommand(ExecuteNavigateToNumberedTabKeyboardAcceleratorCommand);
ReviewAppCommand = new RelayCommand(ExecuteReviewAppCommand);
DismissReviewPromptCommand = new RelayCommand(ExecuteDismissReviewPromptCommand);
+ SponsorCommand = new RelayCommand(ExecuteSponsorCommand);
+ DismissSponsorPromptCommand = new RelayCommand(ExecuteDismissSponsorPromptCommand);
AppearanceSettingsService.PropertyChanged += (s, e) =>
{
@@ -322,7 +337,7 @@ await Task.WhenAll(
private async void ExecuteReviewAppCommand()
{
- UserSettingsService.ApplicationSettingsService.ClickedToReviewApp = true;
+ UserSettingsService.ApplicationSettingsService.HasClickedReviewPrompt = true;
OnPropertyChanged(nameof(ShowReviewPrompt));
try
@@ -336,7 +351,19 @@ private async void ExecuteReviewAppCommand()
private void ExecuteDismissReviewPromptCommand()
{
- UserSettingsService.ApplicationSettingsService.ClickedToReviewApp = true;
+ UserSettingsService.ApplicationSettingsService.HasClickedReviewPrompt = true;
+ }
+
+ private async void ExecuteSponsorCommand()
+ {
+ UserSettingsService.ApplicationSettingsService.HasClickedSponsorPrompt = true;
+ OnPropertyChanged(nameof(ShowSponsorPrompt));
+ await Launcher.LaunchUriAsync(new Uri(Constants.ExternalUrl.SupportUsUrl)).AsTask();
+ }
+
+ private void ExecuteDismissSponsorPromptCommand()
+ {
+ UserSettingsService.ApplicationSettingsService.HasClickedSponsorPrompt = true;
}
private async void ExecuteNavigateToNumberedTabKeyboardAcceleratorCommand(KeyboardAcceleratorInvokedEventArgs? e)
diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml
index a7cb40424092..ab1bde83e9b5 100644
--- a/src/Files.App/Views/MainPage.xaml
+++ b/src/Files.App/Views/MainPage.xaml
@@ -368,7 +368,7 @@
+
+
+