diff --git a/SNUTT-2022/SNUTT/AppState/AppEnvironment.swift b/SNUTT-2022/SNUTT/AppState/AppEnvironment.swift index f30d5469..3dc2bdbd 100644 --- a/SNUTT-2022/SNUTT/AppState/AppEnvironment.swift +++ b/SNUTT-2022/SNUTT/AppState/AppEnvironment.swift @@ -168,7 +168,7 @@ extension EnvironmentValues { #if DEBUG extension AppEnvironment.Services { - @MainActor static func preview(appState: AppState) -> Self { + @MainActor static func preview(appState _: AppState) -> Self { .init(timetableService: FakeTimetableService(), userService: FakeUserService(), lectureService: FakeLectureService(), diff --git a/SNUTT-2022/SNUTT/AppState/States/SystemState.swift b/SNUTT-2022/SNUTT/AppState/States/SystemState.swift index c898d93f..26d3b817 100644 --- a/SNUTT-2022/SNUTT/AppState/States/SystemState.swift +++ b/SNUTT-2022/SNUTT/AppState/States/SystemState.swift @@ -19,7 +19,7 @@ class SystemState { @Published var preferredColorScheme: ColorScheme? = nil @Published var selectedTab: TabType = .timetable - + @Published var noticeViewInfo: ConfigsDto.NoticeViewInfoDto? var isMapViewExpanded: Bool? diff --git a/SNUTT-2022/SNUTT/Repositories/Dto/ConfigDto.swift b/SNUTT-2022/SNUTT/Repositories/Dto/ConfigDto.swift index 7bbb7c15..1dbcb1d9 100644 --- a/SNUTT-2022/SNUTT/Repositories/Dto/ConfigDto.swift +++ b/SNUTT-2022/SNUTT/Repositories/Dto/ConfigDto.swift @@ -36,7 +36,7 @@ extension ConfigsDto { src["ios"] } } - + struct NoticeViewInfoDto: Codable { let title: String let content: String diff --git a/SNUTT-2022/SNUTT/Services/GlobalUIService.swift b/SNUTT-2022/SNUTT/Services/GlobalUIService.swift index 93dc27d7..2cc02a3f 100644 --- a/SNUTT-2022/SNUTT/Services/GlobalUIService.swift +++ b/SNUTT-2022/SNUTT/Services/GlobalUIService.swift @@ -45,7 +45,7 @@ protocol GlobalUIServiceProtocol: Sendable { func setRoutingState(_ key: WritableKeyPath, value: V) func hasNewBadge(settingName: String) -> Bool - + func showNoticeViewIfNeeded() async throws } @@ -164,8 +164,9 @@ struct GlobalUIService: GlobalUIServiceProtocol, UserAuthHandler, ConfigsProvida appState.menu.lectureTimeSheetAction = action appState.menu.isLectureTimeSheetOpen = value } - + // MARK: Show Notice View + func showNoticeViewIfNeeded() async throws { let configs = try await configRepository?.fetchConfigs() appState.system.noticeViewInfo = configs?.notice @@ -205,14 +206,14 @@ extension GlobalUIService { } class FakeGlobalUIService: GlobalUIServiceProtocol { - func setColorScheme(_ colorScheme: ColorScheme?) {} + func setColorScheme(_: ColorScheme?) {} func loadColorSchemeDuringBootstrap() {} - func setSelectedTab(_ tab: TabType) {} - func setIsErrorAlertPresented(_ value: Bool) {} - func setIsMenuOpen(_ value: Bool) {} + func setSelectedTab(_: TabType) {} + func setIsErrorAlertPresented(_: Bool) {} + func setIsMenuOpen(_: Bool) {} - func openEllipsis(for timetable: TimetableMetadata) {} + func openEllipsis(for _: TimetableMetadata) {} func closeEllipsis() {} func openThemeSheet() {} @@ -221,25 +222,25 @@ class FakeGlobalUIService: GlobalUIServiceProtocol { func openRenameSheet() {} func closeRenameSheet() {} - func openCreateSheet(withPicker: Bool) {} + func openCreateSheet(withPicker _: Bool) {} func closeCreateSheet() {} - func setRenameTitle(_ value: String) {} - func setCreateTitle(_ value: String) {} - func setCreateQuarter(_ value: Quarter?) {} + func setRenameTitle(_: String) {} + func setCreateTitle(_: String) {} + func setCreateQuarter(_: Quarter?) {} - func setIsLectureTimeSheetOpen(_ value: Bool, modifying timePlace: TimePlace?, action: ((TimePlace) -> Void)?) {} + func setIsLectureTimeSheetOpen(_: Bool, modifying _: TimePlace?, action _: ((TimePlace) -> Void)?) {} - func presentErrorAlert(error: STError?) {} - func presentErrorAlert(error: ErrorCode) {} - func presentErrorAlert(error: Error) {} + func presentErrorAlert(error _: STError?) {} + func presentErrorAlert(error _: ErrorCode) {} + func presentErrorAlert(error _: Error) {} func preloadWebViews() {} func sendMainWebViewReloadSignal() {} - func sendDetailWebViewReloadSignal(url: URL) {} + func sendDetailWebViewReloadSignal(url _: URL) {} + + func setRoutingState(_: WritableKeyPath, value _: V) {} + func hasNewBadge(settingName _: String) -> Bool { return true } - func setRoutingState(_ key: WritableKeyPath, value: V) {} - func hasNewBadge(settingName: String) -> Bool { return true } - func showNoticeViewIfNeeded() async throws {} } diff --git a/SNUTT-2022/SNUTT/Views/Components/NoticeView.swift b/SNUTT-2022/SNUTT/Views/Components/NoticeView.swift index 0f8ff4e1..022f056b 100644 --- a/SNUTT-2022/SNUTT/Views/Components/NoticeView.swift +++ b/SNUTT-2022/SNUTT/Views/Components/NoticeView.swift @@ -11,9 +11,9 @@ struct NoticeView: View { let title: String? let content: String? let sendFeedback: (String, String) async -> Bool - + @State private var pushToFeedBackView = false - + var body: some View { VStack(spacing: 32) { Image("warning.cat") diff --git a/SNUTT-2022/SNUTT/Views/SNUTTView.swift b/SNUTT-2022/SNUTT/Views/SNUTTView.swift index 037e9599..8239969c 100644 --- a/SNUTT-2022/SNUTT/Views/SNUTTView.swift +++ b/SNUTT-2022/SNUTT/Views/SNUTTView.swift @@ -35,7 +35,7 @@ struct SNUTTView: View, Sendable { ZStack { if let noticeViewInfo = viewModel.noticeViewInfo, noticeViewInfo.visible { NavigationView { - NoticeView(title: noticeViewInfo.title, + NoticeView(title: noticeViewInfo.title, content: noticeViewInfo.content, sendFeedback: viewModel.sendFeedback) } @@ -147,7 +147,6 @@ extension SNUTTView { @Published var preferredColorScheme: ColorScheme? = nil @Published private var error: STError? = nil @Published var noticeViewInfo: ConfigsDto.NoticeViewInfoDto? - @Published private var _isErrorAlertPresented = false var isErrorAlertPresented: Bool { @@ -223,7 +222,7 @@ extension SNUTTView { services.globalUIService.presentErrorAlert(error: error) } } - + func showNoticeViewIfNeeded() async { do { try await services.globalUIService.showNoticeViewIfNeeded() @@ -275,7 +274,7 @@ extension SNUTTView { services.globalUIService.presentErrorAlert(error: error) } } - + func sendFeedback(email: String, message: String) async -> Bool { if !Validation.check(email: email) { services.globalUIService.presentErrorAlert(error: .INVALID_EMAIL)