Skip to content

Commit 36972db

Browse files
committed
v1.0.5
1 parent b629e48 commit 36972db

File tree

8 files changed

+34
-19
lines changed

8 files changed

+34
-19
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v1.0.5
4+
5+
### Changed
6+
7+
- Updated minimum supported SDK version to `minSdkVersion` 23 to meet the requirements of `react-native` version 0.73.0.
8+
- Updated the country code retrieval function to prioritize the **system language** instead of the app language on Android.
9+
310
## v1.0.4
411

512
### Changed

android/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.3'
9+
classpath 'com.android.tools.build:gradle:7.4.0'
1010
}
1111
}
1212
}
@@ -18,11 +18,11 @@ def safeExtGet(prop, fallback) {
1818
}
1919

2020
android {
21-
compileSdkVersion safeExtGet('DeviceCountry_compileSdkVersion', 31)
21+
compileSdkVersion safeExtGet('DeviceCountry_compileSdkVersion', 33)
2222
buildToolsVersion safeExtGet('DeviceCountry_buildToolsVersion', '29.0.2')
2323
defaultConfig {
24-
minSdkVersion safeExtGet('DeviceCountry_minSdkVersion', 16)
25-
targetSdkVersion safeExtGet('DeviceCountry_targetSdkVersion', 31)
24+
minSdkVersion safeExtGet('DeviceCountry_minSdkVersion', 23)
25+
targetSdkVersion safeExtGet('DeviceCountry_targetSdkVersion', 33)
2626
versionCode 1
2727
versionName "1.0"
2828

@@ -49,6 +49,7 @@ repositories {
4949
url("$rootDir/../node_modules/react-native/android")
5050
}
5151
google()
52+
mavenCentral()
5253
jcenter()
5354
}
5455

android/src/main/java/com/reactnativedevicecountry/DeviceCountryModule.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import android.content.Context;
44
import android.telephony.TelephonyManager;
55
import androidx.annotation.NonNull;
6+
import android.content.res.Resources;
7+
import android.os.Build;
8+
import java.util.Locale;
69
import com.facebook.react.bridge.Promise;
710
import com.facebook.react.bridge.ReactApplicationContext;
811
import com.facebook.react.bridge.ReactContextBaseJavaModule;
@@ -85,15 +88,19 @@ protected String getCountryCodeFromTelephonyManager() {
8588
}
8689
}
8790

88-
protected String getCountryCodeFromConfiguration() {
91+
protected String getCountryCodeFromConfiguration() {
8992
try {
90-
String countryCode = reactContext
91-
.getResources()
92-
.getConfiguration()
93-
.locale.getCountry();
94-
return countryCode;
93+
Locale systemLocale;
94+
95+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
96+
systemLocale = Resources.getSystem().getConfiguration().getLocales().get(0);
97+
} else {
98+
systemLocale = Resources.getSystem().getConfiguration().locale;
99+
}
100+
101+
return systemLocale.getCountry();
95102
} catch (Exception e) {
96-
return null;
103+
return null;
97104
}
98-
}
105+
}
99106
}

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ dependencies {
210210
// Run this once to be able to run the application with BUCK
211211
// puts all compile dependencies into folder libs for BUCK to use
212212
task copyDownloadableDepsToLibs(type: Copy) {
213-
from configurations.compile
213+
from configurations.implementation
214214
into 'libs'
215215
}
216216

example/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
buildscript {
44
ext {
55
buildToolsVersion = "29.0.2"
6-
minSdkVersion = 16
7-
compileSdkVersion = 29
6+
minSdkVersion = 23
7+
compileSdkVersion = 33
88
targetSdkVersion = 29
99
}
1010
repositories {
1111
google()
1212
jcenter()
1313
}
1414
dependencies {
15-
classpath("com.android.tools.build:gradle:3.5.3")
15+
classpath("com.android.tools.build:gradle:7.4.0")
1616

1717
// NOTE: Do not place your application dependencies here; they belong
1818
// in the individual module build.gradle files

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
android.useAndroidX=true
2121
android.enableJetifier=true
22-
FLIPPER_VERSION=0.54.0
22+
FLIPPER_VERSION=0.125.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-device-country",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Get device location by telephony (SIM card) or settings without using GPS tracker.",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)