Skip to content

Commit

Permalink
Merge pull request #73 from DeveloperAcademy-POSTECH/fix/#65-LiveActi…
Browse files Browse the repository at this point in the history
…vityFix

[Fix]/#65-LiveActivityFix
  • Loading branch information
KimPilGyeom authored Nov 11, 2024
2 parents e7159ba + 9e8f14a commit 37e768c
Show file tree
Hide file tree
Showing 42 changed files with 755 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Icon 오후 9.05.06.png",
"filename" : "Icon 오후 9.05.06.png",
"idiom" : "universal",
"platform" : "watchos",
"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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions hearo/LiveActivity/Assets.xcassets/Caution.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Caution.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Caution 1.svg",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Caution 2.svg",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
66 changes: 44 additions & 22 deletions hearo/LiveActivity/LiveActivityLiveActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,39 @@
// Created by 김준수(엘빈) on 10/18/24.
//



import ActivityKit
import WidgetKit
import SwiftUI

// 라이브 액티비티 속성 정의
struct LiveActivityAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
// 현재 상태를 나타내는 속성을 정의 (예: 경고 여부)
// 하지만 필요 없다면 이 속성을 추가적으로 활용할 수 있습니다.
// 현재 상태를 나타내는 속성을 정의
}

var name: String // 이름 속성만 유지
}

struct LiveActivityLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: LiveActivityAttributes.self) { context in
// UI 구성
// Live Activity 구성
HStack {
VStack {
Text("소리 수집이 중지되었습니다.") // 변경된 메시지
.font(.headline)
.foregroundColor(.white)
VStack(alignment: .leading) {
Text("히어로드")
.font(.LiveActivitySub)
.foregroundColor(Color("MainFontColor"))
Text("소리수집이\n중지되었습니다.")
.font(.LiveActivityMain)
.foregroundColor(Color("MainFontColor"))
}

Spacer()

Image(systemName: "exclamationmark.triangle") // 경고 아이콘
Image("Caution") // "Caution" 이미지를 왼쪽에 추가
.resizable()
.scaledToFit()
.frame(width: 40, height: 40)
.frame(width: 91, height: 91)
.foregroundColor(.white)
}
.padding()
Expand All @@ -47,21 +48,42 @@ struct LiveActivityLiveActivity: Widget {
.activitySystemActionForegroundColor(Color.white)
} dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.leading) {
Image(systemName: "exclamationmark.triangle")
}
DynamicIslandExpandedRegion(.center) {
Text("소리 수집이 중지되었습니다.") // 동일한 메시지
}
DynamicIslandExpandedRegion(.trailing) {
// 추가 아이콘이나 요소가 필요하다면 여기에 추가
HStack {
Image("Caution") // 아이콘
.resizable()
.scaledToFit()
.frame(width: 59, height: 59, alignment: .top)
.foregroundColor(.white)

Spacer() // 아이콘과 텍스트 사이 간격

VStack(alignment: .leading) { // 텍스트 영역
Text("히어로드")
.font(.LiveActivitySub)
.foregroundColor(Color("SubFontColor"))
Text("소리수집이 중지되었습니다.")
.font(.medium)
.foregroundColor(Color("MainFontColor"))
}
}
.padding() // 전체 패딩 추가
.frame(maxWidth: .infinity, maxHeight: 82) // HStack 최대 너비 설정
}
} compactLeading: {
Image(systemName: "exclamationmark.triangle")
Image("Caution")
.resizable()
.scaledToFit()
.frame(width: 30, height: 30)
} compactTrailing: {
Text("수집 중지")
Text("수집중지")
.font(.DaynamicIsland)
.foregroundColor(Color("MainFontColor"))
} minimal: {
Image(systemName: "exclamationmark.triangle")
Image("Caution")
.resizable()
.scaledToFit()
.frame(width: 30, height: 30)
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions hearo/hearo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
1121777B2CC283BC000A146F /* LiveActivityLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1121777A2CC283BC000A146F /* LiveActivityLiveActivity.swift */; };
112177812CC283BD000A146F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 112177802CC283BD000A146F /* Assets.xcassets */; };
112177852CC283BD000A146F /* LiveActivityExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 112177712CC283BC000A146F /* LiveActivityExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
11A2D0882CDE344500BF2BAF /* FontDesignSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00D1B7572CDDD9D800BA2AF1 /* FontDesignSystem.swift */; };
64F73A252CBAC9F100D2A140 /* HornSoundDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F73A242CBAC9F100D2A140 /* HornSoundDetector.swift */; };
64F73A272CBAD1C000D2A140 /* SoundDetectorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F73A262CBAD1C000D2A140 /* SoundDetectorViewModel.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -841,6 +842,7 @@
buildActionMask = 2147483647;
files = (
112177792CC283BC000A146F /* LiveActivityBundle.swift in Sources */,
11A2D0882CDE344500BF2BAF /* FontDesignSystem.swift in Sources */,
1121777B2CC283BC000A146F /* LiveActivityLiveActivity.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1008,7 +1010,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"hearo/Preview Content\"";
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = hearo/Info.plist;
Expand Down Expand Up @@ -1042,7 +1044,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"hearo/Preview Content\"";
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = hearo/Info.plist;
Expand Down Expand Up @@ -1148,7 +1150,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"HearoadWatch Watch App/Preview Content\"";
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "HearoadWatch-Watch-App-Info.plist";
Expand Down Expand Up @@ -1179,7 +1181,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"HearoadWatch Watch App/Preview Content\"";
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "HearoadWatch-Watch-App-Info.plist";
Expand Down Expand Up @@ -1287,7 +1289,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LiveActivity/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = LiveActivity;
Expand Down Expand Up @@ -1315,7 +1317,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = J5N8Y9F8Z8;
DEVELOPMENT_TEAM = GT56H2MYWV;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LiveActivity/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = LiveActivity;
Expand Down
Loading

0 comments on commit 37e768c

Please sign in to comment.