diff --git a/Projects/App/Sources/AppDelegate+Notifications.swift b/Projects/App/Sources/AppDelegate+Notifications.swift index 8389dd71f2..dfe6a3c8e9 100644 --- a/Projects/App/Sources/AppDelegate+Notifications.swift +++ b/Projects/App/Sources/AppDelegate+Notifications.swift @@ -106,4 +106,5 @@ enum PushNotificationType: String { case OPEN_FOREVER_TAB case OPEN_INSURANCE_TAB case CROSS_SELL + case OPEN_CONTACT_INFO } diff --git a/Projects/App/Sources/Journeys/LoggedInNavigation.swift b/Projects/App/Sources/Journeys/LoggedInNavigation.swift index 8e869a76b2..f0f18de91b 100644 --- a/Projects/App/Sources/Journeys/LoggedInNavigation.swift +++ b/Projects/App/Sources/Journeys/LoggedInNavigation.swift @@ -484,6 +484,10 @@ class LoggedInNavigationViewModel: ObservableObject { case .CROSS_SELL: UIApplication.shared.getRootViewController()?.dismiss(animated: true) self.selectedTab = 1 + case .OPEN_CONTACT_INFO: + UIApplication.shared.getRootViewController()?.dismiss(animated: true) + self.selectedTab = 4 + self.profileNavigationVm.pushToProfile() } } } @@ -544,6 +548,10 @@ class LoggedInNavigationViewModel: ObservableObject { self.terminateInsuranceVm.start(with: contractsConfig) case .openChat: NotificationCenter.default.post(name: .openChat, object: nil) + case .contactInfo: + UIApplication.shared.getRootViewController()?.dismiss(animated: true) + self.selectedTab = 4 + self.profileNavigationVm.pushToProfile() case nil: openUrl(url: url) } diff --git a/Projects/Chat/Sources/Service/OctopusImplementation/FetchMessagesClientOctopus.swift b/Projects/Chat/Sources/Service/OctopusImplementation/FetchMessagesClientOctopus.swift index c3b4d8029a..3ec1f1bcf9 100644 --- a/Projects/Chat/Sources/Service/OctopusImplementation/FetchMessagesClientOctopus.swift +++ b/Projects/Chat/Sources/Service/OctopusImplementation/FetchMessagesClientOctopus.swift @@ -35,12 +35,13 @@ extension OctopusGraphQL.MessageFragment { private var messageType: MessageType { if let text = self.asChatMessageText?.text { - if let url = URL(string: text), text.isUrl { - if text.isGIFURL { + let urlText = text.trimmingCharacters(in: .whitespacesAndNewlines) + if let url = URL(string: urlText), urlText.isUrl { + if urlText.isGIFURL { return .file(file: .init(id: self.id, size: 0, mimeType: .GIF, name: "", source: .url(url: url))) - } else if text.isCrossSell { + } else if urlText.isCrossSell { return .crossSell(url: url) - } else if text.isDeepLink { + } else if urlText.isDeepLink { return .deepLink(url: url) } else { return .otherLink(url: url) diff --git a/Projects/Profile/Sources/Navigation/ProfileNavigation.swift b/Projects/Profile/Sources/Navigation/ProfileNavigation.swift index f587dd70da..102f0e71d6 100644 --- a/Projects/Profile/Sources/Navigation/ProfileNavigation.swift +++ b/Projects/Profile/Sources/Navigation/ProfileNavigation.swift @@ -12,6 +12,12 @@ public class ProfileNavigationViewModel: ObservableObject { public let profileRouter = Router() + public func pushToProfile() { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in + self?.profileRouter.push(ProfileRouterType.myInfo) + } + } + public init() {} } diff --git a/Projects/hCore/Sources/DeepLink.swift b/Projects/hCore/Sources/DeepLink.swift index d028b01033..8cef79bf45 100644 --- a/Projects/hCore/Sources/DeepLink.swift +++ b/Projects/hCore/Sources/DeepLink.swift @@ -15,6 +15,7 @@ public enum DeepLink: String, Codable, CaseIterable { case moveContract = "move-contract" case terminateContract = "terminate-contract" case openChat = "open-chat" + case contactInfo = "contact-info" public func wholeText(displayText: String) -> String { return L10n.generalGoTo(displayText) @@ -48,6 +49,8 @@ public enum DeepLink: String, Codable, CaseIterable { return L10n.hcQuickActionsTerminationTitle case .openChat: return L10n.chatTitle + case .contactInfo: + return L10n.profileMyInfoTitle } }