Remove music
All checks were successful
Ascently - Docs Deploy / build-and-push (push) Successful in 3m57s
All checks were successful
Ascently - Docs Deploy / build-and-push (push) Successful in 3m57s
This commit is contained in:
@@ -58,7 +58,6 @@ struct CalendarView: View {
|
||||
let gym = dataManager.gym(withId: activeSession.gymId)
|
||||
{
|
||||
ActiveSessionBanner(session: activeSession, gym: gym)
|
||||
.environmentObject(MusicService.shared)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 16)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import Combine
|
||||
import MusicKit
|
||||
import SwiftUI
|
||||
|
||||
struct SessionDetailView: View {
|
||||
let sessionId: UUID
|
||||
@EnvironmentObject var dataManager: ClimbingDataManager
|
||||
@EnvironmentObject var themeManager: ThemeManager
|
||||
@EnvironmentObject var musicService: MusicService
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var showingDeleteAlert = false
|
||||
@State private var showingAddAttempt = false
|
||||
@@ -47,12 +45,7 @@ struct SessionDetailView: View {
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
|
||||
if session.status == .active && musicService.isMusicEnabled && musicService.isAuthorized {
|
||||
MusicControlCard()
|
||||
.listRowInsets(EdgeInsets(top: 6, leading: 16, bottom: 6, trailing: 16))
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
|
||||
|
||||
SessionStatsCard(stats: sessionStats)
|
||||
.listRowInsets(EdgeInsets(top: 6, leading: 16, bottom: 6, trailing: 16))
|
||||
@@ -449,52 +442,7 @@ struct SessionStats {
|
||||
let uniqueProblemsCompleted: Int
|
||||
}
|
||||
|
||||
struct MusicControlCard: View {
|
||||
@EnvironmentObject var musicService: MusicService
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Image(systemName: "music.note")
|
||||
.font(.title2)
|
||||
.foregroundColor(.pink)
|
||||
.frame(width: 40, height: 40)
|
||||
.background(Color.pink.opacity(0.1))
|
||||
.clipShape(Circle())
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Music")
|
||||
.font(.headline)
|
||||
|
||||
if let playlistId = musicService.selectedPlaylistId,
|
||||
let playlist = musicService.playlists.first(where: { $0.id.rawValue == playlistId }) {
|
||||
Text(playlist.name)
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
} else {
|
||||
Text("No playlist selected")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
musicService.togglePlayback()
|
||||
}) {
|
||||
Image(systemName: musicService.isPlaying ? "pause.circle.fill" : "play.circle.fill")
|
||||
.font(.system(size: 32))
|
||||
.foregroundColor(.pink)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 16)
|
||||
.fill(Color(.secondarySystemGroupedBackground))
|
||||
.shadow(color: .black.opacity(0.05), radius: 5, x: 0, y: 2)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationView {
|
||||
|
||||
@@ -122,7 +122,6 @@ struct SessionsList: View {
|
||||
{
|
||||
Section {
|
||||
ActiveSessionBanner(session: activeSession, gym: gym)
|
||||
.environmentObject(MusicService.shared)
|
||||
.padding(.horizontal, 16)
|
||||
.listRowInsets(EdgeInsets(top: 16, leading: 0, bottom: 24, trailing: 0))
|
||||
.listRowBackground(Color.clear)
|
||||
@@ -184,7 +183,7 @@ struct ActiveSessionBanner: View {
|
||||
let session: ClimbSession
|
||||
let gym: Gym
|
||||
@EnvironmentObject var dataManager: ClimbingDataManager
|
||||
@EnvironmentObject var musicService: MusicService
|
||||
|
||||
@State private var navigateToDetail = false
|
||||
|
||||
var body: some View {
|
||||
@@ -210,18 +209,7 @@ struct ActiveSessionBanner: View {
|
||||
.monospacedDigit()
|
||||
}
|
||||
|
||||
if musicService.isMusicEnabled && musicService.isAuthorized {
|
||||
Button(action: {
|
||||
musicService.togglePlayback()
|
||||
}) {
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: musicService.isPlaying ? "pause.fill" : "play.fill")
|
||||
.font(.caption)
|
||||
}
|
||||
.foregroundColor(.pink)
|
||||
.padding(.top, 2)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.contentShape(Rectangle())
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import HealthKit
|
||||
import MusicKit
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
import UniformTypeIdentifiers
|
||||
@@ -24,8 +23,7 @@ struct SettingsView: View {
|
||||
HealthKitSection()
|
||||
.environmentObject(dataManager.healthKitService)
|
||||
|
||||
MusicSection()
|
||||
.environmentObject(dataManager.musicService)
|
||||
|
||||
|
||||
AppearanceSection()
|
||||
|
||||
@@ -1282,52 +1280,7 @@ struct HealthKitSection: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct MusicSection: View {
|
||||
@EnvironmentObject var musicService: MusicService
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
Toggle(isOn: Binding(
|
||||
get: { musicService.isMusicEnabled },
|
||||
set: { musicService.toggleMusicEnabled($0) }
|
||||
)) {
|
||||
HStack {
|
||||
Image(systemName: "music.note")
|
||||
.foregroundColor(.pink)
|
||||
Text("Apple Music Integration")
|
||||
}
|
||||
}
|
||||
|
||||
if musicService.isMusicEnabled {
|
||||
if !musicService.isAuthorized {
|
||||
Button("Connect Apple Music") {
|
||||
Task {
|
||||
await musicService.checkAuthorizationStatus()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toggle("Auto-Play on Session Start", isOn: $musicService.isAutoPlayEnabled)
|
||||
Toggle("Stop Music on Session End", isOn: $musicService.isAutoStopEnabled)
|
||||
|
||||
Picker("Playlist", selection: $musicService.selectedPlaylistId) {
|
||||
Text("None").tag(nil as String?)
|
||||
ForEach(musicService.playlists, id: \.id) { playlist in
|
||||
Text(playlist.name).tag(playlist.id.rawValue as String?)
|
||||
}
|
||||
}
|
||||
|
||||
if musicService.isAutoPlayEnabled {
|
||||
Text("Music will only auto-play if headphones are connected when you start a session.")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text("Music")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsView()
|
||||
|
||||
Reference in New Issue
Block a user