mobile: hide share address until v5.2 (#2468)

* mobile: hide share address until v5.2

* terminal: hide /profile_address from help
This commit is contained in:
Evgeny Poberezkin
2023-05-20 21:41:07 +02:00
committed by GitHub
parent d40db1ddea
commit 353927e6d2
7 changed files with 43 additions and 33 deletions

View File

@@ -9,6 +9,7 @@ import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
@@ -44,14 +45,15 @@ fun CreateSimpleXAddress(m: ChatModel) {
val connReqContact = m.controller.apiCreateUserAddress()
if (connReqContact != null) {
m.userAddress.value = UserContactLinkRec(connReqContact)
try {
val u = m.controller.apiSetProfileAddress(true)
if (u != null) {
m.updateUser(u)
}
} catch (e: Exception) {
Log.e(TAG, "CreateSimpleXAddress apiSetProfileAddress: ${e.stackTraceToString()}")
}
// TODO uncomment in v5.2
// try {
// val u = m.controller.apiSetProfileAddress(true)
// if (u != null) {
// m.updateUser(u)
// }
// } catch (e: Exception) {
// Log.e(TAG, "CreateSimpleXAddress apiSetProfileAddress: ${e.stackTraceToString()}")
// }
progressIndicator = false
}
}
@@ -92,7 +94,8 @@ private fun CreateSimpleXAddressLayout(
ContinueButton(nextStep)
} else {
CreateAddressButton(createAddress)
TextBelowButton(stringResource(R.string.your_contacts_will_see_it))
// TODO remove color in v5.2
TextBelowButton(stringResource(R.string.your_contacts_will_see_it), color = Color.Transparent)
Spacer(Modifier.weight(1f))
SkipButton(nextStep)
}
@@ -141,7 +144,8 @@ private fun SkipButton(onClick: () -> Unit) {
}
@Composable
private fun TextBelowButton(text: String) {
private fun TextBelowButton(text: String, color: Color = Color.Unspecified) {
// TODO remove color in v5.2
Text(
text,
Modifier
@@ -149,6 +153,7 @@ private fun TextBelowButton(text: String) {
.padding(horizontal = DEFAULT_PADDING * 3),
style = MaterialTheme.typography.subtitle1,
textAlign = TextAlign.Center,
color = color
)
}

View File

@@ -69,15 +69,16 @@ fun UserAddressView(
if (connReqContact != null) {
chatModel.userAddress.value = UserContactLinkRec(connReqContact)
AlertManager.shared.showAlertDialog(
title = generalGetString(R.string.share_address_with_contacts_question),
text = generalGetString(R.string.add_address_to_your_profile),
confirmText = generalGetString(R.string.share_verb),
onConfirm = {
setProfileAddress(true)
shareViaProfile.value = true
}
)
// TODO uncomment in v5.2
// AlertManager.shared.showAlertDialog(
// title = generalGetString(R.string.share_address_with_contacts_question),
// text = generalGetString(R.string.add_address_to_your_profile),
// confirmText = generalGetString(R.string.share_verb),
// onConfirm = {
// setProfileAddress(true)
// shareViaProfile.value = true
// }
// )
}
progressIndicator = false
}
@@ -203,7 +204,8 @@ private fun UserAddressLayout(
QRCode(userAddress.connReqContact, Modifier.padding(horizontal = DEFAULT_PADDING, vertical = DEFAULT_PADDING_HALF).aspectRatio(1f))
ShareAddressButton { share(userAddress.connReqContact) }
ShareViaEmailButton { sendEmail(userAddress) }
ShareWithContactsButton(shareViaProfile, setProfileAddress)
// TODO uncomment in v5.2
// ShareWithContactsButton(shareViaProfile, setProfileAddress)
AutoAcceptToggle(autoAcceptState) { saveAas(autoAcceptState.value, autoAcceptStateSaved) }
LearnMoreButton(learnMore)
}