parent
f592a26b00
commit
15b00f6110
@ -9,7 +9,6 @@ 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
|
||||
@ -45,15 +44,14 @@ fun CreateSimpleXAddress(m: ChatModel) {
|
||||
val connReqContact = m.controller.apiCreateUserAddress()
|
||||
if (connReqContact != null) {
|
||||
m.userAddress.value = UserContactLinkRec(connReqContact)
|
||||
// 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()}")
|
||||
// }
|
||||
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
|
||||
}
|
||||
}
|
||||
@ -94,8 +92,7 @@ private fun CreateSimpleXAddressLayout(
|
||||
ContinueButton(nextStep)
|
||||
} else {
|
||||
CreateAddressButton(createAddress)
|
||||
// TODO remove color in v5.2
|
||||
TextBelowButton(stringResource(R.string.your_contacts_will_see_it), color = Color.Transparent)
|
||||
TextBelowButton(stringResource(R.string.your_contacts_will_see_it))
|
||||
Spacer(Modifier.weight(1f))
|
||||
SkipButton(nextStep)
|
||||
}
|
||||
@ -144,8 +141,7 @@ private fun SkipButton(onClick: () -> Unit) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TextBelowButton(text: String, color: Color = Color.Unspecified) {
|
||||
// TODO remove color in v5.2
|
||||
private fun TextBelowButton(text: String) {
|
||||
Text(
|
||||
text,
|
||||
Modifier
|
||||
@ -153,7 +149,6 @@ private fun TextBelowButton(text: String, color: Color = Color.Unspecified) {
|
||||
.padding(horizontal = DEFAULT_PADDING * 3),
|
||||
style = MaterialTheme.typography.subtitle1,
|
||||
textAlign = TextAlign.Center,
|
||||
color = color
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -69,16 +69,15 @@ fun UserAddressView(
|
||||
if (connReqContact != null) {
|
||||
chatModel.userAddress.value = UserContactLinkRec(connReqContact)
|
||||
|
||||
// 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
|
||||
// }
|
||||
// )
|
||||
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
|
||||
}
|
||||
@ -204,8 +203,7 @@ private fun UserAddressLayout(
|
||||
QRCode(userAddress.connReqContact, Modifier.padding(horizontal = DEFAULT_PADDING, vertical = DEFAULT_PADDING_HALF).aspectRatio(1f))
|
||||
ShareAddressButton { share(userAddress.connReqContact) }
|
||||
ShareViaEmailButton { sendEmail(userAddress) }
|
||||
// TODO uncomment in v5.2
|
||||
// ShareWithContactsButton(shareViaProfile, setProfileAddress)
|
||||
ShareWithContactsButton(shareViaProfile, setProfileAddress)
|
||||
AutoAcceptToggle(autoAcceptState) { saveAas(autoAcceptState.value, autoAcceptStateSaved) }
|
||||
LearnMoreButton(learnMore)
|
||||
}
|
||||
|
@ -81,12 +81,11 @@ struct CreateSimpleXAddress: View {
|
||||
DispatchQueue.main.async {
|
||||
m.userAddress = UserContactLink(connReqContact: connReqContact)
|
||||
}
|
||||
// TODO uncomment in v5.2
|
||||
// if let u = try await apiSetProfileAddress(on: true) {
|
||||
// DispatchQueue.main.async {
|
||||
// m.updateUser(u)
|
||||
// }
|
||||
// }
|
||||
if let u = try await apiSetProfileAddress(on: true) {
|
||||
DispatchQueue.main.async {
|
||||
m.updateUser(u)
|
||||
}
|
||||
}
|
||||
await MainActor.run { progressIndicator = false }
|
||||
} catch let error {
|
||||
logger.error("CreateSimpleXAddress create address: \(responseError(error))")
|
||||
@ -102,11 +101,9 @@ struct CreateSimpleXAddress: View {
|
||||
Text("Create SimpleX address").font(.title)
|
||||
}
|
||||
Text("Your contacts in SimpleX will see it.\nYou can change it in Settings.")
|
||||
// TODO remove in in v5.2
|
||||
.foregroundColor(.clear)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.footnote)
|
||||
.padding(.horizontal, 32)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.footnote)
|
||||
.padding(.horizontal, 32)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,7 @@ struct UserAddressView: View {
|
||||
if MFMailComposeViewController.canSendMail() {
|
||||
shareViaEmailButton(userAddress)
|
||||
}
|
||||
// TODO uncomment in 5.2
|
||||
// shareWithContactsButton()
|
||||
shareWithContactsButton()
|
||||
autoAcceptToggle()
|
||||
learnMoreButton()
|
||||
} header: {
|
||||
@ -223,8 +222,7 @@ struct UserAddressView: View {
|
||||
let connReqContact = try await apiCreateUserAddress()
|
||||
DispatchQueue.main.async {
|
||||
chatModel.userAddress = UserContactLink(connReqContact: connReqContact)
|
||||
// TODO uncomment in 5.2
|
||||
// alert = .shareOnCreate
|
||||
alert = .shareOnCreate
|
||||
progressIndicator = false
|
||||
}
|
||||
} catch let error {
|
||||
|
@ -201,7 +201,7 @@ myAddressHelpInfo =
|
||||
styleMarkdown
|
||||
[ green "Your contact address commands:",
|
||||
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 "/show_address " <> " - show your address",
|
||||
indent <> highlight "/accept <name> " <> " - accept contact request",
|
||||
|
@ -641,7 +641,7 @@ connReqContact_ intro cReq =
|
||||
"",
|
||||
"Anybody can send you contact requests with: " <> highlight' "/c <contact_link_above>",
|
||||
"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)"
|
||||
]
|
||||
|
||||
|
@ -358,7 +358,7 @@ getContactLink cc created = do
|
||||
cc <## ""
|
||||
cc <## "Anybody can send you contact requests with: /c <contact_link_above>"
|
||||
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)"
|
||||
pure link
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user