mirror of
				https://github.com/yattee/yattee.git
				synced 2025-10-31 04:31:54 +00:00 
			
		
		
		
	New actions buttons
This commit is contained in:
		| @@ -6,6 +6,14 @@ struct VideoActions: View { | ||||
|         case share | ||||
|         case addToPlaylist | ||||
|         case subscribe | ||||
|         case fullScreen | ||||
|         case pip | ||||
|         #if os(iOS) | ||||
|             case lockOrientation | ||||
|         #endif | ||||
|         case restart | ||||
|         case advanceToNextItem | ||||
|         case musicMode | ||||
|         case settings | ||||
|         case hide | ||||
|         case close | ||||
| @@ -24,6 +32,12 @@ struct VideoActions: View { | ||||
|     @Default(.actionButtonAddToPlaylistEnabled) private var actionButtonAddToPlaylistEnabled | ||||
|     @Default(.actionButtonSubscribeEnabled) private var actionButtonSubscribeEnabled | ||||
|     @Default(.actionButtonSettingsEnabled) private var actionButtonSettingsEnabled | ||||
|     @Default(.actionButtonFullScreenEnabled) private var actionButtonFullScreenEnabled | ||||
|     @Default(.actionButtonPipEnabled) private var actionButtonPipEnabled | ||||
|     @Default(.actionButtonLockOrientationEnabled) private var actionButtonLockOrientationEnabled | ||||
|     @Default(.actionButtonRestartEnabled) private var actionButtonRestartEnabled | ||||
|     @Default(.actionButtonAdvanceToNextItemEnabled) private var actionButtonAdvanceToNextItemEnabled | ||||
|     @Default(.actionButtonMusicModeEnabled) private var actionButtonMusicModeEnabled | ||||
|     @Default(.actionButtonHideEnabled) private var actionButtonHideEnabled | ||||
|     @Default(.actionButtonCloseEnabled) private var actionButtonCloseEnabled | ||||
|  | ||||
| @@ -51,6 +65,20 @@ struct VideoActions: View { | ||||
|             return actionButtonSubscribeEnabled | ||||
|         case .settings: | ||||
|             return actionButtonSettingsEnabled | ||||
|         case .fullScreen: | ||||
|             return actionButtonFullScreenEnabled | ||||
|         case .pip: | ||||
|             return actionButtonPipEnabled | ||||
|         #if os(iOS) | ||||
|             case .lockOrientation: | ||||
|                 return actionButtonLockOrientationEnabled | ||||
|         #endif | ||||
|         case .restart: | ||||
|             return actionButtonRestartEnabled | ||||
|         case .advanceToNextItem: | ||||
|             return actionButtonAdvanceToNextItemEnabled | ||||
|         case .musicMode: | ||||
|             return actionButtonMusicModeEnabled | ||||
|         case .hide: | ||||
|             return actionButtonHideEnabled | ||||
|         case .close: | ||||
| @@ -68,6 +96,8 @@ struct VideoActions: View { | ||||
|             return !(video?.isLocal ?? true) && accounts.signedIn && accounts.app.supportsSubscriptions | ||||
|         case .settings: | ||||
|             return video != nil | ||||
|         case .advanceToNextItem: | ||||
|             return player.isAdvanceToNextItemAvailable | ||||
|         default: | ||||
|             return true | ||||
|         } | ||||
| @@ -110,6 +140,23 @@ struct VideoActions: View { | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 case .fullScreen: | ||||
|                     actionButton("Fullscreen", systemImage: player.fullscreenImage, action: player.toggleFullScreenAction) | ||||
|                 case .pip: | ||||
|                     actionButton("PiP", systemImage: player.pipImage, action: player.togglePiPAction) | ||||
|                 #if os(iOS) | ||||
|                     case .lockOrientation: | ||||
|                         actionButton("Lock", systemImage: player.lockOrientationImage, active: player.lockedOrientation != nil, action: player.lockOrientationAction) | ||||
|                 #endif | ||||
|                 case .restart: | ||||
|                     actionButton("Replay", systemImage: "backward.end.fill", action: player.replayAction) | ||||
|                 case .advanceToNextItem: | ||||
|                     actionButton("Next", systemImage: "forward.fill") { | ||||
|                         player.advanceToNextItem() | ||||
|                     } | ||||
|                 case .musicMode: | ||||
|                     actionButton("Music", systemImage: "music.note", active: player.musicMode, action: player.toggleMusicMode) | ||||
|  | ||||
|                 case .settings: | ||||
|                     actionButton("Settings", systemImage: "gear") { | ||||
|                         withAnimation(ControlOverlaysModel.animation) { | ||||
| @@ -138,15 +185,17 @@ struct VideoActions: View { | ||||
|     func actionButton( | ||||
|         _ name: String, | ||||
|         systemImage: String, | ||||
|         active: Bool = false, | ||||
|         action: @escaping () -> Void = {} | ||||
|     ) -> some View { | ||||
|         Button(action: action) { | ||||
|             VStack(spacing: 3) { | ||||
|                 Image(systemName: systemImage) | ||||
|                     .frame(width: 20, height: 20) | ||||
|                     .foregroundColor(active ? Color("AppRedColor") : .accentColor) | ||||
|                 if playerActionsButtonLabelStyle.text { | ||||
|                     Text(name.localized()) | ||||
|                         .foregroundColor(.secondary) | ||||
|                         .foregroundColor(active ? Color("AppRedColor") : .secondary) | ||||
|                         .font(.caption2) | ||||
|                         .allowsTightening(true) | ||||
|                 } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Arkadiusz Fal
					Arkadiusz Fal