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

View File

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

View File

@ -81,11 +81,12 @@ struct CreateSimpleXAddress: View {
DispatchQueue.main.async { DispatchQueue.main.async {
m.userAddress = UserContactLink(connReqContact: connReqContact) m.userAddress = UserContactLink(connReqContact: connReqContact)
} }
if let u = try await apiSetProfileAddress(on: true) { // TODO uncomment in v5.2
DispatchQueue.main.async { // if let u = try await apiSetProfileAddress(on: true) {
m.updateUser(u) // DispatchQueue.main.async {
} // m.updateUser(u)
} // }
// }
await MainActor.run { progressIndicator = false } await MainActor.run { progressIndicator = false }
} catch let error { } catch let error {
logger.error("CreateSimpleXAddress create address: \(responseError(error))") logger.error("CreateSimpleXAddress create address: \(responseError(error))")
@ -100,9 +101,9 @@ struct CreateSimpleXAddress: View {
} label: { } label: {
Text("Create SimpleX address").font(.title) Text("Create SimpleX address").font(.title)
} }
Group { Text("Your contacts in SimpleX will see it.\nYou can change it in Settings.")
Text("Your contacts in SimpleX will see it.\nYou can change it in Settings.") // TODO remove in in v5.2
} .foregroundColor(.clear)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.footnote) .font(.footnote)
.padding(.horizontal, 32) .padding(.horizontal, 32)

View File

@ -195,7 +195,8 @@ struct UserAddressView: View {
if MFMailComposeViewController.canSendMail() { if MFMailComposeViewController.canSendMail() {
shareViaEmailButton(userAddress) shareViaEmailButton(userAddress)
} }
shareWithContactsButton() // TODO uncomment in 5.2
// shareWithContactsButton()
autoAcceptToggle() autoAcceptToggle()
learnMoreButton() learnMoreButton()
} header: { } header: {
@ -222,7 +223,8 @@ struct UserAddressView: View {
let connReqContact = try await apiCreateUserAddress() let connReqContact = try await apiCreateUserAddress()
DispatchQueue.main.async { DispatchQueue.main.async {
chatModel.userAddress = UserContactLink(connReqContact: connReqContact) chatModel.userAddress = UserContactLink(connReqContact: connReqContact)
alert = .shareOnCreate // TODO uncomment in 5.2
// alert = .shareOnCreate
progressIndicator = false progressIndicator = false
} }
} catch let error { } catch let error {

View File

@ -201,7 +201,7 @@ myAddressHelpInfo =
styleMarkdown styleMarkdown
[ green "Your contact address commands:", [ green "Your contact address commands:",
indent <> highlight "/address " <> " - create your address", indent <> highlight "/address " <> " - create your address",
indent <> highlight "/profile_address on/off " <> " - share address with your contacts (it will be added to your profile)", -- indent <> highlight "/profile_address on/off " <> " - share address with your contacts (it will be added to your profile)",
indent <> highlight "/delete_address " <> " - delete your address (accepted contacts will remain connected)", indent <> highlight "/delete_address " <> " - delete your address (accepted contacts will remain connected)",
indent <> highlight "/show_address " <> " - show your address", indent <> highlight "/show_address " <> " - show your address",
indent <> highlight "/accept <name> " <> " - accept contact request", indent <> highlight "/accept <name> " <> " - accept contact request",

View File

@ -633,7 +633,7 @@ connReqContact_ intro cReq =
"", "",
"Anybody can send you contact requests with: " <> highlight' "/c <contact_link_above>", "Anybody can send you contact requests with: " <> highlight' "/c <contact_link_above>",
"to show it again: " <> highlight' "/sa", "to show it again: " <> highlight' "/sa",
"to share with your contacts: " <> highlight' "/profile_address on", -- "to share with your contacts: " <> highlight' "/profile_address on",
"to delete it: " <> highlight' "/da" <> " (accepted contacts will remain connected)" "to delete it: " <> highlight' "/da" <> " (accepted contacts will remain connected)"
] ]

View File

@ -355,7 +355,7 @@ getContactLink cc created = do
cc <## "" cc <## ""
cc <## "Anybody can send you contact requests with: /c <contact_link_above>" cc <## "Anybody can send you contact requests with: /c <contact_link_above>"
cc <## "to show it again: /sa" cc <## "to show it again: /sa"
cc <## "to share with your contacts: /profile_address on" -- cc <## "to share with your contacts: /profile_address on"
cc <## "to delete it: /da (accepted contacts will remain connected)" cc <## "to delete it: /da (accepted contacts will remain connected)"
pure link pure link