Browse Source

VLCPlaybackController: Simplify repeat code

(cherry picked from commit a5df68ebba0cdcf5ab214fbfd43ee0612b9a8f63)
Carola Nitz 7 years ago
parent
commit
309000a30e
1 changed files with 4 additions and 12 deletions
  1. 4 12
      Sources/VLCPlaybackController.m

+ 4 - 12
Sources/VLCPlaybackController.m

@@ -594,19 +594,11 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 
 - (void)toggleRepeatMode
 {
-    VLCRepeatMode nextRepeatMode = VLCDoNotRepeat;
-    switch (_listPlayer.repeatMode) {
-        case VLCDoNotRepeat:
-            nextRepeatMode = VLCRepeatCurrentItem;
-            break;
-        case VLCRepeatCurrentItem:
-            nextRepeatMode = VLCRepeatAllItems;
-            break;
-        default:
-            nextRepeatMode = VLCDoNotRepeat;
-            break;
+    if (_listPlayer.repeatMode == VLCRepeatAllItems) {
+        _listPlayer.repeatMode = VLCDoNotRepeat;
+    } else {
+        _listPlayer.repeatMode += 1;
     }
-    _listPlayer.repeatMode = nextRepeatMode;
 }
 
 - (NSInteger)indexOfCurrentAudioTrack