Merge branch 'ismail/5068_design_tweaks' into ismail/5096_thread_notifications

This commit is contained in:
ismailgulek
2022-01-12 13:58:48 +03:00
165 changed files with 4485 additions and 928 deletions
@@ -193,5 +193,6 @@ 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
+29 -47
View File
@@ -70,6 +70,11 @@
@property(nonatomic) BOOL reviewSessionAlertHasBeenDisplayed;
/**
A flag to indicate that the analytics prompt should be shown during `-addMatrixSession:`.
*/
@property(nonatomic) BOOL presentAnalyticsPromptOnAddSession;
@end
@implementation MasterTabBarController
@@ -196,11 +201,18 @@
if (!authIsShown)
{
// Check whether the user has been already prompted to send crash reports.
// (Check whether 'enableCrashReport' flag has been set once)
if (!RiotSettings.shared.isEnableCrashReportHasBeenSetOnce)
// Check whether the user should be prompted to send analytics.
if (Analytics.shared.shouldShowAnalyticsPrompt)
{
[self promptUserBeforeUsingAnalytics];
MXSession *mxSession = self.mxSessions.firstObject;
if (mxSession)
{
[self promptUserBeforeUsingAnalyticsForSession:mxSession];
}
else
{
self.presentAnalyticsPromptOnAddSession = YES;
}
}
[self refreshTabBarBadges];
@@ -405,6 +417,12 @@
return;
}
if (self.presentAnalyticsPromptOnAddSession)
{
self.presentAnalyticsPromptOnAddSession = NO;
[self promptUserBeforeUsingAnalyticsForSession:mxSession];
}
// Check whether the controller'€™s view is loaded into memory.
if (self.homeViewController)
{
@@ -921,50 +939,14 @@
#pragma mark -
- (void)promptUserBeforeUsingAnalytics
- (void)promptUserBeforeUsingAnalyticsForSession:(MXSession *)mxSession
{
MXLogDebug(@"[MasterTabBarController]: Invite the user to send crash reports");
__weak typeof(self) weakSelf = self;
[currentAlert dismissViewControllerAnimated:NO completion:nil];
NSString *appDisplayName = [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"];
currentAlert = [UIAlertController alertControllerWithTitle:[VectorL10n googleAnalyticsUsePrompt:appDisplayName] message:nil preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
RiotSettings.shared.enableCrashReport = NO;
if (weakSelf)
{
typeof(self) self = weakSelf;
self->currentAlert = nil;
}
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
RiotSettings.shared.enableCrashReport = YES;
if (weakSelf)
{
typeof(self) self = weakSelf;
self->currentAlert = nil;
}
[[Analytics sharedInstance] start];
}]];
[currentAlert mxk_setAccessibilityIdentifier: @"HomeVCUseAnalyticsAlert"];
[self presentViewController:currentAlert animated:YES completion:nil];
// 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
@@ -559,6 +559,19 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
self.splitViewMasterPresentableDelegate?.splitViewMasterPresentableWantsToResetDetail(self)
}
@available(iOS 14.0, *)
private func presentAnalyticsPrompt(with session: MXSession) {
let parameters = AnalyticsPromptCoordinatorParameters(session: session, navigationRouter: navigationRouter)
let coordinator = AnalyticsPromptCoordinator(parameters: parameters)
coordinator.completion = { [weak self, weak coordinator] in
guard let self = self, let coordinator = coordinator else { return }
self.remove(childCoordinator: coordinator)
}
coordinator.start()
add(childCoordinator: coordinator)
}
// MARK: UserSessions management
private func registerUserSessionsServiceNotifications() {
@@ -650,6 +663,12 @@ 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