mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 11:02:48 +02:00
vector-im/element-ios/issues/5298 - Allow sharing locations to other system apps.
This commit is contained in:
committed by
Stefan Ceriu
parent
9b6960e0e7
commit
3de2af63c7
@@ -16,6 +16,7 @@
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import CoreLocation
|
||||
|
||||
@available(iOS 14, *)
|
||||
typealias LocationSharingViewModelType = StateStoreViewModel< LocationSharingViewState,
|
||||
@@ -51,12 +52,17 @@ class LocationSharingViewModel: LocationSharingViewModelType {
|
||||
case .cancel:
|
||||
completion?(.cancel)
|
||||
case .share:
|
||||
if let location = state.location {
|
||||
completion?(.share(latitude: location.latitude, longitude: location.longitude))
|
||||
return
|
||||
}
|
||||
|
||||
guard let location = state.bindings.userLocation else {
|
||||
dispatch(action: .error(.failedLocatingUser, completion))
|
||||
return
|
||||
}
|
||||
|
||||
completion?(.share(location.latitude, location.longitude))
|
||||
completion?(.share(latitude: location.latitude, longitude: location.longitude))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user