@yuno-payments/yuno-sdk-react-native 1.0.31-beta.4 → 1.0.31-beta.5
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.
|
@@ -2,9 +2,11 @@ package com.yunosdkreactnative
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.content.Context
|
|
5
|
+
import android.os.Build
|
|
5
6
|
import android.util.Log
|
|
6
7
|
import android.widget.Toast
|
|
7
8
|
import androidx.activity.ComponentActivity
|
|
9
|
+
import androidx.activity.enableEdgeToEdge
|
|
8
10
|
import com.facebook.react.bridge.*
|
|
9
11
|
import com.facebook.react.module.annotations.ReactModule
|
|
10
12
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -183,24 +185,44 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
183
185
|
}
|
|
184
186
|
}
|
|
185
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Configures edge-to-edge on Android 15+ (API 35).
|
|
190
|
+
*
|
|
191
|
+
* Android 15 enforces edge-to-edge rendering for all Activities. Without
|
|
192
|
+
* calling enableEdgeToEdge(), the Activity window is left in an inconsistent
|
|
193
|
+
* state and the Yuno SDK's payment UI renders behind system bars.
|
|
194
|
+
*
|
|
195
|
+
* @param activity The activity to configure
|
|
196
|
+
*/
|
|
197
|
+
private fun ensureEdgeToEdgeConfigured(activity: Activity) {
|
|
198
|
+
if (Build.VERSION.SDK_INT >= 35 && activity is ComponentActivity) {
|
|
199
|
+
try {
|
|
200
|
+
activity.enableEdgeToEdge()
|
|
201
|
+
} catch (e: Exception) {
|
|
202
|
+
Log.w(TAG, "Failed to configure edge-to-edge: ${e.message}")
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
186
207
|
/**
|
|
187
208
|
* Register Yuno SDK callbacks for an activity.
|
|
188
|
-
*
|
|
209
|
+
*
|
|
189
210
|
* IMPORTANT: This MUST be called from YunoActivity.onCreate() BEFORE super.onCreate()
|
|
190
211
|
* This is required by Android's registerForActivityResult() API.
|
|
191
|
-
*
|
|
212
|
+
*
|
|
192
213
|
* The SDK must be already initialized before calling this method.
|
|
193
|
-
*
|
|
214
|
+
*
|
|
194
215
|
* NOTE: This method can be called multiple times (e.g. when "Don't Keep Activities" is enabled
|
|
195
216
|
* and the activity is recreated). Android handles multiple registrations correctly by replacing
|
|
196
217
|
* the previous launcher.
|
|
197
|
-
*
|
|
218
|
+
*
|
|
198
219
|
* @param activity The ComponentActivity instance (usually YunoActivity)
|
|
199
220
|
*/
|
|
200
221
|
@JvmStatic
|
|
201
222
|
fun registerYunoCallbacks(activity: ComponentActivity) {
|
|
202
223
|
try {
|
|
203
|
-
|
|
224
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
225
|
+
|
|
204
226
|
// Register payment callbacks
|
|
205
227
|
// Note: Android allows registering multiple times - the last registration wins
|
|
206
228
|
activity.startCheckout(
|
|
@@ -350,7 +372,8 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
350
372
|
return
|
|
351
373
|
}
|
|
352
374
|
|
|
353
|
-
|
|
375
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
376
|
+
|
|
354
377
|
// Start enrollment
|
|
355
378
|
activity.startEnrollment(
|
|
356
379
|
customerSession = customerSession,
|
|
@@ -400,6 +423,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
400
423
|
return
|
|
401
424
|
}
|
|
402
425
|
|
|
426
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
403
427
|
|
|
404
428
|
// Update checkout session
|
|
405
429
|
activity.updateCheckoutSession(
|
|
@@ -446,6 +470,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
446
470
|
return
|
|
447
471
|
}
|
|
448
472
|
|
|
473
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
449
474
|
|
|
450
475
|
// Start payment
|
|
451
476
|
activity.startPayment(
|
|
@@ -481,6 +506,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
481
506
|
return
|
|
482
507
|
}
|
|
483
508
|
|
|
509
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
484
510
|
|
|
485
511
|
// Continue payment
|
|
486
512
|
activity.continuePayment(
|
|
@@ -558,6 +584,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
558
584
|
return
|
|
559
585
|
}
|
|
560
586
|
|
|
587
|
+
ensureEdgeToEdgeConfigured(activity)
|
|
561
588
|
|
|
562
589
|
// Update checkout session
|
|
563
590
|
activity.updateCheckoutSession(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuno-payments/yuno-sdk-react-native",
|
|
3
|
-
"version": "1.0.31-beta.
|
|
3
|
+
"version": "1.0.31-beta.5",
|
|
4
4
|
"description": "Yuno React Native SDK empowers you to create seamless payment experiences in your native Android and iOS apps built with React Native.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|