Skip to content

Commit

Permalink
feat #93: 문제풀이 웹뷰 연결 및 뒤로가기 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
0inn committed Sep 10, 2023
1 parent 7781a32 commit 80c02ec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
13 changes: 6 additions & 7 deletions Projects/Features/Sources/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ extension HomeView {
.frame(height: 60)
.onTapGesture {
Task {
// TODO: 현재 url 이슈로 shorURL 생성 안됨 -> 추후에 바꿔놓기
if viewStore.isSolvedDailyTest {
let url = "https://keyme-frontend.vercel.app/test/17"
// let url = "https://keyme-frontend.vercel.app/test/\(viewStore.view.testId)"
// let shortURL = try await ShortUrlAPIManager.shared.request(
// .shortenURL(longURL: url),
// object: BitlyResponse.self).link
// let url = "https://keyme-frontend.vercel.app/test/17"
let url = "https://keyme-frontend.vercel.app/test/\(viewStore.testId)"
let shortURL = try await ShortUrlAPIManager.shared.request(
.shortenURL(longURL: url),
object: BitlyResponse.self).link

sharedURL = ActivityViewController.SharedURL("www.example.com")
} else {
// TODO: 시작하기 누르면 웹뷰로 가도록 구현
viewStore.send(.startTest(.presented(.startButtonDidTap)))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public struct StartTestFeature: Reducer {
case let .setIcon(icon):
state.icon = icon

// TODO: 현재 문제 풀이 웹뷰로 안넘어감
case .startButtonDidTap:
let url = "https://keyme-frontend.vercel.app/test/\(state.testData.testId)"
state.keymeTestsState = KeymeTestsFeature.State(url: url, authorizationToken: state.authorizationToken)
Expand Down
4 changes: 4 additions & 0 deletions Projects/Features/Sources/KeymeTests/KeymeTestsFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public struct KeymeTestsFeature: Reducer {
public enum View: Equatable {
case showResult(data: KeymeWebViewModel)
case closeButtonTapped
case closeWebView
}

public enum Alert: Equatable {
Expand Down Expand Up @@ -83,6 +84,9 @@ public struct KeymeTestsFeature: Reducer {
}
))
}

case .view(.closeWebView):
return .send(.close)

case .submit:
return .none
Expand Down
3 changes: 3 additions & 0 deletions Projects/Features/Sources/KeymeTests/KeymeTestsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public struct KeymeTestsView: View {
.onTestSubmitted { testResult in
viewStore.send(.showResult(data: testResult))
}
.onCloseWebView {
viewStore.send(.closeWebView)
}
.toolbar(.hidden, for: .navigationBar)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
Expand Down

0 comments on commit 80c02ec

Please sign in to comment.