mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 17:42:45 +02:00
RoomVC: Handle live location banner display on user location status change.
This commit is contained in:
@@ -230,13 +230,6 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
// scroll state just before the layout change, and restore it after the layout.
|
||||
@property (nonatomic) BOOL wasScrollAtBottomBeforeLayout;
|
||||
|
||||
/// Handles all banners that should be displayed at the top of the timeline but that should not scroll with the timeline
|
||||
@property (weak, nonatomic, nullable) IBOutlet UIStackView *topBannersStackView;
|
||||
|
||||
@property (nonatomic) BOOL shouldShowLiveLocationSharingBannerView;
|
||||
|
||||
@property (nonatomic, weak) LiveLocationSharingBannerView *liveLocationSharingBannerView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomViewController
|
||||
@@ -408,6 +401,8 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
[self setupActions];
|
||||
|
||||
[self setupUserSuggestionViewIfNeeded];
|
||||
|
||||
[self.topBannersStackView vc_removeAllSubviews];
|
||||
}
|
||||
|
||||
- (void)userInterfaceThemeDidChange
|
||||
@@ -547,6 +542,8 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
|
||||
notificationTaskProfile = [MXSDKOptions.sharedInstance.profiler startMeasuringTaskWithName:MXTaskProfileNameNotificationsOpenEvent];
|
||||
}
|
||||
|
||||
[self updateTopBanners];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
@@ -1526,6 +1523,11 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
missedDiscussionsDotView.hidden = missedDiscussionsBadgeHidden;
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowLiveLocationSharingBannerView
|
||||
{
|
||||
return customizedRoomDataSource.isCurrentUserSharingIsLocation;
|
||||
}
|
||||
|
||||
#pragma mark - Internals
|
||||
|
||||
- (UIBarButtonItem *)videoCallBarButtonItem
|
||||
@@ -2419,12 +2421,7 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
{
|
||||
[self.view bringSubviewToFront:self.topBannersStackView];
|
||||
|
||||
[self.topBannersStackView vc_removeAllSubviews];
|
||||
|
||||
if (self.shouldShowLiveLocationSharingBannerView)
|
||||
{
|
||||
[self showLiveLocationBannerView];
|
||||
}
|
||||
[self updateLiveLocationBannerViewVisibility];
|
||||
}
|
||||
|
||||
#pragma mark - Jitsi
|
||||
@@ -4415,6 +4412,11 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
[Analytics.shared trackInteraction:AnalyticsUIElementRoomThreadSummaryItem];
|
||||
}
|
||||
|
||||
- (void)roomDataSourceDidUpdateCurrentUserSharingLocationStatus:(RoomDataSource *)roomDataSource
|
||||
{
|
||||
[self updateLiveLocationBannerViewVisibility];
|
||||
}
|
||||
|
||||
#pragma mark - Segues
|
||||
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
|
||||
@@ -7411,34 +7413,4 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
[self stopActivityIndicator];
|
||||
}
|
||||
|
||||
#pragma mark - Live location sharing
|
||||
|
||||
- (void)showLiveLocationBannerView
|
||||
{
|
||||
if (self.liveLocationSharingBannerView)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LiveLocationSharingBannerView *bannerView = [LiveLocationSharingBannerView instantiate];
|
||||
|
||||
[bannerView updateWithTheme:ThemeService.shared.theme];
|
||||
|
||||
MXWeakify(self);
|
||||
|
||||
bannerView.didTapBackground = ^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self.delegate roomViewControllerDidTapLiveLocationSharingBanner:self];
|
||||
};
|
||||
|
||||
bannerView.didTapStopButton = ^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self.delegate roomViewControllerDidStopLiveLocationSharing:self];
|
||||
};
|
||||
|
||||
[self.topBannersStackView addArrangedSubview:bannerView];
|
||||
|
||||
self.liveLocationSharingBannerView = bannerView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user