ios: fix ContactConnectionInfo share sheet (#1215)

This commit is contained in:
JRoberts
2022-10-15 15:47:04 +04:00
committed by GitHub
parent 9670da4646
commit 3523c7ebd7
5 changed files with 13 additions and 17 deletions

View File

@@ -14,7 +14,6 @@ struct ContactConnectionInfo: View {
@Environment(\.dismiss) var dismiss: DismissAction
@State var contactConnection: PendingContactConnection
@State private var alert: CCInfoAlert?
@State private var showQRCodeView = false
@State private var localAlias = ""
@FocusState private var aliasTextFieldFocused: Bool
@@ -60,9 +59,11 @@ struct ContactConnectionInfo: View {
.onSubmit(setConnectionAlias)
}
if contactConnection.initiated && contactConnection.connReqInv != nil {
Button {
showQRCodeView = true
if contactConnection.initiated,
let connReqInv = contactConnection.connReqInv {
NavigationLink {
AddContactView(contactConnection: contactConnection, connReqInvitation: connReqInv, viaNavLink: true)
.navigationBarTitleDisplayMode(.inline)
} label: {
Label("Show QR code", systemImage: "qrcode")
.foregroundColor(contactConnection.incognito ? .indigo : .accentColor)
@@ -79,11 +80,6 @@ struct ContactConnectionInfo: View {
}
.listStyle(.insetGrouped)
}
.sheet(isPresented: $showQRCodeView) {
if let connReqInv = contactConnection.connReqInv {
AddContactView(contactConnection: contactConnection, connReqInvitation: connReqInv)
}
}
.alert(item: $alert) { _alert in
switch _alert {
case .deleteInvitationAlert:

View File

@@ -14,7 +14,7 @@ struct AddContactView: View {
@EnvironmentObject private var chatModel: ChatModel
var contactConnection: PendingContactConnection? = nil
var connReqInvitation: String
var viaSettings = false
var viaNavLink = false
var body: some View {
ScrollView {
@@ -22,7 +22,7 @@ struct AddContactView: View {
Text("One-time invitation link")
.font(.largeTitle)
.bold()
.padding(viaSettings ? .bottom : .vertical)
.padding(viaNavLink ? .bottom : .vertical)
Text("Your contact can scan it from the app.")
.padding(.bottom, 4)
if (contactConnection?.incognito ?? chatModel.incognito) {

View File

@@ -18,11 +18,11 @@ struct CreateLinkView: View {
@State var selection: CreateLinkTab
@State var connReqInvitation: String = ""
@State private var creatingConnReq = false
var viaSettings = false
var viaNavLink = false
var body: some View {
TabView(selection: $selection) {
AddContactView(connReqInvitation: connReqInvitation, viaSettings: viaSettings)
AddContactView(connReqInvitation: connReqInvitation, viaNavLink: viaNavLink)
.tabItem {
Label(
connReqInvitation == ""
@@ -32,7 +32,7 @@ struct CreateLinkView: View {
)
}
.tag(CreateLinkTab.oneTime)
UserAddress(viaSettings: viaSettings)
UserAddress(viaNavLink: viaNavLink)
.tabItem {
Label("Your contact address", systemImage: "infinity.circle")
}

View File

@@ -93,7 +93,7 @@ struct SettingsView: View {
.disabled(chatModel.chatRunning != true)
NavigationLink {
CreateLinkView(selection: .longTerm, viaSettings: true)
CreateLinkView(selection: .longTerm, viaNavLink: true)
.navigationBarTitleDisplayMode(.inline)
} label: {
settingsRow("qrcode") { Text("Your SimpleX contact address") }

View File

@@ -12,7 +12,7 @@ import SimpleXChat
struct UserAddress: View {
@EnvironmentObject private var chatModel: ChatModel
@State private var alert: UserAddressAlert?
var viaSettings = false
var viaNavLink = false
private enum UserAddressAlert: Identifiable {
case deleteAddress
@@ -32,7 +32,7 @@ struct UserAddress: View {
Text("Your contact address")
.font(.largeTitle)
.bold()
.padding(viaSettings ? .bottom : .vertical)
.padding(viaNavLink ? .bottom : .vertical)
Text("You can share your address as a link or as a QR code - anybody will be able to connect to you. You won't lose your contacts if you later delete it.")
.padding(.bottom)
if let userAdress = chatModel.userAddress {