diff --git a/apps/ios/Shared/ContentView.swift b/apps/ios/Shared/ContentView.swift index 2f39dfa075..24cd35b187 100644 --- a/apps/ios/Shared/ContentView.swift +++ b/apps/ios/Shared/ContentView.swift @@ -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 diff --git a/apps/ios/Shared/Model/NtfManager.swift b/apps/ios/Shared/Model/NtfManager.swift index 904357eec6..073c91c0d2 100644 --- a/apps/ios/Shared/Model/NtfManager.swift +++ b/apps/ios/Shared/Model/NtfManager.swift @@ -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 diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 19aaec6763..4f5d044716 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -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) diff --git a/apps/ios/Shared/Views/NewChat/NewChatButton.swift b/apps/ios/Shared/Views/NewChat/NewChatButton.swift index 95add21038..b389f9c47a 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatButton.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatButton.swift @@ -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() diff --git a/apps/ios/SimpleX.xcodeproj/project.pbxproj b/apps/ios/SimpleX.xcodeproj/project.pbxproj index b52ecdc22f..4ed34fa537 100644 --- a/apps/ios/SimpleX.xcodeproj/project.pbxproj +++ b/apps/ios/SimpleX.xcodeproj/project.pbxproj @@ -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;