Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): Crash in getToken api #4290

Merged
merged 2 commits into from Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -34,15 +34,19 @@ extension AWSMobileClient {
AWSMobileClientLogging.verbose("Adding FetchUserPoolTokensOperation operation")
let operation = FetchUserPoolTokensOperation(completion: completionHandler)
operation.delegate = self
tokenOperations.add(operation)
tokenFetchOperationQueue.addOperation {
self.tokenOperations.add(operation)
}
tokenFetchOperationQueue.addOperation(operation)
case .hostedUI:
AWSMobileClientLogging.verbose("Invoking hostedUI getTokens")
let operation = FetchUserPoolTokensOperation(
userPool: AWSCognitoAuth(forKey: AWSMobileClientConstants.CognitoAuthRegistrationKey),
completion: completionHandler)
operation.delegate = self
tokenOperations.add(operation)
tokenFetchOperationQueue.addOperation {
self.tokenOperations.add(operation)
}
tokenFetchOperationQueue.addOperation(operation)
default:
let message = AWSMobileClientConstants.notSignedInMessage
Expand Down
Expand Up @@ -55,12 +55,12 @@ + (NSString *) userContextString:(int) minTarget
CGRect bounds = [[UIScreen mainScreen] nativeBounds];
CGFloat screenWidth = bounds.size.width;
CGFloat screenHeight = bounds.size.height;

NSDateFormatter *localTimeZoneFormatter = [NSDateFormatter new];
localTimeZoneFormatter.timeZone = [NSTimeZone localTimeZone];
localTimeZoneFormatter.dateFormat = @"Z";
NSString *localTimeZoneOffset = [localTimeZoneFormatter stringFromDate:[NSDate date]];

NSString *hourOffset = [localTimeZoneOffset substringToIndex:[localTimeZoneOffset length] - 2];
NSString *minuteOffset = [localTimeZoneOffset substringFromIndex:[localTimeZoneOffset length] - 2];
NSString *timezoneOffset = [NSString stringWithFormat:@"%@:%@",hourOffset,minuteOffset];
Expand Down