From 329d0d5391a1e212e4f56a939aceeeceb99182f8 Mon Sep 17 00:00:00 2001 From: Damian Viktorovich Morozov Date: Mon, 25 Nov 2024 15:20:02 +0400 Subject: [PATCH] Added license to TgDownloaderDesktop --- .../Common/TgPageViewModelBase.cs | 7 ++++++- .../Helpers/TgResourceExtensions.cs | 3 +++ .../Strings/en-us/Resources.resw | 15 ++++++++++++--- .../Strings/ru-RU/Resources.resw | 17 +++++++++++++---- .../ViewModels/TgClientViewModel.cs | 2 +- .../ViewModels/TgMainViewModel.cs | 4 +++- .../TgDownloaderDesktop/Views/TgMainPage.xaml | 12 +++++++++--- 7 files changed, 47 insertions(+), 13 deletions(-) diff --git a/Clients/TgDownloaderDesktop/Common/TgPageViewModelBase.cs b/Clients/TgDownloaderDesktop/Common/TgPageViewModelBase.cs index 296145b..f315b7d 100644 --- a/Clients/TgDownloaderDesktop/Common/TgPageViewModelBase.cs +++ b/Clients/TgDownloaderDesktop/Common/TgPageViewModelBase.cs @@ -40,7 +40,10 @@ public string AppTgSession } } - public TgAppSettingsHelper TgAppSettings => TgAppSettingsHelper.Instance; + [ObservableProperty] + private TgAppSettingsHelper _appSettings = TgAppSettingsHelper.Instance; + [ObservableProperty] + private TgLicenseManagerHelper _licenseManager = TgLicenseManagerHelper.Instance; public static TgExceptionModel Exception { get; set; } = new(); [ObservableProperty] @@ -71,6 +74,8 @@ public string AppTgSession public TgPageViewModelBase(ITgSettingsService settingsService) { SettingsService = settingsService; + LicenseManager.ActivateLicense(string.Empty, TgResourceExtensions.GetLicenseFreeDescription(), + TgResourceExtensions.GetLicensePaidDescription(), TgResourceExtensions.GetLicensePremiumDescription()); } #endregion diff --git a/Clients/TgDownloaderDesktop/Helpers/TgResourceExtensions.cs b/Clients/TgDownloaderDesktop/Helpers/TgResourceExtensions.cs index faab72f..be3df91 100644 --- a/Clients/TgDownloaderDesktop/Helpers/TgResourceExtensions.cs +++ b/Clients/TgDownloaderDesktop/Helpers/TgResourceExtensions.cs @@ -25,6 +25,9 @@ public static class TgResourceExtensions public static string ClientSettingsAreNotValid() => "ClientSettingsAreNotValid".GetLocalized(); public static string GetAppVersion() => "AppVersion".GetLocalized(); public static string GetCancelButton() => "CancelButton".GetLocalized(); + public static string GetLicenseFreeDescription() => "LicenseFreeDescription".GetLocalized(); + public static string GetLicensePaidDescription() => "LicensePaidDescription".GetLocalized(); + public static string GetLicensePremiumDescription() => "LicensePremiumDescription".GetLocalized(); public static string GetMenuClientIsQuery() => "MenuClientIsQuery".GetLocalized(); public static string GetNoButton() => "NoButton".GetLocalized(); public static string GetSettingsThemeDark() => "SettingsThemeDark".GetLocalized(); diff --git a/Clients/TgDownloaderDesktop/Strings/en-us/Resources.resw b/Clients/TgDownloaderDesktop/Strings/en-us/Resources.resw index 2ead715..6f23cf4 100644 --- a/Clients/TgDownloaderDesktop/Strings/en-us/Resources.resw +++ b/Clients/TgDownloaderDesktop/Strings/en-us/Resources.resw @@ -148,11 +148,11 @@ Default - + TgDownloader - Telegram Files Downloader - - TODO: Replace with your app description. + + License TgDownloader repository @@ -333,4 +333,13 @@ Client settings are not valid + + Free license + + + Paid license + + + Premium license + diff --git a/Clients/TgDownloaderDesktop/Strings/ru-RU/Resources.resw b/Clients/TgDownloaderDesktop/Strings/ru-RU/Resources.resw index 0a88bc7..bb937eb 100644 --- a/Clients/TgDownloaderDesktop/Strings/ru-RU/Resources.resw +++ b/Clients/TgDownloaderDesktop/Strings/ru-RU/Resources.resw @@ -207,11 +207,11 @@ Default - - TgDownloader - Telegram Files Downloader + + TgDownloader - Загрузчик файлов Telegram - - TODO: Replace with your app description. + + Лицензия TgDownloader repository @@ -398,4 +398,13 @@ Настройки клиента не валидны + + Бесплатная лицензия + + + Платная лицензия + + + Премиальная лицензия + \ No newline at end of file diff --git a/Clients/TgDownloaderDesktop/ViewModels/TgClientViewModel.cs b/Clients/TgDownloaderDesktop/ViewModels/TgClientViewModel.cs index 0537dc2..3669e5a 100644 --- a/Clients/TgDownloaderDesktop/ViewModels/TgClientViewModel.cs +++ b/Clients/TgDownloaderDesktop/ViewModels/TgClientViewModel.cs @@ -110,7 +110,7 @@ public async Task ConfigClientDesktop(string what) IsNeedLastName = true; return LastName; case "session_pathname": - string sessionPath = Path.Combine(Directory.GetCurrentDirectory(), TgAppSettings.AppXml.XmlFileSession); + string sessionPath = Path.Combine(Directory.GetCurrentDirectory(), AppSettings.AppXml.XmlFileSession); return sessionPath; case "verification_code": if (string.IsNullOrEmpty(VerificationCode)) diff --git a/Clients/TgDownloaderDesktop/ViewModels/TgMainViewModel.cs b/Clients/TgDownloaderDesktop/ViewModels/TgMainViewModel.cs index bd48c80..80eed08 100644 --- a/Clients/TgDownloaderDesktop/ViewModels/TgMainViewModel.cs +++ b/Clients/TgDownloaderDesktop/ViewModels/TgMainViewModel.cs @@ -15,6 +15,8 @@ public partial class TgMainViewModel : TgPageViewModelBase private string _appVersionShort = string.Empty; [ObservableProperty] private string _appVersionFull = string.Empty; + [ObservableProperty] + private string _licenseDescription = string.Empty; public TgMainViewModel(ITgSettingsService settingsService) : base(settingsService) { @@ -24,7 +26,7 @@ public TgMainViewModel(ITgSettingsService settingsService) : base(settingsServic $"v{TgCommonUtils.GetTrimVersion(Assembly.GetExecutingAssembly().GetName().Version)}"; AppVersionShort = $"v{TgCommonUtils.GetTrimVersion(Assembly.GetExecutingAssembly().GetName().Version)}"; AppVersionFull = $"{TgResourceExtensions.GetAppVersion()}: {AppVersionShort}"; - + LicenseDescription = LicenseManager.CurrentLicense.Description; } #endregion diff --git a/Clients/TgDownloaderDesktop/Views/TgMainPage.xaml b/Clients/TgDownloaderDesktop/Views/TgMainPage.xaml index 9a2a40f..8723157 100644 --- a/Clients/TgDownloaderDesktop/Views/TgMainPage.xaml +++ b/Clients/TgDownloaderDesktop/Views/TgMainPage.xaml @@ -11,14 +11,20 @@ + - + - + + + + + + @@ -26,7 +32,7 @@ - +