diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index be5e38fe2f..eebbdb26f6 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -153,6 +153,17 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; } return NO; } + +- (void)alertOnFailureStoringTokenInKeychain { + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil + message:BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerStorageError") + delegate:self + cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK") + otherButtonTitles:nil]; + [alertView setTag:1]; + [alertView show]; +} + - (void) identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion { if(_authenticationController) { BITHockeyLog(@"Authentication controller already visible. Ingoring identify request"); @@ -245,6 +256,7 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; delegate:self cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK") otherButtonTitles:nil]; + [alertView setTag:0]; [alertView show]; } }]; @@ -397,7 +409,10 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [strongSelf storeInstallationIdentifier:authToken withType:strongSelf.identificationType]; [strongSelf dismissAuthenticationControllerAnimated:YES completion:nil]; strongSelf->_authenticationController = nil; - [self addStringValueToKeychain:email forKey:kBITAuthenticatorUserEmailKey]; + BOOL success = [self addStringValueToKeychain:email forKey:kBITAuthenticatorUserEmailKey]; + if (!success) { + [strongSelf alertOnFailureStoringTokenInKeychain]; + } } else { identified = NO; } @@ -572,7 +587,10 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; NSString *email = nil; [self.class email:&email andIUID:&installationIdentifier fromOpenURL:url]; if(email) { - [self addStringValueToKeychain:email forKey:kBITAuthenticatorUserEmailKey]; + BOOL success = [self addStringValueToKeychain:email forKey:kBITAuthenticatorUserEmailKey]; + if (!success) { + [self alertOnFailureStoringTokenInKeychain]; + } } else { BITHockeyLog(@"No email found in URL: %@", url); } @@ -767,13 +785,15 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; [self removeKeyFromKeychain:kBITAuthenticatorIdentifierKey]; [self removeKeyFromKeychain:kBITAuthenticatorIdentifierTypeKey]; } else { - BOOL success = [self addStringValueToKeychainForThisDeviceOnly:installationIdentifier + BOOL success1 = [self addStringValueToKeychainForThisDeviceOnly:installationIdentifier forKey:kBITAuthenticatorIdentifierKey]; - NSParameterAssert(success); - success = [self addStringValueToKeychainForThisDeviceOnly:[self.class stringForIdentificationType:type] + NSParameterAssert(success1); + BOOL success2 = [self addStringValueToKeychainForThisDeviceOnly:[self.class stringForIdentificationType:type] forKey:kBITAuthenticatorIdentifierTypeKey]; - NSParameterAssert(success); -#pragma unused(success) + NSParameterAssert(success2); + if (!success1 || !success2) { + [self alertOnFailureStoringTokenInKeychain]; + } } } @@ -851,6 +871,8 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44}; #pragma mark - UIAlertViewDelegate - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - [self validate]; + if (alertView.tag == 0) { + [self validate]; + } } @end diff --git a/Resources/de.lproj/HockeySDK.strings b/Resources/de.lproj/HockeySDK.strings index 8529703ebb..8a4b45b734 100644 --- a/Resources/de.lproj/HockeySDK.strings +++ b/Resources/de.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Die Autorisierung ist fehlgeschlagen, da Ihr Gerät anscheinend nicht mit dem Internet verbunden ist. Bitte erneut versuchen."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Autorisierung fehlgeschlagen. Bitte erneut versuchen oder an den Entwickler dieser App wenden."; "HockeyAuthenticationNotMember" = "Sie sind nicht berechtigt, diese App zu nutzen. Bitte wenden Sie sich an den Entwickler dieser App."; diff --git a/Resources/en.lproj/HockeySDK.strings b/Resources/en.lproj/HockeySDK.strings index c6e2ac4bc8..25229c843d 100644 --- a/Resources/en.lproj/HockeySDK.strings +++ b/Resources/en.lproj/HockeySDK.strings @@ -257,6 +257,8 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Failed to authorize because your device appears to be disconnected from the Internet. Please try again."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; "HockeyAuthenticationFailedAuthenticate" = "Failed to authorize. Please try again or contact the developer of this app."; "HockeyAuthenticationNotMember" = "You are not authorized to use this app. Please contact the developer of this app."; diff --git a/Resources/es.lproj/HockeySDK.strings b/Resources/es.lproj/HockeySDK.strings index a3551572f8..514fd282f8 100644 --- a/Resources/es.lproj/HockeySDK.strings +++ b/Resources/es.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "No se ha podido realizar la autorización porque su dispositivo parece no estar conectado a Internet. Vuelva a intentarlo."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Error de autorización. Vuelva a intentarlo o póngase en contacto con el desarrollador de la app."; "HockeyAuthenticationNotMember" = "No tiene autorización para usar esta app. Póngase en contacto con el desarrollador de la app."; diff --git a/Resources/fr.lproj/HockeySDK.strings b/Resources/fr.lproj/HockeySDK.strings index 9677af296a..a231bf4f4d 100644 --- a/Resources/fr.lproj/HockeySDK.strings +++ b/Resources/fr.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Échec de l'autorisation. Votre appareil semble déconnecté d'Internet. Réessayez."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Échec de l'autorisation. Réessayez ou contactez le développeur de l'application."; "HockeyAuthenticationNotMember" = "Vous n'êtes pas autorisé à utiliser cette application. Contactez le développeur de l'application."; diff --git a/Resources/hr.lproj/HockeySDK.strings b/Resources/hr.lproj/HockeySDK.strings index 1b9d07ddca..9f5a7520c8 100644 --- a/Resources/hr.lproj/HockeySDK.strings +++ b/Resources/hr.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Autorizacija nije uspjela. Vaš uređaj nema pristup internetu. Molimo Vas pokušajte iznova."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Autorizacija nije uspjela. Molimo Vas pokušajte iznova ili kontaktirajte razvojnog programera ove aplikacije."; "HockeyAuthenticationNotMember" = "Vi niste autorizirani za korištenje ove aplikacije. Molimo Vas kontaktirajte razvojnog programera ove aplikacije."; diff --git a/Resources/hu.lproj/HockeySDK.strings b/Resources/hu.lproj/HockeySDK.strings index 88eaa7a5b7..7ecaea350b 100644 --- a/Resources/hu.lproj/HockeySDK.strings +++ b/Resources/hu.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "A hitelesítés sikertelen, mert készüléke nem csatlakozik az internethez. Kérjük, próbálja meg később újra."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "A hitelesítés sikertelen. Kérjük, próbálja meg később újra vagy lépjen kapcsolatba az alkalmazás fejlesztőjével."; "HockeyAuthenticationNotMember" = "Nem jogosult az alkalmazás használatára. Kérjük, lépjen kapcsolatba az alkalmazás fejlesztőjével."; diff --git a/Resources/it.lproj/HockeySDK.strings b/Resources/it.lproj/HockeySDK.strings index 1a125239a4..75753bab84 100644 --- a/Resources/it.lproj/HockeySDK.strings +++ b/Resources/it.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Autorizzazione non riuscita. Pare che il dispositivo non sia connesso a Internet. Riprova."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Autorizzazione non riuscita. Riprova o contatta lo sviluppatore di questa app."; "HockeyAuthenticationNotMember" = "Non sei autorizzato a usare questa app. Contatta lo sviluppatore di questa app."; diff --git a/Resources/ja.lproj/HockeySDK.strings b/Resources/ja.lproj/HockeySDK.strings index 865df99f3b..4532f8a583 100644 --- a/Resources/ja.lproj/HockeySDK.strings +++ b/Resources/ja.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "デバイスがインターネットに接続されていないため、認証できません。やり直してください。"; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "認証できませんでした。やり直すか、このAppのデベロッパに連絡してください。"; "HockeyAuthenticationNotMember" = "このAppの使用を認証されていません。このAppのデベロッパに連絡してください。"; diff --git a/Resources/nl.lproj/HockeySDK.strings b/Resources/nl.lproj/HockeySDK.strings index cd2b2336c7..0d37d47206 100755 --- a/Resources/nl.lproj/HockeySDK.strings +++ b/Resources/nl.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Identiteitscontrole mislukt omdat uw apparaat niet is verbonden met het internet. Probeer opnieuw."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Identiteitscontrole mislukt. Probeer opnieuw of neem contact op met de ontwikkelaar van deze app."; "HockeyAuthenticationNotMember" = "U bent niet gemachtigd om deze app te gebruiken. Neem contact op met de ontwikkelaar van deze app."; diff --git a/Resources/pt-PT.lproj/HockeySDK.strings b/Resources/pt-PT.lproj/HockeySDK.strings index 2273ca2267..70928c4dcb 100644 --- a/Resources/pt-PT.lproj/HockeySDK.strings +++ b/Resources/pt-PT.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Falha ao autorizar porque provavelmente o dispositivo não tem ligação à Internet. Tente novamente."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Falha ao autorizar. Tente novamente ou contacte o programador desta aplicação."; "HockeyAuthenticationNotMember" = "Não está autorizado a utilizar esta aplicação. Contacte o programador desta aplicação."; diff --git a/Resources/pt.lproj/HockeySDK.strings b/Resources/pt.lproj/HockeySDK.strings index b4ff7f97e5..1e09c89615 100644 --- a/Resources/pt.lproj/HockeySDK.strings +++ b/Resources/pt.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Não foi possível autorizar porque seu dispositivo parece estar desconectado da Internet. Tente novamente."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Falha ao autorizar. Tente novamente ou contate o desenvolvedor deste aplicativo."; "HockeyAuthenticationNotMember" = "Você não tem autorização para usar este aplicativo. Contate o desenvolvedor deste aplicativo."; diff --git a/Resources/ro.lproj/HockeySDK.strings b/Resources/ro.lproj/HockeySDK.strings index aae2a983bc..6c0225cf8d 100755 --- a/Resources/ro.lproj/HockeySDK.strings +++ b/Resources/ro.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Failed to authorize because your device appears to be disconnected from the Internet. Please try again."; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Failed to authorize. Please try again or contact the developer of this app."; "HockeyAuthenticationNotMember" = "You are not authorized to use this app. Please contact the developer of this app."; diff --git a/Resources/ru.lproj/HockeySDK.strings b/Resources/ru.lproj/HockeySDK.strings index e0ca880402..da77e3f87b 100644 --- a/Resources/ru.lproj/HockeySDK.strings +++ b/Resources/ru.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "Не удалось авторизоваться, так как ваше устройство не подключено к интернету. Попробуйте еще раз "; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "Авторизация не удалась. Попробуйте еще раз или свяжитесь с разработчиком приложения."; "HockeyAuthenticationNotMember" = "У вас нет разрешения использовать это приложение. Обратитесь к разработчику приложения."; diff --git a/Resources/zh-Hans.lproj/HockeySDK.strings b/Resources/zh-Hans.lproj/HockeySDK.strings index daaa3aa17c..fc8859be3c 100644 --- a/Resources/zh-Hans.lproj/HockeySDK.strings +++ b/Resources/zh-Hans.lproj/HockeySDK.strings @@ -257,6 +257,9 @@ /* Error presented to the user if authentication failed because of networking issues */ "HockeyAuthenticationViewControllerNetworkError" = "你设备的 Internet 连接似乎已断开,导致授权失败。请再试一次。"; +/* Error presented to the user if authentication could not be stored on the device */ +"HockeyAuthenticationViewControllerStorageError" = "Your authentication token could not be stored due to a keychain error. Please contact the developer of the app."; + "HockeyAuthenticationFailedAuthenticate" = "授权错误。请再试一次或联系这个 app 的开发人员。"; "HockeyAuthenticationNotMember" = "你未获授权使用这个程序。请联系这个 app 的开发人员。";