From 04c3ac08298cdff632f0e91680b75d9dfcef4290 Mon Sep 17 00:00:00 2001 From: bingbong Date: Tue, 13 Apr 2021 11:00:33 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20gson=20koin=20get=20key=20=EB=B0=98?= =?UTF-8?q?=EC=98=81=20=EB=B0=8F=20class=20=EC=9D=B4=EB=A6=84=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...amPortWebView.kt => IamPortWebViewMode.kt} | 23 ++++++++++--------- .../sdk/presentation/activity/IamportSdk.kt | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) rename sdk/src/main/java/com/iamport/sdk/presentation/activity/{IamPortWebView.kt => IamPortWebViewMode.kt} (93%) diff --git a/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebView.kt b/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebViewMode.kt similarity index 93% rename from sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebView.kt rename to sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebViewMode.kt index 3601bb26..3ad2c160 100644 --- a/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebView.kt +++ b/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamPortWebViewMode.kt @@ -25,10 +25,11 @@ import com.orhanobut.logger.Logger.* import kotlinx.coroutines.* import org.koin.core.component.KoinApiExtension import org.koin.core.component.get +import org.koin.core.qualifier.named @KoinApiExtension -class IamPortWebView @JvmOverloads constructor(scope: BaseCoroutineScope = UICoroutineScope()) : +class IamPortWebViewMode @JvmOverloads constructor(scope: BaseCoroutineScope = UICoroutineScope()) : IamportKoinComponent, BaseCoroutineScope by scope { // override val viewModel: WebViewModel by viewModel() @@ -100,16 +101,16 @@ class IamPortWebView @JvmOverloads constructor(scope: BaseCoroutineScope = UICor payment?.let { pay: Payment -> activity?.run { - i("등록하니?") + d("등록하니?") - viewModel.payment().observe(this, EventObserver(this@IamPortWebView::requestPayment)) - viewModel.loading().observe(this, EventObserver(this@IamPortWebView::loadingVisible)) + viewModel.payment().observe(this, EventObserver(this@IamPortWebViewMode::requestPayment)) + viewModel.loading().observe(this, EventObserver(this@IamPortWebViewMode::loadingVisible)) - viewModel.openWebView().observe(this, EventObserver(this@IamPortWebView::openWebView)) - viewModel.niceTransRequestParam().observe(this, EventObserver(this@IamPortWebView::openNiceTransApp)) - viewModel.thirdPartyUri().observe(this, EventObserver(this@IamPortWebView::openThirdPartyApp)) + viewModel.openWebView().observe(this, EventObserver(this@IamPortWebViewMode::openWebView)) + viewModel.niceTransRequestParam().observe(this, EventObserver(this@IamPortWebViewMode::openNiceTransApp)) + viewModel.thirdPartyUri().observe(this, EventObserver(this@IamPortWebViewMode::openThirdPartyApp)) - viewModel.impResponse().observe(this, EventObserver(this@IamPortWebView::sdkFinish)) + viewModel.impResponse().observe(this, EventObserver(this@IamPortWebViewMode::sdkFinish)) viewModel.startPayment(pay) } @@ -127,7 +128,7 @@ class IamPortWebView @JvmOverloads constructor(scope: BaseCoroutineScope = UICor * 결제 요청 실행 */ private fun requestPayment(it: Payment) { - i("나왔니??") + d("나왔니??") loadingVisible(true) activity?.run { if (!Util.isInternetAvailable(this)) { @@ -167,7 +168,7 @@ class IamPortWebView @JvmOverloads constructor(scope: BaseCoroutineScope = UICor // activity?.setResult(Activity.RESULT_OK, // Intent().apply { putExtra(CONST.CONTRACT_OUTPUT, iamPortResponse) }) // activity?.finish() - Iamport.callback(iamPortResponse) + Iamport.callback.invoke(iamPortResponse) } /** @@ -249,7 +250,7 @@ class IamPortWebView @JvmOverloads constructor(scope: BaseCoroutineScope = UICor setLayerType(View.LAYER_TYPE_HARDWARE, null) clearCache(true) addJavascriptInterface( - JsNativeInterface(payment, get(), get(), evaluateJS), + JsNativeInterface(payment, get(named("${CONST.KOIN_KEY}Gson")), get(), evaluateJS), CONST.PAYMENT_WEBVIEW_JS_INTERFACE_NAME ) webViewClient = viewModel.getWebViewClient(payment) diff --git a/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamportSdk.kt b/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamportSdk.kt index 33f6563d..0c400e9f 100644 --- a/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamportSdk.kt +++ b/sdk/src/main/java/com/iamport/sdk/presentation/activity/IamportSdk.kt @@ -313,7 +313,7 @@ internal class IamportSdk( clearData() webview?.let { webView -> hostHelper.activity?.let { activity -> - IamPortWebView().initStart(activity, webView, it) // webview only 모드 + IamPortWebViewMode().initStart(activity, webView, it) // webview only 모드 } ?: run { w("Cannot found activity, So running activity mode") webViewLauncher?.launch(it) // new activity 모드