8
8
using Microsoft . UI . Xaml . Media . Imaging ;
9
9
using Microsoft . UI . Xaml . Navigation ;
10
10
using System . Windows . Input ;
11
- using Windows . ApplicationModel ;
12
11
using Windows . Services . Store ;
13
12
using Windows . System ;
14
13
using WinRT . Interop ;
@@ -134,11 +133,23 @@ public bool ShowReviewPrompt
134
133
{
135
134
get
136
135
{
137
- var isTargetPackage = Package . Current . Id . Name == "49306atecsolution.FilesUWP" || Package . Current . Id . Name == "49306atecsolution.FilesPreview" ;
138
- var hasNotClickedReview = ! UserSettingsService . ApplicationSettingsService . ClickedToReviewApp ;
136
+ var isTargetEnvironment = AppLifecycleHelper . AppEnvironment is AppEnvironment . StoreStable or AppEnvironment . StorePreview ;
137
+ var hasClickedReviewPrompt = UserSettingsService . ApplicationSettingsService . HasClickedReviewPrompt ;
139
138
var launchCountReached = AppLifecycleHelper . TotalLaunchCount == 30 ;
140
139
141
- return isTargetPackage && hasNotClickedReview && launchCountReached ;
140
+ return isTargetEnvironment && ! hasClickedReviewPrompt && launchCountReached ;
141
+ }
142
+ }
143
+
144
+ public bool ShowSponsorPrompt
145
+ {
146
+ get
147
+ {
148
+ var isTargetEnvironment = AppLifecycleHelper . AppEnvironment is AppEnvironment . Dev or AppEnvironment . SideloadStable or AppEnvironment . SideloadPreview ;
149
+ var hasClickedSponsorPrompt = UserSettingsService . ApplicationSettingsService . HasClickedSponsorPrompt ;
150
+ var launchCountReached = AppLifecycleHelper . TotalLaunchCount == 30 ;
151
+
152
+ return isTargetEnvironment && ! hasClickedSponsorPrompt && launchCountReached ;
142
153
}
143
154
}
144
155
@@ -147,6 +158,8 @@ public bool ShowReviewPrompt
147
158
public ICommand NavigateToNumberedTabKeyboardAcceleratorCommand { get ; }
148
159
public ICommand ReviewAppCommand { get ; }
149
160
public ICommand DismissReviewPromptCommand { get ; }
161
+ public ICommand SponsorCommand { get ; }
162
+ public ICommand DismissSponsorPromptCommand { get ; }
150
163
151
164
// Constructor
152
165
@@ -155,6 +168,8 @@ public MainPageViewModel()
155
168
NavigateToNumberedTabKeyboardAcceleratorCommand = new RelayCommand < KeyboardAcceleratorInvokedEventArgs > ( ExecuteNavigateToNumberedTabKeyboardAcceleratorCommand ) ;
156
169
ReviewAppCommand = new RelayCommand ( ExecuteReviewAppCommand ) ;
157
170
DismissReviewPromptCommand = new RelayCommand ( ExecuteDismissReviewPromptCommand ) ;
171
+ SponsorCommand = new RelayCommand ( ExecuteSponsorCommand ) ;
172
+ DismissSponsorPromptCommand = new RelayCommand ( ExecuteDismissSponsorPromptCommand ) ;
158
173
159
174
AppearanceSettingsService . PropertyChanged += ( s , e ) =>
160
175
{
@@ -322,7 +337,7 @@ await Task.WhenAll(
322
337
323
338
private async void ExecuteReviewAppCommand ( )
324
339
{
325
- UserSettingsService . ApplicationSettingsService . ClickedToReviewApp = true ;
340
+ UserSettingsService . ApplicationSettingsService . HasClickedReviewPrompt = true ;
326
341
OnPropertyChanged ( nameof ( ShowReviewPrompt ) ) ;
327
342
328
343
try
@@ -336,7 +351,19 @@ private async void ExecuteReviewAppCommand()
336
351
337
352
private void ExecuteDismissReviewPromptCommand ( )
338
353
{
339
- UserSettingsService . ApplicationSettingsService . ClickedToReviewApp = true ;
354
+ UserSettingsService . ApplicationSettingsService . HasClickedReviewPrompt = true ;
355
+ }
356
+
357
+ private async void ExecuteSponsorCommand ( )
358
+ {
359
+ UserSettingsService . ApplicationSettingsService . HasClickedSponsorPrompt = true ;
360
+ OnPropertyChanged ( nameof ( ShowReviewPrompt ) ) ;
361
+ await Launcher . LaunchUriAsync ( new Uri ( Constants . ExternalUrl . SupportUsUrl ) ) . AsTask ( ) ;
362
+ }
363
+
364
+ private void ExecuteDismissSponsorPromptCommand ( )
365
+ {
366
+ UserSettingsService . ApplicationSettingsService . HasClickedSponsorPrompt = true ;
340
367
}
341
368
342
369
private async void ExecuteNavigateToNumberedTabKeyboardAcceleratorCommand ( KeyboardAcceleratorInvokedEventArgs ? e )
0 commit comments