-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from talsec/release-3.9.0
Release 3.9.0
- Loading branch information
Showing
51 changed files
with
1,225 additions
and
6,973 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.freeraspreactnative | ||
|
||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.bridge.ReadableMap | ||
import com.freeraspreactnative.exceptions.TalsecException | ||
|
||
internal fun ReadableMap.getMapThrowing(key: String): ReadableMap { | ||
return this.getMap(key) ?: throw TalsecException("Key missing in configuration: $key") | ||
} | ||
|
||
internal fun ReadableMap.getStringThrowing(key: String): String { | ||
return this.getString(key) ?: throw TalsecException("Key missing in configuration: $key") | ||
} | ||
|
||
internal fun ReadableMap.getBooleanSafe(key: String, defaultValue: Boolean = true): Boolean { | ||
if (this.hasKey(key)) { | ||
return this.getBoolean(key) | ||
} | ||
return defaultValue | ||
} | ||
|
||
internal fun ReadableArray.toArray(): Array<String> { | ||
val output = mutableListOf<String>() | ||
for (i in 0 until this.size()) { | ||
// in RN versions < 0.63, getString is nullable | ||
@Suppress("UNNECESSARY_SAFE_CALL") | ||
this.getString(i)?.let { | ||
output.add(it) | ||
} | ||
} | ||
return output.toTypedArray() | ||
} | ||
|
||
internal fun ReadableMap.getArraySafe(key: String): Array<String> { | ||
if (this.hasKey(key)) { | ||
val inputArray = this.getArray(key)!! | ||
return inputArray.toArray() | ||
} | ||
return arrayOf() | ||
} |
3 changes: 3 additions & 0 deletions
3
android/src/main/java/com/freeraspreactnative/exceptions/TalsecException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.freeraspreactnative.exceptions | ||
|
||
class TalsecException(message: String, val code: String? = null, val ex: Exception? = null) : Exception(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1
Binary file not shown.
Oops, something went wrong.