From 23b61bed49fbf69285d51df03178966c95ccb4d4 Mon Sep 17 00:00:00 2001 From: MaraMincho <103064352+MaraMincho@users.noreply.github.com> Date: Mon, 27 Jan 2025 21:35:45 +0900 Subject: [PATCH] =?UTF-8?q?[Feature]=20=EC=88=98=EC=88=98=20Text=20Writing?= =?UTF-8?q?=20=EC=A0=95=EC=B1=85=20=EB=B3=80=EA=B2=BD,=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85=EC=8B=9C=20Loading=20modifier=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20Delegate=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=20(#653)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: regex 완화 * feat: isLoading 변수 및 뷰 추가 * feat: reducer 내부 동작 함수 매핑 및 로직 변경 * project: update build version * feat: udpate regex * bug: reload token logic 수정 --- Projects/App/Project.swift | 4 +-- Projects/App/Sources/App/SSTimeOut.swift | 8 ++--- .../Sources/RegexPatternString.swift | 12 +++---- .../OnboardingAdditional.swift | 35 ++++++++++++++----- .../OnboardingAdditionalView.swift | 1 + 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift index cf623977..bcdbee5c 100644 --- a/Projects/App/Project.swift +++ b/Projects/App/Project.swift @@ -27,8 +27,8 @@ let project = Project.makeModule( "CFBundleDisplayName": "수수", "UILaunchStoryboardName": "LaunchScreen", "BGTaskSchedulerPermittedIdentifiers": "com.oksusu.susu.app", - "CFBundleShortVersionString": "1.1.1", - "CFBundleVersion": "2024112844", + "CFBundleShortVersionString": "1.1.2", + "CFBundleVersion": "2025011545", "UIUserInterfaceStyle": "Light", "ITSAppUsesNonExemptEncryption": "No", "AppstoreAPPID": "6503701515", diff --git a/Projects/App/Sources/App/SSTimeOut.swift b/Projects/App/Sources/App/SSTimeOut.swift index 14f0b12d..0a817539 100644 --- a/Projects/App/Sources/App/SSTimeOut.swift +++ b/Projects/App/Sources/App/SSTimeOut.swift @@ -24,14 +24,14 @@ final class SSTimeOut { static func enterBackground() { os_log("백그라운드 진입") - if shared.initialLoading == false { - shared.initialLoading = true - return - } shared.enteredBackgroundDate = Date.now } static func enterForegroundScreen() { + if shared.initialLoading == false { + shared.initialLoading = true + return + } os_log("포그라운드 진입") reloadToken() } diff --git a/Projects/Core/SSRegexManager/Sources/RegexPatternString.swift b/Projects/Core/SSRegexManager/Sources/RegexPatternString.swift index fb76c77a..42c6f92f 100644 --- a/Projects/Core/SSRegexManager/Sources/RegexPatternString.swift +++ b/Projects/Core/SSRegexManager/Sources/RegexPatternString.swift @@ -22,19 +22,19 @@ public enum RegexPatternString { public var regexString: String { switch self { case .name: - "^[가-힣|a-z|A-Z|0-9| |.]{1,10}$" + "^\\S(?:.{0,8}\\S)?$" case .price: "^[\\d]{1,10}$" case .relationship: - "^[가-힣|a-z|A-Z| ]{1,10}$" + "^\\S(?:.{0,8}\\S)?$" case .category: - "^[가-힣|a-z|A-Z| ]{1,10}$" + "^\\S(?:.{0,8}\\S)?$" case .ledger: - "^[가-힣|a-z|A-Z| ]{1,10}$" + "^\\S(?:.{0,8}\\S)?$" case .gift: - "^[가-힣|a-z|A-Z|0-9| ]{1,30}$" + "^\\S(?:.{0,28}\\S)?$" case .memo: - "^.{1,30}$" + "^\\S(?:.{0,28}\\S)?$" case .contacts: "^[\\d]{11}$" case .voteContents: diff --git a/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditional.swift b/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditional.swift index 1a624aa3..97ece5c7 100644 --- a/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditional.swift +++ b/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditional.swift @@ -23,6 +23,7 @@ struct OnboardingAdditional { var header: HeaderViewFeature.State = .init(.init(type: .depthProgressBar(1))) var presentBirthBottomSheet: Bool = false var helper: OnboardingAdditionalProperty + var isLoading: Bool = false @Presents var bottomSheet: SSSelectableBottomSheetReducer.State? = nil init() { @@ -45,7 +46,9 @@ struct OnboardingAdditional { case tappedNextButton } - enum InnerAction: Equatable {} + enum InnerAction: Equatable { + case isLoading(Bool) + } enum AsyncAction: Equatable {} @@ -59,6 +62,17 @@ struct OnboardingAdditional { @Dependency(\.onboardingAdditionalNetwork) var network + private func handleSignup(send _: Send) async throws { + guard let body = SharedStateContainer.getValue(SignUpBodyProperty.self) else { + return + } + let response = try await network.requestSignUp(body) + try OnboardingAdditionalPersistence.saveToken(response) + + let userID = try await network.requestUserID() + try await OnboardingAdditionalPersistence.saveUserID(userID) + } + var body: some Reducer { Scope(state: \.header, action: \.scope.header) { HeaderViewFeature() @@ -93,19 +107,22 @@ struct OnboardingAdditional { body.setGender(state.helper.selectedGenderItem) body.setBirth(state.helper.selectedBirthItemToBodyString()) - return .ssRun { _ in - // 화면 전환 - defer { + return .ssRun { send in + await send(.inner(.isLoading(true))) + do { + try await handleSignup(send: send) NotificationCenter.default.post(name: SSNotificationName.goMainScene, object: nil) + } catch { + throw error } - let response = try await network.requestSignUp(body) - try OnboardingAdditionalPersistence.saveToken(response) - - let userID = try await network.requestUserID() - try await OnboardingAdditionalPersistence.saveUserID(userID) + await send(.inner(.isLoading(false))) } case .scope(.bottomSheet): return .none + + case let .inner(.isLoading(val)): + state.isLoading = val + return .none } } .addFeatures0() diff --git a/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditionalView.swift b/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditionalView.swift index 40cb53ca..6ddb99d9 100644 --- a/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditionalView.swift +++ b/Projects/Feature/Onboarding/Sources/OnboardingAdditional/OnboardingAdditionalView.swift @@ -125,6 +125,7 @@ struct OnboardingAdditionalView: View { .safeAreaInset(edge: .bottom) { makeNextScreenButton() } + .ssLoading(store.isLoading) .selectableBottomSheetWithBottomView( store: $store.scope(state: \.bottomSheet, action: \.scope.bottomSheet), cellCount: 6,