Skip to content

Commit

Permalink
Merge pull request #53 from iamport/feat/webview-cache-mode
Browse files Browse the repository at this point in the history
feat : add setWebViewCacheMode interface[PCM-445]
  • Loading branch information
kjh5833 authored Jan 18, 2022
2 parents 44e66da + 4cba309 commit 1662d43
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/iamport/sampleapp/ui/PaymentFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ class PaymentFragment : BaseFragment<PaymentFragmentBinding>() {
// paymentResultCallback = { callBackListener.result(it) })

// Iamport.payment(userCode, iamPortRequest = request, approveCallback = { approveCallback(it) }) { callBackListener.result(it) }

// Iamport.webViewCacheMode = WebSettings.LOAD_DEFAULT // 필요시 추가 default WebSettings.LOAD_NO_CACHE (ex: PG 세틀뱅크 이용시, 뒤로가기 때 LOAD_DEFAULT 설정)
Iamport.payment(userCode, iamPortRequest = request) { callBackListener.result(it) }
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 디펜던시 업데이트 확인 ./gradlew dependencyUpdates -Drevision=release
object Versions {
const val versionCode = 220112001 // yymmdd000
const val versionName = "1.3.0" // https://www.notion.so/chaifinance/QA-Process-d1a4be396337493b81c6e85fff2d5cd6
const val versionCode = 220118001 // yymmdd000
const val versionName = "1.3.1" // https://www.notion.so/chaifinance/QA-Process-d1a4be396337493b81c6e85fff2d5cd6

const val gradle_versions_plugin = "0.39.0"
const val gradle_version = "4.1.1"
Expand Down
7 changes: 7 additions & 0 deletions sdk/src/main/java/com/iamport/sdk/domain/core/Iamport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.iamport.sdk.domain.core
import android.app.Application
import android.net.Uri
import android.util.Log
import android.webkit.WebSettings
import android.webkit.WebView
import androidx.activity.ComponentActivity
import androidx.activity.result.ActivityResultLauncher
Expand Down Expand Up @@ -59,6 +60,11 @@ object Iamport {
private val preventOverlapRun by lazy { PreventOverlapRun() }
private var isCreated = false


// WebView CacheMode
// default WebSettings.LOAD_NO_CACHE 이나, 세틀뱅크 뒤로가기시 오동작하여(캐시가 필요) 가맹점에서 선택할 수 있게 수정
var webViewCacheMode: Int = WebSettings.LOAD_NO_CACHE

var response: IamPortResponse? = null // 내부의 imp_uid로 종료 콜백 중복호출 방지

// ===========================================
Expand Down Expand Up @@ -386,4 +392,5 @@ object Iamport {
iamportSdk?.requestApprovePayments(approve)
}
// ======================================================

}
3 changes: 2 additions & 1 deletion sdk/src/main/java/com/iamport/sdk/domain/utils/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ object Util {
imp37739582("chai 테스트"),
imp87936124("alipay 테스트"),
imp02690184("smartro 테스트"),
imp42284830("payple 테스트");
imp42284830("payple 테스트"),
imp46277621("settlebank 테스트");

companion object {
fun getUserCodes(): List<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.webkit.WebView
import com.iamport.sdk.BuildConfig
import com.iamport.sdk.data.sdk.IamPortResponse
import com.iamport.sdk.data.sdk.Payment
import com.iamport.sdk.domain.core.Iamport

interface BaseMain {
fun openWebView(payment: Payment)
Expand Down Expand Up @@ -38,7 +39,7 @@ interface BaseMain {
cookieManager.setAcceptThirdPartyCookies(webView, true)
}

cacheMode = WebSettings.LOAD_NO_CACHE
cacheMode = Iamport.webViewCacheMode // default WebSettings.LOAD_NO_CACHE

blockNetworkImage = false
loadsImagesAutomatically = true
Expand Down

0 comments on commit 1662d43

Please sign in to comment.