diff --git a/ElementX/Sources/Screens/LocationSharing/LocationSharingScreenViewModel.swift b/ElementX/Sources/Screens/LocationSharing/LocationSharingScreenViewModel.swift index bf78ed980..848a36d24 100644 --- a/ElementX/Sources/Screens/LocationSharing/LocationSharingScreenViewModel.swift +++ b/ElementX/Sources/Screens/LocationSharing/LocationSharingScreenViewModel.swift @@ -184,6 +184,11 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati } private func startLiveLocationSharingInRoom(duration: Duration) async { + showLoader() + defer { + hideLoader() + } + let result = await liveLocationManager.startLiveLocation(roomID: roomProxy.id, duration: duration) @@ -222,15 +227,28 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati } private func showErrorIndicator() { - userIndicatorController.submitIndicator(UserIndicator(id: statusIndicatorID, + userIndicatorController.submitIndicator(UserIndicator(id: Self.statusIndicatorID, type: .toast, title: L10n.errorUnknown, iconName: "xmark")) } - private var statusIndicatorID: String { - "\(Self.self)-Status" + private func showLoader() { + userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorID, + type: .modal(progress: .indeterminate, + interactiveDismissDisabled: true, + allowsInteraction: false), + title: L10n.commonLoading, + persistent: true)) } + + private func hideLoader() { + userIndicatorController.retractIndicatorWithId(Self.loadingIndicatorID) + } + + private static let loadingIndicatorID = "\(LocationSharingScreenViewModel.self)-Loading" + + private static let statusIndicatorID = "\(LocationSharingScreenViewModel.self)-Status" } extension LocationSharingScreenViewModel {