show confirmation alert after the connection (#299)
* show confirmation alert after the connection * update build number
This commit is contained in:
committed by
GitHub
parent
dc306dfcd0
commit
710971a0cd
@@ -53,6 +53,7 @@ final class AlertManager: ObservableObject {
|
||||
@Published var alertView: Alert?
|
||||
|
||||
func showAlert(_ alert: Alert) {
|
||||
logger.debug("AlertManager.showAlert")
|
||||
DispatchQueue.main.async {
|
||||
self.alertView = alert
|
||||
self.presentAlert = true
|
||||
|
||||
@@ -56,10 +56,6 @@ class NtfManager: NSObject, UNUserNotificationCenterDelegate, ObservableObject {
|
||||
let model = ChatModel.shared
|
||||
if UIApplication.shared.applicationState == .active {
|
||||
switch content.categoryIdentifier {
|
||||
case ntfCategoryContactRequest:
|
||||
return [.sound, .banner, .list]
|
||||
case ntfCategoryContactConnected:
|
||||
return model.chatId == nil ? [.sound, .list] : [.sound, .banner, .list]
|
||||
case ntfCategoryMessageReceived:
|
||||
if model.chatId == nil {
|
||||
// in the chat list
|
||||
|
||||
@@ -88,6 +88,7 @@ struct ChatListView: View {
|
||||
DispatchQueue.main.async {
|
||||
do {
|
||||
try apiConnect(connReq: link)
|
||||
connectionReqSentAlert(path == "contact" ? .contact : .invitation)
|
||||
} catch {
|
||||
let err = error.localizedDescription
|
||||
AlertManager.shared.showAlertMsg(title: "Connection error", message: err)
|
||||
|
||||
@@ -39,7 +39,9 @@ struct NewChatButton: View {
|
||||
connReqInvitation = try apiAddContact()
|
||||
addContact = true
|
||||
} catch {
|
||||
connectionErrorAlert(error)
|
||||
DispatchQueue.global().async {
|
||||
connectionErrorAlert(error)
|
||||
}
|
||||
logger.error("NewChatButton.addContactAction apiAddContact error: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
@@ -47,8 +49,12 @@ struct NewChatButton: View {
|
||||
func connectContactSheet() -> some View {
|
||||
ConnectContactView(completed: { err in
|
||||
connectContact = false
|
||||
if let error = err {
|
||||
connectionErrorAlert(error)
|
||||
DispatchQueue.global().async {
|
||||
if let error = err {
|
||||
connectionErrorAlert(error)
|
||||
} else {
|
||||
connectionReqSentAlert(.invitation)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -58,6 +64,21 @@ struct NewChatButton: View {
|
||||
}
|
||||
}
|
||||
|
||||
enum ConnReqType: Equatable {
|
||||
case contact
|
||||
case invitation
|
||||
}
|
||||
|
||||
func connectionReqSentAlert(_ type: ConnReqType) {
|
||||
let whenConnected = type == .contact
|
||||
? "your connection request is accepted"
|
||||
: "your contact's device is online"
|
||||
AlertManager.shared.showAlertMsg(
|
||||
title: "Connection request sent!",
|
||||
message: "You will be connected when \(whenConnected), please wait or check later!"
|
||||
)
|
||||
}
|
||||
|
||||
struct NewChatButton_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
NewChatButton()
|
||||
|
||||
@@ -799,7 +799,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
CURRENT_PROJECT_VERSION = 9;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -839,7 +839,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
CURRENT_PROJECT_VERSION = 9;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
|
||||
Reference in New Issue
Block a user