rns-nativecall 0.7.9 → 0.8.1

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.
@@ -1,55 +0,0 @@
1
- package com.rnsnativecall
2
-
3
- import android.app.Activity
4
- import android.app.KeyguardManager
5
- import android.content.Context
6
- import android.content.Intent
7
- import android.os.Build
8
- import android.os.Bundle
9
- import android.view.WindowManager
10
-
11
- class UnlockPromptActivity : Activity() {
12
- override fun onCreate(savedInstanceState: Bundle?) {
13
- super.onCreate(savedInstanceState)
14
-
15
- // Ensure this activity shows over the lockscreen to trigger the prompt
16
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
17
- setShowWhenLocked(true)
18
- setTurnScreenOn(true)
19
- } else {
20
- window.addFlags(
21
- WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
22
- WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
23
- )
24
- }
25
-
26
- val km = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
27
-
28
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
29
- km.requestDismissKeyguard(this, object : KeyguardManager.KeyguardDismissCallback() {
30
- override fun onDismissSucceeded() {
31
- super.onDismissSucceeded()
32
- // Unlock successful, launch the main app
33
- val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
34
- startActivity(launchIntent)
35
- finish()
36
- }
37
-
38
- override fun onDismissCancelled() {
39
- super.onDismissCancelled()
40
- finish()
41
- }
42
-
43
- override fun onDismissError() {
44
- super.onDismissError()
45
- finish()
46
- }
47
- })
48
- } else {
49
- // Fallback for older Android versions
50
- val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
51
- startActivity(launchIntent)
52
- finish()
53
- }
54
- }
55
- }