-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Merge and improve add contact and contact requests menu MACOS_ONLY - Please make sure to test everything thoroughly: this is the final release candidate for the last stable version that will support macOS 11 + 12. IOS_ONLY - Please make sure to test everything thoroughly: this is the final release candidate for the last stable version that will support iOS 14 + 15.
- Loading branch information
Showing
12 changed files
with
113 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,10 @@ struct AddContactMenu: View { | |
} | ||
else | ||
{ | ||
if DataLayer.sharedInstance().allContactRequests().count > 0 { | ||
ContactRequestsMenu() | ||
} | ||
|
||
Section(header:Text("Contact and Group/Channel Jids are usually in the format: [email protected]")) { | ||
if connectedAccounts.count > 1 { | ||
Picker("Use account", selection: $selectedAccount) { | ||
|
@@ -190,18 +194,16 @@ struct AddContactMenu: View { | |
.addClearButton(isEditing: isEditingJid, text:$toAdd) | ||
.disabled(scannedFingerprints != nil) | ||
.foregroundColor(scannedFingerprints != nil ? .secondary : .primary) | ||
.onChange(of: toAdd) { _ in | ||
toAdd = toAdd.replacingOccurrences(of: " ", with: "") | ||
} | ||
} | ||
if scannedFingerprints != nil && scannedFingerprints!.count > 0 { | ||
Section(header: Text("A contact was scanned through the QR code scanner")) { | ||
Toggle(isOn: $importScannedFingerprints) { | ||
Text("Import and trust OMEMO fingerprints from QR code") | ||
.onChange(of: toAdd) { _ in toAdd = toAdd.replacingOccurrences(of: " ", with: "") } | ||
|
||
if scannedFingerprints != nil && scannedFingerprints!.count > 0 { | ||
Section(header: Text("A contact was scanned through the QR code scanner")) { | ||
Toggle(isOn: $importScannedFingerprints) { | ||
Text("Import and trust OMEMO fingerprints from QR code") | ||
} | ||
} | ||
} | ||
} | ||
Section { | ||
|
||
if scannedFingerprints != nil { | ||
Button(action: { | ||
toAdd = "" | ||
|
@@ -212,26 +214,43 @@ struct AddContactMenu: View { | |
.foregroundColor(.red) | ||
}) | ||
} | ||
Button(action: { | ||
showAlert = toAddEmptyAlert || toAddInvalidAlert | ||
|
||
HStack { | ||
Spacer() | ||
|
||
Button(action: { | ||
showAlert = toAddEmptyAlert || toAddInvalidAlert | ||
|
||
if !showAlert { | ||
let jidComponents = HelperTools.splitJid(toAdd) | ||
if jidComponents["host"] == nil || jidComponents["host"]!.isEmpty { | ||
errorAlert(title: Text("Error"), message: Text("Something went wrong while parsing your input...")) | ||
showAlert = true | ||
return | ||
if !showAlert { | ||
let jidComponents = HelperTools.splitJid(toAdd) | ||
if jidComponents["host"] == nil || jidComponents["host"]!.isEmpty { | ||
errorAlert(title: Text("Error"), message: Text("Something went wrong while parsing your input...")) | ||
showAlert = true | ||
return | ||
} | ||
// use the canonized jid from now on (lowercased, resource removed etc.) | ||
addJid(jid: jidComponents["user"]!) | ||
} | ||
// use the canonized jid from now on (lowercased, resource removed etc.) | ||
addJid(jid: jidComponents["user"]!) | ||
}) { | ||
scannedFingerprints == nil ? Text("Add") : Text("Add scanned contact") | ||
} | ||
}, label: { | ||
scannedFingerprints == nil ? Text("Add Group/Channel or Contact") : Text("Add scanned Group/Channel or Contact") | ||
}) | ||
.disabled(toAddEmpty || toAddInvalid) | ||
//.fontWeight(.bold) | ||
.padding() | ||
.background(toAddEmpty || toAddInvalid ? Color.gray : Color.blue) | ||
.foregroundColor(.white) | ||
.cornerRadius(10) | ||
.disabled(toAddEmpty || toAddInvalid) | ||
} | ||
} | ||
|
||
if DataLayer.sharedInstance().allContactRequests().count == 0 { | ||
Section { | ||
ContactRequestsMenu() | ||
} | ||
} | ||
} | ||
} | ||
.padding() | ||
.alert(isPresented: $showAlert) { | ||
Alert(title: alertPrompt.title, message: alertPrompt.message, dismissButton:.default(Text("Close"), action: { | ||
showAlert = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters