diff --git a/DependencyGraph/mohanyang_dev_graph.png b/DependencyGraph/mohanyang_dev_graph.png index 970d4af..23c2ed3 100644 Binary files a/DependencyGraph/mohanyang_dev_graph.png and b/DependencyGraph/mohanyang_dev_graph.png differ diff --git a/DependencyGraph/mohanyang_prod_graph.png b/DependencyGraph/mohanyang_prod_graph.png index c4dd20b..16d3cd4 100644 Binary files a/DependencyGraph/mohanyang_prod_graph.png and b/DependencyGraph/mohanyang_prod_graph.png differ diff --git a/Projects/Feature/HomeFeature/Sources/Home/HomeCore.swift b/Projects/Feature/HomeFeature/Sources/Home/HomeCore.swift index d189574..2f31bd1 100644 --- a/Projects/Feature/HomeFeature/Sources/Home/HomeCore.swift +++ b/Projects/Feature/HomeFeature/Sources/Home/HomeCore.swift @@ -9,7 +9,7 @@ import UserNotifications import PushService -import UserNotificationClientInterface +import UserDefaultsClientInterface import ComposableArchitecture @@ -28,7 +28,7 @@ public struct HomeCore { } public enum Action { - case onAppear + case onLoad case setHomeCatTooltip(HomeCatDialogueTooltip?) case setHomeCategoryGuideTooltip(HomeCategoryGuideTooltip?) case setHomeTimeGuideTooltip(HomeTimeGuideTooltip?) @@ -48,7 +48,8 @@ public struct HomeCore { case guide } - @Dependency(UserNotificationClient.self) var userNotificationClient + @Dependency(UserDefaultsClient.self) var userDefaultsClient + let isHomeGuideCompletedKey = "mohanyang_userdefaults_isHomeGuideCompleted" public init() {} @@ -64,17 +65,24 @@ public struct HomeCore { private func core(_ state: inout State, _ action: Action) -> EffectOf { switch action { - case .onAppear: - state.homeCatTooltip = .init(title: "오랜만이다냥") - state.homeCategoryGuideTooltip = .init() - return .none + case .onLoad: + return .run { send in + await send(.setHomeCatTooltip(nil)) + if self.userDefaultsClient.boolForKey(isHomeGuideCompletedKey) == false { + await self.userDefaultsClient.setBool(true, key: isHomeGuideCompletedKey) + await send(.setHomeCategoryGuideTooltip(HomeCategoryGuideTooltip())) + } + } - case let .setHomeCatTooltip(tooltip): + case .setHomeCatTooltip: + state.homeCatTooltip = .init(title: "오랜만이다냥") // TODO: - 문구 랜덤변경하기 return .none case let .setHomeCategoryGuideTooltip(tooltip): state.homeCategoryGuideTooltip = tooltip - state.homeTimeGuideTooltip = .init() + if tooltip == nil { + state.homeTimeGuideTooltip = .init() + } return .none case let .setHomeTimeGuideTooltip(tooltip): diff --git a/Projects/Feature/HomeFeature/Sources/Home/HomeView.swift b/Projects/Feature/HomeFeature/Sources/Home/HomeView.swift index af01c94..e9cbf1f 100644 --- a/Projects/Feature/HomeFeature/Sources/Home/HomeView.swift +++ b/Projects/Feature/HomeFeature/Sources/Home/HomeView.swift @@ -9,6 +9,7 @@ import SwiftUI import DesignSystem +import Utils import ComposableArchitecture @@ -122,8 +123,8 @@ public struct HomeView: View { ) { store in TimeSelectView(store: store) } - .onAppear { - store.send(.onAppear) + .onLoad { + store.send(.onLoad) } } } diff --git a/Projects/Feature/HomeFeature/Sources/WheelPicker/WheelPicker.swift b/Projects/Feature/HomeFeature/Sources/WheelPicker/WheelPicker.swift index 220a48a..c9cf5ad 100644 --- a/Projects/Feature/HomeFeature/Sources/WheelPicker/WheelPicker.swift +++ b/Projects/Feature/HomeFeature/Sources/WheelPicker/WheelPicker.swift @@ -9,6 +9,7 @@ import SwiftUI import DesignSystem +import Utils struct WheelPicker: View { @Namespace var backgroundFrameID diff --git a/Projects/Shared/DesignSystem/Project.swift b/Projects/Shared/DesignSystem/Project.swift index e2ef347..6397bd2 100644 --- a/Projects/Shared/DesignSystem/Project.swift +++ b/Projects/Shared/DesignSystem/Project.swift @@ -22,7 +22,11 @@ let project: Project = .makeTMABasedProject( .sources, .example ], - dependencies: [:], + dependencies: [ + .sources: [ + .dependency(module: Shared.Utils) + ] + ], resourceSynthesizers: [ .fonts(), // for font .assets(), // for .xcassets, diff --git a/Projects/Shared/DesignSystem/Sources/Component/Tooltip/TooltipTarget.swift b/Projects/Shared/DesignSystem/Sources/Component/Tooltip/TooltipTarget.swift index f9d28fb..ac3f484 100644 --- a/Projects/Shared/DesignSystem/Sources/Component/Tooltip/TooltipTarget.swift +++ b/Projects/Shared/DesignSystem/Sources/Component/Tooltip/TooltipTarget.swift @@ -8,6 +8,8 @@ import SwiftUI +import Utils + struct TooltipTarget: View { let identifier: AnyHashable diff --git a/Projects/Shared/DesignSystem/Sources/Extension/ExcludeRoundedRectMask.swift b/Projects/Shared/DesignSystem/Sources/Helper/ExcludeRoundedRectMask.swift similarity index 89% rename from Projects/Shared/DesignSystem/Sources/Extension/ExcludeRoundedRectMask.swift rename to Projects/Shared/DesignSystem/Sources/Helper/ExcludeRoundedRectMask.swift index d0bc669..ad7e0e1 100644 --- a/Projects/Shared/DesignSystem/Sources/Extension/ExcludeRoundedRectMask.swift +++ b/Projects/Shared/DesignSystem/Sources/Helper/ExcludeRoundedRectMask.swift @@ -8,11 +8,11 @@ import SwiftUI -public struct ExcludeRoundedRectMask: View { +struct ExcludeRoundedRectMask: View { let excludedRect: CGRect let cornerRadius: CGFloat - public init( + init( excludedRect: CGRect, cornerRadius: CGFloat ) { @@ -20,7 +20,7 @@ public struct ExcludeRoundedRectMask: View { self.cornerRadius = cornerRadius } - public var body: some View { + var body: some View { GeometryReader { geometry in let fullRect = geometry.frame(in: .local) diff --git a/Projects/Shared/DesignSystem/Sources/Extension/Triangle.swift b/Projects/Shared/DesignSystem/Sources/Helper/Triangle.swift similarity index 84% rename from Projects/Shared/DesignSystem/Sources/Extension/Triangle.swift rename to Projects/Shared/DesignSystem/Sources/Helper/Triangle.swift index 572269e..da26141 100644 --- a/Projects/Shared/DesignSystem/Sources/Extension/Triangle.swift +++ b/Projects/Shared/DesignSystem/Sources/Helper/Triangle.swift @@ -8,8 +8,8 @@ import SwiftUI -public struct Triangle: View { - public enum Direction: Double { +struct Triangle: View { + enum Direction: Double { case down = 180 case left = -90 case up = 0 @@ -19,12 +19,12 @@ public struct Triangle: View { private let direction: Direction private let color: Color - public init(direction: Direction, color: Color) { + init(direction: Direction, color: Color) { self.direction = direction self.color = color } - public var body: some View { + var body: some View { TriangleShape() .fill(color) .rotationEffect(Angle.degrees(direction.rawValue)) diff --git a/Projects/Shared/Shared/Sources/Exports.swift b/Projects/Shared/Shared/Sources/Exports.swift index 0531316..2553052 100644 --- a/Projects/Shared/Shared/Sources/Exports.swift +++ b/Projects/Shared/Shared/Sources/Exports.swift @@ -9,7 +9,6 @@ @_exported import Logger @_exported import DesignSystem @_exported import Utils -@_exported import UtilsInterface @_exported import ThirdParty_SPM @_exported import ThirdParty_Firebase diff --git a/Projects/Shared/Utils/Interface/UtilsInterface.swift b/Projects/Shared/Utils/Interface/UtilsInterface.swift deleted file mode 100644 index 1465e61..0000000 --- a/Projects/Shared/Utils/Interface/UtilsInterface.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public struct UtilsInterface { - public init() {} -} diff --git a/Projects/Shared/Utils/Preview/Resources/dummy.txt b/Projects/Shared/Utils/Preview/Resources/dummy.txt deleted file mode 100644 index 3c546eb..0000000 --- a/Projects/Shared/Utils/Preview/Resources/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -dummy file \ No newline at end of file diff --git a/Projects/Shared/Utils/Preview/Sources/Utils.swift b/Projects/Shared/Utils/Preview/Sources/Utils.swift deleted file mode 100644 index 55c51f0..0000000 --- a/Projects/Shared/Utils/Preview/Sources/Utils.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public struct Utils { - public init() {} -} diff --git a/Projects/Shared/Utils/Project.swift b/Projects/Shared/Utils/Project.swift index 95b9007..befea77 100644 --- a/Projects/Shared/Utils/Project.swift +++ b/Projects/Shared/Utils/Project.swift @@ -8,10 +8,7 @@ let project: Project = .makeTMABasedProject( module: Shared.Utils, scripts: [], targets: [ - .sources, - .interface, - .tests, - .testing + .sources ], dependencies: [:] ) diff --git a/Projects/Shared/Utils/Resources/dummy.txt b/Projects/Shared/Utils/Resources/dummy.txt deleted file mode 100644 index 3c546eb..0000000 --- a/Projects/Shared/Utils/Resources/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -dummy file \ No newline at end of file diff --git a/Projects/Shared/Utils/Sources/Extensions/Data+.swift b/Projects/Shared/Utils/Sources/Extension/Foundation/Data+Extension.swift similarity index 100% rename from Projects/Shared/Utils/Sources/Extensions/Data+.swift rename to Projects/Shared/Utils/Sources/Extension/Foundation/Data+Extension.swift diff --git a/Projects/Shared/Utils/Sources/Extensions/Encodable+.swift b/Projects/Shared/Utils/Sources/Extension/Swift/Encodable+Extension.swift similarity index 100% rename from Projects/Shared/Utils/Sources/Extensions/Encodable+.swift rename to Projects/Shared/Utils/Sources/Extension/Swift/Encodable+Extension.swift diff --git a/Projects/Shared/DesignSystem/Sources/Extension/RoundedCorner.swift b/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+CornerRadius.swift similarity index 100% rename from Projects/Shared/DesignSystem/Sources/Extension/RoundedCorner.swift rename to Projects/Shared/Utils/Sources/Extension/SwiftUI/View+CornerRadius.swift diff --git a/Projects/Shared/DesignSystem/Sources/Extension/FrameMeasure.swift b/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+FrameMeasure.swift similarity index 100% rename from Projects/Shared/DesignSystem/Sources/Extension/FrameMeasure.swift rename to Projects/Shared/Utils/Sources/Extension/SwiftUI/View+FrameMeasure.swift diff --git a/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+Onload.swift b/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+Onload.swift new file mode 100644 index 0000000..3d60c10 --- /dev/null +++ b/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+Onload.swift @@ -0,0 +1,33 @@ +// +// View+Extension.swift +// Utils +// +// Created by devMinseok on 8/16/24. +// Copyright © 2024 PomoNyang. All rights reserved. +// + +import SwiftUI + +extension View { + public func onLoad(perform action: (() -> Void)? = nil) -> some View { + modifier(ViewDidLoadModifier(perform: action)) + } +} + +private struct ViewDidLoadModifier: ViewModifier { + @State private var didLoad = false + private let action: (() -> Void)? + + init(perform action: (() -> Void)? = nil) { + self.action = action + } + + func body(content: Content) -> some View { + content.onAppear { + if didLoad == false { + didLoad = true + action?() + } + } + } +} diff --git a/Projects/Shared/DesignSystem/Sources/Extension/OverlayWithOnPreferenceChange.swift b/Projects/Shared/Utils/Sources/Extension/SwiftUI/View+OverlayWithOnPreferenceChange.swift similarity index 100% rename from Projects/Shared/DesignSystem/Sources/Extension/OverlayWithOnPreferenceChange.swift rename to Projects/Shared/Utils/Sources/Extension/SwiftUI/View+OverlayWithOnPreferenceChange.swift diff --git a/Projects/Shared/Utils/Testing/UtilsTesting.swift b/Projects/Shared/Utils/Testing/UtilsTesting.swift deleted file mode 100644 index 0ebcae6..0000000 --- a/Projects/Shared/Utils/Testing/UtilsTesting.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public struct UtilsTesting { - public init() {} -} diff --git a/Projects/Shared/Utils/Tests/UtilsTests.swift b/Projects/Shared/Utils/Tests/UtilsTests.swift deleted file mode 100644 index d27665a..0000000 --- a/Projects/Shared/Utils/Tests/UtilsTests.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public struct UtilsTests { - public init() {} -}