0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-20 12:02:17 +02:00

Remove unnecessary safe call operators

This commit is contained in:
Markus Fisch 2021-08-31 20:08:14 +02:00
parent f0d0ee04af
commit 9baf6d621a
2 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ object VCardAction : IntentAction() {
return VTypeParser.parseVType(String(data)) == "VCARD"
}
override suspend fun createIntent(context: Context, data: ByteArray): Intent? {
override suspend fun createIntent(context: Context, data: ByteArray): Intent {
val info = VTypeParser.parseMap(String(data))
return Intent(Intent.ACTION_INSERT_OR_EDIT).apply {

View File

@ -167,17 +167,17 @@ object WifiConnector {
@RequiresApi(Build.VERSION_CODES.Q)
private fun WifiNetworkSuggestion.Builder.apply(
data: SimpleDataAccessor
): WifiNetworkSuggestion.Builder? {
): WifiNetworkSuggestion.Builder {
fun WifiNetworkSuggestion.Builder.applyCommon(
data: SimpleDataAccessor
): WifiNetworkSuggestion.Builder? {
): WifiNetworkSuggestion.Builder {
setSsid(data.ssid)
return this
}
fun WifiNetworkSuggestion.Builder.applySecurity(
data: SimpleDataAccessor
): WifiNetworkSuggestion.Builder? {
): WifiNetworkSuggestion.Builder {
when (data.securityType) {
"WPA", "WPA2" -> {
data.password?.let {
@ -215,7 +215,7 @@ object WifiConnector {
return this
}
return this.applyCommon(data)?.applySecurity(data)
return this.applyCommon(data).applySecurity(data)
}
// WifiConfiguration is deprecated in Android Q.
@ -228,7 +228,7 @@ object WifiConnector {
fun WifiConfiguration.applyCommon(
data: SimpleDataAccessor
): WifiConfiguration? {
): WifiConfiguration {
allowedAuthAlgorithms.clear()
allowedGroupCiphers.clear()
allowedKeyManagement.clear()
@ -298,7 +298,7 @@ object WifiConnector {
return this
}
return this.applyCommon(data)?.applySecurity(data)
return this.applyCommon(data).applySecurity(data)
}
private inline fun <T> requireSdk(version: Int, block: () -> T): T? {