expo-cellular 4.1.0 β 4.3.0
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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/android/build.gradle +38 -25
- package/android/src/main/java/expo/modules/cellular/CellularModule.kt +8 -8
- package/build/Cellular.d.ts +6 -5
- package/build/Cellular.d.ts.map +1 -0
- package/build/Cellular.js +5 -5
- package/build/Cellular.js.map +1 -1
- package/build/Cellular.types.d.ts +1 -0
- package/build/Cellular.types.d.ts.map +1 -0
- package/build/ExpoCellular.d.ts +1 -0
- package/build/ExpoCellular.d.ts.map +1 -0
- package/build/ExpoCellular.web.d.ts +1 -0
- package/build/ExpoCellular.web.d.ts.map +1 -0
- package/ios/CellularModule.swift +14 -16
- package/package.json +2 -2
- package/src/Cellular.ts +5 -5
- package/tsconfig.json +1 -1
- package/unimodule.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
### π‘ Others
|
|
12
12
|
|
|
13
|
+
## 4.3.0 β 2022-07-07
|
|
14
|
+
|
|
15
|
+
### π‘ Others
|
|
16
|
+
|
|
17
|
+
- Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
19
|
+
## 4.2.0 β 2022-04-18
|
|
20
|
+
|
|
21
|
+
### β οΈ Notices
|
|
22
|
+
|
|
23
|
+
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
|
|
24
|
+
|
|
25
|
+
## 4.1.1 - 2022-02-01
|
|
26
|
+
|
|
27
|
+
### π Bug fixes
|
|
28
|
+
|
|
29
|
+
- Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
|
|
30
|
+
|
|
13
31
|
## 4.1.0 β 2021-12-03
|
|
14
32
|
|
|
15
33
|
### π‘ Others
|
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ Information about the userβs cellular service provider, such as its unique ide
|
|
|
4
4
|
|
|
5
5
|
# API documentation
|
|
6
6
|
|
|
7
|
-
- [Documentation for the
|
|
8
|
-
- [Documentation for the latest stable release](https://docs.expo.
|
|
7
|
+
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/cellular.md)
|
|
8
|
+
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/cellular/)
|
|
9
9
|
|
|
10
10
|
# Installation in managed Expo projects
|
|
11
11
|
|
|
12
|
-
For
|
|
12
|
+
For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/cellular/).
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
package/android/build.gradle
CHANGED
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven'
|
|
3
|
+
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '4.
|
|
6
|
+
version = '4.3.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
|
+
if (expoModulesCorePlugin.exists()) {
|
|
11
|
+
apply from: expoModulesCorePlugin
|
|
12
|
+
applyKotlinExpoModulesCorePlugin()
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
16
|
ext.safeExtGet = { prop, fallback ->
|
|
11
17
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
// Ensures backward compatibility
|
|
21
|
+
ext.getKotlinVersion = {
|
|
22
|
+
if (ext.has("kotlinVersion")) {
|
|
23
|
+
ext.kotlinVersion()
|
|
24
|
+
} else {
|
|
25
|
+
ext.safeExtGet("kotlinVersion", "1.6.10")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
repositories {
|
|
15
30
|
mavenCentral()
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
dependencies {
|
|
19
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${
|
|
34
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
// Upload android library to maven with javadoc and android sources
|
|
24
|
-
configurations {
|
|
25
|
-
deployerJars
|
|
26
|
-
}
|
|
27
|
-
|
|
28
38
|
// Creating sources with comments
|
|
29
39
|
task androidSourcesJar(type: Jar) {
|
|
30
40
|
classifier = 'sources'
|
|
31
41
|
from android.sourceSets.main.java.srcDirs
|
|
32
42
|
}
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
afterEvaluate {
|
|
45
|
+
publishing {
|
|
46
|
+
publications {
|
|
47
|
+
release(MavenPublication) {
|
|
48
|
+
from components.release
|
|
49
|
+
// Add additional sourcesJar to artifacts
|
|
50
|
+
artifact(androidSourcesJar)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
repositories {
|
|
54
|
+
maven {
|
|
55
|
+
url = mavenLocal().url
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
android {
|
|
49
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
50
63
|
|
|
51
64
|
compileOptions {
|
|
52
|
-
sourceCompatibility JavaVersion.
|
|
53
|
-
targetCompatibility JavaVersion.
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
kotlinOptions {
|
|
57
|
-
jvmTarget = JavaVersion.
|
|
70
|
+
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
defaultConfig {
|
|
61
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
62
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
63
76
|
versionCode 11
|
|
64
|
-
versionName '4.
|
|
77
|
+
versionName '4.3.0'
|
|
65
78
|
}
|
|
66
79
|
lintOptions {
|
|
67
80
|
abortOnError false
|
|
@@ -71,5 +84,5 @@ android {
|
|
|
71
84
|
dependencies {
|
|
72
85
|
implementation project(':expo-modules-core')
|
|
73
86
|
|
|
74
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${
|
|
87
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
75
88
|
}
|
|
@@ -13,8 +13,8 @@ const val moduleName = "ExpoCellular"
|
|
|
13
13
|
|
|
14
14
|
class CellularModule : Module() {
|
|
15
15
|
override fun definition() = ModuleDefinition {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Name(moduleName)
|
|
17
|
+
Constants {
|
|
18
18
|
val telephonyManager = telephonyManager()
|
|
19
19
|
mapOf(
|
|
20
20
|
"allowsVoip" to SipManager.isVoipSupported(context),
|
|
@@ -25,7 +25,7 @@ class CellularModule : Module() {
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
AsyncFunction("getCellularGenerationAsync") {
|
|
29
29
|
try {
|
|
30
30
|
getCurrentGeneration()
|
|
31
31
|
} catch (e: SecurityException) {
|
|
@@ -34,23 +34,23 @@ class CellularModule : Module() {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
AsyncFunction("allowsVoipAsync") {
|
|
38
38
|
SipManager.isVoipSupported(context)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
AsyncFunction("getIsoCountryCodeAsync") {
|
|
42
42
|
telephonyManager()?.simCountryIso
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
AsyncFunction("getCarrierNameAsync") {
|
|
46
46
|
telephonyManager()?.simOperatorName
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
AsyncFunction("getMobileCountryCodeAsync") {
|
|
50
50
|
telephonyManager()?.simOperator?.substring(0, 3)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
AsyncFunction("getMobileNetworkCodeAsync") {
|
|
54
54
|
telephonyManager()?.simOperator?.substring(3)
|
|
55
55
|
}
|
|
56
56
|
}
|
package/build/Cellular.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { CellularGeneration };
|
|
|
15
15
|
* ```ts
|
|
16
16
|
* Cellular.allowsVoip; // true or false
|
|
17
17
|
* ```
|
|
18
|
-
* @deprecated
|
|
18
|
+
* @deprecated Use [`allowsVoipAsync()`](#allowsvoipasync) instead.
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
export declare const allowsVoip: boolean | null;
|
|
@@ -36,7 +36,7 @@ export declare const allowsVoip: boolean | null;
|
|
|
36
36
|
* ```ts
|
|
37
37
|
* Cellular.carrier; // "T-Mobile" or "Verizon"
|
|
38
38
|
* ```
|
|
39
|
-
* @deprecated
|
|
39
|
+
* @deprecated Use [`getCarrierNameAsync()`](#getcarriernameasync) instead.
|
|
40
40
|
*
|
|
41
41
|
*/
|
|
42
42
|
export declare const carrier: string | null;
|
|
@@ -53,7 +53,7 @@ export declare const carrier: string | null;
|
|
|
53
53
|
* ```ts
|
|
54
54
|
* Cellular.isoCountryCode; // "us" or "au"
|
|
55
55
|
* ```
|
|
56
|
-
* @deprecated
|
|
56
|
+
* @deprecated Use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.
|
|
57
57
|
*
|
|
58
58
|
*/
|
|
59
59
|
export declare const isoCountryCode: string | null;
|
|
@@ -71,7 +71,7 @@ export declare const isoCountryCode: string | null;
|
|
|
71
71
|
* ```ts
|
|
72
72
|
* Cellular.mobileCountryCode; // "310"
|
|
73
73
|
* ```
|
|
74
|
-
* @deprecated
|
|
74
|
+
* @deprecated Use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.
|
|
75
75
|
*
|
|
76
76
|
*/
|
|
77
77
|
export declare const mobileCountryCode: string | null;
|
|
@@ -88,7 +88,7 @@ export declare const mobileCountryCode: string | null;
|
|
|
88
88
|
* ```ts
|
|
89
89
|
* Cellular.mobileNetworkCode; // "260"
|
|
90
90
|
* ```
|
|
91
|
-
* @deprecated
|
|
91
|
+
* @deprecated Use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.
|
|
92
92
|
*
|
|
93
93
|
*/
|
|
94
94
|
export declare const mobileNetworkCode: string | null;
|
|
@@ -196,3 +196,4 @@ export declare function getMobileCountryCodeAsync(): Promise<string | null>;
|
|
|
196
196
|
* ```
|
|
197
197
|
*/
|
|
198
198
|
export declare function getMobileNetworkCodeAsync(): Promise<string | null>;
|
|
199
|
+
//# sourceMappingURL=Cellular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cellular.d.ts","sourceRoot":"","sources":["../src/Cellular.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAG9B;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,GAAG,IAAoD,CAAC;AAGxF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,GAAG,IAAiD,CAAC;AAGjF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,GAAG,IAAwD,CAAC;AAG/F;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,GAAG,IAEjC,CAAC;AAGT;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,GAAG,IAEjC,CAAC;AAGT;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAK9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAK/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKrE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxE"}
|
package/build/Cellular.js
CHANGED
|
@@ -18,7 +18,7 @@ export { CellularGeneration };
|
|
|
18
18
|
* ```ts
|
|
19
19
|
* Cellular.allowsVoip; // true or false
|
|
20
20
|
* ```
|
|
21
|
-
* @deprecated
|
|
21
|
+
* @deprecated Use [`allowsVoipAsync()`](#allowsvoipasync) instead.
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
export const allowsVoip = ExpoCellular ? ExpoCellular.allowsVoip : null;
|
|
@@ -40,7 +40,7 @@ export const allowsVoip = ExpoCellular ? ExpoCellular.allowsVoip : null;
|
|
|
40
40
|
* ```ts
|
|
41
41
|
* Cellular.carrier; // "T-Mobile" or "Verizon"
|
|
42
42
|
* ```
|
|
43
|
-
* @deprecated
|
|
43
|
+
* @deprecated Use [`getCarrierNameAsync()`](#getcarriernameasync) instead.
|
|
44
44
|
*
|
|
45
45
|
*/
|
|
46
46
|
export const carrier = ExpoCellular ? ExpoCellular.carrier : null;
|
|
@@ -58,7 +58,7 @@ export const carrier = ExpoCellular ? ExpoCellular.carrier : null;
|
|
|
58
58
|
* ```ts
|
|
59
59
|
* Cellular.isoCountryCode; // "us" or "au"
|
|
60
60
|
* ```
|
|
61
|
-
* @deprecated
|
|
61
|
+
* @deprecated Use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.
|
|
62
62
|
*
|
|
63
63
|
*/
|
|
64
64
|
export const isoCountryCode = ExpoCellular ? ExpoCellular.isoCountryCode : null;
|
|
@@ -77,7 +77,7 @@ export const isoCountryCode = ExpoCellular ? ExpoCellular.isoCountryCode : null;
|
|
|
77
77
|
* ```ts
|
|
78
78
|
* Cellular.mobileCountryCode; // "310"
|
|
79
79
|
* ```
|
|
80
|
-
* @deprecated
|
|
80
|
+
* @deprecated Use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.
|
|
81
81
|
*
|
|
82
82
|
*/
|
|
83
83
|
export const mobileCountryCode = ExpoCellular
|
|
@@ -97,7 +97,7 @@ export const mobileCountryCode = ExpoCellular
|
|
|
97
97
|
* ```ts
|
|
98
98
|
* Cellular.mobileNetworkCode; // "260"
|
|
99
99
|
* ```
|
|
100
|
-
* @deprecated
|
|
100
|
+
* @deprecated Use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.
|
|
101
101
|
*
|
|
102
102
|
*/
|
|
103
103
|
export const mobileNetworkCode = ExpoCellular
|
package/build/Cellular.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cellular.js","sourceRoot":"","sources":["../src/Cellular.ts"],"names":[],"mappings":"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","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport { CellularGeneration } from './Cellular.types';\nimport ExpoCellular from './ExpoCellular';\n\nexport { CellularGeneration };\n\n// @needsAudit\n/**\n * Indicates if the carrier allows making VoIP calls on its network. On Android, this checks whether\n * the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))\n * to view more information.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the `boolean` value indicating the carrierβs policy regarding VoIP. If you then install\n * a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.allowsVoip; // true or false\n * ```\n * @deprecated Deprecated field, use [`allowsVoipAsync()`](#allowsvoipasync) instead.\n *\n */\nexport const allowsVoip: boolean | null = ExpoCellular ? ExpoCellular.allowsVoip : null;\n\n// @needsAudit\n/**\n * The name of the userβs home cellular service provider. If the device has dual SIM cards, only the\n * carrier for the currently active SIM card will be returned. On Android, this value is only\n * available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).\n * Otherwise, this returns `null`.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the name of the carrier. If you then install a new SIM card, its carrier name replaces\n * the previous value of this property. The value for this property is `null` if the user never\n * configured a carrier for the device.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.carrier; // \"T-Mobile\" or \"Verizon\"\n * ```\n * @deprecated Deprecated field, use [`getCarrierNameAsync()`](#getcarriernameasync) instead.\n *\n */\nexport const carrier: string | null = ExpoCellular ? ExpoCellular.carrier : null;\n\n// @needsAudit\n/**\n * The ISO country code for the userβs cellular service provider. On iOS, the value is `null` if any\n * of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.isoCountryCode; // \"us\" or \"au\"\n * ```\n * @deprecated Deprecated field, use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.\n *\n */\nexport const isoCountryCode: string | null = ExpoCellular ? ExpoCellular.isoCountryCode : null;\n\n// @needsAudit\n/**\n * The mobile country code (MCC) for the userβs current registered cellular service provider.\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.mobileCountryCode; // \"310\"\n * ```\n * @deprecated Deprecated field, use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.\n *\n */\nexport const mobileCountryCode: string | null = ExpoCellular\n ? ExpoCellular.mobileCountryCode\n : null;\n\n// @needsAudit\n/**\n * The ISO country code for the userβs cellular service provider. On iOS, the value is `null` if\n * any of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.mobileNetworkCode; // \"260\"\n * ```\n * @deprecated Deprecated field, use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.\n *\n */\nexport const mobileNetworkCode: string | null = ExpoCellular\n ? ExpoCellular.mobileNetworkCode\n : null;\n\n// @needsAudit\n/**\n * @return Returns a promise which fulfils with a [`Cellular.CellularGeneration`](#cellulargeneration)\n * enum value that represents the current cellular-generation type.\n *\n * On web, this method uses [`navigator.connection.effectiveType`](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType)\n * to detect the effective type of the connection using a combination of recently observed\n * round-trip time and downlink values. See [here](https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API)\n * to view browser compatibility.\n *\n * @example\n * ```ts\n * await Cellular.getCellularGenerationAsync();\n * // CellularGeneration.CELLULAR_4G\n * ```\n */\nexport async function getCellularGenerationAsync(): Promise<CellularGeneration> {\n if (!ExpoCellular.getCellularGenerationAsync) {\n throw new UnavailabilityError('expo-cellular', 'getCellularGenerationAsync');\n }\n return await ExpoCellular.getCellularGenerationAsync();\n}\n\n/**\n * @return Returns if the carrier allows making VoIP calls on its network. On Android, this checks whether\n * the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))\n * to view more information.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the `boolean` value indicating the carrierβs policy regarding VoIP. If you then install\n * a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.allowsVoipAsync(); // true or false\n * ```\n */\nexport async function allowsVoipAsync(): Promise<boolean | null> {\n if (!ExpoCellular.allowsVoipAsync) {\n throw new UnavailabilityError('expo-cellular', 'allowsVoipAsync');\n }\n return await ExpoCellular.allowsVoipAsync();\n}\n\n/**\n * @return Returns the ISO country code for the userβs cellular service provider.\n *\n * On iOS, the value is `null` if any of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getIsoCountryCodeAsync(); // \"us\" or \"au\"\n * ```\n *\n */\nexport async function getIsoCountryCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getIsoCountryCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getIsoCountryCodeAsync');\n }\n return await ExpoCellular.getIsoCountryCodeAsync();\n}\n\n/**\n * @return Returns name of the userβs home cellular service provider. If the device has dual SIM cards, only the\n * carrier for the currently active SIM card will be returned.\n *\n * On Android, this value is only available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).\n * Otherwise, this returns `null`.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the name of the carrier. If you then install a new SIM card, its carrier name replaces\n * the previous value of this property. The value for this property is `null` if the user never\n * configured a carrier for the device.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getCarrierNameAsync(); // \"T-Mobile\" or \"Verizon\"\n * ```\n */\nexport async function getCarrierNameAsync(): Promise<string | null> {\n if (!ExpoCellular.getCarrierNameAsync) {\n throw new UnavailabilityError('expo-cellular', 'getCarrierNameAsync');\n }\n return await ExpoCellular.getCarrierNameAsync();\n}\n\n/**\n * @return Returns mobile country code (MCC) for the userβs current registered cellular service provider.\n *\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getMobileCountryCodeAsync(); // \"310\"\n * ```\n */\nexport async function getMobileCountryCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getMobileCountryCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getMobileCountryCodeAsync');\n }\n return await ExpoCellular.getMobileCountryCodeAsync();\n}\n\n/**\n * @return Returns the mobile network code (MNC) for the userβs current registered cellular service provider.\n *\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getMobileNetworkCodeAsync(); // \"310\"\n * ```\n */\nexport async function getMobileNetworkCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getMobileNetworkCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getMobileNetworkCodeAsync');\n }\n return await ExpoCellular.getMobileNetworkCodeAsync();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Cellular.js","sourceRoot":"","sources":["../src/Cellular.ts"],"names":[],"mappings":"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","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport { CellularGeneration } from './Cellular.types';\nimport ExpoCellular from './ExpoCellular';\n\nexport { CellularGeneration };\n\n// @needsAudit\n/**\n * Indicates if the carrier allows making VoIP calls on its network. On Android, this checks whether\n * the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))\n * to view more information.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the `boolean` value indicating the carrierβs policy regarding VoIP. If you then install\n * a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.allowsVoip; // true or false\n * ```\n * @deprecated Use [`allowsVoipAsync()`](#allowsvoipasync) instead.\n *\n */\nexport const allowsVoip: boolean | null = ExpoCellular ? ExpoCellular.allowsVoip : null;\n\n// @needsAudit\n/**\n * The name of the userβs home cellular service provider. If the device has dual SIM cards, only the\n * carrier for the currently active SIM card will be returned. On Android, this value is only\n * available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).\n * Otherwise, this returns `null`.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the name of the carrier. If you then install a new SIM card, its carrier name replaces\n * the previous value of this property. The value for this property is `null` if the user never\n * configured a carrier for the device.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.carrier; // \"T-Mobile\" or \"Verizon\"\n * ```\n * @deprecated Use [`getCarrierNameAsync()`](#getcarriernameasync) instead.\n *\n */\nexport const carrier: string | null = ExpoCellular ? ExpoCellular.carrier : null;\n\n// @needsAudit\n/**\n * The ISO country code for the userβs cellular service provider. On iOS, the value is `null` if any\n * of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.isoCountryCode; // \"us\" or \"au\"\n * ```\n * @deprecated Use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.\n *\n */\nexport const isoCountryCode: string | null = ExpoCellular ? ExpoCellular.isoCountryCode : null;\n\n// @needsAudit\n/**\n * The mobile country code (MCC) for the userβs current registered cellular service provider.\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.mobileCountryCode; // \"310\"\n * ```\n * @deprecated Use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.\n *\n */\nexport const mobileCountryCode: string | null = ExpoCellular\n ? ExpoCellular.mobileCountryCode\n : null;\n\n// @needsAudit\n/**\n * The ISO country code for the userβs cellular service provider. On iOS, the value is `null` if\n * any of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * Cellular.mobileNetworkCode; // \"260\"\n * ```\n * @deprecated Use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.\n *\n */\nexport const mobileNetworkCode: string | null = ExpoCellular\n ? ExpoCellular.mobileNetworkCode\n : null;\n\n// @needsAudit\n/**\n * @return Returns a promise which fulfils with a [`Cellular.CellularGeneration`](#cellulargeneration)\n * enum value that represents the current cellular-generation type.\n *\n * On web, this method uses [`navigator.connection.effectiveType`](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType)\n * to detect the effective type of the connection using a combination of recently observed\n * round-trip time and downlink values. See [here](https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API)\n * to view browser compatibility.\n *\n * @example\n * ```ts\n * await Cellular.getCellularGenerationAsync();\n * // CellularGeneration.CELLULAR_4G\n * ```\n */\nexport async function getCellularGenerationAsync(): Promise<CellularGeneration> {\n if (!ExpoCellular.getCellularGenerationAsync) {\n throw new UnavailabilityError('expo-cellular', 'getCellularGenerationAsync');\n }\n return await ExpoCellular.getCellularGenerationAsync();\n}\n\n/**\n * @return Returns if the carrier allows making VoIP calls on its network. On Android, this checks whether\n * the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))\n * to view more information.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the `boolean` value indicating the carrierβs policy regarding VoIP. If you then install\n * a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.allowsVoipAsync(); // true or false\n * ```\n */\nexport async function allowsVoipAsync(): Promise<boolean | null> {\n if (!ExpoCellular.allowsVoipAsync) {\n throw new UnavailabilityError('expo-cellular', 'allowsVoipAsync');\n }\n return await ExpoCellular.allowsVoipAsync();\n}\n\n/**\n * @return Returns the ISO country code for the userβs cellular service provider.\n *\n * On iOS, the value is `null` if any of the following apply:\n * - The device is in airplane mode.\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getIsoCountryCodeAsync(); // \"us\" or \"au\"\n * ```\n *\n */\nexport async function getIsoCountryCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getIsoCountryCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getIsoCountryCodeAsync');\n }\n return await ExpoCellular.getIsoCountryCodeAsync();\n}\n\n/**\n * @return Returns name of the userβs home cellular service provider. If the device has dual SIM cards, only the\n * carrier for the currently active SIM card will be returned.\n *\n * On Android, this value is only available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).\n * Otherwise, this returns `null`.\n *\n * On iOS, if you configure a device for a carrier and then remove the SIM card, this property\n * retains the name of the carrier. If you then install a new SIM card, its carrier name replaces\n * the previous value of this property. The value for this property is `null` if the user never\n * configured a carrier for the device.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getCarrierNameAsync(); // \"T-Mobile\" or \"Verizon\"\n * ```\n */\nexport async function getCarrierNameAsync(): Promise<string | null> {\n if (!ExpoCellular.getCarrierNameAsync) {\n throw new UnavailabilityError('expo-cellular', 'getCarrierNameAsync');\n }\n return await ExpoCellular.getCarrierNameAsync();\n}\n\n/**\n * @return Returns mobile country code (MCC) for the userβs current registered cellular service provider.\n *\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getMobileCountryCodeAsync(); // \"310\"\n * ```\n */\nexport async function getMobileCountryCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getMobileCountryCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getMobileCountryCodeAsync');\n }\n return await ExpoCellular.getMobileCountryCodeAsync();\n}\n\n/**\n * @return Returns the mobile network code (MNC) for the userβs current registered cellular service provider.\n *\n * On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this\n * returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.\n * Furthermore, the value for this property is `null` if any of the following apply:\n * - There is no SIM card in the device.\n * - The device is outside of cellular service range.\n *\n * On web, this returns `null`.\n *\n * @example\n * ```ts\n * await Cellular.getMobileNetworkCodeAsync(); // \"310\"\n * ```\n */\nexport async function getMobileNetworkCodeAsync(): Promise<string | null> {\n if (!ExpoCellular.getMobileNetworkCodeAsync) {\n throw new UnavailabilityError('expo-cellular', 'getMobileNetworkCodeAsync');\n }\n return await ExpoCellular.getMobileNetworkCodeAsync();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cellular.types.d.ts","sourceRoot":"","sources":["../src/Cellular.types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,WAAW,IAAI;CAChB"}
|
package/build/ExpoCellular.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoCellular.d.ts","sourceRoot":"","sources":["../src/ExpoCellular.ts"],"names":[],"mappings":";AACA,wBAA+C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoCellular.web.d.ts","sourceRoot":"","sources":["../src/ExpoCellular.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;;;;;;;kCAkBhB,QAAQ,kBAAkB,CAAC;uBAoBtC,QAAQ,OAAO,GAAG,IAAI,CAAC;8BAGhB,QAAQ,MAAM,GAAG,IAAI,CAAC;2BAGzB,QAAQ,MAAM,GAAG,IAAI,CAAC;iCAGhB,QAAQ,MAAM,GAAG,IAAI,CAAC;iCAGtB,QAAQ,MAAM,GAAG,IAAI,CAAC;;AAhD3D,wBAmDE"}
|
package/ios/CellularModule.swift
CHANGED
|
@@ -3,33 +3,33 @@ import ExpoModulesCore
|
|
|
3
3
|
|
|
4
4
|
public class CellularModule: Module {
|
|
5
5
|
public func definition() -> ModuleDefinition {
|
|
6
|
-
|
|
6
|
+
Name("ExpoCellular")
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Constants {
|
|
9
9
|
Self.getCurrentCellularInfo()
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
AsyncFunction("getCellularGenerationAsync") { () -> Int in
|
|
13
13
|
Self.currentCellularGeneration().rawValue
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
AsyncFunction("allowsVoipAsync") { () -> Bool? in
|
|
17
17
|
Self.currentCarrier()?.allowsVOIP
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
AsyncFunction("getIsoCountryCodeAsync") { () -> String? in
|
|
21
21
|
Self.currentCarrier()?.isoCountryCode
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
AsyncFunction("getCarrierNameAsync") { () -> String? in
|
|
25
25
|
Self.currentCarrier()?.carrierName
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
AsyncFunction("getMobileCountryCodeAsync") { () -> String? in
|
|
29
29
|
Self.currentCarrier()?.mobileCountryCode
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
AsyncFunction("getMobileNetworkCodeAsync") { () -> String? in
|
|
33
33
|
Self.currentCarrier()?.mobileNetworkCode
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -67,8 +67,8 @@ public class CellularModule: Module {
|
|
|
67
67
|
return .cellular4G
|
|
68
68
|
default:
|
|
69
69
|
if #available(iOS 14.1, *) {
|
|
70
|
-
if
|
|
71
|
-
radioAccessTechnology == CTRadioAccessTechnologyNR
|
|
70
|
+
if radioAccessTechnology == CTRadioAccessTechnologyNRNSA ||
|
|
71
|
+
radioAccessTechnology == CTRadioAccessTechnologyNR {
|
|
72
72
|
return .cellular5G
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ public class CellularModule: Module {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
static func getCurrentCellularInfo() -> [String
|
|
79
|
+
static func getCurrentCellularInfo() -> [String: Any?] {
|
|
80
80
|
let carrier = Self.currentCarrier()
|
|
81
81
|
let generation = Self.currentCellularGeneration()
|
|
82
82
|
|
|
@@ -86,7 +86,7 @@ public class CellularModule: Module {
|
|
|
86
86
|
"isoCountryCode": carrier?.isoCountryCode,
|
|
87
87
|
"mobileCountryCode": carrier?.mobileCountryCode,
|
|
88
88
|
"mobileNetworkCode": carrier?.mobileNetworkCode,
|
|
89
|
-
"generation": generation.rawValue
|
|
89
|
+
"generation": generation.rawValue
|
|
90
90
|
]
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -104,10 +104,8 @@ public class CellularModule: Module {
|
|
|
104
104
|
let netinfo = CTTelephonyNetworkInfo()
|
|
105
105
|
|
|
106
106
|
if #available(iOS 12.0, *), let providers = netinfo.serviceSubscriberCellularProviders {
|
|
107
|
-
for carrier in providers.values {
|
|
108
|
-
|
|
109
|
-
return carrier
|
|
110
|
-
}
|
|
107
|
+
for carrier in providers.values where carrier.carrierName != nil {
|
|
108
|
+
return carrier
|
|
111
109
|
}
|
|
112
110
|
return providers.values.first
|
|
113
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-cellular",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Provides information about the userβs cellular service provider",
|
|
5
5
|
"main": "build/Cellular.js",
|
|
6
6
|
"types": "build/Cellular.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"expo": "*"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e893ff2b01e108cf246cec02318c0df9d6bc603c"
|
|
40
40
|
}
|
package/src/Cellular.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { CellularGeneration };
|
|
|
21
21
|
* ```ts
|
|
22
22
|
* Cellular.allowsVoip; // true or false
|
|
23
23
|
* ```
|
|
24
|
-
* @deprecated
|
|
24
|
+
* @deprecated Use [`allowsVoipAsync()`](#allowsvoipasync) instead.
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
export const allowsVoip: boolean | null = ExpoCellular ? ExpoCellular.allowsVoip : null;
|
|
@@ -44,7 +44,7 @@ export const allowsVoip: boolean | null = ExpoCellular ? ExpoCellular.allowsVoip
|
|
|
44
44
|
* ```ts
|
|
45
45
|
* Cellular.carrier; // "T-Mobile" or "Verizon"
|
|
46
46
|
* ```
|
|
47
|
-
* @deprecated
|
|
47
|
+
* @deprecated Use [`getCarrierNameAsync()`](#getcarriernameasync) instead.
|
|
48
48
|
*
|
|
49
49
|
*/
|
|
50
50
|
export const carrier: string | null = ExpoCellular ? ExpoCellular.carrier : null;
|
|
@@ -63,7 +63,7 @@ export const carrier: string | null = ExpoCellular ? ExpoCellular.carrier : null
|
|
|
63
63
|
* ```ts
|
|
64
64
|
* Cellular.isoCountryCode; // "us" or "au"
|
|
65
65
|
* ```
|
|
66
|
-
* @deprecated
|
|
66
|
+
* @deprecated Use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.
|
|
67
67
|
*
|
|
68
68
|
*/
|
|
69
69
|
export const isoCountryCode: string | null = ExpoCellular ? ExpoCellular.isoCountryCode : null;
|
|
@@ -83,7 +83,7 @@ export const isoCountryCode: string | null = ExpoCellular ? ExpoCellular.isoCoun
|
|
|
83
83
|
* ```ts
|
|
84
84
|
* Cellular.mobileCountryCode; // "310"
|
|
85
85
|
* ```
|
|
86
|
-
* @deprecated
|
|
86
|
+
* @deprecated Use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.
|
|
87
87
|
*
|
|
88
88
|
*/
|
|
89
89
|
export const mobileCountryCode: string | null = ExpoCellular
|
|
@@ -104,7 +104,7 @@ export const mobileCountryCode: string | null = ExpoCellular
|
|
|
104
104
|
* ```ts
|
|
105
105
|
* Cellular.mobileNetworkCode; // "260"
|
|
106
106
|
* ```
|
|
107
|
-
* @deprecated
|
|
107
|
+
* @deprecated Use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.
|
|
108
108
|
*
|
|
109
109
|
*/
|
|
110
110
|
export const mobileNetworkCode: string | null = ExpoCellular
|
package/tsconfig.json
CHANGED
package/unimodule.json
DELETED