diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/common/functions/Functions.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/common/functions/Functions.kt index 59d8986..726f8bf 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/common/functions/Functions.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/common/functions/Functions.kt @@ -16,7 +16,9 @@ fun rememberFileImportLauncherForResult(onNoFileExplorer: () -> Unit, onData: (d return rememberLauncherForActivityResult( object : ActivityResultContracts.GetContent() { override fun createIntent(context: Context, input: String): Intent { - val intent = super.createIntent(context, input) + val intent = super.createIntent(context, input).apply { + type = Constants.ALLOWED_FILE_TYPES + } /* AndroidTV now comes with stubs that do nothing but display a Toast less helpful than * what we can do, so detect this and throw an exception that we can catch later. */ diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt index c267f31..3d4ee3d 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/MainScreen.kt @@ -166,7 +166,7 @@ fun MainScreen(viewModel: MainViewModel = hiltViewModel(), uiState: AppUiState, }, floatingActionButtonPosition = FabPosition.End, floatingActionButton = { - ScrollDismissFab(icon = { + ScrollDismissFab({ val icon = Icons.Filled.Add Icon( imageVector = icon, diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/components/TunnelStatisticsRow.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/components/TunnelStatisticsRow.kt index e342825..18ecba3 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/components/TunnelStatisticsRow.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/main/components/TunnelStatisticsRow.kt @@ -37,6 +37,7 @@ fun TunnelStatisticsRow(statistics: TunnelStatistics?, tunnelConfig: TunnelConfi val peerTxMB = NumberUtils.bytesToMB(peerTx).toThreeDecimalPlaceString() val peerRxMB = NumberUtils.bytesToMB(peerRx).toThreeDecimalPlaceString() val handshake = statistics?.peerStats(it.publicKey)?.latestHandshakeEpochMillis?.let { + if(it == 0L) stringResource(R.string.never) else "${NumberUtils.getSecondsBetweenTimestampAndNow(it)} ${stringResource(R.string.sec)}" } ?: stringResource(R.string.never) Column( diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/Constants.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/Constants.kt index 2d4732c..640dcd8 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/Constants.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/util/Constants.kt @@ -11,9 +11,9 @@ object Constants { const val CONF_FILE_EXTENSION = ".conf" const val ZIP_FILE_EXTENSION = ".zip" const val URI_CONTENT_SCHEME = "content" - const val ALLOWED_FILE_TYPES = "*/*" const val TEXT_MIME_TYPE = "text/plain" const val ZIP_FILE_MIME_TYPE = "application/zip" + const val ALLOWED_FILE_TYPES = "${TEXT_MIME_TYPE}|${ZIP_FILE_MIME_TYPE}" const val GOOGLE_TV_EXPLORER_STUB = "com.google.android.tv.frameworkpackagestubs" const val ANDROID_TV_EXPLORER_STUB = "com.android.tv.frameworkpackagestubs" const val VPN_SETTINGS_PACKAGE = "android.net.vpn.SETTINGS"