diff --git a/Amperfy/Assets.xcassets/Contents.json b/Amperfy/Assets.xcassets/Contents.json index da4a164c..73c00596 100644 --- a/Amperfy/Assets.xcassets/Contents.json +++ b/Amperfy/Assets.xcassets/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Amperfy/Assets.xcassets/main_insert.imageset/Contents.json b/Amperfy/Assets.xcassets/context_queue_append.imageset/Contents.json similarity index 85% rename from Amperfy/Assets.xcassets/main_insert.imageset/Contents.json rename to Amperfy/Assets.xcassets/context_queue_append.imageset/Contents.json index 78293ea2..f6e2c5a3 100644 --- a/Amperfy/Assets.xcassets/main_insert.imageset/Contents.json +++ b/Amperfy/Assets.xcassets/context_queue_append.imageset/Contents.json @@ -9,7 +9,7 @@ "scale" : "2x" }, { - "filename" : "main_insert.png", + "filename" : "context_queue_append.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Amperfy/Assets.xcassets/context_queue_append.imageset/context_queue_append.png b/Amperfy/Assets.xcassets/context_queue_append.imageset/context_queue_append.png new file mode 100644 index 00000000..7262019f Binary files /dev/null and b/Amperfy/Assets.xcassets/context_queue_append.imageset/context_queue_append.png differ diff --git a/Amperfy/Assets.xcassets/waiting_insert.imageset/Contents.json b/Amperfy/Assets.xcassets/context_queue_insert.imageset/Contents.json similarity index 85% rename from Amperfy/Assets.xcassets/waiting_insert.imageset/Contents.json rename to Amperfy/Assets.xcassets/context_queue_insert.imageset/Contents.json index f66d6308..57046257 100644 --- a/Amperfy/Assets.xcassets/waiting_insert.imageset/Contents.json +++ b/Amperfy/Assets.xcassets/context_queue_insert.imageset/Contents.json @@ -9,7 +9,7 @@ "scale" : "2x" }, { - "filename" : "waiting_insert.png", + "filename" : "context_queue_insert.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Amperfy/Assets.xcassets/context_queue_insert.imageset/context_queue_insert.png b/Amperfy/Assets.xcassets/context_queue_insert.imageset/context_queue_insert.png new file mode 100644 index 00000000..3aff8cdc Binary files /dev/null and b/Amperfy/Assets.xcassets/context_queue_insert.imageset/context_queue_insert.png differ diff --git a/Amperfy/Assets.xcassets/main_append.imageset/main_append.png b/Amperfy/Assets.xcassets/main_append.imageset/main_append.png deleted file mode 100644 index 29d63640..00000000 Binary files a/Amperfy/Assets.xcassets/main_append.imageset/main_append.png and /dev/null differ diff --git a/Amperfy/Assets.xcassets/main_insert.imageset/main_insert.png b/Amperfy/Assets.xcassets/main_insert.imageset/main_insert.png deleted file mode 100644 index 3d1f584c..00000000 Binary files a/Amperfy/Assets.xcassets/main_insert.imageset/main_insert.png and /dev/null differ diff --git a/Amperfy/Assets.xcassets/main_append.imageset/Contents.json b/Amperfy/Assets.xcassets/user_queue_append.imageset/Contents.json similarity index 86% rename from Amperfy/Assets.xcassets/main_append.imageset/Contents.json rename to Amperfy/Assets.xcassets/user_queue_append.imageset/Contents.json index cae92e43..a73f8c0c 100644 --- a/Amperfy/Assets.xcassets/main_append.imageset/Contents.json +++ b/Amperfy/Assets.xcassets/user_queue_append.imageset/Contents.json @@ -9,7 +9,7 @@ "scale" : "2x" }, { - "filename" : "main_append.png", + "filename" : "user_queue_append.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Amperfy/Assets.xcassets/user_queue_append.imageset/user_queue_append.png b/Amperfy/Assets.xcassets/user_queue_append.imageset/user_queue_append.png new file mode 100644 index 00000000..ed69bd9d Binary files /dev/null and b/Amperfy/Assets.xcassets/user_queue_append.imageset/user_queue_append.png differ diff --git a/Amperfy/Assets.xcassets/waiting_append.imageset/Contents.json b/Amperfy/Assets.xcassets/user_queue_insert.imageset/Contents.json similarity index 86% rename from Amperfy/Assets.xcassets/waiting_append.imageset/Contents.json rename to Amperfy/Assets.xcassets/user_queue_insert.imageset/Contents.json index 7652cc3d..056cbc31 100644 --- a/Amperfy/Assets.xcassets/waiting_append.imageset/Contents.json +++ b/Amperfy/Assets.xcassets/user_queue_insert.imageset/Contents.json @@ -9,7 +9,7 @@ "scale" : "2x" }, { - "filename" : "waiting_append.png", + "filename" : "user_queue_insert.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Amperfy/Assets.xcassets/user_queue_insert.imageset/user_queue_insert.png b/Amperfy/Assets.xcassets/user_queue_insert.imageset/user_queue_insert.png new file mode 100644 index 00000000..01b0fffb Binary files /dev/null and b/Amperfy/Assets.xcassets/user_queue_insert.imageset/user_queue_insert.png differ diff --git a/Amperfy/Assets.xcassets/waiting_append.imageset/waiting_append.png b/Amperfy/Assets.xcassets/waiting_append.imageset/waiting_append.png deleted file mode 100644 index f248060a..00000000 Binary files a/Amperfy/Assets.xcassets/waiting_append.imageset/waiting_append.png and /dev/null differ diff --git a/Amperfy/Assets.xcassets/waiting_insert.imageset/waiting_insert.png b/Amperfy/Assets.xcassets/waiting_insert.imageset/waiting_insert.png deleted file mode 100644 index 692ed31f..00000000 Binary files a/Amperfy/Assets.xcassets/waiting_insert.imageset/waiting_insert.png and /dev/null differ diff --git a/Amperfy/Player/PlayerUtil.swift b/Amperfy/Player/PlayerUtil.swift index 516a89b9..549da856 100644 --- a/Amperfy/Player/PlayerUtil.swift +++ b/Amperfy/Player/PlayerUtil.swift @@ -41,9 +41,9 @@ enum PlayerQueueType: Int, CaseIterable { var description : String { switch self { - case .prev: return "Previous in Main Queue" + case .prev: return "Previous" case .waitingQueue: return "Next in Waiting Queue" - case .next: return "Next in Main Queue" + case .next: return "Next" } } } diff --git a/Amperfy/Screens/ViewController/BasicTableViewController.swift b/Amperfy/Screens/ViewController/BasicTableViewController.swift index 9f176464..de311a8d 100644 --- a/Amperfy/Screens/ViewController/BasicTableViewController.swift +++ b/Amperfy/Screens/ViewController/BasicTableViewController.swift @@ -35,7 +35,7 @@ typealias QueueSwipeCallback = (IndexPath, _ completionHandler: @escaping (_ pla extension BasicTableViewController { func createInsertNextQueueSwipeAction(indexPath: IndexPath, actionCallback: @escaping QueueSwipeCallback) -> UIContextualAction { - let action = UIContextualAction(style: .normal, title: "Insert into Next in Main Queue") { (action, view, completionHandler) in + let action = UIContextualAction(style: .normal, title: "Play Next") { (action, view, completionHandler) in let generator = UINotificationFeedbackGenerator() generator.notificationOccurred(.success) actionCallback(indexPath) { playables in @@ -44,26 +44,12 @@ extension BasicTableViewController { completionHandler(true) } action.backgroundColor = .systemBlue - action.image = UIImage(named: "main_insert")?.invertedImage() - return action - } - - func createInsertWaitingQueueSwipeAction(indexPath: IndexPath, actionCallback: @escaping QueueSwipeCallback) -> UIContextualAction { - let action = UIContextualAction(style: .normal, title: "Insert into Next in Waiting Queue") { (action, view, completionHandler) in - let generator = UIImpactFeedbackGenerator(style: .light) - generator.impactOccurred() - actionCallback(indexPath) { playables in - self.appDelegate.player.insertFirstToWaitingQueue(playables: playables.filterCached(dependigOn: self.appDelegate.persistentStorage.settings.isOfflineMode)) - } - completionHandler(true) - } - action.backgroundColor = .systemOrange - action.image = UIImage(named: "waiting_insert")?.invertedImage() + action.image = UIImage(named: "context_queue_insert")?.invertedImage() return action } func createAppendNextQueueSwipeAction(indexPath: IndexPath, actionCallback: @escaping QueueSwipeCallback) -> UIContextualAction { - let action = UIContextualAction(style: .normal, title: "Append to Next in Main Queue") { (action, view, completionHandler) in + let action = UIContextualAction(style: .normal, title: "Play Later") { (action, view, completionHandler) in let generator = UINotificationFeedbackGenerator() generator.notificationOccurred(.success) actionCallback(indexPath) { playables in @@ -71,22 +57,8 @@ extension BasicTableViewController { } completionHandler(true) } - action.backgroundColor = .systemBlue - action.image = UIImage(named: "main_append")?.invertedImage() - return action - } - - func createAppendWaitingQueueSwipeAction(indexPath: IndexPath, actionCallback: @escaping QueueSwipeCallback) -> UIContextualAction { - let action = UIContextualAction(style: .normal, title: "Append to Next in Waiting Queue") { (action, view, completionHandler) in - let generator = UIImpactFeedbackGenerator(style: .light) - generator.impactOccurred() - actionCallback(indexPath) { playables in - self.appDelegate.player.appendToWaitingQueue(playables: playables.filterCached(dependigOn: self.appDelegate.persistentStorage.settings.isOfflineMode)) - } - completionHandler(true) - } action.backgroundColor = .systemOrange - action.image = UIImage(named: "waiting_append")?.invertedImage() + action.image = UIImage(named: "context_queue_append")?.invertedImage() return action } } @@ -120,18 +92,11 @@ class BasicTableViewController: UITableViewController { updateSearchResults(for: searchController) } - override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { - guard let swipeCB = swipeCallback else { return nil } - return UISwipeActionsConfiguration(actions: [ - createInsertNextQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB), - createInsertWaitingQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB) - ]) - } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { guard let swipeCB = swipeCallback else { return nil } return UISwipeActionsConfiguration(actions: [ - createAppendNextQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB), - createAppendWaitingQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB) + createInsertNextQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB), + createAppendNextQueueSwipeAction(indexPath: indexPath, actionCallback: swipeCB) ]) } diff --git a/Amperfy/Screens/ViewController/DirectoriesVC.swift b/Amperfy/Screens/ViewController/DirectoriesVC.swift index 807b9c62..96de6ec9 100644 --- a/Amperfy/Screens/ViewController/DirectoriesVC.swift +++ b/Amperfy/Screens/ViewController/DirectoriesVC.swift @@ -80,31 +80,16 @@ class DirectoriesVC: BasicTableViewController { return 0.0 } } - - override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { - guard indexPath.section == 1 else { return nil } - let adjustedIndexPath = IndexPath(row: indexPath.row , section: 0) - return UISwipeActionsConfiguration(actions: [ - createInsertNextQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in - let song = self.songsFetchedResultsController.getWrappedEntity(at: indexPath) - completionHandler([song]) - }, - createInsertWaitingQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in - let song = self.songsFetchedResultsController.getWrappedEntity(at: indexPath) - completionHandler([song]) - } - ]) - } override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { guard indexPath.section == 1 else { return nil } let adjustedIndexPath = IndexPath(row: indexPath.row , section: 0) return UISwipeActionsConfiguration(actions: [ - createAppendNextQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in + createInsertNextQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in let song = self.songsFetchedResultsController.getWrappedEntity(at: indexPath) completionHandler([song]) }, - createAppendWaitingQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in + createAppendNextQueueSwipeAction(indexPath: adjustedIndexPath) { (indexPath, completionHandler) in let song = self.songsFetchedResultsController.getWrappedEntity(at: indexPath) completionHandler([song]) } diff --git a/Amperfy/Screens/ViewController/PopupPlayerVC.swift b/Amperfy/Screens/ViewController/PopupPlayerVC.swift index 692bbfc8..b3f60b56 100644 --- a/Amperfy/Screens/ViewController/PopupPlayerVC.swift +++ b/Amperfy/Screens/ViewController/PopupPlayerVC.swift @@ -247,26 +247,7 @@ class PopupPlayerVC: UIViewController, UITableViewDelegate, UITableViewDataSourc func refreshWaitingQueueSectionHeader() { let waitingQueueSectionView = sectionViews[1] - if player.waitingQueue.isEmpty { - waitingQueueSectionView.hide() - } else { - waitingQueueSectionView.display(type: .waitingQueue, buttonTitle: "Clear") { - self.clearWaitingQueue() - } - } - } - - func clearWaitingQueue() { - tableView.beginUpdates() - var indexPaths = [IndexPath]() - for i in 0...self.player.waitingQueue.count-1 { - indexPaths.append(IndexPath(row: i, section: 1)) - } - tableView.deleteRows(at: indexPaths, with: .fade) - appDelegate.player.clearWaitingQueue() - tableView.endUpdates() - refreshWaitingQueueSectionHeader() - playerView?.refreshPlayer() + waitingQueueSectionView.hide() } // Override to support conditional rearranging of the table view. @@ -307,11 +288,6 @@ class PopupPlayerVC: UIViewController, UITableViewDelegate, UITableViewDataSourc self.reloadData() self.playerView?.refreshPlayer() })) - if !player.waitingQueue.isEmpty { - alert.addAction(UIAlertAction(title: "Clear Waiting Queue", style: .default, handler: { _ in - self.clearWaitingQueue() - })) - } if appDelegate.persistentStorage.settings.isOnlineMode { alert.addAction(UIAlertAction(title: "Add all songs to playlist", style: .default, handler: { _ in let selectPlaylistVC = PlaylistSelectorVC.instantiateFromAppStoryboard() diff --git a/Design/Playlist.xcf b/Design/Playlist.xcf index b8d3c415..d1bebdab 100644 Binary files a/Design/Playlist.xcf and b/Design/Playlist.xcf differ diff --git a/Design/context_queue_append.png b/Design/context_queue_append.png new file mode 100644 index 00000000..7262019f Binary files /dev/null and b/Design/context_queue_append.png differ diff --git a/Design/context_queue_insert.png b/Design/context_queue_insert.png new file mode 100644 index 00000000..3aff8cdc Binary files /dev/null and b/Design/context_queue_insert.png differ diff --git a/Design/user_queue_append.png b/Design/user_queue_append.png new file mode 100644 index 00000000..ed69bd9d Binary files /dev/null and b/Design/user_queue_append.png differ diff --git a/Design/user_queue_insert.png b/Design/user_queue_insert.png new file mode 100644 index 00000000..01b0fffb Binary files /dev/null and b/Design/user_queue_insert.png differ