Добавлены новые методы отправки сообщений

This commit is contained in:
2026-02-06 04:38:06 +03:00
parent 69ff3cf7d4
commit cd280369bc
25 changed files with 1525 additions and 219 deletions

View File

@@ -16,9 +16,14 @@ public sealed class PageContext
/// <summary>Хранилище состояния.</summary>
public required IStateStorage StateStorage { get; init; }
/// <summary>Сервис навигации.</summary>
public required NavigationService Navigation { get; init; }
/// <summary>Адаптер мессенджера.</summary>
/// <summary>Фабрика адаптеров (для получения других адаптеров).</summary>
public required IMessengerAdapterFactory AdapterFactory { get; init; }
/// <summary>Текущий адаптер мессенджера.</summary>
public required IMessengerAdapter Adapter { get; init; }
/// <summary>
@@ -26,4 +31,36 @@ public sealed class PageContext
/// </summary>
public IAlbumBuilder Albums => Adapter.CreateAlbumBuilder(this);
/// <summary>
/// Получить адаптер по ID.
/// </summary>
public IMessengerAdapter GetAdapter(string adapterId)
=> AdapterFactory.Resolve(adapterId);
/// <summary>
/// Попытаться получить адаптер по ID.
/// </summary>
public bool TryGetAdapter(string adapterId, out IMessengerAdapter? adapter)
=> AdapterFactory.TryResolve(adapterId, out adapter);
/// <summary>
/// Получить все адаптеры определенного типа.
/// </summary>
public IReadOnlyList<IMessengerAdapter> GetAdaptersByType(string adapterType)
=> AdapterFactory.GetAdaptersByType(adapterType);
/// <summary>
/// Получить текущий тип адаптера.
/// </summary>
public string CurrentAdapterType => Update.AdapterType;
/// <summary>
/// Получить текущий ID адаптера.
/// </summary>
public string CurrentAdapterId => Update.AdapterId;
/// <summary>
/// Получить все адаптеры.
/// </summary>
public IReadOnlyList<IMessengerAdapter> AllAdapters => AdapterFactory.AllAdapters;
}