Skip to content

Commit

Permalink
[Feature] 수수 Text Writing 정책 변경, 회원가입시 Loading modifier 추가, Delegate …
Browse files Browse the repository at this point in the history
…로직 수정 (#653)

* feat: regex 완화

* feat: isLoading 변수 및 뷰 추가

* feat: reducer 내부 동작 함수 매핑 및 로직 변경

* project: update build version

* feat: udpate regex

* bug: reload token logic 수정
  • Loading branch information
MaraMincho authored Jan 27, 2025
1 parent 4782cb6 commit 23b61be
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions Projects/App/Sources/App/SSTimeOut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
12 changes: 6 additions & 6 deletions Projects/Core/SSRegexManager/Sources/RegexPatternString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BottomSheetYearItem>.State? = nil

init() {
Expand All @@ -45,7 +46,9 @@ struct OnboardingAdditional {
case tappedNextButton
}

enum InnerAction: Equatable {}
enum InnerAction: Equatable {
case isLoading(Bool)
}

enum AsyncAction: Equatable {}

Expand All @@ -59,6 +62,17 @@ struct OnboardingAdditional {

@Dependency(\.onboardingAdditionalNetwork) var network

private func handleSignup(send _: Send<Action>) 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<State, Action> {
Scope(state: \.header, action: \.scope.header) {
HeaderViewFeature()
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 23b61be

Please sign in to comment.