Skip to content

Commit

Permalink
fix: scripting bug & code generator bug
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed May 12, 2024
1 parent 16ed08f commit 6d91b5e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
4 changes: 3 additions & 1 deletion GalaxyBudsClient/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class App : Application
defaultBindingMode: BindingMode.OneWay, defaultValue: []);
public NativeMenu TrayMenu => GetValue(TrayMenuProperty);

private readonly ExperimentManager _experimentManager = new();

public override void Initialize()
{
DataContext = this;
Expand Down Expand Up @@ -68,12 +70,12 @@ public override void Initialize()
MediaKeyRemote.Init();
DeviceMessageCache.Init();
BatteryHistoryManager.Init();
ExperimentManager.Init();
ScriptManager.Instance.RegisterUserHooks();

Settings.MainSettingsPropertyChanged += OnMainSettingsPropertyChanged;

Log.Information("Translator mode file location: {File}", Loc.TranslatorModeFile);
Log.Debug("Environment: {Env}", _experimentManager.CurrentEnvironment());
}

public override void OnFrameworkInitializationCompleted()
Expand Down
2 changes: 1 addition & 1 deletion GalaxyBudsClient/Model/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public enum Locales
[Description("Chinese (Traditional)")]
tw,
[Description("Indonesian")]
@in,
in_,
[Description("Vietnamese")]
vn,
[Description("Greek")]
Expand Down
3 changes: 2 additions & 1 deletion GalaxyBudsClient/Model/Specifications/BudsDeviceSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class BudsDeviceSpec : IDeviceSpec
{ Features.Current, null },
{ Features.PairingMode, null },
{ Features.AmbientSoundVolume, null },
{ Features.SppLegacyMessageHeader, null }
{ Features.SppLegacyMessageHeader, null },
{ Features.UsageReport, null },
};

public Models Device => Models.Buds;
Expand Down
26 changes: 2 additions & 24 deletions GalaxyBudsClient/Scripting/Experiment/ExperimentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace GalaxyBudsClient.Scripting.Experiment;

public class ExperimentManager
{
private const int InitialScanTimeout = 5000;
private const int InitialScanTimeout = 10000;
private readonly ExperimentClient _client = new();
private ExperimentRequest? _activeExperiment;
private IExperimentBase? _activeExperimentHook;
Expand Down Expand Up @@ -80,7 +80,7 @@ private void ExcludeExperiment(long id)
Settings.Data.ExperimentsFinishedIds.Add(id);
}

public static Environment CurrentEnvironment()
public Environment CurrentEnvironment()
{
#if DEBUG
return Environment.Internal;
Expand Down Expand Up @@ -159,26 +159,4 @@ private void OnNewResultsFound(object? sender, IReadOnlyList<ExperimentRequest>
LaunchExperiment(e[0]);
}
}

#region Singleton
private static readonly object Padlock = new();
private static ExperimentManager? _instance;
public static ExperimentManager Instance
{
get
{
lock (Padlock)
{
return _instance ??= new ExperimentManager();
}
}
}
public static void Init()
{
lock (Padlock)
{
_instance ??= new ExperimentManager();
}
}
#endregion
}

0 comments on commit 6d91b5e

Please sign in to comment.