Skip to content

Commit

Permalink
Merge pull request #202 from project-fika/notif-changes
Browse files Browse the repository at this point in the history
FikaNotificationManager changes
  • Loading branch information
Lacyway authored Nov 29, 2024
2 parents 40a8898 + d1cfb57 commit 2a78242
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Fika.Core/Networking/Websocket/FikaNotificationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ namespace Fika.Core.Networking.Websocket
public class FikaNotificationManager : MonoBehaviour
{
private static readonly ManualLogSource logger = BepInEx.Logging.Logger.CreateLogSource("FikaNotificationManager");
public static FikaNotificationManager Instance;
public static bool Exists
{
get
{
return Instance != null;
}
}

public string Host { get; set; }
public string Url { get; set; }
Expand All @@ -36,6 +44,7 @@ public bool Connected

public void Awake()
{
Instance = this;
Host = RequestHandler.Host.Replace("http", "ws");
SessionId = RequestHandler.SessionId;
Url = $"{Host}/fika/notification/";
Expand Down
5 changes: 4 additions & 1 deletion Fika.Core/UI/Patches/TarkovApplication_method_18_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ protected override MethodBase GetTargetMethod()
[PatchPostfix]
internal static void Postfix()
{
Singleton<PreloaderUI>.Instance.gameObject.AddComponent<FikaNotificationManager>();
if (!FikaNotificationManager.Exists)
{
Singleton<PreloaderUI>.Instance.gameObject.AddComponent<FikaNotificationManager>();
}
}
}
}

0 comments on commit 2a78242

Please sign in to comment.