Skip to content

Commit c9e8b5e

Browse files
committed
롤백
1 parent cdb3a35 commit c9e8b5e

File tree

106 files changed

+1714
-1653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1714
-1653
lines changed

hearo/HearoadWatch Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"images" : [
33
{
4+
"filename" : "Icon 오후 9.05.06.png",
45
"idiom" : "universal",
56
"platform" : "watchos",
67
"size" : "1024x1024"
Loading

hearo/HearoadWatch Watch App/ContentView.swift

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,25 @@ struct ContentView: View {
1515
ZStack {
1616
// 배경색을 alert 상태에 따라 변경
1717
sessionManager.isAlerting ? Color.red.edgesIgnoringSafeArea(.all) : Color.black.edgesIgnoringSafeArea(.all)
18-
19-
VStack {
20-
// 상태에 따른 텍스트 표시
21-
Text(sessionManager.isAlerting ? sessionManager.alertMessage : "인식중")
22-
.foregroundColor(.white)
23-
.font(.title)
24-
.padding()
25-
26-
27-
// 알림 아이콘을 표시하고, 알림이 아닐 때는 숨김 처리
28-
if sessionManager.isAlerting {
29-
Image(systemName: "exclamationmark.triangle.fill")
30-
.resizable()
31-
.frame(width: 50, height: 50)
32-
.foregroundColor(.yellow)
33-
.padding()
34-
}
35-
}
18+
19+
// 알림 상태에 따른 아이콘 표시
20+
if sessionManager.isAlerting {
21+
Image(sessionManager.alertImageName())
22+
.resizable()
23+
.scaledToFit()
24+
.frame(width: 200, height: 200)
25+
.padding()
26+
} else {
27+
// 알림이 아닐 때는 MainCircle 이미지를 표시
28+
Image("MainCircle")
29+
.resizable()
30+
.frame(width: 200, height: 200)
31+
.padding()
32+
}
3633
}
3734
.onAppear {
3835
// 초기화
3936
sessionManager.resetAlert()
4037
}
4138
}
4239
}
43-
//struct ContentView: View {
44-
// @ObservedObject var viewManager = WatchViewManager()
45-
//
46-
// var body: some View {
47-
// VStack {
48-
// if viewManager.currentView == "working" {
49-
// WatchWorkingView()
50-
// } else if viewManager.currentView == "warning" {
51-
// WatchWarningView()
52-
// } else if viewManager.currentView == "finish" {
53-
// WatchFinishView()
54-
// } else {
55-
// WatchHomeView()
56-
// }
57-
// }
58-
// .onAppear {
59-
// print("현재 Watch 뷰: \(viewManager.currentView)")
60-
// }
61-
// }
62-
//}

hearo/HearoadWatch Watch App/WatchFinishView.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

hearo/HearoadWatch Watch App/WatchHomeView.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

hearo/HearoadWatch Watch App/WatchSessionManager.swift

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import WatchConnectivity
1111
class WatchSessionManager: NSObject, ObservableObject, WCSessionDelegate {
1212
static let shared = WatchSessionManager() // 싱글톤 인스턴스 생성
1313

14-
@Published var alertMessage: String = "인식중" // 기본 메시지
14+
@Published var alertMessage: String = " " // 기본 메시지
1515
@Published var isAlerting: Bool = false // 알림 상태 확인
1616

1717
private override init() {
@@ -32,17 +32,47 @@ class WatchSessionManager: NSObject, ObservableObject, WCSessionDelegate {
3232
}
3333
}
3434

35+
// 이미지 이름을 반환하는 메서드
36+
func alertImageName() -> String {
37+
switch alertMessage {
38+
case "Carhorn":
39+
return "Car" // carhorn 이미지 이름
40+
case "Siren":
41+
return "Siren" // siren 이미지 이름
42+
case "Bicyclebell":
43+
return "Bicycle" // bicycle 이미지 이름
44+
default:
45+
return "exclamationmark.triangle.fill" // 기본 알림 아이콘
46+
}
47+
}
48+
3549
// 3초 동안 알림 표시 후 기본 상태로 복구
3650
func showAlert(with message: String) {
3751
alertMessage = message
3852
isAlerting = true
39-
WKInterfaceDevice.current().play(.notification) // 진동 알림 발생
53+
54+
// 강한 진동 알림 발생
55+
playUrgentHapticPattern()
4056

4157
// 3초 후에 기본 상태로 복구
4258
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
4359
self.resetAlert()
4460
}
4561
}
62+
63+
// 긴급 상황을 위한 강한 진동 패턴
64+
func playUrgentHapticPattern() {
65+
// 반복 횟수 및 간격 설정
66+
let repeatCount = 30 // 진동 반복 횟수
67+
let interval: TimeInterval = 0.05 // 반복 간격 (0.1초)
68+
69+
// 반복적으로 강한 진동을 재생하는 패턴
70+
for i in 0..<repeatCount {
71+
DispatchQueue.main.asyncAfter(deadline: .now() + (interval * Double(i))) {
72+
WKInterfaceDevice.current().play(.failure) // 강한 피드백을 주는 진동
73+
}
74+
}
75+
}
4676

4777
// 기본 상태로 복구하는 메서드
4878
func resetAlert() {
@@ -57,4 +87,13 @@ class WatchSessionManager: NSObject, ObservableObject, WCSessionDelegate {
5787
print("애플워치 - 활성화 오류: \(error.localizedDescription)")
5888
}
5989
}
90+
91+
func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String : Any]) {
92+
if let highestConfidenceSound = applicationContext["highestConfidenceSound"] as? String {
93+
DispatchQueue.main.async {
94+
self.showAlert(with: highestConfidenceSound) // 수신한 소리를 알림으로 표시
95+
print("애플워치 - applicationContext 데이터 수신: \(highestConfidenceSound)")
96+
}
97+
}
98+
}
6099
}

hearo/HearoadWatch Watch App/WatchViewManager.swift

Lines changed: 0 additions & 75 deletions
This file was deleted.

hearo/HearoadWatch Watch App/WatchWarningView.swift

Lines changed: 0 additions & 32 deletions
This file was deleted.

hearo/HearoadWatch Watch App/WatchWorkingView.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

hearo/HearoadWatch Watch AppTests/HearoadWatch_Watch_AppTests.swift

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)