Skip to content

Commit

Permalink
Support personalized device names
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed May 21, 2022
1 parent 53641bc commit f6853bc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions GalaxyBudsClient/Model/Specifications/DeviceSpecHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ namespace GalaxyBudsClient.Model.Specifications
{
public static class DeviceSpecHelper
{
private static readonly Collection<IDeviceSpec> _specs = new Collection<IDeviceSpec>();
private static readonly Collection<IDeviceSpec> Specs = new();

static DeviceSpecHelper()
{
_specs.Add(new StubDeviceSpec());
_specs.Add(new BudsDeviceSpec());
_specs.Add(new BudsPlusDeviceSpec());
_specs.Add(new BudsLiveDeviceSpec());
_specs.Add(new BudsProDeviceSpec());
_specs.Add(new Buds2DeviceSpec());
Specs.Add(new StubDeviceSpec());
Specs.Add(new BudsDeviceSpec());
Specs.Add(new BudsPlusDeviceSpec());
Specs.Add(new BudsLiveDeviceSpec());
Specs.Add(new BudsProDeviceSpec());
Specs.Add(new Buds2DeviceSpec());
}

public static IDeviceSpec? FindByDeviceName(string deviceName)
{
return _specs.FirstOrDefault(spec => deviceName.StartsWith(spec.DeviceBaseName));
return Specs.FirstOrDefault(spec => deviceName.Contains(spec.DeviceBaseName));
}

public static IDeviceSpec? FindByModel(Models model)
{
return _specs.FirstOrDefault(spec => model == spec.Device);
return Specs.FirstOrDefault(spec => model == spec.Device);
}
}
}

0 comments on commit f6853bc

Please sign in to comment.