From b5639355f317554e4965da4c68c96a68b00106b9 Mon Sep 17 00:00:00 2001 From: Jaesung Lee Date: Thu, 28 Mar 2024 01:36:40 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20=EC=98=A8=EB=B3=B4?= =?UTF-8?q?=EB=94=A9=20=ED=95=99=EA=B3=BC=20=EC=84=A0=ED=83=9D=EC=8B=9C=20?= =?UTF-8?q?=EA=B3=B5=EC=A7=80=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=97=90=20?= =?UTF-8?q?=EB=B0=98=EC=98=81=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KuringApp/KuringApp/KuringApp.swift | 18 ++++++++++-------- package-kuring/Package.swift | 2 ++ .../Caches/Dependency/Departments.swift | 2 +- .../MyDepartmentSelector.swift | 4 ++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/KuringApp/KuringApp/KuringApp.swift b/KuringApp/KuringApp/KuringApp.swift index 5cc69ba1..143d6562 100644 --- a/KuringApp/KuringApp/KuringApp.swift +++ b/KuringApp/KuringApp/KuringApp.swift @@ -29,9 +29,6 @@ struct KuringApp: App { if completesLink { // MARK: ContentView ContentView() - .fullScreenCover(isPresented: $showsOnboarding) { - OnboardingView() - } // MARK: 앱 업데이트 알림 .versionUpdateAlert() // MARK: 새 공지 보여주기 (알림 탭했을 때) @@ -102,14 +99,19 @@ struct KuringApp: App { // MARK: LaunchScreen SplashScreen() .kuringLink( - onRequest: { - print("onRequest") - }, onCompletion: { result in - print("onCompletion: \(result)") - completesLink = true + onRequest: { }, + onCompletion: { result in showsOnboarding = !commons.isCompleteOnboarding() + if !showsOnboarding { + completesLink = true + } } ) + .fullScreenCover(isPresented: $showsOnboarding) { + completesLink = true + } content: { + OnboardingView() + } } } } diff --git a/package-kuring/Package.swift b/package-kuring/Package.swift index 7837d60e..f8b4f65e 100644 --- a/package-kuring/Package.swift +++ b/package-kuring/Package.swift @@ -128,7 +128,9 @@ let package = Package( "DepartmentUI", "Networks", "ColorSet", + "Caches", .product(name: "Lottie", package: "lottie-spm"), + .product(name: "ComposableArchitecture", package: "swift-composable-architecture"), ], path: "Sources/UIKit/OnboardingUI", resources: [.process("Resources")] diff --git a/package-kuring/Sources/Caches/Dependency/Departments.swift b/package-kuring/Sources/Caches/Dependency/Departments.swift index 4f1e5224..76cc3676 100644 --- a/package-kuring/Sources/Caches/Dependency/Departments.swift +++ b/package-kuring/Sources/Caches/Dependency/Departments.swift @@ -66,7 +66,7 @@ extension Departments { Self.selections }, getCurrent: { - Self.current + Self.current ?? Self.selections.first }, changeCurrent: { noticeProvider in Self.current = noticeProvider diff --git a/package-kuring/Sources/UIKit/OnboardingUI/MyDepartmentSelector/MyDepartmentSelector.swift b/package-kuring/Sources/UIKit/OnboardingUI/MyDepartmentSelector/MyDepartmentSelector.swift index 5be8e97e..4ca96f19 100644 --- a/package-kuring/Sources/UIKit/OnboardingUI/MyDepartmentSelector/MyDepartmentSelector.swift +++ b/package-kuring/Sources/UIKit/OnboardingUI/MyDepartmentSelector/MyDepartmentSelector.swift @@ -3,9 +3,11 @@ // See the 'License.txt' file for licensing information. // +import Caches import Models import SwiftUI import ColorSet +import Dependencies struct MyDepartmentSelector: View { @Environment(\.dismiss) private var dismiss @@ -33,7 +35,9 @@ struct MyDepartmentSelector: View { if currentStep == .selectDepartment { Button(StringSet.button_complete.rawValue) { if let selectedDepartment { + @Dependency(\.departments) var departments NoticeProvider.addedDepartments.append(selectedDepartment) + departments.add(selectedDepartment) } currentStep = .addedDepartment.id } From 2f995527128fc14ddf4adebcbcd36249a468922e Mon Sep 17 00:00:00 2001 From: Jaesung Lee Date: Thu, 28 Mar 2024 01:37:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20import=20=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-kuring/Sources/Models/NoticeProvider.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/package-kuring/Sources/Models/NoticeProvider.swift b/package-kuring/Sources/Models/NoticeProvider.swift index 0450e147..df20adfa 100644 --- a/package-kuring/Sources/Models/NoticeProvider.swift +++ b/package-kuring/Sources/Models/NoticeProvider.swift @@ -5,7 +5,6 @@ import Foundation import OrderedCollections -import Dependencies /// 공지 제공자 카테고리 public enum NoticeType: String, Codable, Hashable, CaseIterable, Identifiable, Equatable { From e644e8538b882ed0547eeccb745103d8952b18b7 Mon Sep 17 00:00:00 2001 From: Jaesung Lee Date: Thu, 28 Mar 2024 01:37:48 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20=EC=B6=94=ED=9B=84?= =?UTF-8?q?=20=EC=9E=AC=EC=8B=9C=EB=8F=84=20=EB=A1=9C=EC=A7=81=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=B4=20=EB=A1=9C=EC=A7=81=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIKit/CommonUI/View.onFetchAllData.swift | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/package-kuring/Sources/UIKit/CommonUI/View.onFetchAllData.swift b/package-kuring/Sources/UIKit/CommonUI/View.onFetchAllData.swift index e14bdc67..2a0d6e64 100644 --- a/package-kuring/Sources/UIKit/CommonUI/View.onFetchAllData.swift +++ b/package-kuring/Sources/UIKit/CommonUI/View.onFetchAllData.swift @@ -16,23 +16,7 @@ struct KuringLinkFetcher: ViewModifier { func body(content: Content) -> some View { content - .task { - onRequest() - do { - @Dependency(\.kuringLink) var kuringLink - async let allUnivNoticeTypes = try kuringLink.getAllUnivNoticeType() - async let allDepartments = try kuringLink.getAllDepartments() - let _ = try await [allUnivNoticeTypes, allDepartments] - - async let subscribedDepartments = try kuringLink.getSubscribedDepartments() - async let subscribedUnivNotices = try kuringLink.getSubscribedUnivNotices() - let _ = try await [subscribedDepartments, subscribedUnivNotices] - onCompletion(.success(())) - } catch { - showsNetworkError = true - onCompletion(.failure(error)) - } - } + .task { await request() } .alert("앗! 인터넷 연결이 좋지 않아요!", isPresented: $showsNetworkError) { // 무시 Button(role: .cancel) { @@ -43,7 +27,24 @@ struct KuringLinkFetcher: ViewModifier { } message: { Text("네트워크 연결이 좋지 않아서 서버 정보를 불러오는데에 실패했어요.") } - + } + + func request() async { + onRequest() + do { + @Dependency(\.kuringLink) var kuringLink + async let allUnivNoticeTypes = try kuringLink.getAllUnivNoticeType() + async let allDepartments = try kuringLink.getAllDepartments() + let _ = try await [allUnivNoticeTypes, allDepartments] + + async let subscribedDepartments = try kuringLink.getSubscribedDepartments() + async let subscribedUnivNotices = try kuringLink.getSubscribedUnivNotices() + let _ = try await [subscribedDepartments, subscribedUnivNotices] + onCompletion(.success(())) + } catch { + showsNetworkError = true + onCompletion(.failure(error)) + } } }