Ask for enable startup on first launch.
This commit is contained in:
@@ -112,6 +112,9 @@
|
||||
"DialogMessage_UnsubscribeConfirmationGoToWebsiteMessage": "To stop getting messages from {0}, go to their website to unsubscribe.",
|
||||
"DialogMessage_UnsubscribeConfirmationGoToWebsiteConfirmButton": "Go to website",
|
||||
"DialogMessage_UnsubscribeConfirmationMailtoMessage": "Do you want to stop getting messages from {0}? Wino will unsubscribe for you by sending an email from your email account to {1}.",
|
||||
"DialogMessage_EnableStartupLaunchTitle": "Enable Startup Launch",
|
||||
"DialogMessage_EnableStartupLaunchMessage": "Let Wino Mail automatically launch minimized on Windows startup to not miss any notifications.\n\nDo you want to enable startup launch?",
|
||||
"DialogMessage_EnableStartupLaunchDeniedMessage": "You can enable startup launch from Settings -> App Preferences.",
|
||||
"Dialog_DontAskAgain": "Don't ask again",
|
||||
"CreateAccountAliasDialog_Title": "Create Account Alias",
|
||||
"CreateAccountAliasDialog_Description": "Make sure your outgoing server allows sending mails from this alias.",
|
||||
|
||||
15
Wino.Core.Domain/Translator.Designer.cs
generated
15
Wino.Core.Domain/Translator.Designer.cs
generated
@@ -583,6 +583,21 @@ namespace Wino.Core.Domain
|
||||
/// </summary>
|
||||
public static string DialogMessage_UnsubscribeConfirmationMailtoMessage => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationMailtoMessage");
|
||||
|
||||
/// <summary>
|
||||
/// Enable Startup Launch
|
||||
/// </summary>
|
||||
public static string DialogMessage_EnableStartupLaunchTitle => Resources.GetTranslatedString(@"DialogMessage_EnableStartupLaunchTitle");
|
||||
|
||||
/// <summary>
|
||||
/// Let Wino Mail automatically launch minimized on Windows startup to not miss any notifications. Do you want to enable startup launch?
|
||||
/// </summary>
|
||||
public static string DialogMessage_EnableStartupLaunchMessage => Resources.GetTranslatedString(@"DialogMessage_EnableStartupLaunchMessage");
|
||||
|
||||
/// <summary>
|
||||
/// You can enable startup launch from Settings -> App Preferences.
|
||||
/// </summary>
|
||||
public static string DialogMessage_EnableStartupLaunchDeniedMessage => Resources.GetTranslatedString(@"DialogMessage_EnableStartupLaunchDeniedMessage");
|
||||
|
||||
/// <summary>
|
||||
/// Don't ask again
|
||||
/// </summary>
|
||||
|
||||
@@ -60,6 +60,8 @@ namespace Wino.Mail.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
private const string IsActivateStartupLaunchAskedKey = nameof(IsActivateStartupLaunchAskedKey);
|
||||
|
||||
public IStatePersistanceService StatePersistenceService { get; }
|
||||
public IWinoServerConnectionManager ServerConnectionManager { get; }
|
||||
public IPreferencesService PreferencesService { get; }
|
||||
@@ -67,6 +69,7 @@ namespace Wino.Mail.ViewModels
|
||||
|
||||
private readonly IFolderService _folderService;
|
||||
private readonly IConfigurationService _configurationService;
|
||||
private readonly IStartupBehaviorService _startupBehaviorService;
|
||||
private readonly IAccountService _accountService;
|
||||
private readonly IContextMenuItemService _contextMenuItemService;
|
||||
private readonly IStoreRatingService _storeRatingService;
|
||||
@@ -101,7 +104,8 @@ namespace Wino.Mail.ViewModels
|
||||
IFolderService folderService,
|
||||
IStatePersistanceService statePersistanceService,
|
||||
IWinoServerConnectionManager serverConnectionManager,
|
||||
IConfigurationService configurationService) : base(dialogService)
|
||||
IConfigurationService configurationService,
|
||||
IStartupBehaviorService startupBehaviorService) : base(dialogService)
|
||||
{
|
||||
StatePersistenceService = statePersistanceService;
|
||||
ServerConnectionManager = serverConnectionManager;
|
||||
@@ -119,6 +123,7 @@ namespace Wino.Mail.ViewModels
|
||||
NavigationService = navigationService;
|
||||
|
||||
_configurationService = configurationService;
|
||||
_startupBehaviorService = startupBehaviorService;
|
||||
_backgroundTaskService = backgroundTaskService;
|
||||
_mimeFileService = mimeFileService;
|
||||
_nativeAppService = nativeAppService;
|
||||
@@ -239,9 +244,41 @@ namespace Wino.Mail.ViewModels
|
||||
await ProcessLaunchOptionsAsync();
|
||||
|
||||
await ForceAllAccountSynchronizationsAsync();
|
||||
await MakeSureEnableStartupLaunchAsync();
|
||||
ConfigureBackgroundTasks();
|
||||
}
|
||||
|
||||
private async Task MakeSureEnableStartupLaunchAsync()
|
||||
{
|
||||
if (!_configurationService.Get<bool>(IsActivateStartupLaunchAskedKey, false))
|
||||
{
|
||||
bool isAccepted = await DialogService.ShowWinoCustomMessageDialogAsync(Translator.DialogMessage_EnableStartupLaunchTitle,
|
||||
Translator.DialogMessage_EnableStartupLaunchMessage,
|
||||
Translator.Buttons_Yes,
|
||||
WinoCustomMessageDialogIcon.Information,
|
||||
Translator.Buttons_No);
|
||||
|
||||
bool shouldDisplayLaterOnMessage = !isAccepted;
|
||||
|
||||
if (isAccepted)
|
||||
{
|
||||
var behavior = await _startupBehaviorService.ToggleStartupBehavior(true);
|
||||
|
||||
shouldDisplayLaterOnMessage = behavior != StartupBehaviorResult.Enabled;
|
||||
}
|
||||
|
||||
if (shouldDisplayLaterOnMessage)
|
||||
{
|
||||
await DialogService.ShowWinoCustomMessageDialogAsync(Translator.DialogMessage_EnableStartupLaunchTitle,
|
||||
Translator.DialogMessage_EnableStartupLaunchDeniedMessage,
|
||||
Translator.Buttons_Close,
|
||||
WinoCustomMessageDialogIcon.Information);
|
||||
}
|
||||
|
||||
_configurationService.Set(IsActivateStartupLaunchAskedKey, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureBackgroundTasks()
|
||||
{
|
||||
try
|
||||
@@ -809,16 +846,11 @@ namespace Wino.Mail.ViewModels
|
||||
|
||||
protected override async void OnAccountUpdated(MailAccount updatedAccount)
|
||||
{
|
||||
await ExecuteUIThread(async () =>
|
||||
await ExecuteUIThread(() =>
|
||||
{
|
||||
if (MenuItems.TryGetAccountMenuItem(updatedAccount.Id, out IAccountMenuItem foundAccountMenuItem))
|
||||
{
|
||||
foundAccountMenuItem.UpdateAccount(updatedAccount);
|
||||
|
||||
if (latestSelectedAccountMenuItem == foundAccountMenuItem)
|
||||
{
|
||||
await ChangeLoadedAccountAsync(foundAccountMenuItem, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user