Commit e857c0c1 authored by Alexandre Lision's avatar Alexandre Lision

hotfix: don't come back on previous wizard screen

The name registration can take timeout and client is never notified.
We setup a 30s timer to skip the registration. It should exit with a
success since the account is valid.

Change-Id: Ief304e8afc7d78f56a3e0806acddd8080b89a61c
parent 45c18672
...@@ -277,10 +277,6 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2; ...@@ -277,10 +277,6 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2;
- (void)setCallback - (void)setCallback
{ {
errorTimer = [NSTimer scheduledTimerWithTimeInterval:30
target:self
selector:@selector(didCreateFailed) userInfo:nil
repeats:NO];
stateChanged = QObject::connect(&AccountModel::instance(), stateChanged = QObject::connect(&AccountModel::instance(),
&AccountModel::accountStateChanged, &AccountModel::accountStateChanged,
[=](Account *account, const Account::RegistrationState state) { [=](Account *account, const Account::RegistrationState state) {
...@@ -313,6 +309,11 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2; ...@@ -313,6 +309,11 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2;
- (void) startNameRegistration:(Account*) account - (void) startNameRegistration:(Account*) account
{ {
// Dismiss this screen if after 30 seconds the name is still not registered
errorTimer = [NSTimer scheduledTimerWithTimeInterval:30
target:self
selector:@selector(nameRegistrationTimeout) userInfo:nil
repeats:NO];
registrationEnded = QObject::connect(account, registrationEnded = QObject::connect(account,
&Account::nameRegistrationEnded, &Account::nameRegistrationEnded,
[=] (NameDirectory::RegisterNameStatus status, const QString& name) { [=] (NameDirectory::RegisterNameStatus status, const QString& name) {
...@@ -340,9 +341,11 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2; ...@@ -340,9 +341,11 @@ NSInteger const ERROR_REPEAT_MISMATCH = -2;
} }
} }
- (void)didCreateFailed - (void)nameRegistrationTimeout
{ {
[self.delegate didCreateAccountWithSuccess:NO]; // This callback is used when registration takes more than 30 seconds
// It skips the wizard and brings the main window
[self.delegate didCreateAccountWithSuccess:YES];
} }
- (IBAction)cancel:(id)sender - (IBAction)cancel:(id)sender
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment