Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "$(APP_NAME)";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -237,8 +237,8 @@
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "$(APP_NAME)";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
27 changes: 27 additions & 0 deletions iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x8D",
"green" : "0x42",
"red" : "0x77"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xBE",
"green" : "0x5A",
"red" : "0xA0"
}
},
"idiom" : "universal"
}
],
Expand Down
23 changes: 1 addition & 22 deletions iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"filename" : "blackcandy_logo.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion iosApp/iosApp/Utils/CustomStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ struct CustomStyle {

static let playerImageSize: CGFloat = 200
static let playerMaxWidth: CGFloat = 350
static let sideBarPlayerHeight: CGFloat = 550
static let playlistMaxHeight: CGFloat = 550
static let loginFormMaxWidth: CGFloat = 600

static func spacing(_ spacing: Spacing) -> CGFloat {
spacing.rawValue
Expand Down
28 changes: 4 additions & 24 deletions iosApp/iosApp/ViewControllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,18 @@ import HotwireNative
import LNPopupUI
import sharedKit

class MainViewController: UISplitViewController, UISplitViewControllerDelegate {
class MainViewController: HotwireTabBarController {
private let musicServiceViewModel: MusicServiceViewModel = KoinHelper().getMusicServiceViewModel()

init(serverAddress: String) {
super.init(style: .doubleColumn)
super.init()

preferredDisplayMode = .oneBesideSecondary
preferredSplitBehavior = .tile
presentsWithGesture = false
delegate = self
load(buildMainTabs(serverAddress: serverAddress))

let tabBarController = HotwireTabBarController(navigatorDelegate: self)
let tabs = buildMainTabs(serverAddress: serverAddress)

tabBarController.load(tabs)
tabBarController.presentPopupBar {
presentPopupBar {
PlayerScreen()
}

setViewController(tabBarController, for: .secondary)
setViewController(tabBarController, for: .compact)

musicServiceViewModel.setupMusicServiceController()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

extension MainViewController: NavigatorDelegate {
func handle(proposal: HotwireNative.VisitProposal, from navigator: HotwireNative.Navigator) -> HotwireNative.ProposalResult {
return .accept
}
}
2 changes: 2 additions & 0 deletions iosApp/iosApp/Views/LoginScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct LoginScreen: View {
viewModel.updateServerAddress(serverAddress: serverAddress)
}
)
.frame(maxWidth: CustomStyle.loginFormMaxWidth)
.navigationDestination(for: Route.self) { route in
switch route {
case .authentication:
Expand All @@ -36,6 +37,7 @@ struct LoginScreen: View {
viewModel.updatePassword(password: password)
}
)
.frame(maxWidth: CustomStyle.loginFormMaxWidth)
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions iosApp/iosApp/Views/Player/FullPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SwiftUI
import sharedKit

struct FullPlayer: View {
let isCompactMode: Bool
let currentSong: Song?
let currentPosition: Double
let playbackMode: PlaybackMode
Expand All @@ -11,14 +12,16 @@ struct FullPlayer: View {
let onNextButtonClicked: (() -> Void)
let onPlayButtonClicked: (() -> Void)
let onPauseButtonClicked: (() -> Void)
let onPlaylistButtonClicked: (() -> Void)
let onPlaylistButtonClicked: (() -> Void)?
let onModeSwitchButtonClicked: (() -> Void)
let onFavoriteButtonClicked: (() -> Void)
let onSeek: ((Double) -> Void)

var body: some View {
VStack {
Spacer()
if isCompactMode {
Spacer()
}

PlayerArt(imageURL: currentSong?.albumImageUrl.large)
.padding(.bottom, CustomStyle.spacing(.extraWide))
Expand All @@ -38,7 +41,9 @@ struct FullPlayer: View {
)
.padding(.horizontal, CustomStyle.spacing(.large))

Spacer()
if isCompactMode {
Spacer()
}

PlayerActions(
playbackMode: playbackMode,
Expand Down
26 changes: 14 additions & 12 deletions iosApp/iosApp/Views/Player/PlayerActions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct PlayerActions: View {
let isFavorited: Bool
let onModeSwitchButtonClicked: (() -> Void)
let onFavoriteButtonClicked: (() -> Void)
let onPlaylistButtonClicked: (() -> Void)
let onPlaylistButtonClicked: (() -> Void)?

var body: some View {
HStack {
Expand Down Expand Up @@ -40,18 +40,20 @@ struct PlayerActions: View {
)
.padding(CustomStyle.spacing(.narrow))

Spacer()
if let onPlaylistButtonClicked {
Spacer()

Button(
action: {
onPlaylistButtonClicked()
},
label: {
Image(systemName: "list.bullet")
}
)
.padding(CustomStyle.spacing(.narrow))
.cornerRadius(CustomStyle.cornerRadius(.medium))
Button(
action: {
onPlaylistButtonClicked()
},
label: {
Image(systemName: "list.bullet")
}
)
.padding(CustomStyle.spacing(.narrow))
.cornerRadius(CustomStyle.cornerRadius(.medium))
}
}
}

Expand Down
93 changes: 74 additions & 19 deletions iosApp/iosApp/Views/PlayerScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,83 @@ import sharedKit
struct PlayerScreen: View {
private let viewModel: PlayerViewModel = KoinHelper().getPlayerViewModel()

@Environment(\.horizontalSizeClass) var horizontalSizeClass
@State private var path = NavigationPath()
@State private var albumImage: UIImage?
@State private var currentSong: Song?
@State private var isPlaying = false

var body: some View {
Observing(viewModel.uiState) { uiState in
NavigationStack(path: $path) {
FullPlayer(
currentSong: uiState.musicState.currentSong,
currentPosition: uiState.currentPosition,
playbackMode: uiState.musicState.playbackMode,
isPlaying: uiState.musicState.isPlaying,
isLoading: uiState.musicState.isLoading,
onPreviousButtonClicked: { viewModel.previous() },
onNextButtonClicked: { viewModel.next() },
onPlayButtonClicked: { viewModel.play() },
onPauseButtonClicked: { viewModel.pause() },
onPlaylistButtonClicked: { path.append(Route.playlist) },
onModeSwitchButtonClicked: { viewModel.nextMode() },
onFavoriteButtonClicked: { viewModel.toggleFavorite() },
onSeek: { viewModel.seekToRatio(ratio: $0) }
)
.navigationDestination(for: Route.self) { route in
switch route {
case .playlist:
if horizontalSizeClass == .regular {
HStack(spacing: CustomStyle.spacing(.ultraWide)) {
FullPlayer(
isCompactMode: false,
currentSong: uiState.musicState.currentSong,
currentPosition: uiState.currentPosition,
playbackMode: uiState.musicState.playbackMode,
isPlaying: uiState.musicState.isPlaying,
isLoading: uiState.musicState.isLoading,
onPreviousButtonClicked: { viewModel.previous() },
onNextButtonClicked: { viewModel.next() },
onPlayButtonClicked: { viewModel.play() },
onPauseButtonClicked: { viewModel.pause() },
onPlaylistButtonClicked: nil,
onModeSwitchButtonClicked: { viewModel.nextMode() },
onFavoriteButtonClicked: { viewModel.toggleFavorite() },
onSeek: { viewModel.seekToRatio(ratio: $0) }
)

VStack {
HStack {
Text("label.tracks(\(uiState.musicState.playlist.count))")
Spacer()
EditButton()
}
.padding(CustomStyle.spacing(.medium))
.cornerRadius(CustomStyle.cornerRadius(.large))

PlayerPlaylist(
playlist: uiState.musicState.playlist,
currentSong: uiState.musicState.currentSong,
onItemClicked: { viewModel.playOn(songId: $0) },
onItemSweepToDismiss: { viewModel.removeSongFromPlaylist(songId: $0) },
onItemMoved: { from, to in viewModel.moveSongInPlaylist(from: Int32(from), to: Int32(to)) }
)

}

.frame(maxHeight: CustomStyle.playlistMaxHeight)
}
} else {
NavigationStack(path: $path) {
FullPlayer(
isCompactMode: true,
currentSong: uiState.musicState.currentSong,
currentPosition: uiState.currentPosition,
playbackMode: uiState.musicState.playbackMode,
isPlaying: uiState.musicState.isPlaying,
isLoading: uiState.musicState.isLoading,
onPreviousButtonClicked: { viewModel.previous() },
onNextButtonClicked: { viewModel.next() },
onPlayButtonClicked: { viewModel.play() },
onPauseButtonClicked: { viewModel.pause() },
onPlaylistButtonClicked: { path.append(Route.playlist) },
onModeSwitchButtonClicked: { viewModel.nextMode() },
onFavoriteButtonClicked: { viewModel.toggleFavorite() },
onSeek: { viewModel.seekToRatio(ratio: $0) }
)
.navigationDestination(for: Route.self) { route in
switch route {
case .playlist:
PlayerPlaylist(
playlist: uiState.musicState.playlist,
currentSong: uiState.musicState.currentSong,
onItemClicked: { viewModel.playOn(songId: $0) },
onItemSweepToDismiss: { viewModel.removeSongFromPlaylist(songId: $0) },
onItemMoved: { from, to in viewModel.moveSongInPlaylist(from: Int32(from), to: Int32(to)) }
)
}
}
}
}
Expand All @@ -46,6 +90,17 @@ struct PlayerScreen: View {
.popupImage(albumImage != nil ? Image(uiImage: albumImage!) : nil)
.popupBarButtons {
ToolbarItemGroup(placement: .popupBar) {
if horizontalSizeClass == .regular {
Button(
action: {
viewModel.previous()
},
label: {
Image(systemName: "backward.fill")
.tint(.primary)
}
)
}
Button(
action: {
if isPlaying {
Expand Down