mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-29 10:09:49 +08:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using BetterGenshinImpact.Core.Config;
|
|
using BetterGenshinImpact.Service.Interface;
|
|
using BetterGenshinImpact.Service.Notification;
|
|
using BetterGenshinImpact.Service.Notifier;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BetterGenshinImpact.ViewModel.Pages;
|
|
|
|
public partial class NotificationSettingsPageViewModel : ObservableObject, IViewModel
|
|
{
|
|
public AllConfig Config { get; set; }
|
|
|
|
private readonly NotificationService _notificationService;
|
|
|
|
[ObservableProperty] private bool _isLoading;
|
|
|
|
[ObservableProperty] private string _webhookStatus = string.Empty;
|
|
|
|
public NotificationSettingsPageViewModel(IConfigService configService, NotificationService notificationService)
|
|
{
|
|
Config = configService.Get();
|
|
_notificationService = notificationService;
|
|
}
|
|
|
|
[RelayCommand]
|
|
private async Task OnTestWebhook()
|
|
{
|
|
IsLoading = true;
|
|
WebhookStatus = string.Empty;
|
|
|
|
var res = await _notificationService.TestNotifierAsync<WebhookNotifier>();
|
|
|
|
WebhookStatus = res.Message;
|
|
|
|
IsLoading = false;
|
|
}
|
|
}
|