Skip to content

Commit

Permalink
[버전] 2.0.0-beta.0 (#188)
Browse files Browse the repository at this point in the history
* [수정] 온보딩 학과 선택시 공지리스트에 반영되지 않는 이슈 수정
* [수정] 잘못된 import 로 인한 빌드 에러 수정
* [수정] 추후 재시도 로직을 위해 로직 함수화
  • Loading branch information
x-0o0 authored Mar 28, 2024
1 parent 279ecd5 commit acbf77f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
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

0 comments on commit acbf77f

Please sign in to comment.