Universal link + next link: Forward the next_link parameters to AuthenticationVC

This commit is contained in:
manuroe 2016-04-21 16:19:16 +02:00
parent 767ac0044b
commit d58016b47b
5 changed files with 54 additions and 2 deletions

View file

@ -922,8 +922,19 @@
}
else if ([pathParams[0] isEqualToString:@"register"])
{
NSLog(@"[AppDelegate] Universal link: Registration next_link parameters: %@", queryParams);
continueUserActivity = YES;
// This is the nextLink in the registration process
// The app should already display the auth VC. So, do nothing at the UI level
if (_homeViewController.authViewController)
{
NSLog(@"[AppDelegate] Universal link: Forward next_link parameter to the existing AuthViewController");
[_homeViewController.authViewController registerWithNextLinkParameters:queryParams];
}
else
{
NSLog(@"[AppDelegate] Universal link: TODO");
}
}
else
{

View file

@ -33,5 +33,12 @@
@property (weak, nonatomic) IBOutlet UIView *homeServerSeparator;
@property (weak, nonatomic) IBOutlet UIView *identityServerSeparator;
/**
Pursue the registration process from the next_link sent in an email validation email.
@param nextLinkParameters the parameters extracted from next_link link.
*/
- (void)registerWithNextLinkParameters:(NSDictionary*)nextLinkParameters;
@end

View file

@ -214,6 +214,12 @@
#pragma mark -
- (void)registerWithNextLinkParameters:(NSDictionary *)nextLinkParameters
{
// Giom: Help!!!
NSLog(@"[AuthenticationViewController] registerWithNextLinkParameters: TODO: %@", nextLinkParameters);
}
- (void)hideServerOptionsContainer:(BOOL)hidden
{
if (self.serverOptionsContainer.isHidden == hidden)

View file

@ -18,6 +18,7 @@
#import "SegmentedViewController.h"
#import "RoomViewController.h"
#import "AuthenticationViewController.h"
/**
The `HomeViewController` screen is the main app screen.
@ -34,6 +35,8 @@
@property (nonatomic, readonly) MXSession *selectedRoomSession;
@property (nonatomic, readonly) RoomPreviewData *selectedRoomPreviewData;
// Reference to the current auth VC. It is not nil only when the auth screen is displayed.
@property (nonatomic, readonly) AuthenticationViewController *authViewController;
/**
Display the authentication screen.

View file

@ -43,6 +43,11 @@
UIImageView* createNewRoomImageView;
MXHTTPOperation *roomCreationRequest;
/**
Observer that check when the Authentification view controller has gone.
*/
id authViewControllerObserver;
}
@end
@ -95,7 +100,13 @@
- (void)destroy
{
[super destroy];
if (authViewControllerObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:authViewControllerObserver];
authViewControllerObserver = nil;
}
if (roomCreationRequest)
{
[roomCreationRequest cancel];
@ -528,6 +539,20 @@
DirectoryViewController *directoryViewController = segue.destinationViewController;
[directoryViewController displayWitDataSource:recentsDataSource.publicRoomsDirectoryDataSource];
}
else if ([[segue identifier] isEqualToString:@"showAuth"])
{
// Keep ref on the authentification view controller while it is displayed
// ie until we get the notification about a new account
_authViewController = segue.destinationViewController;
authViewControllerObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKAccountManagerDidAddAccountNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
_authViewController = nil;
[[NSNotificationCenter defaultCenter] removeObserver:authViewControllerObserver];
authViewControllerObserver = nil;
}];
}
}
// Hide back button title