diff --git a/ConversationsClassic/AppCore/Middlewares/SharingMiddleware.swift b/ConversationsClassic/AppCore/Middlewares/SharingMiddleware.swift index 3a8c1bb..312029f 100644 --- a/ConversationsClassic/AppCore/Middlewares/SharingMiddleware.swift +++ b/ConversationsClassic/AppCore/Middlewares/SharingMiddleware.swift @@ -7,7 +7,7 @@ import UIKit final class SharingMiddleware { static let shared = SharingMiddleware() - func middleware(state _: AppState, action: AppAction) -> AnyPublisher { + func middleware(state: AppState, action: AppAction) -> AnyPublisher { switch action { case .sharingAction(.checkCameraAccess): return Future { promise in @@ -114,6 +114,15 @@ final class SharingMiddleware { } return Empty().eraseToAnyPublisher() + case .sharingAction(.shareLocation(let lat, let lon)): + if let chat = state.conversationsState.currentChat { + let msg = "geo:\(lat),\(lon)" + return Just(.conversationAction(.sendMessage(from: chat.account, to: chat.participant, body: msg))) + .eraseToAnyPublisher() + } else { + return Empty().eraseToAnyPublisher() + } + default: return Empty().eraseToAnyPublisher() }