mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Move completions around
This commit is contained in:
parent
6831a00ad2
commit
ec746fbb87
1 changed files with 3 additions and 10 deletions
|
@ -103,8 +103,10 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
|||
self.completion?()
|
||||
case .share(let latitude, let longitude, let coordinateType):
|
||||
self.shareStaticLocation(latitude: latitude, longitude: longitude, coordinateType: coordinateType)
|
||||
self.completion?()
|
||||
case .shareLiveLocation(let timeout):
|
||||
self.startLiveLocationSharing(with: timeout)
|
||||
self.completion?()
|
||||
case .checkLiveLocationCanBeStarted(let completion):
|
||||
self.checkLiveLocationCanBeStarted(completion: completion)
|
||||
}
|
||||
|
@ -129,29 +131,20 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
|||
} failure: { error in
|
||||
MXLog.error("[LocationSharingCoordinator] Failed sharing location", context: error)
|
||||
}
|
||||
|
||||
self.completion?()
|
||||
}
|
||||
|
||||
private func startLiveLocationSharing(with timeout: TimeInterval) {
|
||||
guard let locationService = parameters.roomDataSource.mxSession.locationService, let roomId = parameters.roomDataSource.roomId else {
|
||||
locationSharingViewModel.stopLoading(error: .locationSharingError)
|
||||
return
|
||||
}
|
||||
|
||||
locationService.startUserLocationSharing(withRoomId: roomId, description: nil, timeout: timeout) { [weak self] response in
|
||||
guard let self = self else { return }
|
||||
|
||||
locationService.startUserLocationSharing(withRoomId: roomId, description: nil, timeout: timeout) { response in
|
||||
switch response {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
MXLog.error("[LocationSharingCoordinator] Failed to start live location sharing", context: error)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.completion?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue