Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge newcase to Develop #89

Merged
merged 12 commits into from
Jun 4, 2024
Merged
12 changes: 8 additions & 4 deletions MinGenie/MinGenie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
/* Begin PBXBuildFile section */
130D52852BFDD6AC0010BAE2 /* OnboardingTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130D52842BFDD6AC0010BAE2 /* OnboardingTabView.swift */; };
130D52872BFDD6B60010BAE2 /* OnboardingPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130D52862BFDD6B60010BAE2 /* OnboardingPageView.swift */; };
130D52892BFDD6BF0010BAE2 /* OnboardingButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130D52882BFDD6BF0010BAE2 /* OnboardingButtonView.swift */; };
130D52892BFDD6BF0010BAE2 /* OnboardingMusicAuthButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130D52882BFDD6BF0010BAE2 /* OnboardingMusicAuthButtonView.swift */; };
130D528B2BFDD6CB0010BAE2 /* OnboardingLastPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130D528A2BFDD6CB0010BAE2 /* OnboardingLastPageView.swift */; };
264802B22BFE343700369831 /* StoredTrack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264802B12BFE343700369831 /* StoredTrack.swift */; };
269FDD552BF88FE200715CB4 /* ActionDetectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 269FDD542BF88FE200715CB4 /* ActionDetectionModel.swift */; };
26B6F5262BFA2D07000B2340 /* MusicItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26B6F5252BFA2D07000B2340 /* MusicItemCell.swift */; };
26B6F5292BFA36AC000B2340 /* MusicItemRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26B6F5282BFA36AC000B2340 /* MusicItemRowView.swift */; };
26B6F52B2BFA436E000B2340 /* HomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26B6F52A2BFA436E000B2340 /* HomeModel.swift */; };
26E8A0632BFF7D4A001EF6AE /* NextMusicRecommendationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E8A0622BFF7D4A001EF6AE /* NextMusicRecommendationModel.swift */; };
26EF7C342C074F530010EBAC /* OnboardingNextButtonPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EF7C332C074F530010EBAC /* OnboardingNextButtonPageView.swift */; };
452B00992BFE14B4002F4560 /* headphone.gif in Resources */ = {isa = PBXBuildFile; fileRef = 452B00952BFE14B4002F4560 /* headphone.gif */; };
452B009C2BFE14B4002F4560 /* notebook.gif in Resources */ = {isa = PBXBuildFile; fileRef = 452B00982BFE14B4002F4560 /* notebook.gif */; };
452B009E2BFE1C68002F4560 /* shaking.gif in Resources */ = {isa = PBXBuildFile; fileRef = 452B009D2BFE1C68002F4560 /* shaking.gif */; };
Expand Down Expand Up @@ -47,14 +48,15 @@
/* Begin PBXFileReference section */
130D52842BFDD6AC0010BAE2 /* OnboardingTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTabView.swift; sourceTree = "<group>"; };
130D52862BFDD6B60010BAE2 /* OnboardingPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingPageView.swift; sourceTree = "<group>"; };
130D52882BFDD6BF0010BAE2 /* OnboardingButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingButtonView.swift; sourceTree = "<group>"; };
130D52882BFDD6BF0010BAE2 /* OnboardingMusicAuthButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingMusicAuthButtonView.swift; sourceTree = "<group>"; };
130D528A2BFDD6CB0010BAE2 /* OnboardingLastPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingLastPageView.swift; sourceTree = "<group>"; };
264802B12BFE343700369831 /* StoredTrack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoredTrack.swift; sourceTree = "<group>"; };
269FDD542BF88FE200715CB4 /* ActionDetectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDetectionModel.swift; sourceTree = "<group>"; };
26B6F5252BFA2D07000B2340 /* MusicItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicItemCell.swift; sourceTree = "<group>"; };
26B6F5282BFA36AC000B2340 /* MusicItemRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicItemRowView.swift; sourceTree = "<group>"; };
26B6F52A2BFA436E000B2340 /* HomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeModel.swift; sourceTree = "<group>"; };
26E8A0622BFF7D4A001EF6AE /* NextMusicRecommendationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextMusicRecommendationModel.swift; sourceTree = "<group>"; };
26EF7C332C074F530010EBAC /* OnboardingNextButtonPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingNextButtonPageView.swift; sourceTree = "<group>"; };
452B00952BFE14B4002F4560 /* headphone.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = headphone.gif; sourceTree = "<group>"; };
452B00982BFE14B4002F4560 /* notebook.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = notebook.gif; sourceTree = "<group>"; };
452B009D2BFE1C68002F4560 /* shaking.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = shaking.gif; sourceTree = "<group>"; };
Expand Down Expand Up @@ -100,7 +102,8 @@
children = (
130D52842BFDD6AC0010BAE2 /* OnboardingTabView.swift */,
130D52862BFDD6B60010BAE2 /* OnboardingPageView.swift */,
130D52882BFDD6BF0010BAE2 /* OnboardingButtonView.swift */,
26EF7C332C074F530010EBAC /* OnboardingNextButtonPageView.swift */,
130D52882BFDD6BF0010BAE2 /* OnboardingMusicAuthButtonView.swift */,
C7D27B4C2BFF0B9800E76800 /* OnboardingFailPageView.swift */,
130D528A2BFDD6CB0010BAE2 /* OnboardingLastPageView.swift */,
C7D27B482BFDED9E00E76800 /* GifImage.swift */,
Expand Down Expand Up @@ -354,10 +357,11 @@
D8672FEB2BF2444600E9E242 /* MinGenieApp.swift in Sources */,
D85D2AB42BFDD024003803C0 /* DetailedAlbumModel.swift in Sources */,
26B6F52B2BFA436E000B2340 /* HomeModel.swift in Sources */,
26EF7C342C074F530010EBAC /* OnboardingNextButtonPageView.swift in Sources */,
D8C4C80C2BFF1B2E007C9E4B /* NowQueueItemCell.swift in Sources */,
269FDD552BF88FE200715CB4 /* ActionDetectionModel.swift in Sources */,
86D8FD0C2BFB2B99008FD1AD /* MiniPlayerItemCell.swift in Sources */,
130D52892BFDD6BF0010BAE2 /* OnboardingButtonView.swift in Sources */,
130D52892BFDD6BF0010BAE2 /* OnboardingMusicAuthButtonView.swift in Sources */,
130D52872BFDD6B60010BAE2 /* OnboardingPageView.swift in Sources */,
26B6F5292BFA36AC000B2340 /* MusicItemRowView.swift in Sources */,
86D8FD052BFB2B52008FD1AD /* MusicPlayerModel.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "AppIcon1024x1024.png",
"filename" : "MinGenie.jpg",
"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.
19 changes: 13 additions & 6 deletions MinGenie/MinGenie/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by 김유빈 on 5/13/24.
//


import AudioToolbox
import MusicKit
import SwiftUI

Expand All @@ -15,16 +15,17 @@ struct ContentView: View {
@StateObject private var shakeDetectionModel = ShakeDetectionModel()
@StateObject var musicPlayerModel = MusicPlayerModel.shared

@State private var hasSeenOnboarding: Bool = UserDefaults.standard.bool(forKey: "hasSeenOnboarding")
@State private var hasSeenOnboarding: Bool = false

var body: some View {
if hasSeenOnboarding {
if hasSeenOnboarding {
ZStack(alignment: .bottom) {
HomeView()
.modelContainer(for: StoredTrackID.self)
.environmentObject(musicPlayerModel)

.onChange(of: phase) { _, newValue in
if newValue == .background {
if newValue == .background && musicPlayerModel.isPlaying {
shakeDetectionModel.startDetection()
} else {
shakeDetectionModel.stopDetection()
Expand All @@ -34,6 +35,8 @@ struct ContentView: View {
if newValue && musicPlayerModel.isPlaying {
print("🎧 Music Change")

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) //진동 주기

// 노래 교체가 끝나면 다시 시작
shakeDetectionModel.stopDetection()
Task {
Expand All @@ -44,9 +47,13 @@ struct ContentView: View {
}
}
}
} else {
OnboardingTabView(hasSeenOnboarding: $hasSeenOnboarding)
MiniPlayerView()
}
.ignoresSafeArea(.keyboard)
} else {
OnboardingTabView(hasSeenOnboarding: $hasSeenOnboarding)
}
}
}

Expand Down
38 changes: 18 additions & 20 deletions MinGenie/MinGenie/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,30 @@ struct HomeView: View {

var body: some View {
NavigationView {
if searchTerm.isEmpty { // 검색어 없을 때
// 검색어 없을 때
if searchTerm.isEmpty {
VStack(spacing: 0) {

if let tracks = selectedMusicDataModel.storedTracks {
MusicItemRowView(itemRowTitle: "지난 선곡", tracks: tracks)
.padding(.bottom, 30)
}

if let tracks = musicPersonalRecommendationModel.personalRecommendationTracks {
MusicItemRowView(itemRowTitle: "맞춤 랜덤 선곡", tracks: tracks)
}

Spacer()

MiniPlayerView()
if let tracks = selectedMusicDataModel.storedTracks {
MusicItemRowView(itemRowTitle: "지난 선곡", tracks: tracks)
.padding(.bottom, 30)
}
.padding(.top, 20)
.navigationTitle("오늘의 첫곡 🎧")
.background(Color.BG.main)
.ignoresSafeArea(.keyboard)

} else { // 검색어 있을 때

if let tracks = musicPersonalRecommendationModel.personalRecommendationTracks {
MusicItemRowView(itemRowTitle: "맞춤 랜덤 선곡", tracks: tracks)
}

Spacer()
}
.padding(.top, 20)
.navigationTitle("오늘의 첫곡 🎧")
.background(Color.BG.main)
} else {
// 검색어 있을 때
MusicSearchView(searchTerm: $searchTerm)
}
}
.background(Color.BG.main)
.tint(Color.accentColor)
.searchable(text: $searchTerm, prompt: "아티스트, 노래")
.onChange(of: storedTrackIDs) {
selectedMusicDataModel.loadTracksByID(storedTrackIDs)
Expand Down
20 changes: 11 additions & 9 deletions MinGenie/MinGenie/OnboardingViews/OnboardingLastPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@ struct OnboardingLastPageView: View {

var body: some View {
ZStack {
VStack{
VStack {
Text(title)
.font(.title)
.fontWeight(.bold)
.foregroundStyle(Color.Text.blue)
.multilineTextAlignment(.center)
.lineSpacing(6)
.frame(width: 300, height: 120, alignment: .bottom)

.padding(EdgeInsets(top: 100, leading: 0, bottom: 40, trailing: 0))
GifImage(imageName)
.aspectRatio(contentMode: .fit)
.frame(width: 361, height: 200)

Spacer()
}
VStack{

VStack {
Spacer()
Button(action: {
UserDefaults.standard.set(true, forKey: "hasSeenOnboarding")
Button {
hasSeenOnboarding = true

}) {
} label: {
Text("시작하기")
.fontWeight(.semibold)
.foregroundColor(.white)
.foregroundColor(Color.Text.white100)
.frame(width: 361, height: 50)
.background(Color.black)
.background(Color.Shape.black)
.cornerRadius(16)
.padding(.bottom, 160) }
.padding(.bottom, 160)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// OnboardingButtonView.swift
// OnboardingMusicAuthButtonView.swift
// MinGenie
//
// Created by Sunyoung Jeon on 5/22/24.
Expand All @@ -13,15 +13,14 @@

import SwiftUI

struct OnboardingButtonView: View {
struct OnboardingMusicAuthButtonView: View {
@ObservedObject var model: MusicAuthorizationModel

let title: String
let imageName: String
let text: String
@Binding var currentPage: Int


var body: some View {
ZStack {
VStack{
Expand All @@ -43,16 +42,16 @@ struct OnboardingButtonView: View {
Spacer()
Text(text)
.font(.subheadline)
.foregroundStyle(Color.gray)
.foregroundStyle(Color.Text.gray50)
Button {
model.requestMusicAuthorizationStatus(currentPage: $currentPage)

} label: {
Text("다음")
.fontWeight(.semibold)
.foregroundColor(.white)
.foregroundColor(Color.Text.white100)
.frame(width: 361, height: 50)
.background(Color.black)
.background(Color.Shape.black)
.cornerRadius(16)
.padding(.bottom, 160)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// OnboardingNextButtonPageView.swift
// MinGenie
//
// Created by zaehorang on 5/29/24.
//

import SwiftUI

struct OnboardingNextButtonPageView: View {
let title: String
let imageName: String

@Binding var currentPage: Int

var body: some View {
VStack{
Text(title)
.font(.title)
.fontWeight(.bold)
.foregroundStyle(Color.Text.blue)
.multilineTextAlignment(.center)
.lineSpacing(6)
.frame(width: 300, height: 120, alignment: .bottom)
.padding(EdgeInsets(top: 100, leading: 0, bottom: 40, trailing: 0))
GifImage(imageName)
.aspectRatio(contentMode: .fit)
.frame(width: 361, height: 200)
Spacer()
}

VStack{
Spacer()
Button {
currentPage += 1

} label: {
Text("다음")
.fontWeight(.semibold)
.foregroundColor(Color.Text.white100)
.frame(width: 361, height: 50)
.background(Color.Shape.black)
.cornerRadius(16)
.padding(.bottom, 160)
}
}
}
}
2 changes: 2 additions & 0 deletions MinGenie/MinGenie/OnboardingViews/OnboardingPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ struct OnboardingPageView: View {
.frame(width: 361, height: 200)
Spacer()
}


}
}
Loading