using DidabuCloud.Unity.Core; using Mogafa.App.LogEvents; using System.Collections.Generic; namespace DidabuCloud.Unity.LogEvents { public static class DidabuLogEventReporterExtension { private static bool didabuLogEventReporterAdded = false; private static DidabuLogEventReporter didabuLogEventReporter; /// /// Uses the didabu event reporter. /// /// The didabu. /// The required parameters. public static void UseDidabuEventReporter(this Didabu didabu, List requiredParameters = null, int waitingTime = 60000) { if (!didabuLogEventReporterAdded) { didabuLogEventReporter = new DidabuLogEventReporter(didabu, requiredParameters, waitingTime); LogEventReporter.AddEventReporter(didabuLogEventReporter); didabuLogEventReporterAdded = true; didabu.OnApplicationToBackground += OnApplicationToBackground; } } private static async void OnApplicationToBackground() { if(didabuLogEventReporter != null) { await didabuLogEventReporter.ReportWaitingList(); } } public static void UseDidabuEventReporter(this Didabu didabu, int waitingTime) { UseDidabuEventReporter(didabu, null, waitingTime); } } }