merged element 1.8.10

This commit is contained in:
Arnfried Griesert
2022-05-03 12:48:01 +02:00
1235 changed files with 50869 additions and 23132 deletions
+26 -49
View File
@@ -74,13 +74,6 @@
@property (nonatomic) BOOL reviewSessionAlertHasBeenDisplayed;
/**
A flag to indicate that the analytics prompt should be shown during `-addMatrixSession:`.
*/
@property(nonatomic) BOOL presentAnalyticsPromptOnAddSession;
@property (nonatomic, strong) SecureBackupSetupCoordinatorBridgePresenter *secureBackupSetupCoordinatorBridgePresenter;
@end
@implementation MasterTabBarController
@@ -122,9 +115,9 @@
self.delegate = self;
_isOnboardingInProgress = NO;
self.isOnboardingInProgress = NO;
// Note: UITabBarViewController shoud not be embed in a UINavigationController (https://github.com/vector-im/riot-ios/issues/3086)
// Note: UITabBarViewController should not be embed in a UINavigationController (https://github.com/vector-im/riot-ios/issues/3086)
[self vc_removeBackTitle];
/**
@@ -234,20 +227,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
@@ -350,7 +329,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];
@@ -370,6 +349,8 @@
{
NSInteger index = [self indexOfTabItemWithTag:tabBarIndex];
self.selectedIndex = index;
titleView.titleLabel.text = [self getTitleForItemViewController:self.selectedViewController];
}
#pragma mark -
@@ -457,12 +438,6 @@
return;
}
if (self.presentAnalyticsPromptOnAddSession)
{
self.presentAnalyticsPromptOnAddSession = NO;
[self promptUserBeforeUsingAnalyticsForSession:mxSession];
}
// Check whether the controller'€™s view is loaded into memory.
if (self.viewControllers)
{
@@ -557,7 +532,7 @@
[self.onboardingCoordinatorBridgePresenter dismissWithAnimated:YES completion:nil];
self.onboardingCoordinatorBridgePresenter = nil;
self.isOnboardingInProgress = NO;
self.isOnboardingInProgress = NO; // Must be set before calling didCompleteAuthentication
[self.masterTabBarDelegate masterTabBarControllerDidCompleteAuthentication:self];
};
@@ -568,7 +543,8 @@
self.addAccountObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKAccountManagerDidAddAccountNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXStrongifyAndReturnIfNil(self);
#warning What was this doing? This should probably happen elsewhere
// What was this doing? This should probably happen elsewhere
// self.onboardingCoordinatorBridgePresenter = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self.addAccountObserver];
@@ -578,7 +554,8 @@
self.removeAccountObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKAccountManagerDidRemoveAccountNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXStrongifyAndReturnIfNil(self);
// The user has cleared data for their soft logged out account
#warning What was this doing? This should probably happen elsewhere
// What was this doing? This should probably happen elsewhere
// self.onboardingCoordinatorBridgePresenter = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self.removeAccountObserver];
@@ -860,6 +837,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
@@ -987,18 +975,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
@@ -1011,14 +987,15 @@
}
self.reviewSessionAlertHasBeenDisplayed = YES;
// Force verification if required by the HS configuration
if (session.homeserverWellknown.backupRequired)
if (session.vc_homeserverConfiguration.encryption.isSecureBackupRequired)
{
NSLog(@"[MasterTabBarController] presentVerifyCurrentSessionAlertIfNeededWithSession: Force verification of the device");
[[AppDelegate theDelegate] presentCompleteSecurityForSession:session];
return;
}
[self presentVerifyCurrentSessionAlertWithSession:session];
}
@@ -1160,7 +1137,7 @@
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
titleView.titleLabel.text = viewController.accessibilityLabel;
titleView.titleLabel.text = [self getTitleForItemViewController:viewController];
}
#pragma mark - Hardened -