Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.0.0 beta.0 #188

Merged
merged 3 commits into from
Mar 28, 2024
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
18 changes: 10 additions & 8 deletions KuringApp/KuringApp/KuringApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ struct KuringApp: App {
if completesLink {
// MARK: ContentView
ContentView()
.fullScreenCover(isPresented: $showsOnboarding) {
OnboardingView()
}
// MARK: 앱 업데이트 알림
.versionUpdateAlert()
// MARK: 새 공지 보여주기 (알림 탭했을 때)
Expand Down Expand Up @@ -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()
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions package-kuring/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion package-kuring/Sources/Caches/Dependency/Departments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension Departments {
Self.selections

}, getCurrent: {
Self.current
Self.current ?? Self.selections.first

}, changeCurrent: { noticeProvider in
Self.current = noticeProvider
Expand Down
1 change: 0 additions & 1 deletion package-kuring/Sources/Models/NoticeProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import Foundation
import OrderedCollections
import Dependencies

/// 공지 제공자 카테고리
public enum NoticeType: String, Codable, Hashable, CaseIterable, Identifiable, Equatable {
Expand Down
37 changes: 19 additions & 18 deletions package-kuring/Sources/UIKit/CommonUI/View.onFetchAllData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down