mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 18:12:44 +02:00
MESSENGER-2762 Initial Merge
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright (c) 2021 BWI GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -78,6 +79,8 @@
|
||||
*/
|
||||
@property(nonatomic) BOOL presentAnalyticsPromptOnAddSession;
|
||||
|
||||
@property (nonatomic, strong) SecureBackupSetupCoordinatorBridgePresenter *secureBackupSetupCoordinatorBridgePresenter;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MasterTabBarController
|
||||
@@ -124,6 +127,19 @@
|
||||
// Note: UITabBarViewController shoud not be embed in a UINavigationController (https://github.com/vector-im/riot-ios/issues/3086)
|
||||
[self vc_removeBackTitle];
|
||||
|
||||
/**
|
||||
* Remove unused ViewController Home & Groups from TabBarViewController array.
|
||||
* In a later release it will be may be deactivated again and this code
|
||||
* can be removed.
|
||||
*
|
||||
* Furthermore the code set the select viewcontroller to people.
|
||||
*/
|
||||
NSMutableArray *tbViewControllers = [NSMutableArray arrayWithArray:[self viewControllers]];
|
||||
[tbViewControllers removeLastObject]; // remove GroupsViewController from tabbar
|
||||
[tbViewControllers removeLastObject]; // remove HomeViewController from tabbar
|
||||
self.viewControllers = tbViewControllers;
|
||||
self.selectedIndex = TABBAR_PEOPLE_INDEX;
|
||||
|
||||
[self setupTitleView];
|
||||
titleView.titleLabel.text = [VectorL10n titleHome];
|
||||
|
||||
@@ -183,6 +199,20 @@
|
||||
MXLogDebug(@"[MasterTabBarController] viewDidAppear");
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
if (BuildSettings.bwiShowMatomoInfoScreen) {
|
||||
NSString *matomoInfoScreenShownKey = @"bwi_matomo_info_screen_shown";
|
||||
if (![[NSUserDefaults standardUserDefaults] boolForKey: matomoInfoScreenShownKey]) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey: matomoInfoScreenShownKey];
|
||||
[self bwiShowMatomoInfoScreen];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the splash screen only one time although
|
||||
* the viewDidAppear is invoked multiple time in the
|
||||
* startup workflow.
|
||||
*/
|
||||
|
||||
// Check whether we're not logged in
|
||||
BOOL authIsShown = NO;
|
||||
if (![MXKAccountManager sharedManager].accounts.count)
|
||||
@@ -245,6 +275,9 @@
|
||||
[childViewControllers removeAllObjects];
|
||||
}
|
||||
|
||||
if ([[AppDelegate theDelegate] checkJailbreak]) {
|
||||
[[AppDelegate theDelegate] checkIntegrity];
|
||||
}
|
||||
[[AppDelegate theDelegate] checkAppVersion];
|
||||
}
|
||||
}
|
||||
@@ -280,6 +313,7 @@
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:kThemeServiceDidChangeThemeNotificationObserver];
|
||||
kThemeServiceDidChangeThemeNotificationObserver = nil;
|
||||
}
|
||||
|
||||
|
||||
if (spaceNotificationCounterDidUpdateNotificationCountObserver)
|
||||
{
|
||||
@@ -364,15 +398,13 @@
|
||||
[self.roomsViewController displayList:recentsDataSource];
|
||||
|
||||
// Restore the right delegate of the shared recent data source.
|
||||
id<MXKDataSourceDelegate> recentsDataSourceDelegate = self.homeViewController;
|
||||
RecentsDataSourceMode recentsDataSourceMode = RecentsDataSourceModeHome;
|
||||
|
||||
id<MXKDataSourceDelegate> recentsDataSourceDelegate = self.peopleViewController;
|
||||
RecentsDataSourceMode recentsDataSourceMode = RecentsDataSourceModePeople;
|
||||
|
||||
NSInteger tabItemTag = self.tabBar.items[self.selectedIndex].tag;
|
||||
|
||||
switch (tabItemTag)
|
||||
{
|
||||
case TABBAR_HOME_INDEX:
|
||||
break;
|
||||
case TABBAR_FAVOURITES_INDEX:
|
||||
recentsDataSourceDelegate = self.favouritesViewController;
|
||||
recentsDataSourceMode = RecentsDataSourceModeFavourites;
|
||||
@@ -385,7 +417,10 @@
|
||||
recentsDataSourceDelegate = self.roomsViewController;
|
||||
recentsDataSourceMode = RecentsDataSourceModeRooms;
|
||||
break;
|
||||
|
||||
case TABBAR_HOME_INDEX:
|
||||
recentsDataSourceDelegate = self.homeViewController;
|
||||
recentsDataSourceMode = RecentsDataSourceModeHome;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -409,6 +444,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[self bwiCheckForPersonalNotesRoom];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +464,7 @@
|
||||
}
|
||||
|
||||
// Check whether the controller's view is loaded into memory.
|
||||
if (self.homeViewController)
|
||||
if (self.viewControllers)
|
||||
{
|
||||
// Check whether the data sources have been initialized.
|
||||
if (!recentsDataSource)
|
||||
@@ -974,6 +1011,14 @@
|
||||
}
|
||||
|
||||
self.reviewSessionAlertHasBeenDisplayed = YES;
|
||||
|
||||
// Force verification if required by the HS configuration
|
||||
if (session.homeserverWellknown.backupRequired)
|
||||
{
|
||||
[[AppDelegate theDelegate] presentCompleteSecurityForSession:session];
|
||||
return;
|
||||
}
|
||||
|
||||
[self presentVerifyCurrentSessionAlertWithSession:session];
|
||||
}
|
||||
|
||||
@@ -1052,16 +1097,18 @@
|
||||
[self showSettingsSecurityScreenForSession:session];
|
||||
}]];
|
||||
|
||||
[alert addAction:[UIAlertAction actionWithTitle:[VectorL10n later]
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
|
||||
[alert addAction:[UIAlertAction actionWithTitle:[VectorL10n doNotAskAgain]
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * action) {
|
||||
RiotSettings.shared.hideReviewSessionsAlert = YES;
|
||||
}]];
|
||||
|
||||
if (!session.homeserverWellknown.backupRequired)
|
||||
{
|
||||
[alert addAction:[UIAlertAction actionWithTitle:[VectorL10n later]
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
|
||||
[alert addAction:[UIAlertAction actionWithTitle:[VectorL10n doNotAskAgain]
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * action) {
|
||||
RiotSettings.shared.hideReviewSessionsAlert = YES;
|
||||
}]];
|
||||
}
|
||||
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
|
||||
@@ -1116,4 +1163,78 @@
|
||||
titleView.titleLabel.text = viewController.accessibilityLabel;
|
||||
}
|
||||
|
||||
#pragma mark - Hardened -
|
||||
|
||||
#pragma mark - Mandatory SSSS
|
||||
|
||||
- (void)presentSecureBackupSetupForMatrixSession:(MXSession*)session
|
||||
{
|
||||
if (self.secureBackupSetupCoordinatorBridgePresenter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SecureBackupSetupCoordinatorBridgePresenter *keyBackupSetupCoordinatorBridgePresenter = [[SecureBackupSetupCoordinatorBridgePresenter alloc] initWithSession:session allowOverwrite:false];
|
||||
keyBackupSetupCoordinatorBridgePresenter.delegate = self;
|
||||
|
||||
[keyBackupSetupCoordinatorBridgePresenter presentFrom:self animated:NO];
|
||||
|
||||
self.secureBackupSetupCoordinatorBridgePresenter = keyBackupSetupCoordinatorBridgePresenter;
|
||||
}
|
||||
|
||||
#pragma mark - SecureBackupSetupCoordinatorBridgePresenterDelegate
|
||||
|
||||
- (void)secureBackupSetupCoordinatorBridgePresenterDelegateDidComplete:(SecureBackupSetupCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
[self.secureBackupSetupCoordinatorBridgePresenter dismissWithAnimated:YES completion:nil];
|
||||
self.secureBackupSetupCoordinatorBridgePresenter = nil;
|
||||
}
|
||||
|
||||
- (void)secureBackupSetupCoordinatorBridgePresenterDelegateDidCancel:(SecureBackupSetupCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
[self.secureBackupSetupCoordinatorBridgePresenter dismissWithAnimated:YES completion:nil];
|
||||
self.secureBackupSetupCoordinatorBridgePresenter = nil;
|
||||
}
|
||||
|
||||
#pragma mark - bwi sync management
|
||||
|
||||
- (void) bwiOnUnlockedByPin {
|
||||
NSInteger tabItemTag = self.tabBar.items[self.selectedIndex].tag;
|
||||
|
||||
switch (tabItemTag)
|
||||
{
|
||||
case TABBAR_FAVOURITES_INDEX:
|
||||
[self.favouritesViewController setupTopBanner];
|
||||
break;
|
||||
case TABBAR_PEOPLE_INDEX:
|
||||
[self.peopleViewController setupTopBanner];
|
||||
break;
|
||||
case TABBAR_ROOMS_INDEX:
|
||||
[self.roomsViewController setupTopBanner];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) bwiCheckForPersonalNotesRoom {
|
||||
PersonalNotesDefaultService *service = [PersonalNotesDefaultService service:self.mxSessions.firstObject];
|
||||
if (BuildSettings.bwiResetPersonalNotesAccountData) {
|
||||
[service resetPersonalNotesRoom];
|
||||
}
|
||||
if (BuildSettings.bwiPersonalNotesRoom) {
|
||||
[service createPersonalNotesRoomIfNeeded];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - bwi matomo tracking
|
||||
|
||||
- (void) bwiShowMatomoInfoScreen {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
|
||||
message:NSLocalizedStringFromTable(@"MATOMO_USER_INFO", @"Vector", nil)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:NSLocalizedStringFromTable(@"MATOMO_USER_INFO_BUTTON_OK", @"Vector", nil)] style:UIAlertActionStyleDefault handler:nil]];
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user