-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Custom WebView 작성 및 토큰 재발급 로직 작성, MDS 컬러 마이페이지 하위에 적용 #309
[Feature] Custom WebView 작성 및 토큰 재발급 로직 작성, MDS 컬러 마이페이지 하위에 적용 #309
Conversation
let isScrollEnabled: Bool | ||
|
||
public init( | ||
javaScriptEnabled: Bool = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wkwebview javaScriptEnabled 속성에 대응 - 미사용
|
||
public init( | ||
javaScriptEnabled: Bool = true, | ||
allowsBackForwardNavigationGestures: Bool = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
navigation backswipe가 가능하도록 하는 프로퍼티. wkwebview allowsBackForward~ 에 대응
public init( | ||
javaScriptEnabled: Bool = true, | ||
allowsBackForwardNavigationGestures: Bool = true, | ||
allowsInlineMediaPlayback: Bool = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default : false. false인 경우 동영상이 있으면 전체 화면으로 재생 됨. inline으로 재생할 수 있도록 하는 프로퍼티.
javaScriptEnabled: Bool = true, | ||
allowsBackForwardNavigationGestures: Bool = true, | ||
allowsInlineMediaPlayback: Bool = true, | ||
mediaTypesRequiringUserActionForPlayback: WKAudiovisualMediaTypes = [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용자 제스쳐가 필요한 미디어 타입. 없어도 됨
allowsBackForwardNavigationGestures: Bool = true, | ||
allowsInlineMediaPlayback: Bool = true, | ||
mediaTypesRequiringUserActionForPlayback: WKAudiovisualMediaTypes = [], | ||
isScrollEnabled: Bool = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
웹뷰의 스크롤 가능 여부.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역시 최고에요!! ⭐️👍
덕분에 웹 뷰 로그인 풀리는 문제는 막을 수 있겠네요!
WKWebView 관련 코드들 참고 많이 하겠습니다! ㅎㅎ
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
private var appLifecycleAdapter = AppLifecycleAdapter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dev 타겟 AppDelegate에는 일부러 토큰 재발급 로직을 추가하지 않은걸까요~~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헤헤 아니요 추가했어요 감사합니다
NotificationCenter.default | ||
.publisher(for: UIApplication.willEnterForegroundNotification) | ||
.subscribe(on: DispatchQueue.global()) | ||
.receive(on: DispatchQueue.main) | ||
.sink(receiveValue: { [weak self] _ in | ||
self?.reissureTokens() | ||
}).store(in: self.cancelBag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
willEnterForegroundNotification
로 이벤트를 받아오면 사용자가 잠깐 폰 홈을 보고 와도 토큰 재발급 로직 호출이 될 것 같은데 혹시 이 정도 수의 API 호출이 많아지는 문제는 큰 지장이 없을까 궁금합니다!!😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기준 시간을 재는 방법으로 보간할 수 있겠어요 요건 챙겨봅시다! (background 진입 - foreground 진입이 하루 이상인 경우에면 reassurance를 한다라던지)
|
||
import UIKit | ||
|
||
final public class AppLifecycleAdapter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앱 라이프사이클을 이벤트를 받아서 관련 로직을 처리하는 객체를 만들었네요!! 한 수 배워갑니다!!!👍
|
||
extension SOPTWebView: WKNavigationDelegate { | ||
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | ||
guard !self.barrier else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
barrier는 didFinish에 구현된 내용(토큰 주입)이 1회만 발생하기 위해 플래그를 생성한 걸까요~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞아요~ 리액트가 실행되는 타이밍이 제각각이고 무한 리로드가 되는 경우가 생겨서 1회만 되도록 방지해 두었어요
.subscribe(on: DispatchQueue.global()) | ||
.receive(on: DispatchQueue.main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subscribe(on:)과 receive(on:)을 각각 쓰신 이유가 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
각각 적용되는 범위가 달라서 그렇습니다~ 스트림 시작은 글로벌 큐에서 작업되기를 원하고, receiveOn 이후로는 메인스레드에서 동작하기를 의도한 것이에요
09a44ff
to
3e49968
Compare
🌴 PR 요약
🌱 작업한 브랜치
🌱 PR Point
1. Custom WebView를 만들고, 토큰 재발급 로직을 작성했어요
[웹뷰]
[토큰 재발급 로직]
이 구간 극복을 위해 로그인이 되어 있는 경우, enterforeground에 진입하면 토큰 재발급 로직을 수행하게 했습니다.
2. 새로운 컬러를 마이페이지와 하위 뷰에 적용했어요
📸 스크린샷
왼쪽 : historyback, 오른쪽 나가기
📮 관련 이슈