Skip to content

Commit

Permalink
1.6.0 QA 이슈 수정 및 버저닝
Browse files Browse the repository at this point in the history
  • Loading branch information
ghkdemrdus committed Dec 28, 2024
1 parent 321157d commit f4036ef
Show file tree
Hide file tree
Showing 46 changed files with 255 additions and 285 deletions.
4 changes: 2 additions & 2 deletions App/Moda/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.6.0</string>
<key>CFBundleVersion</key>
<string>1.5.0.3</string>
<string>1.6.0.1</string>
<key>GoogleServiceFileName</key>
<string>$(ENV_GOOGLE_INFO_PLIST)</string>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ private extension HomeDailyTodoView {
Spacer().frame(height: 36)

VStack(spacing: 24) {
if DateManager.shared.isDecember {
Image.imgDailyEmptyChristmas
} else {
Image.imgDailyEmpty
}

Image.imgDailyEmpty
Text("가벼운 마음으로 오늘의 할 일을 써보아요")
.font(.spoqaHans(size: 15))
.foregroundStyle(Color.textInactive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import SwiftData
struct HomeRoutineView: View {

@Bindable var store: StoreOf<HomeRoutineCore>
@Environment(\.scenePhase) private var scenePhase

@Environment(\.modelContext) var modelContext
@Query var routineEntities: [RoutineEntity]
Expand Down Expand Up @@ -45,14 +46,26 @@ struct HomeRoutineView: View {
}

private func synchronizeRoutineRecords() {
guard store.currentDate == .today else { return }
let id = store.currentDate.format(.yyMMdd)
let record = routineRecordEntitys.first(where: { $0.id == id })?.toDomain ?? .init(id: id, date: .today, routineIds: .init())

guard let idx = store.routineRecords.firstIndex(where: { $0.id == id }) else { return }
var copy = store.routineRecords
copy[idx] = record
send(.binding(.set(\.routineRecords, copy)))
let id = Date.today.format(.yyMMdd)

guard let update = UserData.shared.updatedRoutinesByWidget.rawValue else { return }
UserData.shared.updatedRoutinesByWidget.update(nil)

if let idx = store.routineRecords.firstIndex(where: { $0.id == id }) {
let record = RoutineRecord(id: id, date: .today, routineIds: update.routineIds)
var copy = store.routineRecords
copy[idx] = record
send(.binding(.set(\.routineRecords, copy)))
return
}

if let idx = routineRecordEntitys.firstIndex(where: { $0.id == id }) {
routineRecordEntitys[idx].routineIds = update.routineIds
try? modelContext.save()
} else {
let routineRecord = RoutineRecord(id: id, date: Date.today, routineIds: update.routineIds)
modelContext.insert(routineRecord.toEntity)
}
}

var content: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ private extension HomeDateItemView {
Circle()
.stroke(Color.brandPrimary, lineWidth: 2)
}
.background(if: mode == .weekly && date.timeline == .following && currentDate == date) {
Circle()
.fill(Color.brandTertiary)
}
}
.frame(maxWidth: .infinity)
.contentTouchable()
}
}

Expand All @@ -74,16 +71,7 @@ private extension HomeDateItemView {
}

var showStroke: Bool {
guard currentDate == date else { return false }
if mode == .weekly, date.timeline == .previous {
return true
}

if mode == .monthly, date.timeline != .current {
return true
}

return false
currentDate == date && date.timeline != .current
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private extension HomeDateSelectorView {
.font(.spoqaHans(size: 13, weight: .bold))
.foregroundStyle(Color.textPrimary)
.frame(maxWidth: .infinity)
.contentTouchable()
}
}
.padding(.vertical, 8)
Expand Down
2 changes: 1 addition & 1 deletion App/Moda/Sources/Feature/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private extension HomeView {
}

var scrollDragGesture: some Gesture {
DragGesture(coordinateSpace: .global)
DragGesture(minimumDistance: 20, coordinateSpace: .global)
.onChanged { value in
if isBlocked { return }
if isDateSectionChanging == nil {
Expand Down
24 changes: 0 additions & 24 deletions App/Moda/Sources/Feature/MainTab/MainTabCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
import ComposableArchitecture
import SwiftUI

public enum MainTab: CaseIterable {
case bookmark, home, setting
}

@Reducer
struct MainTabCore: Reducer {

Expand Down Expand Up @@ -284,23 +280,3 @@ struct MainTabCore: Reducer {
}
}
}

extension MainTab {
var activeImage: Image {
switch self {
case .bookmark: return .icBookmarkActive
case .home: return .icHomeActive
case .setting: return .icSettingActive
}
}

var inactiveImage: Image {
switch self {
case .bookmark: return .icBookmarkInactive
case .home: return .icHomeInactive
case .setting: return .icSettingInactive
}
}
}

extension MainTab: Codable {}
10 changes: 1 addition & 9 deletions App/Moda/Sources/Feature/Splash/SplashView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,7 @@ private extension SplashView {
var content: some View {
ZStack {
Color.backgroundPrimary

if DateManager.shared.isDecember {
Image.imgSplashChristmas
.resizable()
.scaledToFit()
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
Image.imgSplash
}
Image.imgSplash
}
.ignoresSafeArea()
.frame(maxWidth: .infinity, maxHeight: .infinity)
Expand Down
65 changes: 1 addition & 64 deletions App/Moda/Sources/Util/UserData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,6 @@
import Foundation
import ComposableArchitecture


enum UserDataKey: String, CaseIterable {
case launchDates
case todoInputCategory
case lastVersion
case showNotice
case showAppReviewBanner
case didAppReviewBannerShown

// 1.2.0
case firstUsageBookmark
case hasBeenShownBookmarkGuideline
case initialTab
case displayMode
case showAppReviewBannerInSetting
case lastUpdateNotificationVersion

// 1.4.0
case hasBeenShownRoutineGuideline
case hasBeenShownRoutineMonthNudge
case firstRoutineUsage

// 1.5.0
case firstRoutineMemo
case hasBeenShownMemoGuideline
case firstMemoShown
}

public final class UserData {
public let launchDates = DataStorage<Set<String>>(key: .launchDates, defaultValue: .init())
public let todoInputCategory = DataStorage<Todo.Category>(key: .todoInputCategory, defaultValue: .monthly)
public let lastVersion = DataStorage<String?>(key: .lastVersion, defaultValue: nil)
public let showNotice = DataStorage<Bool>(key: .showNotice, defaultValue: false)
public let showAppReviewBanner = DataStorage<Bool>(key: .showAppReviewBanner, defaultValue: false)
public let didAppReviewBannerShown = DataStorage<Bool>(key: .didAppReviewBannerShown, defaultValue: false)
public let firstUsageBookmark = DataStorage<Bool>(key: .firstUsageBookmark, defaultValue: true)
public let hasBeenShownBookmarkGuideline = DataStorage<Bool>(key: .hasBeenShownBookmarkGuideline, defaultValue: false)
public let initialTab = DataStorage<MainTab>(key: .initialTab, defaultValue: .home)
public let displayMode = DataStorage<DisplayMode>(key: .displayMode, defaultValue: .system)
public let showAppReviewBannerInSetting = DataStorage<Bool>(key: .showAppReviewBannerInSetting, defaultValue: true)
public let lastUpdateNotificationVersion = DataStorage<Int>(key: .lastUpdateNotificationVersion, defaultValue: -1)
public let hasBeenShownRoutineMonthNudge = DataStorage<Bool>(key: .hasBeenShownRoutineMonthNudge, defaultValue: false)
public let firstRoutineUsage = DataStorage<Bool>(key: .firstRoutineUsage, defaultValue: true)
public let firstRoutineMemo = DataStorage<Bool>(key: .firstRoutineMemo, defaultValue: true)
public let hasBeenShownMemoGuideline = DataStorage<Bool>(key: .hasBeenShownMemoGuideline, defaultValue: false)
public let firstMemoShown = DataStorage<Bool>(key: .firstMemoShown, defaultValue: true)
}

public extension UserData {
func reset() async {
await removeAll(self)
await lastVersion.update("1.0.0")
}

private func removeAll(_ target: Any) async {
for c in Mirror(reflecting: target).children {
if let instance = c.value as? Removable {
await instance.remove()
}
}
}
}

extension DependencyValues {
var userData: UserData {
get { self[UserData.self] }
Expand All @@ -80,5 +17,5 @@ extension DependencyValues {
}

extension UserData: DependencyKey {
public static let liveValue = UserData()
public static let liveValue = UserData.shared
}
4 changes: 2 additions & 2 deletions App/ModaWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleName</key>
<string>ModaWidget</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.6.0</string>
<key>CFBundleVersion</key>
<string>1.5.0.3</string>
<string>1.6.0.1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RoutineDoneIndent.swift
// RoutineDoneIntent.swift
// ModaWidgetExtension
//
// Created by 황득연 on 12/27/24.
Expand All @@ -11,7 +11,8 @@ import SwiftData
import SwiftUI
import WidgetKit

struct RoutineDoneIndent: AppIntent {
@MainActor
struct RoutineDoneIntent: AppIntent {
static var title: LocalizedStringResource = "Routine Done"

@Parameter(title: "routineId") var routineId: String
Expand All @@ -32,23 +33,49 @@ struct RoutineDoneIndent: AppIntent {
}

func perform() async throws -> some IntentResult {
let userData = UserData.shared

let id = Date.today.format(.yyMMdd)
let fetchDescriptor = FetchDescriptor<RoutineRecordEntity>(
predicate: #Predicate { record in
record.id == id
}
)

guard let recordEntities = try? await todoModelContainer.mainContext.fetch(fetchDescriptor),
guard let recordEntities = try? todoModelContainer.mainContext.fetch(fetchDescriptor),
let recordEntity = recordEntities.first else {
try await todoModelContainer.mainContext.insert(RoutineRecordEntity(id: id, date: Date.today, routineIds: .init([routineId])))
try await todoModelContainer.mainContext.save()
userData.updatedRoutinesByWidget.update(.init(routineIds: [routineId]))
todoModelContainer.mainContext.insert(
RoutineRecordEntity(
id: id,
date: Date.today,
routineIds: .init([routineId])
)
)
try todoModelContainer.mainContext.save()

WidgetCenter.shared.reloadTimelines(ofKind: "RoutineMediumWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineLargeWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineDashboardMediumWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineDashboardLargeWidget")

return .result()
}

// 기존 RecordEntity에 routineId 추가
recordEntity.routineIds.insert(routineId)
try await todoModelContainer.mainContext.save()
try todoModelContainer.mainContext.save()

// iOS 17 에서는 정상적으로 저장이 되지 않아 UserDefaults를 사용한다.
userData.updatedRoutinesByWidget.update(.init(routineIds: recordEntity.routineIds))

// 위젯 리로드
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineMediumWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineLargeWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineDashboardMediumWidget")
WidgetCenter.shared.reloadTimelines(ofKind: "RoutineDashboardLargeWidget")
return .result()
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ struct RoutineDashboardLargeWidget: Widget {
RoutineDashboardLargeWidgetView(entry: entry)
.modelContainer(todoModelContainer)
}
.configurationDisplayName("위클리 루틴 위젯")
.description("위클리 루틴를 확인해보세요!")
.configurationDisplayName("루틴 진행 상황 위젯")
.description("루틴 진행 상황을 확인해보세요!")
.supportedFamilies([.systemLarge])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ struct RoutineDashboardMediumWidget: Widget {
RoutineDashboardMediumWidgetView(entry: entry)
.modelContainer(todoModelContainer)
}
.configurationDisplayName("위클리 루틴 위젯")
.description("위클리 루틴를 확인해보세요!")
.configurationDisplayName("루틴 진행 상황 위젯")
.description("루틴 진행 상황을 확인해보세요!")
.supportedFamilies([.systemMedium])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct RoutineLargeWidget: Widget {
.modelContainer(todoModelContainer)
}
.configurationDisplayName("데일리 루틴 위젯")
.description("데일리 루틴를 확인해보세요!")
.description("데일리 루틴을 확인해보세요!")
.supportedFamilies([.systemLarge])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ struct RoutineLargeWidgetView : View {
.lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading)

Button(intent: RoutineDoneIndent(routineId: routine.id)) {
Button(intent: RoutineDoneIntent(routineId: routine.id)) {
ZStack {
RoundedRectangle(cornerRadius: 4)
.stroke(Color.borderPrimary, lineWidth: 1)
.stroke(Color.slate200, lineWidth: 1)
.frame(size: 16)
}
.frame(size: 24)
Expand Down Expand Up @@ -89,7 +89,7 @@ struct RoutineLargeWidgetView : View {

private extension RoutineLargeWidgetView {
var routines: [Routine] {
let routines = routineEntities.toDomain
let routines = routineEntities.filter { !$0.isDeprecated }.toDomain
let weekday = Weekday.allCases[DateUtil.shared.dayNumberInWeek - 1]

return routines.filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct RoutineMediumWidget: Widget {
.modelContainer(todoModelContainer)
}
.configurationDisplayName("데일리 루틴 위젯")
.description("데일리 루틴를 확인해보세요!")
.description("데일리 루틴을 확인해보세요!")
.supportedFamilies([.systemMedium])
}
}
Expand Down
Loading

0 comments on commit f4036ef

Please sign in to comment.