fix: android 14 tunnel import

closes #376
This commit is contained in:
Zane Schepke 2024-10-13 16:33:12 -04:00
parent fea31437cd
commit e11f0f794a
4 changed files with 6 additions and 3 deletions

View File

@ -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. */

View File

@ -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,

View File

@ -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(

View File

@ -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"