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
10 changes: 10 additions & 0 deletions today-s-sound.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "today-s-sound/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "오늘의 소리";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand All @@ -306,6 +308,9 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.td.today-s-sound";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -324,6 +329,8 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "today-s-sound/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "오늘의 소리";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand All @@ -336,6 +343,9 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.td.today-s-sound";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"images" : [
{
"filename" : "thumbnail.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.
10 changes: 10 additions & 0 deletions today-s-sound/Assets.xcassets/Bell off.imageset/Bell off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/Bell off.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Bell off.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
3 changes: 3 additions & 0 deletions today-s-sound/Assets.xcassets/Bell.imageset/Bell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/Bell.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Bell.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/mail.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "mail.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
9 changes: 9 additions & 0 deletions today-s-sound/Assets.xcassets/mail.imageset/mail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/notice.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "notice.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
9 changes: 9 additions & 0 deletions today-s-sound/Assets.xcassets/notice.imageset/notice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/pause.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "pause.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
9 changes: 9 additions & 0 deletions today-s-sound/Assets.xcassets/pause.imageset/pause.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions today-s-sound/Assets.xcassets/play.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "play.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
9 changes: 9 additions & 0 deletions today-s-sound/Assets.xcassets/play.imageset/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions today-s-sound/Core/AppState/SessionStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,15 @@ final class SessionStore: ObservableObject {
lastError = nil
}
}

#if DEBUG
extension SessionStore {
static var preview: SessionStore {
let store = SessionStore()
store.userId = "preview-user"
store.isRegistered = true
store.lastError = nil
return store
}
}
#endif
78 changes: 23 additions & 55 deletions today-s-sound/Data/Models/Alarm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,44 @@
// Alarm.swift
// today-s-sound
//
// Created by Assistant
//

import Foundation

// MARK: - Alarm Response Models

/// 알림 목록 응답
typealias AlarmListResponse = APIResponse<[AlarmItem]>
/// 최근 알림 목록 응답
/// 서버가 [RecentAlarmResponse] 배열을 내려준다고 했으니까 그대로 [AlarmItem]으로 매핑
typealias AlarmListResponse = [AlarmItem]

extension AlarmListResponse {
// 편의 속성: result를 alarms로 접근
var alarms: [AlarmItem] {
result
}
}

/// 개별 알림 아이템
/// 개별 알림 아이템 (RecentAlarmResponse)
struct AlarmItem: Codable, Identifiable {
let alias: String
let timeAgo: String
let summaries: [SummaryItem]
let isUrgent: Bool?
let subscriptionId: Int64 // 구독 ID (알림 ID 역할)
let alias: String // 구독 별칭
let summaryContent: String // 요약 내용
let timeAgo: String // "~분 전" 같은 상대 시간
let isUrgent: Bool // 긴급 여부

// Identifiable을 위한 id (alias를 고유 식별자로 사용)
var id: String { alias }
// SwiftUI ForEach에서 사용할 식별자
var id: Int64 { subscriptionId }

enum CodingKeys: String, CodingKey {
case subscriptionId
case alias
case summaryContent
case timeAgo
case summaries
case isUrgent
}

// 디코딩 시 isUrgent가 없으면 nil로 설정
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
alias = try container.decode(String.self, forKey: .alias)
timeAgo = try container.decode(String.self, forKey: .timeAgo)
summaries = try container.decode([SummaryItem].self, forKey: .summaries)
isUrgent = try container.decodeIfPresent(Bool.self, forKey: .isUrgent)
}

// 인코딩
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(alias, forKey: .alias)
try container.encode(timeAgo, forKey: .timeAgo)
try container.encode(summaries, forKey: .summaries)
try container.encodeIfPresent(isUrgent, forKey: .isUrgent)
}

// 수동 초기화 (Preview 등에서 사용)
init(alias: String, timeAgo: String, summaries: [SummaryItem], isUrgent: Bool? = nil) {
// Preview 등에서 쓰기 위한 커스텀 init
init(
subscriptionId: Int64,
alias: String,
summaryContent: String,
timeAgo: String,
isUrgent: Bool
) {
self.subscriptionId = subscriptionId
self.alias = alias
self.summaryContent = summaryContent
self.timeAgo = timeAgo
self.summaries = summaries
self.isUrgent = isUrgent
}
}

/// 요약 아이템
struct SummaryItem: Codable, Identifiable {
let id: Int64
let summary: String
let updatedAt: String // ISO8601 문자열

// Date로 변환하는 편의 속성
var updatedDate: Date? {
let formatter = ISO8601DateFormatter()
return formatter.date(from: updatedAt)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ struct ScreenMainTitle: View {

var body: some View {
Text(text)
.font(.system(size: 28, weight: .bold))
.font(.KoddiBold56)
.foregroundColor(Color.text(colorScheme))
.frame(maxWidth: .infinity, alignment: .leading)
.frame(maxWidth: .infinity, alignment: .center)
.multilineTextAlignment(.center)
.padding(.horizontal, 24)
.padding(.bottom, 16)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct ScreenSubTitle: View {

var body: some View {
Text(text)
.font(.system(size: 28, weight: .bold))
.foregroundColor(colorScheme == .dark ? .white : .primaryGreen)
.font(.KoddiExtraBold28)
.foregroundColor(.primaryGreen)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 24)
.padding(.bottom, 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ struct AddSubscriptionView: View {
InputFieldSection(
title: "웹사이트 URL",
placeholder: "https://www.example.com",
description: "모니터링 할 웹페이지 URL을 입력하세요.",
description: "모니터링할 웹페이지의 정확한 URL을 입력하세요.",
text: $viewModel.urlText,
colorScheme: colorScheme
)

InputFieldSection(
title: "웹페이지 별명",
placeholder: "동국대학교 공지사항",
description: " 페이지를 식별할 명칭을 입력하세요.",
description: "해당 페이지를 식별할 명칭을 입력하세요.",
text: $viewModel.nameText,
colorScheme: colorScheme
)
Expand Down Expand Up @@ -92,7 +92,7 @@ struct AddSubscriptionView: View {
.padding(.vertical, 16)
.background(
RoundedRectangle(cornerRadius: 12)
.fill(Color.primaryGreen90)
.fill(Color.primaryGreen)
)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,26 @@ struct KeywordCheckboxRow: View {
.buttonStyle(PlainButtonStyle())
}
}

struct KeywordCheckboxRow_Previews: PreviewProvider {
static var previews: some View {
VStack(spacing: 12) {
KeywordCheckboxRow(
keyword: "시각장애",
isSelected: true,
colorScheme: .light,
action: {}
)

KeywordCheckboxRow(
keyword: "접근성",
isSelected: false,
colorScheme: .dark,
action: {}
)
}
.previewLayout(.sizeThatFits)
.padding()
.background(Color(UIColor.systemBackground))
}
}
Loading