From 7b48dd30e494a579b5d50715d5d9151517922e33 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 15 Mar 2019 23:31:47 +0800 Subject: [PATCH] Fix a build version --- mobile/src/main/java/be/mygod/vpnhotspot/util/Utils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/util/Utils.kt b/mobile/src/main/java/be/mygod/vpnhotspot/util/Utils.kt index 8b01a303..b3365485 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/util/Utils.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/util/Utils.kt @@ -91,7 +91,7 @@ fun Context.stopAndUnbind(connection: ServiceConnection) { unbindService(connection) } -fun MutableMap.computeIfAbsentCompat(key: K, value: () -> V) = if (Build.VERSION.SDK_INT >= 26) +fun MutableMap.computeIfAbsentCompat(key: K, value: () -> V) = if (Build.VERSION.SDK_INT >= 24) computeIfAbsent(key) { value() } else this[key] ?: value().also { put(key, it) } fun MutableMap.putIfAbsentCompat(key: K, value: V) = if (Build.VERSION.SDK_INT >= 24) putIfAbsent(key, value) else this[key] ?: put(key, value)