mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-06 19:04:18 +02:00
Renamed Managers to Connectors
This commit is contained in:
@ -11,7 +11,7 @@ public class Gotify : NotificationConnector
|
||||
private readonly HttpClient _client = new();
|
||||
|
||||
[JsonConstructor]
|
||||
public Gotify(GlobalBase clone, string endpoint, string appToken) : base(clone, NotificationManagerType.Gotify)
|
||||
public Gotify(GlobalBase clone, string endpoint, string appToken) : base(clone, NotificationConnectorType.Gotify)
|
||||
{
|
||||
this.endpoint = endpoint;
|
||||
this.appToken = appToken;
|
||||
|
@ -10,7 +10,7 @@ public class LunaSea : NotificationConnector
|
||||
private readonly HttpClient _client = new();
|
||||
|
||||
[JsonConstructor]
|
||||
public LunaSea(GlobalBase clone, string id) : base(clone, NotificationManagerType.LunaSea)
|
||||
public LunaSea(GlobalBase clone, string id) : base(clone, NotificationConnectorType.LunaSea)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
public abstract class NotificationConnector : GlobalBase
|
||||
{
|
||||
public readonly NotificationManagerType notificationManagerType;
|
||||
public readonly NotificationConnectorType notificationConnectorType;
|
||||
|
||||
protected NotificationConnector(GlobalBase clone, NotificationManagerType notificationManagerType) : base(clone)
|
||||
protected NotificationConnector(GlobalBase clone, NotificationConnectorType notificationConnectorType) : base(clone)
|
||||
{
|
||||
this.notificationManagerType = notificationManagerType;
|
||||
this.notificationConnectorType = notificationConnectorType;
|
||||
}
|
||||
|
||||
public enum NotificationManagerType : byte { Gotify = 0, LunaSea = 1 }
|
||||
public enum NotificationConnectorType : byte { Gotify = 0, LunaSea = 1 }
|
||||
|
||||
public abstract void SendNotification(string title, string notificationText);
|
||||
}
|
@ -21,10 +21,10 @@ public class NotificationManagerJsonConverter : JsonConverter
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
JObject jo = JObject.Load(reader);
|
||||
if (jo["notificationManagerType"]!.Value<byte>() == (byte)NotificationConnector.NotificationManagerType.Gotify)
|
||||
if (jo["notificationConnectorType"]!.Value<byte>() == (byte)NotificationConnector.NotificationConnectorType.Gotify)
|
||||
return new Gotify(this._clone, jo.GetValue("endpoint")!.Value<string>()!, jo.GetValue("appToken")!.Value<string>()!);
|
||||
else if (jo["notificationManagerType"]!.Value<byte>() ==
|
||||
(byte)NotificationConnector.NotificationManagerType.LunaSea)
|
||||
else if (jo["notificationConnectorType"]!.Value<byte>() ==
|
||||
(byte)NotificationConnector.NotificationConnectorType.LunaSea)
|
||||
return new LunaSea(this._clone, jo.GetValue("id")!.Value<string>()!);
|
||||
|
||||
throw new Exception();
|
||||
|
Reference in New Issue
Block a user