mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 10:02:46 +02:00
Merge branch 'develop' into aringenbach/3526_user_pills
This commit is contained in:
@@ -1344,7 +1344,7 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
|
||||
- (void)updateBeaconInfoSummaryWithEventId:(NSString *)eventId
|
||||
{
|
||||
MXBeaconInfoSummary *beaconInfoSummary = [self.mxSession.aggregations.beaconAggregations beaconInfoSummaryFor:eventId inRoomWithId:self.roomId];
|
||||
id<MXBeaconInfoSummaryProtocol> beaconInfoSummary = [self.mxSession.aggregations.beaconAggregations beaconInfoSummaryFor:eventId inRoomWithId:self.roomId];
|
||||
|
||||
self.beaconInfoSummary = beaconInfoSummary;
|
||||
}
|
||||
|
||||
@@ -3045,22 +3045,6 @@
|
||||
[self promptUserToResendEvent:selectedEvent.eventId];
|
||||
}
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellStopShareButtonPressed])
|
||||
{
|
||||
MXEvent *selectedEvent = userInfo[kMXKRoomBubbleCellEventKey];
|
||||
if (selectedEvent)
|
||||
{
|
||||
// TODO: - Implement stop live location action
|
||||
}
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellRetryShareButtonPressed])
|
||||
{
|
||||
MXEvent *selectedEvent = userInfo[kMXKRoomBubbleCellEventKey];
|
||||
if (selectedEvent)
|
||||
{
|
||||
// TODO: - Implement retry live location action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Clipboard
|
||||
|
||||
@@ -32,6 +32,7 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
|
||||
private let userIndicatorStore: UserIndicatorStore
|
||||
private var selectedEventId: String?
|
||||
private var loadingCancel: UserIndicatorCancel?
|
||||
private var locationSharingIndicatorCancel: UserIndicatorCancel? // Used for location sharing advertizements
|
||||
|
||||
private var roomDataSourceManager: MXKRoomDataSourceManager {
|
||||
return MXKRoomDataSourceManager.sharedManager(forMatrixSession: self.parameters.session)
|
||||
@@ -248,6 +249,87 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
|
||||
completion?()
|
||||
}
|
||||
|
||||
private func showLiveLocationViewer() {
|
||||
guard let roomId = self.roomId else {
|
||||
return
|
||||
}
|
||||
|
||||
self.showLiveLocationViewer(for: roomId)
|
||||
}
|
||||
|
||||
private func showLiveLocationViewer(for roomId: String) {
|
||||
|
||||
guard let mxSession = self.mxSession, let navigationRouter = self.navigationRouter else {
|
||||
return
|
||||
}
|
||||
|
||||
guard mxSession.locationService.isSomeoneSharingDisplayableLocation(inRoomWithId: roomId) else {
|
||||
return
|
||||
}
|
||||
|
||||
let parameters = LiveLocationSharingViewerCoordinatorParameters(session: mxSession, roomId: roomId, navigationRouter: nil)
|
||||
|
||||
let coordinator = LiveLocationSharingViewerCoordinator(parameters: parameters)
|
||||
|
||||
coordinator.completion = { [weak self, weak coordinator] in
|
||||
guard let self = self, let coordinator = coordinator else {
|
||||
return
|
||||
}
|
||||
|
||||
self.navigationRouter?.dismissModule(animated: true, completion: nil)
|
||||
self.remove(childCoordinator: coordinator)
|
||||
}
|
||||
|
||||
add(childCoordinator: coordinator)
|
||||
|
||||
navigationRouter.present(coordinator, animated: true)
|
||||
coordinator.start()
|
||||
}
|
||||
|
||||
private func stopLiveLocationSharing(forBeaconInfoEventId beaconInfoEventId: String? = nil, inRoomWithId roomId: String) {
|
||||
guard let session = self.mxSession else {
|
||||
return
|
||||
}
|
||||
|
||||
let errorHandler: (Error) -> Void = { error in
|
||||
|
||||
let viewController = self.roomViewController
|
||||
|
||||
viewController.errorPresenter.presentError(from: viewController, title: VectorL10n.error, message: VectorL10n.locationSharingLiveStopSharingError, animated: true) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Handle loading state on the banner by replacing stop button with a spinner
|
||||
self.showLocationSharingIndicator(withMessage: VectorL10n.locationSharingLiveStopSharingProgress)
|
||||
|
||||
if let beaconInfoEventId = beaconInfoEventId {
|
||||
session.locationService.stopUserLocationSharing(withBeaconInfoEventId: beaconInfoEventId, roomId: roomId) {
|
||||
[weak self] response in
|
||||
|
||||
self?.hideLocationSharingIndicator()
|
||||
|
||||
switch response {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
errorHandler(error)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
session.locationService.stopUserLocationSharing(inRoomWithId: roomId) { [weak self] response in
|
||||
|
||||
self?.hideLocationSharingIndicator()
|
||||
|
||||
switch response {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
errorHandler(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func showLocationCoordinatorWithEvent(_ event: MXEvent, bubbleData: MXKRoomBubbleCellDataStoring) {
|
||||
guard #available(iOS 14.0, *) else {
|
||||
return
|
||||
@@ -371,6 +453,19 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
|
||||
loadingCancel?()
|
||||
loadingCancel = nil
|
||||
}
|
||||
|
||||
private func showLocationSharingIndicator(withMessage message: String) {
|
||||
guard locationSharingIndicatorCancel == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
locationSharingIndicatorCancel = userIndicatorStore.present(type: .loading(label: message, isInteractionBlocking: false))
|
||||
}
|
||||
|
||||
private func hideLocationSharingIndicator() {
|
||||
locationSharingIndicatorCancel?()
|
||||
locationSharingIndicatorCancel = nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - RoomIdentifiable
|
||||
@@ -449,6 +544,15 @@ extension RoomCoordinator: RoomViewControllerDelegate {
|
||||
showLocationCoordinatorWithEvent(event, bubbleData: bubbleData)
|
||||
}
|
||||
|
||||
func roomViewController(_ roomViewController: RoomViewController, didRequestLiveLocationPresentationForBubbleData bubbleData: MXKRoomBubbleCellDataStoring) {
|
||||
|
||||
guard let roomId = bubbleData.roomId else {
|
||||
return
|
||||
}
|
||||
|
||||
showLiveLocationViewer(for: roomId)
|
||||
}
|
||||
|
||||
func roomViewController(_ roomViewController: RoomViewController, locationShareActivityViewControllerFor event: MXEvent) -> UIActivityViewController? {
|
||||
guard let location = event.location else {
|
||||
return nil
|
||||
@@ -494,11 +598,17 @@ extension RoomCoordinator: RoomViewControllerDelegate {
|
||||
}
|
||||
|
||||
func roomViewControllerDidTapLiveLocationSharingBanner(_ roomViewController: RoomViewController) {
|
||||
// TODO:
|
||||
|
||||
showLiveLocationViewer()
|
||||
}
|
||||
|
||||
func roomViewControllerDidStopLiveLocationSharing(_ roomViewController: RoomViewController) {
|
||||
// TODO:
|
||||
func roomViewControllerDidStopLiveLocationSharing(_ roomViewController: RoomViewController, beaconInfoEventId: String?) {
|
||||
|
||||
guard let roomId = self.roomId else {
|
||||
return
|
||||
}
|
||||
|
||||
self.stopLiveLocationSharing(forBeaconInfoEventId: beaconInfoEventId, inRoomWithId: roomId)
|
||||
}
|
||||
|
||||
func threadsCoordinator(for roomViewController: RoomViewController, threadId: String?) -> ThreadsCoordinatorBridgePresenter? {
|
||||
|
||||
@@ -53,7 +53,7 @@ import Foundation
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
self.delegate?.roomViewControllerDidStopLiveLocationSharing(self)
|
||||
self.delegate?.roomViewControllerDidStopLiveLocationSharing(self, beaconInfoEventId: nil)
|
||||
}
|
||||
|
||||
self.topBannersStackView?.addArrangedSubview(bannerView)
|
||||
|
||||
@@ -70,6 +70,9 @@ extern NSNotificationName const RoomGroupCallTileTappedNotification;
|
||||
// Remove Jitsi widget container
|
||||
@property (weak, nonatomic, nullable) IBOutlet UIView *removeJitsiWidgetContainer;
|
||||
|
||||
// Error presenter
|
||||
@property (nonatomic, strong, readonly) MXKErrorAlertPresentation *errorPresenter;
|
||||
|
||||
/**
|
||||
Preview data for a room invitation received by email, or a link to a room.
|
||||
*/
|
||||
@@ -264,6 +267,10 @@ handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters;
|
||||
didRequestLocationPresentationForEvent:(MXEvent *)event
|
||||
bubbleData:(id<MXKRoomBubbleCellDataStoring>)bubbleData;
|
||||
|
||||
/// Ask the coordinator to present the live location sharing viewer.
|
||||
- (void)roomViewController:(RoomViewController *)roomViewController
|
||||
didRequestLiveLocationPresentationForBubbleData:(id<MXKRoomBubbleCellDataStoring>)bubbleData;
|
||||
|
||||
- (nullable UIActivityViewController *)roomViewController:(RoomViewController *)roomViewController
|
||||
locationShareActivityViewControllerForEvent:(MXEvent *)event;
|
||||
|
||||
@@ -296,7 +303,7 @@ didRequestEditForPollWithStartEvent:(MXEvent *)startEvent;
|
||||
- (void)roomViewControllerDidStopLoading:(RoomViewController *)roomViewController;
|
||||
|
||||
/// User tap live location sharing stop action
|
||||
- (void)roomViewControllerDidStopLiveLocationSharing:(RoomViewController *)roomViewController;
|
||||
- (void)roomViewControllerDidStopLiveLocationSharing:(RoomViewController *)roomViewController beaconInfoEventId:(nullable NSString*)beaconInfoEventId;
|
||||
|
||||
/// User tap live location sharing banner
|
||||
- (void)roomViewControllerDidTapLiveLocationSharingBanner:(RoomViewController *)roomViewController;
|
||||
|
||||
@@ -3162,6 +3162,26 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
[self mention:roomMember];
|
||||
}
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellStopShareButtonPressed])
|
||||
{
|
||||
NSString *beaconInfoEventId;
|
||||
|
||||
if ([bubbleData isKindOfClass:[RoomBubbleCellData class]])
|
||||
{
|
||||
RoomBubbleCellData *roomBubbleCellData = (RoomBubbleCellData*)bubbleData;
|
||||
beaconInfoEventId = roomBubbleCellData.beaconInfoSummary.id;
|
||||
}
|
||||
|
||||
[self.delegate roomViewControllerDidStopLiveLocationSharing:self beaconInfoEventId:beaconInfoEventId];
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellRetryShareButtonPressed])
|
||||
{
|
||||
MXEvent *selectedEvent = userInfo[kMXKRoomBubbleCellEventKey];
|
||||
if (selectedEvent)
|
||||
{
|
||||
// TODO: - Implement retry live location action
|
||||
}
|
||||
}
|
||||
else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnMessageTextView] || [actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnContentView])
|
||||
{
|
||||
// Retrieve the tapped event
|
||||
@@ -3172,6 +3192,10 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
{
|
||||
[self cancelEventSelection];
|
||||
}
|
||||
else if (bubbleData.tag == RoomBubbleCellDataTagLiveLocation)
|
||||
{
|
||||
[self.delegate roomViewController:self didRequestLiveLocationPresentationForBubbleData:bubbleData];
|
||||
}
|
||||
else if (tappedEvent)
|
||||
{
|
||||
if (tappedEvent.eventType == MXEventTypeRoomCreate)
|
||||
|
||||
Reference in New Issue
Block a user