wip
This commit is contained in:
parent
9c5c54e09e
commit
a02ca5b04f
|
@ -7,7 +7,7 @@ import UIKit
|
||||||
final class SharingMiddleware {
|
final class SharingMiddleware {
|
||||||
static let shared = SharingMiddleware()
|
static let shared = SharingMiddleware()
|
||||||
|
|
||||||
func middleware(state _: AppState, action: AppAction) -> AnyPublisher<AppAction, Never> {
|
func middleware(state: AppState, action: AppAction) -> AnyPublisher<AppAction, Never> {
|
||||||
switch action {
|
switch action {
|
||||||
case .sharingAction(.checkCameraAccess):
|
case .sharingAction(.checkCameraAccess):
|
||||||
return Future<AppAction, Never> { promise in
|
return Future<AppAction, Never> { promise in
|
||||||
|
@ -114,6 +114,15 @@ final class SharingMiddleware {
|
||||||
}
|
}
|
||||||
return Empty().eraseToAnyPublisher()
|
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:
|
default:
|
||||||
return Empty().eraseToAnyPublisher()
|
return Empty().eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue