This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
beatsaber-scoretracker/Mod/Plugin.cs
Liam 7b560075ba
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 35s
Release Mod / Build (push) Successful in 30s
mod: cleanup auth
2024-08-15 18:22:16 +01:00

55 lines
1.4 KiB
C#

using IPA;
using IPALogger = IPA.Logging.Logger;
using SiraUtil.Zenject;
using System.Threading.Tasks;
using ScoreTracker.API;
using IPA.Config.Stores;
using IPA.Config;
using ScoreTracker.Configuration;
using ScoreTracker.Installers;
namespace ScoreTracker
{
[Plugin(RuntimeOptions.DynamicInit)]
[NoEnableDisable]
public class Plugin
{
internal static Plugin Instance { get; private set; }
internal static IPALogger Log { get; private set; }
[Init]
public Plugin(IPALogger logger, Zenjector zenjector, Config config)
{
Instance = this;
Log = logger; // Setup the logger
// Setup Zenject
zenjector.UseLogger(logger);
zenjector.UseMetadataBinder<Plugin>();
zenjector.Install<AppInstaller>(Location.App);
// Setup the config
PluginConfig.Instance = config.Generated<PluginConfig>();
}
[OnStart]
public void OnApplicationStart()
{
Log.Info("OnApplicationStart");
// Ensure the user is logged in
Task.Factory.StartNew(async () =>
{
await Authentication.ValidateAndSignIn(); // Ensure the user is signed in
});
}
[OnExit]
public void OnApplicationQuit()
{
Log.Info("OnApplicationQuit");
}
}
}