소스 검색

VLCPlaybackController: Simplify repeat code

(cherry picked from commit a5df68ebba0cdcf5ab214fbfd43ee0612b9a8f63)
Carola Nitz 7 년 전
부모
커밋
309000a30e
1개의 변경된 파일4개의 추가작업 그리고 12개의 파일을 삭제
  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