Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulino committed Dec 29, 2022
1 parent 5c52644 commit f2b7b7e
Showing 1 changed file with 18 additions and 32 deletions.
50 changes: 18 additions & 32 deletions src/AmbientSounds.Uwp/Services/ProtocolLaunchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,30 @@

#nullable enable

namespace AmbientSounds.Services
namespace AmbientSounds.Services;

public class ProtocolLaunchController
{
public class ProtocolLaunchController
{
private readonly IMixMediaPlayerService _player;
private readonly INavigator _navigator;
private readonly IMixMediaPlayerService _player;

private const string CompactKey = "compact";
private const string AutoPlayKey = "autoPlay";
private const string AutoPlayKey = "autoPlay";

public ProtocolLaunchController(
IMixMediaPlayerService player,
INavigator navigator)
{
Guard.IsNotNull(player, nameof(player));
Guard.IsNotNull(navigator, nameof(navigator));
public ProtocolLaunchController(IMixMediaPlayerService player)
{
Guard.IsNotNull(player);

_player = player;
_navigator = navigator;
}
_player = player;
}

public void ProcessLaunchProtocolArguments(string arguments)
{
var query = QueryString.Parse(arguments);
query.TryGetValue(AutoPlayKey, out var isAutoPlay);

public void ProcessLaunchProtocolArguments(string arguments)
if (!string.IsNullOrEmpty(isAutoPlay) && Convert.ToBoolean(isAutoPlay))
{
var query = QueryString.Parse(arguments);
query.TryGetValue(CompactKey, out var isCompact);
query.TryGetValue(AutoPlayKey, out var isAutoPlay);

if (!string.IsNullOrEmpty(isCompact) && Convert.ToBoolean(isCompact))
{
// music player compact view not supported for now.
//_navigator.ToCompact();
}

if (!string.IsNullOrEmpty(isAutoPlay) && Convert.ToBoolean(isAutoPlay))
{
// Auto play music.
_player.Play();
}
// Auto play music.
_player.Play();
}
}
}

0 comments on commit f2b7b7e

Please sign in to comment.