@webority-technologies/mobile-core 0.0.6 → 0.0.8
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.
- package/android/build.gradle +65 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +57 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModule.kt +20 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +146 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverPackage.kt +33 -0
- package/lib/commonjs/formatters/dateMath.js +4 -4
- package/lib/commonjs/formatters/windowsToIanaTable.js +164 -0
- package/lib/commonjs/geolocation/index.js +9 -1
- package/lib/commonjs/permissions/calendar.js +14 -0
- package/lib/commonjs/permissions/camera.js +14 -0
- package/lib/commonjs/permissions/contacts.js +10 -0
- package/lib/commonjs/permissions/index.js +60 -150
- package/lib/commonjs/permissions/location.js +14 -0
- package/lib/commonjs/permissions/mediaLibrary.js +10 -0
- package/lib/commonjs/permissions/notifications.js +10 -0
- package/lib/commonjs/permissions/photos.js +14 -0
- package/lib/commonjs/smsRetriever/index.js +91 -0
- package/lib/commonjs/specs/NativeSmsRetriever.js +15 -0
- package/lib/commonjs/sqlite/index.js +12 -30
- package/lib/module/formatters/dateMath.js +4 -4
- package/lib/module/formatters/windowsToIanaTable.js +160 -0
- package/lib/module/geolocation/index.js +8 -1
- package/lib/module/index.js +3 -2
- package/lib/module/permissions/calendar.js +15 -0
- package/lib/module/permissions/camera.js +15 -0
- package/lib/module/permissions/contacts.js +11 -0
- package/lib/module/permissions/index.js +59 -150
- package/lib/module/permissions/location.js +15 -0
- package/lib/module/permissions/mediaLibrary.js +11 -0
- package/lib/module/permissions/notifications.js +11 -0
- package/lib/module/permissions/photos.js +15 -0
- package/lib/module/smsRetriever/index.js +86 -0
- package/lib/module/specs/NativeSmsRetriever.js +13 -0
- package/lib/module/sqlite/index.js +12 -30
- package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/commonjs/geolocation/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -2
- package/lib/typescript/commonjs/permissions/calendar.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/camera.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/contacts.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +29 -36
- package/lib/typescript/commonjs/permissions/location.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/notifications.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/photos.d.ts +2 -0
- package/lib/typescript/commonjs/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/commonjs/sqlite/index.d.ts +10 -18
- package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/module/geolocation/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts +3 -2
- package/lib/typescript/module/permissions/calendar.d.ts +2 -0
- package/lib/typescript/module/permissions/camera.d.ts +2 -0
- package/lib/typescript/module/permissions/contacts.d.ts +2 -0
- package/lib/typescript/module/permissions/index.d.ts +29 -36
- package/lib/typescript/module/permissions/location.d.ts +2 -0
- package/lib/typescript/module/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/module/permissions/notifications.d.ts +2 -0
- package/lib/typescript/module/permissions/photos.d.ts +2 -0
- package/lib/typescript/module/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/module/sqlite/index.d.ts +10 -18
- package/package.json +101 -49
- package/lib/commonjs/sqlite/adapters/op.js +0 -43
- package/lib/commonjs/sqlite/adapters/rows.js +0 -33
- package/lib/commonjs/sqlite/adapters/storage.js +0 -50
- package/lib/commonjs/sqlite/adapters/sync.js +0 -45
- package/lib/commonjs/sqlite/nitro.js +0 -17
- package/lib/commonjs/sqlite/op.js +0 -18
- package/lib/commonjs/sqlite/quick.js +0 -14
- package/lib/commonjs/sqlite/storage.js +0 -14
- package/lib/module/sqlite/adapters/op.js +0 -38
- package/lib/module/sqlite/adapters/rows.js +0 -28
- package/lib/module/sqlite/adapters/storage.js +0 -46
- package/lib/module/sqlite/adapters/sync.js +0 -41
- package/lib/module/sqlite/nitro.js +0 -12
- package/lib/module/sqlite/op.js +0 -13
- package/lib/module/sqlite/quick.js +0 -9
- package/lib/module/sqlite/storage.js +0 -9
- package/lib/typescript/commonjs/sqlite/adapters/op.d.ts +0 -27
- package/lib/typescript/commonjs/sqlite/adapters/rows.d.ts +0 -7
- package/lib/typescript/commonjs/sqlite/adapters/storage.d.ts +0 -30
- package/lib/typescript/commonjs/sqlite/adapters/sync.d.ts +0 -31
- package/lib/typescript/commonjs/sqlite/nitro.d.ts +0 -7
- package/lib/typescript/commonjs/sqlite/op.d.ts +0 -8
- package/lib/typescript/commonjs/sqlite/quick.d.ts +0 -4
- package/lib/typescript/commonjs/sqlite/storage.d.ts +0 -4
- package/lib/typescript/module/sqlite/adapters/op.d.ts +0 -27
- package/lib/typescript/module/sqlite/adapters/rows.d.ts +0 -7
- package/lib/typescript/module/sqlite/adapters/storage.d.ts +0 -30
- package/lib/typescript/module/sqlite/adapters/sync.d.ts +0 -31
- package/lib/typescript/module/sqlite/nitro.d.ts +0 -7
- package/lib/typescript/module/sqlite/op.d.ts +0 -8
- package/lib/typescript/module/sqlite/quick.d.ts +0 -4
- package/lib/typescript/module/sqlite/storage.d.ts +0 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.safeExtGet = { prop, fallback ->
|
|
3
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
4
|
+
}
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
gradlePluginPortal()
|
|
8
|
+
}
|
|
9
|
+
dependencies {
|
|
10
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "2.1.20")}")
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
def isNewArchitectureEnabled() {
|
|
15
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: "com.android.library"
|
|
19
|
+
apply plugin: "kotlin-android"
|
|
20
|
+
|
|
21
|
+
if (isNewArchitectureEnabled()) {
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
android {
|
|
26
|
+
namespace "com.webority.mobilecore.smsretriever"
|
|
27
|
+
|
|
28
|
+
buildToolsVersion safeExtGet("buildToolsVersion", "36.0.0")
|
|
29
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
30
|
+
|
|
31
|
+
buildFeatures {
|
|
32
|
+
buildConfig true
|
|
33
|
+
}
|
|
34
|
+
defaultConfig {
|
|
35
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
36
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
37
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
38
|
+
}
|
|
39
|
+
lintOptions {
|
|
40
|
+
abortOnError false
|
|
41
|
+
}
|
|
42
|
+
sourceSets {
|
|
43
|
+
main {
|
|
44
|
+
if (isNewArchitectureEnabled()) {
|
|
45
|
+
java.srcDirs += ["src/newarch"]
|
|
46
|
+
} else {
|
|
47
|
+
java.srcDirs += ["src/oldarch"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
repositories {
|
|
54
|
+
maven {
|
|
55
|
+
url("$rootDir/../node_modules/react-native/android")
|
|
56
|
+
}
|
|
57
|
+
google()
|
|
58
|
+
mavenCentral()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
dependencies {
|
|
62
|
+
//noinspection GradleDynamicVersion
|
|
63
|
+
implementation "com.facebook.react:react-native:+"
|
|
64
|
+
implementation "com.google.android.gms:play-services-auth-api-phone:18.3.0"
|
|
65
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
package com.webority.mobilecore.smsretriever
|
|
2
|
+
|
|
3
|
+
import android.content.pm.PackageManager
|
|
4
|
+
import android.util.Base64
|
|
5
|
+
import android.util.Log
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import java.security.MessageDigest
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The 11-character app-signature hash the SMS Retriever API matches against
|
|
11
|
+
* an incoming message — the backend appends this same hash so Play Services
|
|
12
|
+
* knows which app to hand the SMS to, with no SMS permission granted.
|
|
13
|
+
* Algorithm is Google's own (SHA-256 of "<packageName> <signature>", first 9
|
|
14
|
+
* bytes, base64 NO_PADDING/NO_WRAP, first 11 chars) — not our own scheme.
|
|
15
|
+
*/
|
|
16
|
+
class AppSignatureHelper(private val context: ReactApplicationContext) {
|
|
17
|
+
companion object {
|
|
18
|
+
private const val HASH_TYPE = "SHA-256"
|
|
19
|
+
private const val NUM_HASHED_BYTES = 9
|
|
20
|
+
private const val NUM_BASE64_CHAR = 11
|
|
21
|
+
private const val TAG = "AppSignatureHelper"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fun getAppSignatures(): List<String> {
|
|
25
|
+
val appCodes = mutableListOf<String>()
|
|
26
|
+
try {
|
|
27
|
+
val packageName = context.packageName
|
|
28
|
+
val packageManager = context.packageManager
|
|
29
|
+
@Suppress("DEPRECATION")
|
|
30
|
+
val signatures = packageManager.getPackageInfo(
|
|
31
|
+
packageName,
|
|
32
|
+
PackageManager.GET_SIGNATURES
|
|
33
|
+
).signatures
|
|
34
|
+
|
|
35
|
+
for (signature in signatures ?: emptyArray()) {
|
|
36
|
+
hash(packageName, signature.toCharsString())?.let { appCodes.add(it) }
|
|
37
|
+
}
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
Log.e(TAG, "Error getting app signature", e)
|
|
40
|
+
}
|
|
41
|
+
return appCodes
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private fun hash(packageName: String, signature: String): String? {
|
|
45
|
+
val appInfo = "$packageName $signature"
|
|
46
|
+
return try {
|
|
47
|
+
val digest = MessageDigest.getInstance(HASH_TYPE)
|
|
48
|
+
digest.update(appInfo.toByteArray())
|
|
49
|
+
val truncated = digest.digest().copyOfRange(0, NUM_HASHED_BYTES)
|
|
50
|
+
Base64.encodeToString(truncated, Base64.NO_PADDING or Base64.NO_WRAP)
|
|
51
|
+
.substring(0, NUM_BASE64_CHAR)
|
|
52
|
+
} catch (e: Exception) {
|
|
53
|
+
Log.e(TAG, "Hash generation failed", e)
|
|
54
|
+
null
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.webority.mobilecore.smsretriever
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
|
|
6
|
+
class SmsRetrieverModule(reactContext: ReactApplicationContext) :
|
|
7
|
+
NativeSmsRetrieverSpec(reactContext) {
|
|
8
|
+
|
|
9
|
+
companion object {
|
|
10
|
+
const val NAME = "WeborityMobileCoreSmsRetriever"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private val impl = SmsRetrieverModuleImpl(reactContext)
|
|
14
|
+
|
|
15
|
+
override fun startSMSListener() = impl.startSMSListener()
|
|
16
|
+
|
|
17
|
+
override fun stopSMSListener() = impl.stopSMSListener()
|
|
18
|
+
|
|
19
|
+
override fun getAppHash(promise: Promise) = impl.getAppHash(promise)
|
|
20
|
+
}
|
package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
package com.webority.mobilecore.smsretriever
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.content.IntentFilter
|
|
7
|
+
import android.os.Build
|
|
8
|
+
import android.util.Log
|
|
9
|
+
import androidx.core.content.ContextCompat
|
|
10
|
+
import com.facebook.react.bridge.Arguments
|
|
11
|
+
import com.facebook.react.bridge.Promise
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
13
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
14
|
+
import com.google.android.gms.auth.api.phone.SmsRetriever
|
|
15
|
+
import com.google.android.gms.auth.api.phone.SmsRetrieverClient
|
|
16
|
+
import com.google.android.gms.common.api.CommonStatusCodes
|
|
17
|
+
import com.google.android.gms.common.api.Status
|
|
18
|
+
|
|
19
|
+
private enum class SmsErrorType { TIMEOUT, SERVICE_UNAVAILABLE, UNKNOWN_ERROR }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Wraps the Play Services SMS Retriever API. Emits the raw SMS text on
|
|
23
|
+
* success — OTP extraction is a JS-side concern (see smsRetriever/index.ts),
|
|
24
|
+
* since the expected format varies per backend and this module's only job
|
|
25
|
+
* is retrieving the message with no SMS permission required.
|
|
26
|
+
*/
|
|
27
|
+
class SmsRetrieverModuleImpl(private val reactContext: ReactApplicationContext) {
|
|
28
|
+
companion object {
|
|
29
|
+
const val NAME = "WeborityMobileCoreSmsRetriever"
|
|
30
|
+
private const val TAG = "SmsRetrieverModuleImpl"
|
|
31
|
+
private const val OTP_EVENT = "WeborityMobileCoreSmsRetrieved"
|
|
32
|
+
private const val ERROR_EVENT = "WeborityMobileCoreSmsRetrieverError"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private var isRegistered = false
|
|
36
|
+
private var isListening = false
|
|
37
|
+
|
|
38
|
+
private val receiver = object : BroadcastReceiver() {
|
|
39
|
+
override fun onReceive(context: Context, intent: Intent) {
|
|
40
|
+
if (SmsRetriever.SMS_RETRIEVED_ACTION != intent.action) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
val status = intent.extras?.getParcelable<Status>(SmsRetriever.EXTRA_STATUS)
|
|
44
|
+
if (status == null) {
|
|
45
|
+
emitError(SmsErrorType.UNKNOWN_ERROR, "Invalid SMS status")
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
when (status.statusCode) {
|
|
49
|
+
CommonStatusCodes.SUCCESS -> {
|
|
50
|
+
val message = intent.extras?.getString(SmsRetriever.EXTRA_SMS_MESSAGE)
|
|
51
|
+
if (message.isNullOrBlank()) {
|
|
52
|
+
emitError(SmsErrorType.UNKNOWN_ERROR, "Empty SMS message")
|
|
53
|
+
} else {
|
|
54
|
+
emitMessage(message)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
CommonStatusCodes.TIMEOUT ->
|
|
58
|
+
emitError(SmsErrorType.TIMEOUT, "SMS retrieval timeout")
|
|
59
|
+
else ->
|
|
60
|
+
emitError(SmsErrorType.SERVICE_UNAVAILABLE, "SMS Retriever status ${status.statusCode}")
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun emitMessage(message: String) {
|
|
66
|
+
isListening = false
|
|
67
|
+
val payload = Arguments.createMap().apply { putString("message", message) }
|
|
68
|
+
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
69
|
+
.emit(OTP_EVENT, payload)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private fun emitError(type: SmsErrorType, message: String) {
|
|
73
|
+
Log.w(TAG, "$type: $message")
|
|
74
|
+
isListening = false
|
|
75
|
+
val payload = Arguments.createMap().apply {
|
|
76
|
+
putString("type", type.name)
|
|
77
|
+
putString("message", message)
|
|
78
|
+
}
|
|
79
|
+
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
80
|
+
.emit(ERROR_EVENT, payload)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fun startSMSListener() {
|
|
84
|
+
if (isListening) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
val client: SmsRetrieverClient = SmsRetriever.getClient(reactContext)
|
|
89
|
+
client.startSmsRetriever()
|
|
90
|
+
.addOnSuccessListener {
|
|
91
|
+
registerReceiver()
|
|
92
|
+
isListening = true
|
|
93
|
+
}
|
|
94
|
+
.addOnFailureListener { exception ->
|
|
95
|
+
emitError(SmsErrorType.SERVICE_UNAVAILABLE, exception.message ?: "startSmsRetriever failed")
|
|
96
|
+
}
|
|
97
|
+
} catch (e: Exception) {
|
|
98
|
+
emitError(SmsErrorType.UNKNOWN_ERROR, e.message ?: "startSMSListener threw")
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private fun registerReceiver() {
|
|
103
|
+
if (isRegistered) {
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
val filter = IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION)
|
|
108
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
109
|
+
ContextCompat.registerReceiver(reactContext, receiver, filter, ContextCompat.RECEIVER_EXPORTED)
|
|
110
|
+
} else {
|
|
111
|
+
ContextCompat.registerReceiver(reactContext, receiver, filter, ContextCompat.RECEIVER_NOT_EXPORTED)
|
|
112
|
+
}
|
|
113
|
+
isRegistered = true
|
|
114
|
+
} catch (e: Exception) {
|
|
115
|
+
emitError(SmsErrorType.UNKNOWN_ERROR, e.message ?: "Failed to register SMS receiver")
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fun stopSMSListener() {
|
|
120
|
+
if (!isRegistered) {
|
|
121
|
+
isListening = false
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
reactContext.unregisterReceiver(receiver)
|
|
126
|
+
} catch (e: IllegalArgumentException) {
|
|
127
|
+
// Already unregistered — not an error, the OS may have torn it down first.
|
|
128
|
+
} finally {
|
|
129
|
+
isRegistered = false
|
|
130
|
+
isListening = false
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
fun getAppHash(promise: Promise) {
|
|
135
|
+
try {
|
|
136
|
+
val hash = AppSignatureHelper(reactContext).getAppSignatures().firstOrNull()
|
|
137
|
+
if (hash == null) {
|
|
138
|
+
promise.reject("NO_SIGNATURES", "No app signatures found")
|
|
139
|
+
} else {
|
|
140
|
+
promise.resolve(hash)
|
|
141
|
+
}
|
|
142
|
+
} catch (e: Exception) {
|
|
143
|
+
promise.reject("HASH_ERROR", "Failed to get app hash: ${e.message}")
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.webority.mobilecore.smsretriever
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
|
|
9
|
+
class SmsRetrieverPackage : TurboReactPackage() {
|
|
10
|
+
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == SmsRetrieverModule.NAME) {
|
|
13
|
+
SmsRetrieverModule(reactContext)
|
|
14
|
+
} else {
|
|
15
|
+
null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
20
|
+
return ReactModuleInfoProvider {
|
|
21
|
+
mapOf(
|
|
22
|
+
SmsRetrieverModule.NAME to
|
|
23
|
+
ReactModuleInfo(
|
|
24
|
+
SmsRetrieverModule.NAME,
|
|
25
|
+
SmsRetrieverModule.NAME,
|
|
26
|
+
false, // canOverrideExistingModule
|
|
27
|
+
false, // needsEagerInit
|
|
28
|
+
false, // isCxxModule
|
|
29
|
+
true // isTurboModule
|
|
30
|
+
))
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startOfDay = exports.isSameDay = exports.isDateBefore = exports.isDateAfter = exports.formatTimeInZone = exports.formatTimeInWindowsZone = exports.formatTime12h = exports.formatDatePattern = exports.formatDateISO = exports.formatDateDDMMMYYYY = exports.diffMs = exports.addDays = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _windowsToIanaTable = require("./windowsToIanaTable.js");
|
|
8
8
|
const toDate = value => {
|
|
9
9
|
if (value instanceof Date) {
|
|
10
10
|
return Number.isNaN(value.getTime()) ? null : value;
|
|
@@ -300,11 +300,11 @@ const formatTimeInZone = (value, ianaTimeZone) => {
|
|
|
300
300
|
*/
|
|
301
301
|
exports.formatTimeInZone = formatTimeInZone;
|
|
302
302
|
const formatTimeInWindowsZone = (value, windowsTimeZoneId) => {
|
|
303
|
-
const
|
|
304
|
-
if (!
|
|
303
|
+
const ianaTimeZone = _windowsToIanaTable.WINDOWS_TO_IANA[windowsTimeZoneId];
|
|
304
|
+
if (!ianaTimeZone) {
|
|
305
305
|
throw new Error(`Mapping for Windows time zone '${windowsTimeZoneId}' not found.`);
|
|
306
306
|
}
|
|
307
|
-
return formatTimeInZone(value,
|
|
307
|
+
return formatTimeInZone(value, ianaTimeZone);
|
|
308
308
|
};
|
|
309
309
|
exports.formatTimeInWindowsZone = formatTimeInWindowsZone;
|
|
310
310
|
//# sourceMappingURL=dateMath.js.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WINDOWS_TO_IANA = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* .NET-style Windows time zone ID → IANA time zone name, one entry per
|
|
9
|
+
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
10
|
+
* upstream source the retired `windows-iana` npm package derived its own
|
|
11
|
+
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
12
|
+
* Windows zone — `formatTimeInWindowsZone` only ever reads the first IANA
|
|
13
|
+
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
14
|
+
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
15
|
+
* this table's one caller uses.
|
|
16
|
+
*
|
|
17
|
+
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
18
|
+
* <path-to-windowsZones.xml>` (CLDR: `common/supplemental/windowsZones.xml` in
|
|
19
|
+
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone —
|
|
20
|
+
* this is a committed, static table; nothing fetches CLDR at build or test
|
|
21
|
+
* time.
|
|
22
|
+
*/
|
|
23
|
+
const WINDOWS_TO_IANA = exports.WINDOWS_TO_IANA = {
|
|
24
|
+
'AUS Central Standard Time': 'Australia/Darwin',
|
|
25
|
+
'AUS Eastern Standard Time': 'Australia/Sydney',
|
|
26
|
+
'Afghanistan Standard Time': 'Asia/Kabul',
|
|
27
|
+
'Alaskan Standard Time': 'America/Anchorage',
|
|
28
|
+
'Aleutian Standard Time': 'America/Adak',
|
|
29
|
+
'Altai Standard Time': 'Asia/Barnaul',
|
|
30
|
+
'Arab Standard Time': 'Asia/Riyadh',
|
|
31
|
+
'Arabian Standard Time': 'Asia/Dubai',
|
|
32
|
+
'Arabic Standard Time': 'Asia/Baghdad',
|
|
33
|
+
'Argentina Standard Time': 'America/Buenos_Aires',
|
|
34
|
+
'Astrakhan Standard Time': 'Europe/Astrakhan',
|
|
35
|
+
'Atlantic Standard Time': 'America/Halifax',
|
|
36
|
+
'Aus Central W. Standard Time': 'Australia/Eucla',
|
|
37
|
+
'Azerbaijan Standard Time': 'Asia/Baku',
|
|
38
|
+
'Azores Standard Time': 'Atlantic/Azores',
|
|
39
|
+
'Bahia Standard Time': 'America/Bahia',
|
|
40
|
+
'Bangladesh Standard Time': 'Asia/Dhaka',
|
|
41
|
+
'Belarus Standard Time': 'Europe/Minsk',
|
|
42
|
+
'Bougainville Standard Time': 'Pacific/Bougainville',
|
|
43
|
+
'Canada Central Standard Time': 'America/Regina',
|
|
44
|
+
'Cape Verde Standard Time': 'Atlantic/Cape_Verde',
|
|
45
|
+
'Caucasus Standard Time': 'Asia/Yerevan',
|
|
46
|
+
'Cen. Australia Standard Time': 'Australia/Adelaide',
|
|
47
|
+
'Central America Standard Time': 'America/Guatemala',
|
|
48
|
+
'Central Asia Standard Time': 'Asia/Almaty',
|
|
49
|
+
'Central Brazilian Standard Time': 'America/Cuiaba',
|
|
50
|
+
'Central Europe Standard Time': 'Europe/Budapest',
|
|
51
|
+
'Central European Standard Time': 'Europe/Warsaw',
|
|
52
|
+
'Central Pacific Standard Time': 'Pacific/Guadalcanal',
|
|
53
|
+
'Central Standard Time': 'America/Chicago',
|
|
54
|
+
'Central Standard Time (Mexico)': 'America/Mexico_City',
|
|
55
|
+
'Chatham Islands Standard Time': 'Pacific/Chatham',
|
|
56
|
+
'China Standard Time': 'Asia/Shanghai',
|
|
57
|
+
'Cuba Standard Time': 'America/Havana',
|
|
58
|
+
'Dateline Standard Time': 'Etc/GMT+12',
|
|
59
|
+
'E. Africa Standard Time': 'Africa/Nairobi',
|
|
60
|
+
'E. Australia Standard Time': 'Australia/Brisbane',
|
|
61
|
+
'E. Europe Standard Time': 'Europe/Chisinau',
|
|
62
|
+
'E. South America Standard Time': 'America/Sao_Paulo',
|
|
63
|
+
'Easter Island Standard Time': 'Pacific/Easter',
|
|
64
|
+
'Eastern Standard Time': 'America/New_York',
|
|
65
|
+
'Eastern Standard Time (Mexico)': 'America/Cancun',
|
|
66
|
+
'Egypt Standard Time': 'Africa/Cairo',
|
|
67
|
+
'Ekaterinburg Standard Time': 'Asia/Yekaterinburg',
|
|
68
|
+
'FLE Standard Time': 'Europe/Kiev',
|
|
69
|
+
'Fiji Standard Time': 'Pacific/Fiji',
|
|
70
|
+
'GMT Standard Time': 'Europe/London',
|
|
71
|
+
'GTB Standard Time': 'Europe/Bucharest',
|
|
72
|
+
'Georgian Standard Time': 'Asia/Tbilisi',
|
|
73
|
+
'Greenland Standard Time': 'America/Godthab',
|
|
74
|
+
'Greenwich Standard Time': 'Atlantic/Reykjavik',
|
|
75
|
+
'Haiti Standard Time': 'America/Port-au-Prince',
|
|
76
|
+
'Hawaiian Standard Time': 'Pacific/Honolulu',
|
|
77
|
+
'India Standard Time': 'Asia/Calcutta',
|
|
78
|
+
'Iran Standard Time': 'Asia/Tehran',
|
|
79
|
+
'Israel Standard Time': 'Asia/Jerusalem',
|
|
80
|
+
'Jordan Standard Time': 'Asia/Amman',
|
|
81
|
+
'Kaliningrad Standard Time': 'Europe/Kaliningrad',
|
|
82
|
+
'Korea Standard Time': 'Asia/Seoul',
|
|
83
|
+
'Libya Standard Time': 'Africa/Tripoli',
|
|
84
|
+
'Line Islands Standard Time': 'Pacific/Kiritimati',
|
|
85
|
+
'Lord Howe Standard Time': 'Australia/Lord_Howe',
|
|
86
|
+
'Magadan Standard Time': 'Asia/Magadan',
|
|
87
|
+
'Magallanes Standard Time': 'America/Punta_Arenas',
|
|
88
|
+
'Marquesas Standard Time': 'Pacific/Marquesas',
|
|
89
|
+
'Mauritius Standard Time': 'Indian/Mauritius',
|
|
90
|
+
'Middle East Standard Time': 'Asia/Beirut',
|
|
91
|
+
'Montevideo Standard Time': 'America/Montevideo',
|
|
92
|
+
'Morocco Standard Time': 'Africa/Casablanca',
|
|
93
|
+
'Mountain Standard Time': 'America/Denver',
|
|
94
|
+
'Mountain Standard Time (Mexico)': 'America/Chihuahua',
|
|
95
|
+
'Myanmar Standard Time': 'Asia/Rangoon',
|
|
96
|
+
'N. Central Asia Standard Time': 'Asia/Novosibirsk',
|
|
97
|
+
'Namibia Standard Time': 'Africa/Windhoek',
|
|
98
|
+
'Nepal Standard Time': 'Asia/Katmandu',
|
|
99
|
+
'New Zealand Standard Time': 'Pacific/Auckland',
|
|
100
|
+
'Newfoundland Standard Time': 'America/St_Johns',
|
|
101
|
+
'Norfolk Standard Time': 'Pacific/Norfolk',
|
|
102
|
+
'North Asia East Standard Time': 'Asia/Irkutsk',
|
|
103
|
+
'North Asia Standard Time': 'Asia/Krasnoyarsk',
|
|
104
|
+
'North Korea Standard Time': 'Asia/Pyongyang',
|
|
105
|
+
'Omsk Standard Time': 'Asia/Omsk',
|
|
106
|
+
'Pacific SA Standard Time': 'America/Santiago',
|
|
107
|
+
'Pacific Standard Time': 'America/Los_Angeles',
|
|
108
|
+
'Pacific Standard Time (Mexico)': 'America/Tijuana',
|
|
109
|
+
'Pakistan Standard Time': 'Asia/Karachi',
|
|
110
|
+
'Paraguay Standard Time': 'America/Asuncion',
|
|
111
|
+
'Qyzylorda Standard Time': 'Asia/Qyzylorda',
|
|
112
|
+
'Romance Standard Time': 'Europe/Paris',
|
|
113
|
+
'Russia Time Zone 10': 'Asia/Srednekolymsk',
|
|
114
|
+
'Russia Time Zone 11': 'Asia/Kamchatka',
|
|
115
|
+
'Russia Time Zone 3': 'Europe/Samara',
|
|
116
|
+
'Russian Standard Time': 'Europe/Moscow',
|
|
117
|
+
'SA Eastern Standard Time': 'America/Cayenne',
|
|
118
|
+
'SA Pacific Standard Time': 'America/Bogota',
|
|
119
|
+
'SA Western Standard Time': 'America/La_Paz',
|
|
120
|
+
'SE Asia Standard Time': 'Asia/Bangkok',
|
|
121
|
+
'Saint Pierre Standard Time': 'America/Miquelon',
|
|
122
|
+
'Sakhalin Standard Time': 'Asia/Sakhalin',
|
|
123
|
+
'Samoa Standard Time': 'Pacific/Apia',
|
|
124
|
+
'Sao Tome Standard Time': 'Africa/Sao_Tome',
|
|
125
|
+
'Saratov Standard Time': 'Europe/Saratov',
|
|
126
|
+
'Singapore Standard Time': 'Asia/Singapore',
|
|
127
|
+
'South Africa Standard Time': 'Africa/Johannesburg',
|
|
128
|
+
'South Sudan Standard Time': 'Africa/Juba',
|
|
129
|
+
'Sri Lanka Standard Time': 'Asia/Colombo',
|
|
130
|
+
'Sudan Standard Time': 'Africa/Khartoum',
|
|
131
|
+
'Syria Standard Time': 'Asia/Damascus',
|
|
132
|
+
'Taipei Standard Time': 'Asia/Taipei',
|
|
133
|
+
'Tasmania Standard Time': 'Australia/Hobart',
|
|
134
|
+
'Tocantins Standard Time': 'America/Araguaina',
|
|
135
|
+
'Tokyo Standard Time': 'Asia/Tokyo',
|
|
136
|
+
'Tomsk Standard Time': 'Asia/Tomsk',
|
|
137
|
+
'Tonga Standard Time': 'Pacific/Tongatapu',
|
|
138
|
+
'Transbaikal Standard Time': 'Asia/Chita',
|
|
139
|
+
'Turkey Standard Time': 'Europe/Istanbul',
|
|
140
|
+
'Turks And Caicos Standard Time': 'America/Grand_Turk',
|
|
141
|
+
'US Eastern Standard Time': 'America/Indianapolis',
|
|
142
|
+
'US Mountain Standard Time': 'America/Phoenix',
|
|
143
|
+
UTC: 'Etc/UTC',
|
|
144
|
+
'UTC+12': 'Etc/GMT-12',
|
|
145
|
+
'UTC+13': 'Etc/GMT-13',
|
|
146
|
+
'UTC-02': 'Etc/GMT+2',
|
|
147
|
+
'UTC-08': 'Etc/GMT+8',
|
|
148
|
+
'UTC-09': 'Etc/GMT+9',
|
|
149
|
+
'UTC-11': 'Etc/GMT+11',
|
|
150
|
+
'Ulaanbaatar Standard Time': 'Asia/Ulaanbaatar',
|
|
151
|
+
'Venezuela Standard Time': 'America/Caracas',
|
|
152
|
+
'Vladivostok Standard Time': 'Asia/Vladivostok',
|
|
153
|
+
'Volgograd Standard Time': 'Europe/Volgograd',
|
|
154
|
+
'W. Australia Standard Time': 'Australia/Perth',
|
|
155
|
+
'W. Central Africa Standard Time': 'Africa/Lagos',
|
|
156
|
+
'W. Europe Standard Time': 'Europe/Berlin',
|
|
157
|
+
'W. Mongolia Standard Time': 'Asia/Hovd',
|
|
158
|
+
'West Asia Standard Time': 'Asia/Tashkent',
|
|
159
|
+
'West Bank Standard Time': 'Asia/Hebron',
|
|
160
|
+
'West Pacific Standard Time': 'Pacific/Port_Moresby',
|
|
161
|
+
'Yakutsk Standard Time': 'Asia/Yakutsk',
|
|
162
|
+
'Yukon Standard Time': 'America/Whitehorse'
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=windowsToIanaTable.js.map
|
|
@@ -8,8 +8,16 @@ var ExpoLocation = _interopRequireWildcard(require("expo-location"));
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _index = require("../logger/index.js");
|
|
10
10
|
var _index2 = require("../permissions/index.js");
|
|
11
|
+
require("../permissions/location.js");
|
|
11
12
|
var _expoLocation2 = require("./adapters/expoLocation.js");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
// expo-location is a REQUIRED peer (unlike the other Expo permission
|
|
15
|
+
// packages, which are optional and registered only when an app opts in by
|
|
16
|
+
// importing their own entry point) — anything that reaches this module
|
|
17
|
+
// already forces Metro to resolve expo-location, so self-registering its
|
|
18
|
+
// permission kinds here costs nothing extra and makes Geolocation's
|
|
19
|
+
// permission gating work without a separate app-level import.
|
|
20
|
+
|
|
13
21
|
const PREFIX = '[@webority-technologies/mobile-core]';
|
|
14
22
|
class GeolocationError extends Error {
|
|
15
23
|
constructor(code, message) {
|
|
@@ -137,7 +145,7 @@ const ensureLocationPermission = async () => {
|
|
|
137
145
|
return;
|
|
138
146
|
}
|
|
139
147
|
if (status === 'unavailable') {
|
|
140
|
-
_index.Logger.warn(`${PREFIX} Location permission status is unavailable (
|
|
148
|
+
_index.Logger.warn(`${PREFIX} Location permission status is unavailable (expo-location is not installed, ` + 'or the check failed); attempting the location request anyway.');
|
|
141
149
|
return;
|
|
142
150
|
}
|
|
143
151
|
throw new GeolocationError('permission-denied', `${PREFIX} Location permission is "${status}". Grant it before requesting a position` + (status === 'blocked' ? ', or call Permissions.openSettings() to let the user fix it.' : '.'));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _index = require("./index.js");
|
|
4
|
+
/** The one place `expo-calendar` is named. Import only if you use calendar/reminders. */
|
|
5
|
+
const m = require('expo-calendar');
|
|
6
|
+
(0, _index.registerPermissionAdapter)('calendar', {
|
|
7
|
+
check: m.getCalendarPermissionsAsync,
|
|
8
|
+
request: m.requestCalendarPermissionsAsync
|
|
9
|
+
});
|
|
10
|
+
(0, _index.registerPermissionAdapter)('reminders', {
|
|
11
|
+
check: m.getRemindersPermissionsAsync,
|
|
12
|
+
request: m.requestRemindersPermissionsAsync
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _index = require("./index.js");
|
|
4
|
+
/** The one place `expo-camera` is named. Import only if you use camera/microphone. */
|
|
5
|
+
const m = require('expo-camera');
|
|
6
|
+
(0, _index.registerPermissionAdapter)('camera', {
|
|
7
|
+
check: m.getCameraPermissionsAsync,
|
|
8
|
+
request: m.requestCameraPermissionsAsync
|
|
9
|
+
});
|
|
10
|
+
(0, _index.registerPermissionAdapter)('microphone', {
|
|
11
|
+
check: m.getMicrophonePermissionsAsync,
|
|
12
|
+
request: m.requestMicrophonePermissionsAsync
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=camera.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _index = require("./index.js");
|
|
4
|
+
/** The one place `expo-contacts` is named. Import only if you use contacts. */
|
|
5
|
+
const m = require('expo-contacts');
|
|
6
|
+
(0, _index.registerPermissionAdapter)('contacts', {
|
|
7
|
+
check: m.getPermissionsAsync,
|
|
8
|
+
request: m.requestPermissionsAsync
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=contacts.js.map
|