mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-26 17:52:29 +01:00
Adjusts Login and Sign up screens for the new Tor Settings
This commit is contained in:
parent
c7b7ad78b7
commit
8810cfde37
@ -295,24 +295,22 @@ fun LoginPage(
|
||||
}
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
if (PackageUtils.isOrbotInstalled(context)) {
|
||||
OrbotCheckBox(
|
||||
torSettings = torSettings.value,
|
||||
onCheckedChange = {
|
||||
torSettings.value = it
|
||||
},
|
||||
onError = {
|
||||
scope.launch {
|
||||
Toast
|
||||
.makeText(
|
||||
context,
|
||||
it,
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
TorSettingsSetup(
|
||||
torSettings = torSettings.value,
|
||||
onCheckedChange = {
|
||||
torSettings.value = it
|
||||
},
|
||||
onError = {
|
||||
scope.launch {
|
||||
Toast
|
||||
.makeText(
|
||||
context,
|
||||
it,
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if (isNFCOrQR.value) {
|
||||
OfferTemporaryAccount(
|
||||
|
@ -60,7 +60,6 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.commons.hashtags.Amethyst
|
||||
import com.vitorpamplona.amethyst.commons.hashtags.CustomHashTagIcons
|
||||
import com.vitorpamplona.amethyst.service.PackageUtils
|
||||
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
||||
import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size10dp
|
||||
@ -181,24 +180,22 @@ fun SignUpPage(
|
||||
)
|
||||
}
|
||||
|
||||
if (PackageUtils.isOrbotInstalled(context)) {
|
||||
OrbotCheckBox(
|
||||
torSettings = torSettings.value,
|
||||
onCheckedChange = {
|
||||
torSettings.value = it
|
||||
},
|
||||
onError = {
|
||||
scope.launch {
|
||||
Toast
|
||||
.makeText(
|
||||
context,
|
||||
it,
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
TorSettingsSetup(
|
||||
torSettings = torSettings.value,
|
||||
onCheckedChange = {
|
||||
torSettings.value = it
|
||||
},
|
||||
onError = {
|
||||
scope.launch {
|
||||
Toast
|
||||
.makeText(
|
||||
context,
|
||||
it,
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(Size10dp))
|
||||
|
||||
|
@ -20,23 +20,27 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedOff
|
||||
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import com.vitorpamplona.amethyst.ui.components.ClickableText
|
||||
import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.tor.ConnectTorDialog
|
||||
import com.vitorpamplona.amethyst.ui.tor.TorSettings
|
||||
import com.vitorpamplona.amethyst.ui.tor.TorType
|
||||
|
||||
@Composable
|
||||
fun OrbotCheckBox(
|
||||
fun TorSettingsSetup(
|
||||
torSettings: TorSettings,
|
||||
onCheckedChange: (TorSettings) -> Unit,
|
||||
onError: (String) -> Unit,
|
||||
@ -44,17 +48,19 @@ fun OrbotCheckBox(
|
||||
var connectOrbotDialogOpen by remember { mutableStateOf(false) }
|
||||
var activeTor by remember { mutableStateOf(false) }
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(
|
||||
checked = activeTor,
|
||||
onCheckedChange = {
|
||||
if (it) {
|
||||
connectOrbotDialogOpen = true
|
||||
}
|
||||
},
|
||||
)
|
||||
val text =
|
||||
buildAnnotatedString {
|
||||
append(stringRes(R.string.connect_via_tor1) + " ")
|
||||
withStyle(SpanStyle(color = MaterialTheme.colorScheme.primary)) {
|
||||
append(stringRes(R.string.connect_via_tor2))
|
||||
}
|
||||
}
|
||||
|
||||
Text(stringRes(R.string.connect_via_tor))
|
||||
ClickableText(
|
||||
text = text,
|
||||
modifier = Modifier.padding(vertical = 10.dp),
|
||||
) {
|
||||
connectOrbotDialogOpen = true
|
||||
}
|
||||
|
||||
if (connectOrbotDialogOpen) {
|
@ -404,6 +404,9 @@
|
||||
<string name="connect_via_tor_short">Tor/Orbot setup</string>
|
||||
<string name="connect_via_tor">Connect through your Orbot setup</string>
|
||||
|
||||
<string name="connect_via_tor1">Adjust</string>
|
||||
<string name="connect_via_tor2">Tor Settings</string>
|
||||
|
||||
<string name="do_you_really_want_to_disable_tor_title">Disconnect from your Orbot/Tor?</string>
|
||||
<string name="do_you_really_want_to_disable_tor_text">Your data will be immediately transferred in the regular network</string>
|
||||
<string name="yes">Yes</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user