Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify queue and play method of DetailViewController and ShowInfoViewController #740

Open
wutschel opened this issue Oct 13, 2022 · 1 comment

Comments

@wutschel
Copy link
Contributor

Inside controllers DetailViewController and ShowInfoViewController there are methods to add items to the playlist queue and to start playback. Those are very similar and should be unified into generic methods. Methods of interest are

DetailViewController:

  • (void)addQueue:(NSDictionary*) indexPath:(NSIndexPath*) afterCurrentItem:(BOOL)
  • (void)addPlayback:(NSDictionary*) indexPath:(NSIndexPath*) position:(int) shuffle:(BOOL)

ShowInfoViewController

  • (void)addQueueAfterCurrent:(BOOL)
  • (void)addPlayback:(float)
@AbdelAzizMohamedMousa
Copy link

Thank you for your question. It sounds like you are looking to unify the add queue and playback methods in the DetailViewController and ShowInfoViewController controllers into generic methods.

To achieve this, you could create a separate class or extension that contains the generic methods for adding items to the playlist queue and starting playback. This class could then be imported and used in both the DetailViewController and ShowInfoViewController classes.

Here is an example of what these generic methods might look like:
`@interface MyPlaylistManager : NSObject

  • (void)addToQueue:(NSDictionary *)item afterCurrentItem:(BOOL)afterCurrent;
  • (void)startPlayback:(NSDictionary *)item position:(int)position shuffle:(BOOL)shuffle;

@EnD

@implementation MyPlaylistManager

  • (void)addToQueue:(NSDictionary *)item afterCurrentItem:(BOOL)afterCurrent {
    // Logic for adding item to the playlist queue
    }

  • (void)startPlayback:(NSDictionary *)item position:(int)position shuffle:(BOOL)shuffle {
    // Logic for starting playback of the specified item at the specified position
    }

@EnD
`

You could then call these methods from the DetailViewController and ShowInfoViewController classes, passing in the appropriate parameters as needed:

`// Example usage in DetailViewController
[MyPlaylistManager addToQueue:item afterCurrentItem:YES];
[MyPlaylistManager startPlayback:item position:0 shuffle:NO];

// Example usage in ShowInfoViewController
[MyPlaylistManager addToQueue:item afterCurrentItem:NO];
[MyPlaylistManager startPlayback:item position:0 shuffle:YES];
`

I hope this helps, and let me know if you have any further questions or concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants