Skip to content

Commit

Permalink
Merge pull request #617 from Simperium/develop
Browse files Browse the repository at this point in the history
Simperium Mk 1.6
  • Loading branch information
jleandroperez committed Mar 4, 2021
2 parents dadba86 + 2ef4c7d commit f4ffbb5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Simperium/SPEnvironment.m
Expand Up @@ -30,7 +30,7 @@
#endif

// TODO: Update this automatically via a script that looks at current git tag
NSString* const SPLibraryVersion = @"1.5.0";
NSString* const SPLibraryVersion = @"1.6.0";

/// SSL Pinning
///
Expand Down
24 changes: 20 additions & 4 deletions Simperium/Simperium.m
Expand Up @@ -837,7 +837,7 @@ - (void)authenticationDidFail {
}

// Delay it a touch to avoid issues with storyboard-driven UIs
[self performSelector:@selector(delayedOpenAuthViewController) withObject:nil afterDelay:0.1];
[self scheduleOpenAuthViewController];
}

- (BOOL)authenticateIfNecessary {
Expand All @@ -850,6 +850,14 @@ - (BOOL)authenticateIfNecessary {
return [self.authenticator authenticateIfNecessary];
}

- (void)scheduleOpenAuthViewController {
[self performSelector:@selector(delayedOpenAuthViewController) withObject:nil afterDelay:0.1];
}

- (void)unscheduleOpenAuthViewController {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayedOpenAuthViewController) object:nil];
}

- (void)delayedOpenAuthViewController {
[self openAuthViewControllerAnimated:YES];
}
Expand Down Expand Up @@ -903,9 +911,15 @@ - (void)openAuthViewControllerAnimated:(BOOL)animated {
}

// Hide the main window and show the auth window instead
[self.window setIsVisible:NO];
[[self.authenticationWindowController window] center];
[[self.authenticationWindowController window] makeKeyAndOrderFront:self];
[self.window setIsVisible:NO];

// Center the AuthWindow *only* when it wasn't previously onscreen (only after alloc!)
NSWindow *authWindow = self.authenticationWindowController.window;
if (!authWindow.isVisible) {
[authWindow center];
}

[authWindow makeKeyAndOrderFront:self];
#endif
}

Expand All @@ -921,6 +935,8 @@ - (void)closeAuthViewControllerAnimated:(BOOL)animated {
[[self.authenticationWindowController window] close];
self.authenticationWindowController = nil;
#endif

[self unscheduleOpenAuthViewController];
}


Expand Down

0 comments on commit f4ffbb5

Please sign in to comment.