Wanjuuuuu / AndroidDictionary

MIT License
0 stars 0 forks source link

WebView shouldOverrideUrlLoading 동작 확인하기 #2

Closed Wanjuuuuu closed 3 years ago

Wanjuuuuu commented 3 years ago

baseUrl 이 안드로이드 공식문서인 경우에 대한 동작 확인

Wanjuuuuu commented 3 years ago

shouldOverrideUrlLoading

그런데 처음 loadUrl 실행시 안드로이드 웹뷰 내부적으로 url을 변경해서 uri.host가 달라짐 그래서 if 문으로 처리가 안되는듯..

Wanjuuuuu commented 3 years ago

2021-10-12 22:18:13.086 21619-21619/com.wanjuuuuu.androiddictionary E/routeToBrowser: uri? https://developer.android.com/oauth2authorize?return_url=https%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Fview%2FWindow&prompt=none&auto_signin=True&scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdeveloperprofiles+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdeveloperprofiles.award 2021-10-12 22:18:13.088 21619-21619/com.wanjuuuuu.androiddictionary E/routeToBrowser: host ? developer.android.com /oauth2authorize developer.android.com 2021-10-12 22:18:13.088 21619-21619/com.wanjuuuuu.androiddictionary E/routeToBrowser: right? oo 2021-10-12 22:18:13.310 21619-21619/com.wanjuuuuu.androiddictionary E/routeToBrowser: uri? https://accounts.google.com/o/oauth2/v2/auth?client_id=721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fdeveloper.android.com%2Foauth2callback&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdeveloperprofiles+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdeveloperprofiles.award+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgoogledevelopers&access_type=online&response_type=code&state=%7B%22csrf_token%22%3A+%2228684df1998902b897f005c12b8991c33f948f07dfd83d99d25a8c03f7153345%22%2C+%22return_url%22%3A+%22https%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Fview%2FWindow%22%7D&prompt=none&auto_signin=True 2021-10-12 22:18:13.311 21619-21619/com.wanjuuuuu.androiddictionary E/routeToBrowser: host ? accounts.google.com /o/oauth2/v2/auth accounts.google.com

Wanjuuuuu commented 3 years ago

그 이후론 뭔가 log가 안찍힘

Wanjuuuuu commented 3 years ago

deprecated 된 shouldOverrideUrlLoading이 불리고 있었음 (첫번째만) -> 이 경우는 브라우저로 점프함 그 이후 접근시 어찌된 영문인지 불리지 않음 -> 한번 브라우저가 뜬 후엔 웹뷰에서 잘 뜸 shouldInterceptRequest를 쓰면 불리는걸 확인할 수 있었음

그래서 항상 shouldOverride 쪽에서 return false를 했더니

  1. Error: disallowed_useragent과 같은 문제 발생

해결책 중 하나가 chrome custom tabs를 쓰는것 https://aroundck.tistory.com/6031

Wanjuuuuu commented 3 years ago

Applied ChromeCustomTabs!!! Closed!