Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
enebin committed Oct 30, 2023
2 parents 0cb7bfa + 7ae783e commit ca4a458
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ProjectDescription

public extension Project {
static let infoPlist: [String: InfoPlist.Value] = [
"CFBundleShortVersionString": "1.0.1",
"CFBundleShortVersionString": "1.0.2",
"CFBundleVersion": "1",
"UIMainStoryboardFile": "",
"UILaunchStoryboardName": "LaunchScreen",
Expand Down
3 changes: 3 additions & 0 deletions Projects/Features/Sources/CommonVariable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import ComposableArchitecture
public final class CommonVariable {
var userId: Int!
var nickname: String!
static func testPageURLString(testId: Int) -> String {
return "https://web.keyme.space/test/\(testId)"
}
}

extension CommonVariable: DependencyKey {
Expand Down
2 changes: 1 addition & 1 deletion Projects/Features/Sources/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public struct HomeView: View {
needToShowProgressView = true

if isSolvedTest {
let url = "https://keyme-frontend.vercel.app/test/\(viewStore.testId)"
let url = CommonVariable.testPageURLString(testId: viewStore.testId)
sharedURL = ActivityViewController.SharedURL(url)
// API 할당량 넘치면 여기서 응답을 안 주고 막혀버림;; 아나
// let shortURL = try await shortURLAPIManager.request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public struct StartTestFeature: Reducer {
state.icon = icon

case .startButtonDidTap:
let url = "https://keyme-frontend.vercel.app/test/\(state.testData.testId)"
let url = CommonVariable.testPageURLString(testId: state.testData.testId)
state.keymeTestsState = KeymeTestsFeature.State(url: url, authorizationToken: state.authorizationToken)

case .keymeTests(.presented(.close)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ public struct TestResultView: View {
.frame(height: 60)
.onTapGesture {
Task {
// TODO: url 주석단거로 바꾸기
let url = "https://keyme-frontend.vercel.app/test/\(17)"
let url = CommonVariable.testPageURLString(testId: viewStore.testId)
let shortURL = try await shortURLManager.request(
.shortenURL(longURL: url),
object: BitlyResponse.self).link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private extension NativeTestContentView {
VStack {
Spacer().frame(height: 25 * 2)
TestContentCircle(
question: questionsWithScore[min(questionIndexBuffer + 2, limit)].question,
question: questionsWithScore[min(questionIndexBuffer + 2, limit - 1)].question,
circleRadius: calculateRadius(score: 3, width: proxy.size.width),
color: .white
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public struct NativeTestFeature: Reducer {
let questions: [Question]

var questionsWithScore: [QuestionWithScore]
var needToShowProgress: Bool = false

@PresentationState var alertState: AlertState<Action.Alert>?

Expand Down Expand Up @@ -58,6 +59,7 @@ public struct NativeTestFeature: Reducer {
case view(View)
case alert(PresentationAction<Alert>)

case showProgress(enabled: Bool)
case showErrorAlert(message: String)

public enum View: Equatable {
Expand Down Expand Up @@ -104,6 +106,8 @@ public struct NativeTestFeature: Reducer {
})

case .view(.postResult):
state.needToShowProgress = true

return .run { [state] send in
do {
let response = try await self.network.request(
Expand All @@ -113,9 +117,10 @@ public struct NativeTestFeature: Reducer {
object: SubmitResponseDTO.self)

await send(.showResult(response.data))
await send(.showProgress(enabled: false))
} catch {
print(error)
await send(.showErrorAlert(message: "오류가 발생했습니다. 잠시 후 다시 시도해주세요."))
await send(.showProgress(enabled: false))
}
}

Expand All @@ -128,7 +133,12 @@ public struct NativeTestFeature: Reducer {
case .submit:
return .none

case .showProgress(let enabled):
state.needToShowProgress = enabled
return .none

case .showErrorAlert(let message):
state.needToShowProgress = false
state.alertState = AlertState.errorWithMessage(message)

case .alert(.presented(.closeTest)):
Expand Down Expand Up @@ -221,6 +231,7 @@ public struct NativeTestView: View {
.toolbar(.hidden, for: .navigationBar)
.alert(store: store.scope(state: \.$alertState, action: NativeTestFeature.Action.alert))
}
.fullscreenProgressView(isShown: viewStore.needToShowProgress)
}
.transition(.opacity.animation(Animation.customInteractiveSpring(duration: 1)))
}
Expand Down
8 changes: 7 additions & 1 deletion Projects/Features/Sources/MyPage/MyPageFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct MyPageFeature: Reducer {
return commonVariable.nickname
}
let testId: Int
var testURL: String { "https://keyme-frontend.vercel.app/test/\(testId)" }
var testURL: String { CommonVariable.testPageURLString(testId: testId) }

var imageExportMode = false

Expand Down Expand Up @@ -80,6 +80,7 @@ public struct MyPageFeature: Reducer {
case prepareSettingView
case selectSegement(MyPageSegment)
case enableImageExportMode
case disableImageExportMode
case captureImage
case requestTestURL
}
Expand Down Expand Up @@ -194,6 +195,11 @@ public struct MyPageFeature: Reducer {

return .none

case .view(.disableImageExportMode):
state.imageExportModeState = nil

return .none

case .view(.requestTestURL):
return .run { [testURL = state.view.testURL] send in
do {
Expand Down
16 changes: 10 additions & 6 deletions Projects/Features/Sources/MyPage/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct MyPageView: View {
.transition(.opacity)
}

// Export 모드에 진입합니다
// Export 모드에 진입합니다
IfLetStore(store.scope(
state: \.imageExportModeState,
action: MyPageFeature.Action.imageExportModeAction)
Expand All @@ -115,17 +115,21 @@ struct MyPageView: View {
}
.transition(
.opacity.combined(with: .scale(scale: 1.5))
.animation(Animation.customInteractiveSpring()))
.animation(Animation.customInteractiveSpring(duration: 0.5)))
.zIndex(ViewZIndex.high.rawValue)

}
}
.toolbar(viewStore.imageExportMode ? .hidden : .visible, for: .tabBar)
// .onDisappear {
// viewStore.send(.disableImageExportMode)
// graphScale /= exportModeScale
// }
.fullFrame()
.border(DSKitAsset.Color.keymeBlack.swiftUIColor, width: viewStore.imageExportMode ? 5 : 0)
.alert(store: store.scope(state: \.$alertState, action: MyPageFeature.Action.alert))
.animation(Animation.customInteractiveSpring(duration: 0.5), value: viewStore.circleShown)
.animation(Animation.customInteractiveSpring(), value: viewStore.imageExportMode)
.animation(Animation.customInteractiveSpring(), value: viewStore.nowFetching)
.border(DSKitAsset.Color.keymeBlack.swiftUIColor, width: viewStore.imageExportMode ? 5 : 0)
.animation(Animation.customInteractiveSpring(duration: 0.5), value: viewStore.imageExportMode)
.animation(Animation.customInteractiveSpring(duration: 0.5), value: viewStore.nowFetching)
.fullscreenProgressView(isShown: needToShowProgressView)
}
.navigationDestination(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public struct OnboardingFeature: Reducer {
}

case .startButtonDidTap:
let url = "https://keyme-frontend.vercel.app/test/\(state.testData.testId)"
let url = CommonVariable.testPageURLString(testId: state.testData.testId)
state.keymeTestsState = NativeTestFeature.State(
testId: state.testData.testId,
nickname: state.nickname,
Expand Down

0 comments on commit ca4a458

Please sign in to comment.