payme-mini-app 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,7 +74,7 @@ dependencies {
74
74
  //noinspection GradleDynamicVersion
75
75
  implementation "com.facebook.react:react-native"
76
76
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
- implementation 'com.github.PayME-Miniapp:native-android:0.0.81'
77
+ implementation 'com.github.PayME-Miniapp:native-android:0.0.83'
78
78
  }
79
79
 
80
80
  if (isNewArchitectureEnabled()) {
@@ -1,5 +1,6 @@
1
1
  package com.paymeminiapp
2
2
 
3
+ import android.app.Activity
3
4
  import android.content.Context
4
5
  import android.util.Log
5
6
  import com.facebook.react.bridge.*
@@ -38,9 +39,13 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
38
39
 
39
40
  @ReactMethod
40
41
  fun initPayME(appId: String, publicKey: String, privateKey: String, locale: String, env: String, mode: String) {
41
- payMEMiniApp = PayMEMiniApp(
42
- reactApplicationContext.applicationContext, appId, publicKey, privateKey, getEnv(env), getLocale(locale)
43
- )
42
+ val fragmentActivity: Activity? = currentActivity
43
+
44
+ payMEMiniApp = fragmentActivity?.let {
45
+ PayMEMiniApp(
46
+ it, appId, publicKey, privateKey, getEnv(env), getLocale(locale)
47
+ )
48
+ }
44
49
  // payMEMiniApp?.setLanguage(locale)
45
50
  payMEMiniApp?.setMode(mode)
46
51
  payMEMiniApp?.setUpListener(onResponse = { actionOpenMiniApp: ActionOpenMiniApp, jsonObject: JSONObject? ->
@@ -188,14 +193,14 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
188
193
  }
189
194
 
190
195
  private fun getTypeOpenMiniApp(type: String): OpenMiniAppType {
191
- // if (type.lowercase() == OpenMiniAppType.modal.toString()) {
192
- // return OpenMiniAppType.modal
193
- // }
194
- // if (type.lowercase() == OpenMiniAppType.screen.toString()) {
195
- // return OpenMiniAppType.screen
196
- // }
197
- // return OpenMiniAppType.screen
196
+ if (type.lowercase() == OpenMiniAppType.modal.toString()) {
197
+ return OpenMiniAppType.modal
198
+ }
199
+ if (type.lowercase() == OpenMiniAppType.screen.toString()) {
200
+ return OpenMiniAppType.screen
201
+ }
198
202
  return OpenMiniAppType.screen
203
+ // return OpenMiniAppType.screen
199
204
  }
200
205
 
201
206
  private fun getActionOpenMiniApp(action: String): ActionOpenMiniApp {
@@ -13,8 +13,8 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
13
13
  DispatchQueue.main.sync {
14
14
  PayMEConfig.instance.setMode(mode ?? "miniapp_product")
15
15
  PayMEConfig.instance.env = (env == "SANDBOX") ? .sbx : .prod
16
- PayMEConfig.instance.locale = (locale == "en") ? .en : .vi
17
16
  self.payme = PayME(key: PayMEKey(appId: appId, publicKey: publicKey, privateKey: privateKey))
17
+ PayMEConfig.instance.locale = (locale == "en") ? .en : .vi
18
18
  self.payme.delegate = self
19
19
  }
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payme-mini-app",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Thư viện tích hợp PayME Miniapp",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",