remove AI integration and account limits

This commit is contained in:
2026-04-29 18:34:42 +02:00
parent 7098a6353c
commit 2f1345908b
56 changed files with 74 additions and 1429 deletions

View File

@@ -26,7 +26,6 @@ public partial class SettingOptionsPageViewModel : CoreBaseViewModel
private readonly INativeAppService _nativeAppService;
private readonly IAccountService _accountService;
private readonly IMimeStorageService _mimeStorageService;
private readonly IStoreRatingService _storeRatingService;
private readonly ITranslationService _translationService;
private readonly INewThemeService _newThemeService;
private readonly IPreferencesService _preferencesService;
@@ -34,8 +33,6 @@ public partial class SettingOptionsPageViewModel : CoreBaseViewModel
private bool _isInitializingSettings;
private bool _isAppearanceSelectionPaused;
public string GitHubUrl => AppUrls.GitHub;
public string PaypalUrl => AppUrls.Paypal;
public string WebsiteUrl => AppUrls.Website;
public string PrivacyPolicyUrl => AppUrls.PrivacyPolicy;
@@ -85,16 +82,14 @@ public partial class SettingOptionsPageViewModel : CoreBaseViewModel
public SettingOptionsPageViewModel(INativeAppService nativeAppService,
IAccountService accountService,
IMimeStorageService mimeStorageService,
IStoreRatingService storeRatingService,
ITranslationService translationService,
INewThemeService newThemeService,
IPreferencesService preferencesService,
IProviderService providerService)
ITranslationService translationService,
INewThemeService newThemeService,
IPreferencesService preferencesService,
IProviderService providerService)
{
_nativeAppService = nativeAppService;
_accountService = accountService;
_mimeStorageService = mimeStorageService;
_storeRatingService = storeRatingService;
_translationService = translationService;
_newThemeService = newThemeService;
_preferencesService = preferencesService;
@@ -218,6 +213,19 @@ public partial class SettingOptionsPageViewModel : CoreBaseViewModel
_isInitializingSettings = false;
}
private void InitializeColors()
{
Colors.Clear();
foreach (var color in AccentColorProvider.GetAvailableColors())
{
Colors.Add(new AppColorViewModel(color));
}
UseAccentColor = _preferencesService.IsCustomAccentColorEnabled;
SelectedAppColor = Colors.FirstOrDefault(color => color.Hex == _preferencesService.CustomAccentColorHex) ?? Colors.FirstOrDefault();
}
private void InitializeLanguageOptions()
{
AvailableLanguages = _translationService.GetAvailableLanguages();
@@ -225,181 +233,77 @@ public partial class SettingOptionsPageViewModel : CoreBaseViewModel
?? AvailableLanguages.FirstOrDefault();
}
private void InitializeColors()
{
Colors.Clear();
foreach (var color in _newThemeService.GetAvailableAccountColors().Distinct(StringComparer.OrdinalIgnoreCase))
{
Colors.Add(new AppColorViewModel(color));
}
var systemAccentColor = _newThemeService.GetSystemAccentColorHex();
if (Colors.All(color => !string.Equals(color.Hex, systemAccentColor, StringComparison.OrdinalIgnoreCase)))
{
Colors.Add(new AppColorViewModel(systemAccentColor, true));
}
else
{
var matchingAccentColor = Colors.First(color => string.Equals(color.Hex, systemAccentColor, StringComparison.OrdinalIgnoreCase));
Colors.Remove(matchingAccentColor);
Colors.Add(new AppColorViewModel(systemAccentColor, true));
}
}
private void InitializeAppearanceOptions()
{
_isAppearanceSelectionPaused = true;
var currentAccentColor = _newThemeService.AccentColor;
if (!string.IsNullOrWhiteSpace(currentAccentColor) &&
Colors.All(color => !string.Equals(color.Hex, currentAccentColor, StringComparison.OrdinalIgnoreCase)))
{
Colors.Insert(0, new AppColorViewModel(currentAccentColor));
}
SelectedElementTheme = ElementThemes.FirstOrDefault(theme => theme.NativeTheme == _newThemeService.RootTheme)
?? ElementThemes.FirstOrDefault();
if (string.IsNullOrWhiteSpace(currentAccentColor))
{
SelectedAppColor = Colors.LastOrDefault(color => color.IsAccentColor) ?? Colors.LastOrDefault();
UseAccentColor = true;
}
else
{
SelectedAppColor = Colors.FirstOrDefault(color => string.Equals(color.Hex, currentAccentColor, StringComparison.OrdinalIgnoreCase))
?? Colors.FirstOrDefault();
UseAccentColor = SelectedAppColor?.IsAccentColor == true;
}
_isAppearanceSelectionPaused = false;
}
private List<IAccountProviderDetailViewModel> CreateAccountItems(List<MailAccount> accounts)
{
var groupedAccounts = accounts
.OrderBy(account => account.MergedInboxId == null ? 1 : 0)
.ThenBy(account => account.Order)
.ThenBy(account => account.Name)
.GroupBy(account => account.MergedInboxId);
var accountItems = new List<IAccountProviderDetailViewModel>();
foreach (var accountGroup in groupedAccounts)
{
if (accountGroup.Key == null)
{
accountItems.AddRange(accountGroup.Select(CreateAccountProviderDetails));
continue;
}
var mergedInbox = accountGroup.First().MergedInbox;
var holdingAccounts = accountGroup
.Select(CreateAccountProviderDetails)
.ToList();
var mergedAccount = new MergedAccountProviderDetailViewModel(mergedInbox, holdingAccounts)
{
ProviderDetail = holdingAccounts.FirstOrDefault()?.ProviderDetail
};
accountItems.Add(mergedAccount);
}
return accountItems;
}
private AccountProviderDetailViewModel CreateAccountProviderDetails(MailAccount account)
{
var provider = _providerService.GetProviderDetail(account.ProviderType);
return new AccountProviderDetailViewModel(provider, account);
SelectedElementTheme = ElementThemes.FirstOrDefault(theme => theme.Theme == _preferencesService.ApplicationTheme)
?? ElementThemes[0];
}
partial void OnSelectedLanguageChanged(AppLanguageModel value)
{
if (_isInitializingSettings || value == null)
{
return;
}
_ = ApplyLanguageAsync(value);
_ = _translationService.InitializeLanguageAsync(value.Language);
}
partial void OnSelectedElementThemeChanged(ElementThemeContainer value)
{
if (_isInitializingSettings || value == null)
{
return;
}
_newThemeService.RootTheme = value.NativeTheme;
_preferencesService.ApplicationTheme = value.Theme;
}
partial void OnSelectedAppColorChanged(AppColorViewModel value)
{
if (_isInitializingSettings || _isAppearanceSelectionPaused || value == null)
{
return;
_preferencesService.CustomAccentColorHex = value.Hex;
if (UseAccentColor)
{
_newThemeService.ApplyCustomAccentColor(value.Color);
}
_isAppearanceSelectionPaused = true;
UseAccentColor = value.IsAccentColor;
_isAppearanceSelectionPaused = false;
_newThemeService.AccentColor = value.Hex;
}
partial void OnUseAccentColorChanged(bool value)
{
if (_isInitializingSettings || _isAppearanceSelectionPaused || Colors.Count == 0)
{
if (_isInitializingSettings)
return;
}
var accentColor = Colors.LastOrDefault(color => color.IsAccentColor);
var fallbackColor = Colors.FirstOrDefault(color => !color.IsAccentColor) ?? Colors.FirstOrDefault();
var targetColor = value ? accentColor : SelectedAppColor?.IsAccentColor == true ? fallbackColor : SelectedAppColor;
if (targetColor == null || ReferenceEquals(targetColor, SelectedAppColor))
{
return;
}
_preferencesService.IsCustomAccentColorEnabled = value;
_isAppearanceSelectionPaused = true;
SelectedAppColor = targetColor;
_isAppearanceSelectionPaused = false;
_newThemeService.AccentColor = targetColor.Hex;
}
private async Task ApplyLanguageAsync(AppLanguageModel language)
{
await _translationService.InitializeLanguageAsync(language.Language);
}
[RelayCommand]
public void NavigateSubDetail(object type)
{
if (type is WinoPage pageType)
try
{
var pageInfo = SettingsNavigationInfoProvider.GetInfo(pageType, AccountSummaryText);
Messenger.Send(new BreadcrumbNavigationRequested(pageInfo.Title, pageType));
if (value && SelectedAppColor != null)
{
_newThemeService.ApplyCustomAccentColor(SelectedAppColor.Color);
}
else
{
_newThemeService.ResetAccentColor();
}
}
finally
{
_isAppearanceSelectionPaused = false;
}
}
[RelayCommand]
private async Task NavigateExternalAsync(object target)
private Task NavigateExternalAsync(string url)
{
if (target is not string stringTarget || string.IsNullOrWhiteSpace(stringTarget))
return;
if (string.IsNullOrWhiteSpace(url))
return Task.CompletedTask;
if (stringTarget == "Store")
{
await _storeRatingService.LaunchStorePageForReviewAsync();
return;
}
await _nativeAppService.LaunchUriAsync(new Uri(stringTarget));
return _nativeAppService.LaunchUriAsync(new Uri(url));
}
}
private static List<IAccountProviderDetailViewModel> CreateAccountItems(List<MailAccount> accounts)
{
return AccountProviderDetailViewModelFactory.CreateAccountItems(accounts);
}
}