mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 11:30:50 +02:00
Merge branch 'develop' into gil/SP1_space_creation
This commit is contained in:
@@ -194,6 +194,5 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
|
||||
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)roomPreviewNavigationParameters completion:(void (^)(void))completion;
|
||||
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters;
|
||||
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters;
|
||||
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController shouldPresentAnalyticsPromptForMatrixSession:(MXSession*)matrixSession;
|
||||
|
||||
@end
|
||||
|
||||
@@ -73,11 +73,6 @@
|
||||
|
||||
@property (nonatomic) BOOL reviewSessionAlertHasBeenDisplayed;
|
||||
|
||||
/**
|
||||
A flag to indicate that the analytics prompt should be shown during `-addMatrixSession:`.
|
||||
*/
|
||||
@property(nonatomic) BOOL presentAnalyticsPromptOnAddSession;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MasterTabBarController
|
||||
@@ -204,20 +199,6 @@
|
||||
|
||||
if (!authIsShown)
|
||||
{
|
||||
// Check whether the user should be prompted to send analytics.
|
||||
if (Analytics.shared.shouldShowAnalyticsPrompt)
|
||||
{
|
||||
MXSession *mxSession = self.mxSessions.firstObject;
|
||||
if (mxSession)
|
||||
{
|
||||
[self promptUserBeforeUsingAnalyticsForSession:mxSession];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.presentAnalyticsPromptOnAddSession = YES;
|
||||
}
|
||||
}
|
||||
|
||||
[self refreshTabBarBadges];
|
||||
|
||||
// Release properly pushed and/or presented view controller
|
||||
@@ -316,7 +297,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
titleView.titleLabel.text = self.selectedViewController.accessibilityLabel;
|
||||
titleView.titleLabel.text = [self getTitleForItemViewController:self.selectedViewController];
|
||||
|
||||
// Need to be called in case of the controllers have been replaced
|
||||
[self.selectedViewController viewDidAppear:NO];
|
||||
@@ -336,6 +317,8 @@
|
||||
{
|
||||
NSInteger index = [self indexOfTabItemWithTag:tabBarIndex];
|
||||
self.selectedIndex = index;
|
||||
|
||||
titleView.titleLabel.text = [self getTitleForItemViewController:self.selectedViewController];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -420,12 +403,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.presentAnalyticsPromptOnAddSession)
|
||||
{
|
||||
self.presentAnalyticsPromptOnAddSession = NO;
|
||||
[self promptUserBeforeUsingAnalyticsForSession:mxSession];
|
||||
}
|
||||
|
||||
// Check whether the controller's view is loaded into memory.
|
||||
if (self.homeViewController)
|
||||
{
|
||||
@@ -825,6 +802,17 @@
|
||||
self.navigationController.navigationBar.hidden = hidden;
|
||||
}
|
||||
|
||||
- (NSString*)getTitleForItemViewController:(UIViewController*)itemViewController
|
||||
{
|
||||
if ([itemViewController conformsToProtocol:@protocol(MasterTabBarItemDisplayProtocol)])
|
||||
{
|
||||
UIViewController<MasterTabBarItemDisplayProtocol> *masterTabBarItem = (UIViewController<MasterTabBarItemDisplayProtocol>*)itemViewController;
|
||||
return masterTabBarItem.masterTabBarItemTitle;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)refreshTabBarBadges
|
||||
@@ -952,18 +940,6 @@
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)promptUserBeforeUsingAnalyticsForSession:(MXSession *)mxSession
|
||||
{
|
||||
// Analytics aren't collected on iOS 12 & 13.
|
||||
if (@available(iOS 14.0, *))
|
||||
{
|
||||
MXLogDebug(@"[MasterTabBarController]: Invite the user to send analytics");
|
||||
[self.masterTabBarDelegate masterTabBarController:self shouldPresentAnalyticsPromptForMatrixSession:mxSession];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Review session
|
||||
|
||||
- (void)presentVerifyCurrentSessionAlertIfNeededWithSession:(MXSession*)session
|
||||
@@ -1115,7 +1091,7 @@
|
||||
|
||||
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
|
||||
{
|
||||
titleView.titleLabel.text = viewController.accessibilityLabel;
|
||||
titleView.titleLabel.text = [self getTitleForItemViewController:viewController];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objc protocol MasterTabBarItemDisplayProtocol {
|
||||
var masterTabBarItemTitle: String { get }
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
import CommonKit
|
||||
|
||||
@objcMembers
|
||||
final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
||||
@@ -53,6 +54,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
||||
return self.navigationRouter.modules.last is MasterTabBarController
|
||||
}
|
||||
|
||||
private var indicators = [UserIndicator]()
|
||||
|
||||
// MARK: Public
|
||||
|
||||
// Must be used only internally
|
||||
@@ -227,8 +230,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
||||
homeViewController.tabBarItem.image = homeViewController.tabBarItem.image
|
||||
homeViewController.accessibilityLabel = VectorL10n.titleHome
|
||||
|
||||
if BuildSettings.appActivityIndicators {
|
||||
homeViewController.activityPresenter = AppActivityIndicatorPresenter(appNavigator: parameters.appNavigator)
|
||||
if BuildSettings.useAppUserIndicators {
|
||||
homeViewController.userIndicatorPresenter = AppUserIndicatorPresenter(appNavigator: parameters.appNavigator)
|
||||
}
|
||||
|
||||
let wrapperViewController = HomeViewControllerWithBannerWrapperViewController(viewController: homeViewController)
|
||||
@@ -580,24 +583,6 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
||||
self.splitViewMasterPresentableDelegate?.splitViewMasterPresentableWantsToResetDetail(self)
|
||||
}
|
||||
|
||||
@available(iOS 14.0, *)
|
||||
private func presentAnalyticsPrompt(with session: MXSession) {
|
||||
let parameters = AnalyticsPromptCoordinatorParameters(session: session)
|
||||
let coordinator = AnalyticsPromptCoordinator(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()
|
||||
}
|
||||
|
||||
// MARK: UserSessions management
|
||||
|
||||
private func registerUserSessionsServiceNotifications() {
|
||||
@@ -715,12 +700,6 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate {
|
||||
|
||||
self.masterTabBarController.navigationItem.leftBarButtonItem = sideMenuBarButtonItem
|
||||
}
|
||||
|
||||
func masterTabBarController(_ masterTabBarController: MasterTabBarController!, shouldPresentAnalyticsPromptForMatrixSession matrixSession: MXSession!) {
|
||||
if #available(iOS 14.0, *) {
|
||||
presentAnalyticsPrompt(with: matrixSession)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - RoomCoordinatorDelegate
|
||||
@@ -733,6 +712,11 @@ extension TabBarCoordinator: RoomCoordinatorDelegate {
|
||||
func roomCoordinatorDidLeaveRoom(_ coordinator: RoomCoordinatorProtocol) {
|
||||
// For the moment when a room is left, reset the split detail with placeholder
|
||||
self.resetSplitViewDetails()
|
||||
if BuildSettings.useAppUserIndicators {
|
||||
parameters.appNavigator
|
||||
.addUserIndicator(.success(VectorL10n.roomParticipantsLeaveSuccess))
|
||||
.store(in: &indicators)
|
||||
}
|
||||
}
|
||||
|
||||
func roomCoordinatorDidCancelRoomPreview(_ coordinator: RoomCoordinatorProtocol) {
|
||||
|
||||
Reference in New Issue
Block a user