Skip to content

Commit f4758f4

Browse files
committed
feat(Android): fix compatibility issues with RN < 0.63
1 parent 0b0fdba commit f4758f4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,22 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
9191
val certificateHashes = mutableListOf<String>()
9292
val hashes = androidConfig.getArray("certificateHashes")!!
9393
for (i in 0 until hashes.size()) {
94-
certificateHashes.add(hashes.getString(i))
94+
// in RN versions < 0.63, getString is nullable
95+
@Suppress("UNNECESSARY_SAFE_CALL")
96+
hashes.getString(i)?.let {
97+
certificateHashes.add(it)
98+
}
9599
}
96100
val watcherMail = config.getString("watcherMail")
97101
val alternativeStores = mutableListOf<String>()
98102
if (androidConfig.hasKey("supportedAlternativeStores")) {
99103
val stores = androidConfig.getArray("supportedAlternativeStores")!!
100104
for (i in 0 until stores.size()) {
101-
alternativeStores.add(stores.getString(i))
105+
// in RN versions < 0.63, getString is nullable
106+
@Suppress("UNNECESSARY_SAFE_CALL")
107+
stores.getString(i)?.let {
108+
alternativeStores.add(it)
109+
}
102110
}
103111
}
104112
var isProd = true

0 commit comments

Comments
 (0)