check if orbot is installed
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<queries>
|
||||
<package android:name="org.torproject.android"/>
|
||||
</queries>
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
@@ -277,10 +277,10 @@ fun ListContent(
|
||||
onClick = { backupDialogOpen = true }
|
||||
)
|
||||
|
||||
var textTorProxy = if (checked) stringResource(R.string.disable) else stringResource(R.string.enable)
|
||||
val textTorProxy = if (checked) stringResource(R.string.disconnect_from_your_orbot_setup) else stringResource(R.string.connect_via_tor)
|
||||
|
||||
IconRow(
|
||||
title = "$textTorProxy Tor",
|
||||
title = textTorProxy,
|
||||
icon = R.drawable.ic_tor,
|
||||
tint = MaterialTheme.colors.onBackground,
|
||||
onClick = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedOff
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -222,13 +223,15 @@ fun LoginPage(
|
||||
}
|
||||
}
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(
|
||||
checked = useProxy.value,
|
||||
onCheckedChange = { useProxy.value = it }
|
||||
)
|
||||
if (isPackageInstalled(context, "org.torproject.android")) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(
|
||||
checked = useProxy.value,
|
||||
onCheckedChange = { useProxy.value = it }
|
||||
)
|
||||
|
||||
Text(stringResource(R.string.connect_via_tor))
|
||||
Text(stringResource(R.string.connect_via_tor))
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
@@ -290,3 +293,7 @@ fun LoginPage(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun isPackageInstalled(context: Context, target: String): Boolean {
|
||||
return context.packageManager.getInstalledApplications(0).find { info -> info.packageName == target } != null
|
||||
}
|
||||
|
||||
@@ -292,10 +292,9 @@
|
||||
<string name="lightning_create_and_add_invoice">Create and Add</string>
|
||||
<string name="poll_author_no_vote">Poll authors can\'t vote in their own polls.</string>
|
||||
<string name="poll_hashtag" translatable="false">#zappoll</string>
|
||||
<string name="connect_via_tor">Connect via Tor</string>
|
||||
<string name="do_you_really_want_to_disable_tor">Do you really want to disable tor?</string>
|
||||
<string name="disable">Disable</string>
|
||||
<string name="enable">Enable</string>
|
||||
<string name="connect_via_tor">Connect through your Orbot setup</string>
|
||||
<string name="do_you_really_want_to_disable_tor">Do you really want to disconnect from your Orbot setup?</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
<string name="disconnect_from_your_orbot_setup">Disconnect from your Orbot setup</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user