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?()
|
self.completion?()
|
||||||
case .share(let latitude, let longitude, let coordinateType):
|
case .share(let latitude, let longitude, let coordinateType):
|
||||||
self.shareStaticLocation(latitude: latitude, longitude: longitude, coordinateType: coordinateType)
|
self.shareStaticLocation(latitude: latitude, longitude: longitude, coordinateType: coordinateType)
|
||||||
|
self.completion?()
|
||||||
case .shareLiveLocation(let timeout):
|
case .shareLiveLocation(let timeout):
|
||||||
self.startLiveLocationSharing(with: timeout)
|
self.startLiveLocationSharing(with: timeout)
|
||||||
|
self.completion?()
|
||||||
case .checkLiveLocationCanBeStarted(let completion):
|
case .checkLiveLocationCanBeStarted(let completion):
|
||||||
self.checkLiveLocationCanBeStarted(completion: completion)
|
self.checkLiveLocationCanBeStarted(completion: completion)
|
||||||
}
|
}
|
||||||
|
@ -129,29 +131,20 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
||||||
} failure: { error in
|
} failure: { error in
|
||||||
MXLog.error("[LocationSharingCoordinator] Failed sharing location", context: error)
|
MXLog.error("[LocationSharingCoordinator] Failed sharing location", context: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.completion?()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func startLiveLocationSharing(with timeout: TimeInterval) {
|
private func startLiveLocationSharing(with timeout: TimeInterval) {
|
||||||
guard let locationService = parameters.roomDataSource.mxSession.locationService, let roomId = parameters.roomDataSource.roomId else {
|
guard let locationService = parameters.roomDataSource.mxSession.locationService, let roomId = parameters.roomDataSource.roomId else {
|
||||||
locationSharingViewModel.stopLoading(error: .locationSharingError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
locationService.startUserLocationSharing(withRoomId: roomId, description: nil, timeout: timeout) { [weak self] response in
|
locationService.startUserLocationSharing(withRoomId: roomId, description: nil, timeout: timeout) { response in
|
||||||
guard let self = self else { return }
|
|
||||||
|
|
||||||
switch response {
|
switch response {
|
||||||
case .success:
|
case .success:
|
||||||
break
|
break
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
MXLog.error("[LocationSharingCoordinator] Failed to start live location sharing", context: error)
|
MXLog.error("[LocationSharingCoordinator] Failed to start live location sharing", context: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.completion?()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue