Prepare onboarding flow for personalisation screens.

Add a BuildSetting to control the display of the personalisation screens.
Add a property to delay the AuthenticationCoordinator from showing any screens.
Add Congratulations screen to onboarding flow.
This commit is contained in:
Doug
2022-02-24 17:24:04 +00:00
parent 7934501811
commit 9396338c19
23 changed files with 642 additions and 91 deletions
@@ -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
@@ -422,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)
{
@@ -965,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
@@ -575,24 +575,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() {
@@ -684,12 +666,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