From 063e50b5625f1e45d5b662de0313766d228dc38e Mon Sep 17 00:00:00 2001 From: Gregorio Date: Thu, 25 Jul 2024 18:54:04 -0300 Subject: [PATCH] Add class to manage connection state --- .../java/com/spruceid/wallet/sdk/Utils.kt | 21 ------------------- example/src/main/AndroidManifest.xml | 2 ++ 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/WalletSdk/src/main/java/com/spruceid/wallet/sdk/Utils.kt b/WalletSdk/src/main/java/com/spruceid/wallet/sdk/Utils.kt index 19ac212..6f1ca93 100644 --- a/WalletSdk/src/main/java/com/spruceid/wallet/sdk/Utils.kt +++ b/WalletSdk/src/main/java/com/spruceid/wallet/sdk/Utils.kt @@ -1,9 +1,5 @@ package com.spruceid.wallet.sdk -import android.content.Context -import android.net.ConnectivityManager -import android.net.NetworkCapabilities - fun hexToByteArray(value: String): ByteArray { val stripped = value.substring(2) @@ -32,20 +28,3 @@ enum class PresentmentState { /// App should display a success message and offer to close the page SUCCESS, } - -fun isOnline(context: Context): Boolean { - val connectivityManager = - context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - val capabilities = - connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork) - if (capabilities != null) { - if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { - return true - } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { - return true - } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) { - return true - } - } - return false -} diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml index f70e08b..1364f7c 100644 --- a/example/src/main/AndroidManifest.xml +++ b/example/src/main/AndroidManifest.xml @@ -15,6 +15,8 @@ + +