-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Play Next for Android + Swipes (#653)
* Play next handled, when playing from queue * Play Next and Add To Playlist added to swipes on Track * iOS pipeline fix
- Loading branch information
Showing
35 changed files
with
510 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using BMM.Core.Constants; | ||
using BMM.Core.GuardedActions.Base; | ||
using BMM.Core.GuardedActions.Tracks.Interfaces; | ||
using BMM.Core.GuardedActions.Tracks.Parameters; | ||
using BMM.Core.Helpers.PresentationHints; | ||
using BMM.Core.Messages; | ||
using BMM.Core.ViewModels; | ||
using MvvmCross.Navigation; | ||
using MvvmCross.Plugin.Messenger; | ||
|
||
namespace BMM.Core.GuardedActions.Tracks; | ||
|
||
public class AddToPlaylistAction | ||
: GuardedActionWithParameter<TrackActionsParameter>, | ||
IAddToPlaylistAction | ||
{ | ||
private readonly IMvxNavigationService _mvxNavigationService; | ||
private readonly IMvxMessenger _mvxMessenger; | ||
|
||
public AddToPlaylistAction( | ||
IMvxNavigationService mvxNavigationService, | ||
IMvxMessenger mvxMessenger) | ||
{ | ||
_mvxNavigationService = mvxNavigationService; | ||
_mvxMessenger = mvxMessenger; | ||
} | ||
|
||
protected override async Task Execute(TrackActionsParameter parameter) | ||
{ | ||
await _mvxNavigationService.ChangePresentation(new CloseFragmentsOverPlayerHint()); | ||
_mvxMessenger.Publish(new TogglePlayerMessage(this, false)); | ||
await Task.Delay(ViewConstants.DefaultAnimationDurationInMilliseconds); | ||
|
||
await _mvxNavigationService.Navigate<TrackCollectionsAddToViewModel, TrackCollectionsAddToViewModel.Parameter>( | ||
new TrackCollectionsAddToViewModel.Parameter | ||
{ | ||
DocumentId = parameter.Track.Id, | ||
DocumentType = parameter.Track.DocumentType, | ||
OriginViewModel = parameter.PlaybackOrigin | ||
}); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
BMM.Core/GuardedActions/Tracks/Interfaces/IAddToPlaylistAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using BMM.Core.GuardedActions.Base.Interfaces; | ||
using BMM.Core.GuardedActions.Tracks.Parameters; | ||
|
||
namespace BMM.Core.GuardedActions.Tracks.Interfaces; | ||
|
||
public interface IAddToPlaylistAction : IGuardedActionWithParameter<TrackActionsParameter> | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using BMM.Core.GuardedActions.Base.Interfaces; | ||
using BMM.Core.GuardedActions.Tracks.Parameters; | ||
|
||
namespace BMM.Core.GuardedActions.Tracks.Interfaces; | ||
|
||
public interface IPlayNextAction : IGuardedActionWithParameter<TrackActionsParameter> | ||
{ | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
BMM.Core/GuardedActions/Tracks/Parameters/TrackActionsParameter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using BMM.Api.Implementation.Models; | ||
|
||
namespace BMM.Core.GuardedActions.Tracks.Parameters; | ||
|
||
public class TrackActionsParameter | ||
{ | ||
public TrackActionsParameter(Track track, string playbackOrigin) | ||
{ | ||
Track = track; | ||
PlaybackOrigin = playbackOrigin; | ||
} | ||
|
||
public Track Track { get; } | ||
public string PlaybackOrigin { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using BMM.Core.GuardedActions.Base; | ||
using BMM.Core.GuardedActions.Tracks.Interfaces; | ||
using BMM.Core.GuardedActions.Tracks.Parameters; | ||
using BMM.Core.Implementations.Analytics; | ||
using BMM.Core.Implementations.Localization.Interfaces; | ||
using BMM.Core.Implementations.UI; | ||
using BMM.Core.NewMediaPlayer.Abstractions; | ||
using BMM.Core.Translation; | ||
|
||
namespace BMM.Core.GuardedActions.Tracks; | ||
|
||
public class PlayNextAction | ||
: GuardedActionWithParameter<TrackActionsParameter>, | ||
IPlayNextAction | ||
{ | ||
private readonly IMediaPlayer _mediaPlayer; | ||
private readonly IToastDisplayer _toastDisplayer; | ||
private readonly IBMMLanguageBinder _bmmLanguageBinder; | ||
private readonly IAnalytics _analytics; | ||
|
||
public PlayNextAction( | ||
IMediaPlayer mediaPlayer, | ||
IToastDisplayer toastDisplayer, | ||
IBMMLanguageBinder bmmLanguageBinder, | ||
IAnalytics analytics) | ||
{ | ||
_mediaPlayer = mediaPlayer; | ||
_toastDisplayer = toastDisplayer; | ||
_bmmLanguageBinder = bmmLanguageBinder; | ||
_analytics = analytics; | ||
} | ||
|
||
protected override async Task Execute(TrackActionsParameter parameter) | ||
{ | ||
bool success = await _mediaPlayer.QueueToPlayNext(parameter.Track, parameter.PlaybackOrigin); | ||
|
||
if (success) | ||
{ | ||
await _toastDisplayer | ||
.Success(_bmmLanguageBinder.GetText(Translations.UserDialogs_Track_AddedToQueue, parameter.Track.Title)); | ||
|
||
_analytics | ||
.LogEvent(Event.TrackHasBeenAddedToBePlayedNext, | ||
new Dictionary<string, object> | ||
{ | ||
{ "track", parameter.Track.Id } | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.