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_UnsubscribeConfirmationGoToWebsiteMessage": "To stop getting messages from {0}, go to their website to unsubscribe.",
|
||||||
"DialogMessage_UnsubscribeConfirmationGoToWebsiteConfirmButton": "Go to website",
|
"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_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",
|
"Dialog_DontAskAgain": "Don't ask again",
|
||||||
"CreateAccountAliasDialog_Title": "Create Account Alias",
|
"CreateAccountAliasDialog_Title": "Create Account Alias",
|
||||||
"CreateAccountAliasDialog_Description": "Make sure your outgoing server allows sending mails from this 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>
|
/// </summary>
|
||||||
public static string DialogMessage_UnsubscribeConfirmationMailtoMessage => Resources.GetTranslatedString(@"DialogMessage_UnsubscribeConfirmationMailtoMessage");
|
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>
|
/// <summary>
|
||||||
/// Don't ask again
|
/// Don't ask again
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private const string IsActivateStartupLaunchAskedKey = nameof(IsActivateStartupLaunchAskedKey);
|
||||||
|
|
||||||
public IStatePersistanceService StatePersistenceService { get; }
|
public IStatePersistanceService StatePersistenceService { get; }
|
||||||
public IWinoServerConnectionManager ServerConnectionManager { get; }
|
public IWinoServerConnectionManager ServerConnectionManager { get; }
|
||||||
public IPreferencesService PreferencesService { get; }
|
public IPreferencesService PreferencesService { get; }
|
||||||
@@ -67,6 +69,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
private readonly IConfigurationService _configurationService;
|
private readonly IConfigurationService _configurationService;
|
||||||
|
private readonly IStartupBehaviorService _startupBehaviorService;
|
||||||
private readonly IAccountService _accountService;
|
private readonly IAccountService _accountService;
|
||||||
private readonly IContextMenuItemService _contextMenuItemService;
|
private readonly IContextMenuItemService _contextMenuItemService;
|
||||||
private readonly IStoreRatingService _storeRatingService;
|
private readonly IStoreRatingService _storeRatingService;
|
||||||
@@ -101,7 +104,8 @@ namespace Wino.Mail.ViewModels
|
|||||||
IFolderService folderService,
|
IFolderService folderService,
|
||||||
IStatePersistanceService statePersistanceService,
|
IStatePersistanceService statePersistanceService,
|
||||||
IWinoServerConnectionManager serverConnectionManager,
|
IWinoServerConnectionManager serverConnectionManager,
|
||||||
IConfigurationService configurationService) : base(dialogService)
|
IConfigurationService configurationService,
|
||||||
|
IStartupBehaviorService startupBehaviorService) : base(dialogService)
|
||||||
{
|
{
|
||||||
StatePersistenceService = statePersistanceService;
|
StatePersistenceService = statePersistanceService;
|
||||||
ServerConnectionManager = serverConnectionManager;
|
ServerConnectionManager = serverConnectionManager;
|
||||||
@@ -119,6 +123,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
NavigationService = navigationService;
|
NavigationService = navigationService;
|
||||||
|
|
||||||
_configurationService = configurationService;
|
_configurationService = configurationService;
|
||||||
|
_startupBehaviorService = startupBehaviorService;
|
||||||
_backgroundTaskService = backgroundTaskService;
|
_backgroundTaskService = backgroundTaskService;
|
||||||
_mimeFileService = mimeFileService;
|
_mimeFileService = mimeFileService;
|
||||||
_nativeAppService = nativeAppService;
|
_nativeAppService = nativeAppService;
|
||||||
@@ -239,9 +244,41 @@ namespace Wino.Mail.ViewModels
|
|||||||
await ProcessLaunchOptionsAsync();
|
await ProcessLaunchOptionsAsync();
|
||||||
|
|
||||||
await ForceAllAccountSynchronizationsAsync();
|
await ForceAllAccountSynchronizationsAsync();
|
||||||
|
await MakeSureEnableStartupLaunchAsync();
|
||||||
ConfigureBackgroundTasks();
|
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()
|
private void ConfigureBackgroundTasks()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -809,16 +846,11 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
protected override async void OnAccountUpdated(MailAccount updatedAccount)
|
protected override async void OnAccountUpdated(MailAccount updatedAccount)
|
||||||
{
|
{
|
||||||
await ExecuteUIThread(async () =>
|
await ExecuteUIThread(() =>
|
||||||
{
|
{
|
||||||
if (MenuItems.TryGetAccountMenuItem(updatedAccount.Id, out IAccountMenuItem foundAccountMenuItem))
|
if (MenuItems.TryGetAccountMenuItem(updatedAccount.Id, out IAccountMenuItem foundAccountMenuItem))
|
||||||
{
|
{
|
||||||
foundAccountMenuItem.UpdateAccount(updatedAccount);
|
foundAccountMenuItem.UpdateAccount(updatedAccount);
|
||||||
|
|
||||||
if (latestSelectedAccountMenuItem == foundAccountMenuItem)
|
|
||||||
{
|
|
||||||
await ChangeLoadedAccountAsync(foundAccountMenuItem, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user