Skip to content

Commit

Permalink
[ADD/#50] WebViewClient 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jul 22, 2024
1 parent 335437a commit 1889c7b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
21 changes: 10 additions & 11 deletions presentation/src/main/assets/web_auth_phone.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@
},
function (rsp) {
if (rsp.success) {
jQuery.ajax({
url: "{서버의 인증 정보를 받는 endpoint}",
method: "POST",
headers: { "Content-Type": "application/json" },
data: JSON.stringify({ imp_uid: rsp.imp_uid }),
success: function(response) {
window.AndroidBridge.resultAuth(true, rsp.imp_uid);
},
error: function(xhr, status, error) {
window.AndroidBridge.resultAuth(false);
$.ajax({
type : 'POST',
url : '/certifications/confirm',
dataType : 'json',
data : {
imp_uid : rsp.imp_uid
}
});
}).done(function() {
window.AndroidBridge.resultAuth(true, rsp.imp_uid);
});
} else {
alert("인증에 실패하였습니다. 에러 내용: " + rsp.error_msg);
window.AndroidBridge.resultAuth(false);
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class SmsAuthActivity : BaseActivity<ActivitySmsAuthBinding>(R.layout.activity_s
setLayerType(View.LAYER_TYPE_HARDWARE, null)
scrollBarStyle = WebView.SCROLLBARS_OUTSIDE_OVERLAY
isScrollbarFadingEnabled = true
// webChromeClient = myChromeClient()
// webViewClient = WebViewClientClass()
webViewClient = SmsAuthWebViewClient()
loadUrl("file:///android_asset/web_auth_phone.html")
}
}
Expand All @@ -62,7 +61,7 @@ class SmsAuthActivity : BaseActivity<ActivitySmsAuthBinding>(R.layout.activity_s

@JvmStatic
fun createIntent(context: Context): Intent =
Intent(context, SmsAuthFactory::class.java).apply {
Intent(context, SmsAuthActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package co.orange.presentation.auth.phone

import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient

class SmsAuthWebViewClient : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?,
): Boolean {
val url: String = request?.url.toString()
view?.loadUrl(url)
return super.shouldOverrideUrlLoading(view, request)
}
}

0 comments on commit 1889c7b

Please sign in to comment.