Skip to content

Commit

Permalink
Fixed connecting to Telegram server for TgDownloaderDesktop
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMorozov committed Jan 2, 2025
1 parent 770d619 commit d8d9f85
Show file tree
Hide file tree
Showing 23 changed files with 616 additions and 495 deletions.
4 changes: 2 additions & 2 deletions Clients/TgDownloaderDesktop/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public App()
services.AddTransient<TgMainPage>();
services.AddTransient<ShellViewModel>();
services.AddTransient<ShellPage>();
services.AddTransient<TgClientViewModel>();
services.AddTransient<TgClientPage>();
services.AddTransient<TgConnectViewModel>();
services.AddTransient<TgConnectPage>();
services.AddTransient<TgLoadDataViewModel>();
services.AddTransient<TgLoadDataPage>();
services.AddTransient<TgContactsViewModel>();
Expand Down
9 changes: 4 additions & 5 deletions Clients/TgDownloaderDesktop/Helpers/TgDesktopUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public static class TgDesktopUtils
#region Public and private fields, properties, constructor

public static TgClientHelper TgClient => TgClientHelper.Instance;
//public static TgClientViewModel TgClientVm { get; } = App.GetService<TgClientViewModel>();
public static string BaseDirectory = AppContext.BaseDirectory;
public static string LocalFolder = ApplicationData.Current.LocalFolder.Path;
public static string InstalledLocation = Package.Current.InstalledLocation.Path;
Expand All @@ -27,7 +26,7 @@ public static class TgDesktopUtils
// {
// if (isUpdateLoad)
// viewModel.IsLoad = true;
// TgClientViewModel.Exception.Clear();
// TgConnectViewModel.Exception.Clear();
// action();
// }

Expand All @@ -42,7 +41,7 @@ public static class TgDesktopUtils
// }
// catch (Exception ex)
// {
// App.MainWindow.DispatcherQueue.TryEnqueue(() => { TgClientViewModel.Exception.Set(ex); });
// App.MainWindow.DispatcherQueue.TryEnqueue(() => { TgConnectViewModel.Exception.Set(ex); });
// }
// finally
// {
Expand Down Expand Up @@ -167,7 +166,7 @@ public static class TgDesktopUtils
// {
// if (isUpdateLoad)
// viewModel.IsLoad = true;
// //TgClientViewModel.Exception.Clear();
// //TgConnectViewModel.Exception.Clear();
// await action();
// }

Expand All @@ -182,7 +181,7 @@ public static class TgDesktopUtils
// }
// catch (Exception ex)
// {
// //App.MainWindow.DispatcherQueue.TryEnqueue(() => TgClientViewModel.Exception.Set(ex));
// //App.MainWindow.DispatcherQueue.TryEnqueue(() => TgConnectViewModel.Exception.Set(ex));
// }
// finally
// {
Expand Down
3 changes: 3 additions & 0 deletions Clients/TgDownloaderDesktop/Helpers/TgResourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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 GetClientEnterLoginCode() => "ClientEnterLoginCode".GetLocalized();
public static string GetClientEnterPassword() => "ClientEnterPassword".GetLocalized();
public static string GetClientFloodWait() => "ClientFloodWait".GetLocalized();
public static string GetClientIsConnected() => "ClientIsConnected".GetLocalized();
public static string GetClientIsDisconnected() => "ClientIsDisconnected".GetLocalized();
public static string GetClipboard() => "Clipboard".GetLocalized();
Expand Down
2 changes: 1 addition & 1 deletion Clients/TgDownloaderDesktop/Services/PageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public PageService()
{
Configure<TgMainViewModel, TgMainPage>();
Configure<TgLoadDataViewModel, TgLoadDataPage>();
Configure<TgClientViewModel, TgClientPage>();
Configure<TgConnectViewModel, TgConnectPage>();
Configure<TgContactsViewModel, TgContactsPage>();
Configure<TgFiltersViewModel, TgFiltersPage>();
Configure<TgSourcesViewModel, TgSourcesPage>();
Expand Down
43 changes: 29 additions & 14 deletions Clients/TgDownloaderDesktop/Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@
<data name="SettingsThemeDefault" xml:space="preserve">
<value>Default</value>
</data>
<data name="SettingsAbout.Text" xml:space="preserve">
<data name="ExpanderAbout.Header" xml:space="preserve">
<value>TgDownloader - Telegram Files Downloader</value>
</data>
<data name="SettingsLicense.Text" xml:space="preserve">
<data name="ExpanderLicense.Header" xml:space="preserve">
<value>License</value>
</data>
<data name="SettingsPage_GitHub_TgDownloader.Content" xml:space="preserve">
Expand Down Expand Up @@ -315,28 +315,31 @@
<data name="ActionDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="SettingsPage_GitHub.Text" xml:space="preserve">
<data name="ExpanderGitHub.Header" xml:space="preserve">
<value>GitHub community</value>
</data>
<data name="SettingsPage_OfficialWebsiteGlobal.Text" xml:space="preserve">
<data name="ExpanderOfficialWebsite.Header" xml:space="preserve">
<value>Official website</value>
</data>
<data name="TextOfficialWebsiteGlobal.Text" xml:space="preserve">
<value>Official website (global version)</value>
</data>
<data name="SettingsPage_OfficialWebsiteRu.Text" xml:space="preserve">
<data name="TextOfficialWebsiteRu.Text" xml:space="preserve">
<value>Official website (russian version)</value>
</data>
<data name="SettingsPage_Download.Text" xml:space="preserve">
<data name="ExpanderDownload.Header" xml:space="preserve">
<value>Download</value>
</data>
<data name="SettingsPage_GitHub_UserSupport.Text" xml:space="preserve">
<data name="ExpanderUserSupport.Header" xml:space="preserve">
<value>User support</value>
</data>
<data name="SettingsPage_GitHub_ProjectSupport.Text" xml:space="preserve">
<data name="ExpanderProjectSupport.Header" xml:space="preserve">
<value>Project support</value>
</data>
<data name="SettingsPage_GitHub_Docker.Text" xml:space="preserve">
<data name="ExpanderDocker.Header" xml:space="preserve">
<value>Docker images</value>
</data>
<data name="SettingsPage_GitHub_InstallRequirements.Text" xml:space="preserve">
<data name="ExpanderInstallRequirements.Header" xml:space="preserve">
<value>Install Requirements</value>
</data>
<data name="SettingsPage_GitHub_InstallRequirementsSaveValues.Text" xml:space="preserve">
Expand Down Expand Up @@ -447,11 +450,11 @@
<data name="OkButton" xml:space="preserve">
<value>Ok</value>
</data>
<data name="ClientConnect.Content" xml:space="preserve">
<value>Connect the client to TG server</value>
<data name="ClientConnect.Text" xml:space="preserve">
<value>Connect to TG server</value>
</data>
<data name="ClientDisconnect.Content" xml:space="preserve">
<value>Disconnect the client from TG server</value>
<data name="ClientDisconnect.Text" xml:space="preserve">
<value>Disconnect from TG server</value>
</data>
<data name="MenuClientIsQuery" xml:space="preserve">
<value>Client requests data</value>
Expand Down Expand Up @@ -480,6 +483,9 @@
<data name="ClientVerificationCode.Text" xml:space="preserve">
<value>Verification code</value>
</data>
<data name="ClientLoginCode.Text" xml:space="preserve">
<value>Login code</value>
</data>
<data name="ClientFirstName.Text" xml:space="preserve">
<value>First name</value>
</data>
Expand All @@ -498,6 +504,15 @@
<data name="ClientIsDisconnected" xml:space="preserve">
<value>Client is disconnected</value>
</data>
<data name="ClientEnterLoginCode" xml:space="preserve">
<value>Enter login code from the Telegram message</value>
</data>
<data name="ClientEnterPassword" xml:space="preserve">
<value>Enter the login password</value>
</data>
<data name="ClientFloodWait" xml:space="preserve">
<value>Flood defense has kicked in, stand by</value>
</data>
<data name="ClientConnectionState.Text" xml:space="preserve">
<value>Connection state</value>
</data>
Expand Down
43 changes: 29 additions & 14 deletions Clients/TgDownloaderDesktop/Strings/ru-RU/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@
<data name="SettingsThemeDefault" xml:space="preserve">
<value>Default</value>
</data>
<data name="SettingsAbout.Text" xml:space="preserve">
<data name="ExpanderAbout.Header" xml:space="preserve">
<value>TgDownloader - Загрузчик файлов Telegram</value>
</data>
<data name="SettingsLicense.Text" xml:space="preserve">
<data name="ExpanderLicense.Header" xml:space="preserve">
<value>Лицензия</value>
</data>
<data name="SettingsPage_GitHub_TgDownloader.Content" xml:space="preserve">
Expand Down Expand Up @@ -374,28 +374,31 @@
<data name="ActionDelete.Text" xml:space="preserve">
<value>Удалить</value>
</data>
<data name="SettingsPage_GitHub.Text" xml:space="preserve">
<data name="ExpanderGitHub.Header" xml:space="preserve">
<value>ГитХаб сообщество</value>
</data>
<data name="SettingsPage_OfficialWebsiteGlobal.Text" xml:space="preserve">
<data name="ExpanderOfficialWebsite.Header" xml:space="preserve">
<value>Официальный вебсайт</value>
</data>
<data name="TextOfficialWebsiteGlobal.Text" xml:space="preserve">
<value>Официальный вебсайт (глобальная версия)</value>
</data>
<data name="SettingsPage_OfficialWebsiteRu.Text" xml:space="preserve">
<data name="TextOfficialWebsiteRu.Text" xml:space="preserve">
<value>Официальный вебсайт (русская версия)</value>
</data>
<data name="SettingsPage_Download.Text" xml:space="preserve">
<data name="ExpanderDownload.Header" xml:space="preserve">
<value>Скачать</value>
</data>
<data name="SettingsPage_GitHub_UserSupport.Text" xml:space="preserve">
<data name="ExpanderUserSupport.Header" xml:space="preserve">
<value>Поддержка пользователей</value>
</data>
<data name="SettingsPage_GitHub_ProjectSupport.Text" xml:space="preserve">
<data name="ExpanderProjectSupport.Header" xml:space="preserve">
<value>Поддержка проекта</value>
</data>
<data name="SettingsPage_GitHub_Docker.Text" xml:space="preserve">
<data name="ExpanderDocker.Header" xml:space="preserve">
<value>Docker образы</value>
</data>
<data name="SettingsPage_GitHub_InstallRequirements.Text" xml:space="preserve">
<data name="ExpanderInstallRequirements.Header" xml:space="preserve">
<value>Требования к установке</value>
</data>
<data name="SettingsPage_GitHub_InstallRequirementsSaveValues.Text" xml:space="preserve">
Expand Down Expand Up @@ -506,11 +509,11 @@
<data name="OkButton" xml:space="preserve">
<value>Ок</value>
</data>
<data name="ClientConnect.Content" xml:space="preserve">
<value>Подключить клиент к серверу TG</value>
<data name="ClientConnect.Text" xml:space="preserve">
<value>Подключиться к серверу TG</value>
</data>
<data name="ClientDisconnect.Content" xml:space="preserve">
<value>Отключить клиент от сервера TG</value>
<data name="ClientDisconnect.Text" xml:space="preserve">
<value>Отключиться от сервера TG</value>
</data>
<data name="MenuClientIsQuery" xml:space="preserve">
<value>Клиент запрашивает данные</value>
Expand Down Expand Up @@ -542,6 +545,9 @@
<data name="ClientVerificationCode.Text" xml:space="preserve">
<value>Проверочный код</value>
</data>
<data name="ClientLoginCode.Text" xml:space="preserve">
<value>Код логина</value>
</data>
<data name="ClientFirstName.Text" xml:space="preserve">
<value>Имя</value>
</data>
Expand All @@ -560,6 +566,15 @@
<data name="ClientIsDisconnected" xml:space="preserve">
<value>Клиент отключен</value>
</data>
<data name="ClientEnterLoginCode" xml:space="preserve">
<value>Введите код входа в систему из сообщения Telegram</value>
</data>
<data name="ClientEnterPassword" xml:space="preserve">
<value>Введите пароль входа</value>
</data>
<data name="ClientFloodWait" xml:space="preserve">
<value>Сработала защита от флуда, ожидайте</value>
</data>
<data name="ClientConnectionState.Text" xml:space="preserve">
<value>Состояние подключения</value>
</data>
Expand Down
2 changes: 2 additions & 0 deletions Clients/TgDownloaderDesktop/Styles/Thickness.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@

<Thickness x:Key="SettingsPageHyperlinkButtonMargin">0,0,10,0</Thickness>

<Thickness x:Key="ExpanderMargin">0,0,10,5</Thickness>

</ResourceDictionary>
5 changes: 1 addition & 4 deletions Clients/TgDownloaderDesktop/TgDownloaderDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
<AppInstallerUri>c:\TgDownloader-Releases\</AppInstallerUri>
<PackageCertificateThumbprint>12ADC21F87DF252CACA6ACA3440704BA8FA91CEA</PackageCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<None Remove="Views\TgClientPage.xaml" />
</ItemGroup>

<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
Expand Down Expand Up @@ -64,7 +61,7 @@
</ItemGroup>

<ItemGroup>
<Page Update="Views\TgClientPage.xaml">
<Page Update="Views\TgConnectPage.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\TgFiltersPage.xaml">
Expand Down
2 changes: 2 additions & 0 deletions Clients/TgDownloaderDesktop/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
global using Microsoft.Xaml.Interactivity;
global using System.Collections.ObjectModel;
global using System.Collections.Specialized;
global using System.Data;
global using System.Diagnostics.CodeAnalysis;
global using System.Diagnostics;
global using System.Reflection;
Expand All @@ -42,6 +43,7 @@
global using TgDownloaderDesktop.ViewModels;
global using TgDownloaderDesktop.Views;
global using TgInfrastructure.Common;
global using TgInfrastructure.Enums;
global using TgInfrastructure.Helpers;
global using TgStorage.Domain.Apps;
global using TgStorage.Domain.Contacts;
Expand Down
Loading

0 comments on commit d8d9f85

Please sign in to comment.