mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-20 11:09:45 +00:00
Merge pull request #446 from bmourat/remove-uialertview
UIAlertView removed
This commit is contained in:
@@ -296,35 +296,14 @@
|
||||
//controller should dismiss us shortly..
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {}];
|
||||
[alertController addAction:okAction];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf setLoginUIEnabled:YES];
|
||||
});
|
||||
|
||||
@@ -241,40 +241,20 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
||||
[self dismissAuthenticationControllerAnimated:YES completion:nil];
|
||||
} else {
|
||||
BITHockeyLogError(@"Validation failed with error: %@", error);
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf validate];
|
||||
}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
otherButtonTitles:nil];
|
||||
[alertView setTag:0];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf validate];
|
||||
}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
[self showAlertController:alertController];
|
||||
}
|
||||
});
|
||||
}];
|
||||
@@ -1006,17 +986,6 @@ static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger) __unused buttonIndex {
|
||||
if (alertView.tag == 0) {
|
||||
[self validate];
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@end
|
||||
|
||||
#endif /* HOCKEYSDK_FEATURE_AUTHENTICATOR */
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@class BITHockeyAppClient;
|
||||
|
||||
@interface BITAuthenticator ()<BITAuthenticationViewControllerDelegate, UIAlertViewDelegate>
|
||||
@interface BITAuthenticator ()<BITAuthenticationViewControllerDelegate>
|
||||
|
||||
/**
|
||||
Delegate that can be used to do any last minute configurations on the
|
||||
|
||||
@@ -1082,65 +1082,36 @@ __attribute__((noreturn)) static void uncaught_cxx_exception_handler(const BITCr
|
||||
if (self.alertViewHandler) {
|
||||
self.alertViewHandler();
|
||||
} else {
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundTitle"), appName]
|
||||
message:alertDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashDontSendReport")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputDontSend withUserProvidedMetaData:nil];
|
||||
}];
|
||||
|
||||
[alertController addAction:cancelAction];
|
||||
|
||||
UIAlertAction *sendAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashSendReport")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundTitle"), appName]
|
||||
message:alertDescription
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashDontSendReport")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputSend withUserProvidedMetaData:nil];
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputDontSend withUserProvidedMetaData:nil];
|
||||
}];
|
||||
|
||||
[alertController addAction:sendAction];
|
||||
|
||||
if (self.shouldShowAlwaysButton) {
|
||||
UIAlertAction *alwaysSendAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashSendReportAlways")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputAlwaysSend withUserProvidedMetaData:nil];
|
||||
}];
|
||||
|
||||
[alertController addAction:alwaysSendAction];
|
||||
}
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundTitle"), appName]
|
||||
message:alertDescription
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"CrashDontSendReport")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"CrashSendReport"), nil];
|
||||
|
||||
if (self.shouldShowAlwaysButton) {
|
||||
[alertView addButtonWithTitle:BITHockeyLocalizedString(@"CrashSendReportAlways")];
|
||||
}
|
||||
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
[alertController addAction:cancelAction];
|
||||
UIAlertAction *sendAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashSendReport")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputSend withUserProvidedMetaData:nil];
|
||||
}];
|
||||
[alertController addAction:sendAction];
|
||||
if (self.shouldShowAlwaysButton) {
|
||||
UIAlertAction *alwaysSendAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"CrashSendReportAlways")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf handleUserInput:BITCrashManagerUserInputAlwaysSend withUserProvidedMetaData:nil];
|
||||
}];
|
||||
|
||||
[alertController addAction:alwaysSendAction];
|
||||
}
|
||||
|
||||
[self showAlertController:alertController];
|
||||
}
|
||||
#endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */
|
||||
|
||||
@@ -1552,30 +1523,6 @@ __attribute__((noreturn)) static void uncaught_cxx_exception_handler(const BITCr
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions)
|
||||
|
||||
#pragma mark - UIAlertView Delegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
- (void)alertView:(UIAlertView *) __unused alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
switch (buttonIndex) {
|
||||
case 0:
|
||||
[self handleUserInput:BITCrashManagerUserInputDontSend withUserProvidedMetaData:nil];
|
||||
break;
|
||||
case 1:
|
||||
[self handleUserInput:BITCrashManagerUserInputSend withUserProvidedMetaData:nil];
|
||||
break;
|
||||
case 2:
|
||||
[self handleUserInput:BITCrashManagerUserInputAlwaysSend withUserProvidedMetaData:nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#endif /* !defined (HOCKEYSDK_CONFIGURATION_ReleaseCrashOnlyExtensions) */
|
||||
|
||||
|
||||
#pragma mark - Networking
|
||||
|
||||
- (NSData *)postBodyWithXML:(NSString *)xml attachment:(BITHockeyAttachment *)attachment boundary:(NSString *)boundary {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
This ensures that the presentation on iOS 6 and iOS 7 will use the current design on each OS Version.
|
||||
*/
|
||||
|
||||
@interface BITFeedbackListViewController : BITHockeyBaseViewController <UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate, UIAlertViewDelegate, QLPreviewControllerDataSource> {
|
||||
@interface BITFeedbackListViewController : BITHockeyBaseViewController <UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate, QLPreviewControllerDataSource> {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -260,69 +260,30 @@
|
||||
}
|
||||
|
||||
- (void)deleteAllMessagesAction:(id) __unused sender {
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
|
||||
NSString *title = BITHockeyLocalizedString(@"HockeyFeedbackListButtonDeleteAllMessages");
|
||||
NSString *message = BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle");
|
||||
UIAlertControllerStyle controllerStyle = UIAlertControllerStyleAlert;
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
controllerStyle = UIAlertControllerStyleActionSheet;
|
||||
title = BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle");
|
||||
message = nil;
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:controllerStyle];
|
||||
|
||||
|
||||
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllCancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
|
||||
[alertController addAction:cancelAction];
|
||||
|
||||
UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllDelete")
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf deleteAllMessages];
|
||||
}];
|
||||
|
||||
[alertController addAction:deleteAction];
|
||||
|
||||
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
UIActionSheet *deleteAction = [[UIActionSheet alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle")
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllCancel")
|
||||
destructiveButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllDelete")
|
||||
otherButtonTitles:nil
|
||||
];
|
||||
[deleteAction setTag:0];
|
||||
[deleteAction setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
|
||||
[deleteAction showInView:[self viewForShowingActionSheetOnPhone]];
|
||||
} else {
|
||||
UIAlertView *deleteAction = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListButtonDeleteAllMessages")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle")
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllCancel")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllDelete"), nil];
|
||||
|
||||
[deleteAction setTag:0];
|
||||
[deleteAction show];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
NSString *title = BITHockeyLocalizedString(@"HockeyFeedbackListButtonDeleteAllMessages");
|
||||
NSString *message = BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle");
|
||||
UIAlertControllerStyle controllerStyle = UIAlertControllerStyleAlert;
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
controllerStyle = UIAlertControllerStyleActionSheet;
|
||||
title = BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle");
|
||||
message = nil;
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:controllerStyle];
|
||||
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllCancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {}];
|
||||
[alertController addAction:cancelAction];
|
||||
UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllDelete")
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf deleteAllMessages];
|
||||
}];
|
||||
[alertController addAction:deleteAction];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (UIView*) viewForShowingActionSheetOnPhone {
|
||||
@@ -704,98 +665,32 @@
|
||||
#pragma mark - BITAttributedLabelDelegate
|
||||
|
||||
- (void)attributedLabel:(BITAttributedLabel *) __unused label didSelectLinkWithURL:(NSURL *)url {
|
||||
/*
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
UIAlertControllerStyle controllerStyle = UIAlertControllerStyleAlert;
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
controllerStyle = UIAlertControllerStyleActionSheet;
|
||||
}
|
||||
|
||||
UIAlertController *linkAction = [UIAlertController alertControllerWithTitle:[url absoluteString]
|
||||
message:nil
|
||||
preferredStyle:controllerStyle];
|
||||
|
||||
|
||||
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
|
||||
[linkAction addAction:cancelAction];
|
||||
|
||||
UIAlertAction* openAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionOpen")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[url absoluteString]]];
|
||||
}];
|
||||
|
||||
[linkAction addAction:openAction];
|
||||
|
||||
UIAlertAction* copyAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCopy")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
pasteboard.URL = [NSURL URLWithString:[url absoluteString]];
|
||||
}];
|
||||
|
||||
[linkAction addAction:copyAction];
|
||||
|
||||
|
||||
[self presentViewController:linkAction animated:YES completion:nil];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
UIActionSheet *linkAction = [[UIActionSheet alloc] initWithTitle:[url absoluteString]
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCancel")
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionOpen"), BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCopy"), nil
|
||||
];
|
||||
[linkAction setTag:1];
|
||||
[linkAction setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
|
||||
[linkAction showInView:[self viewForShowingActionSheetOnPhone]];
|
||||
} else {
|
||||
UIAlertView *linkAction = [[UIAlertView alloc] initWithTitle:[url absoluteString]
|
||||
message:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCancel")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionOpen"), BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCopy"), nil
|
||||
];
|
||||
|
||||
[linkAction setTag:1];
|
||||
[linkAction show];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
if (buttonIndex == alertView.cancelButtonIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([alertView tag] == 0) {
|
||||
if (buttonIndex == [alertView firstOtherButtonIndex]) {
|
||||
[self deleteAllMessages];
|
||||
}
|
||||
} else {
|
||||
if (buttonIndex == [alertView firstOtherButtonIndex]) {
|
||||
[[UIApplication sharedApplication] openURL:(NSURL *)[NSURL URLWithString:alertView.title]];
|
||||
} else {
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
pasteboard.URL = [NSURL URLWithString:alertView.title];
|
||||
}
|
||||
UIAlertControllerStyle controllerStyle = UIAlertControllerStyleAlert;
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
controllerStyle = UIAlertControllerStyleActionSheet;
|
||||
}
|
||||
UIAlertController *linkAction = [UIAlertController alertControllerWithTitle:[url absoluteString]
|
||||
message:nil
|
||||
preferredStyle:controllerStyle];
|
||||
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {}];
|
||||
[linkAction addAction:cancelAction];
|
||||
UIAlertAction* openAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionOpen")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
[[UIApplication sharedApplication] openURL:(NSURL*)[NSURL URLWithString:(NSString*)[url absoluteString]]];
|
||||
}];
|
||||
[linkAction addAction:openAction];
|
||||
UIAlertAction* copyAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListLinkActionCopy")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
pasteboard.URL = [NSURL URLWithString:(NSString*)[url absoluteString]];
|
||||
}];
|
||||
[linkAction addAction:copyAction];
|
||||
[self presentViewController:linkAction animated:YES completion:nil];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma mark - UIActionSheetDelegate
|
||||
|
||||
@@ -818,7 +713,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - ListViewCellDelegate
|
||||
|
||||
- (void)listCell:(id) __unused cell didSelectAttachment:(BITFeedbackMessageAttachment *)attachment {
|
||||
|
||||
@@ -832,41 +832,22 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *_Nonnull latestImage
|
||||
|
||||
if (self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
/*
|
||||
// Requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageText")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageText")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil];
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused * __nonnull action) {
|
||||
[self showFeedbackListView];
|
||||
}];
|
||||
[alertController addAction:cancelAction];
|
||||
[alertController addAction:showAction];
|
||||
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil];
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *__nonnull action) {
|
||||
[self showFeedbackListView];
|
||||
}];
|
||||
[alertController addAction:cancelAction];
|
||||
[alertController addAction:showAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageText")
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackIgnore")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackShow"), nil
|
||||
];
|
||||
[alertView setTag:0];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
self.incomingMessagesAlertShowing = YES;
|
||||
[self showAlertController:alertController];
|
||||
self.incomingMessagesAlertShowing = YES;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1139,24 +1120,6 @@ typedef void (^BITLatestImageFetchCompletionBlock)(UIImage *_Nonnull latestImage
|
||||
[self submitPendingMessages];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
// invoke the selected action from the action sheet for a location element
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
|
||||
self.incomingMessagesAlertShowing = NO;
|
||||
if (buttonIndex == [alertView firstOtherButtonIndex]) {
|
||||
// Show button has been clicked
|
||||
[self showFeedbackListView];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma mark - Observation Handling
|
||||
|
||||
- (void)setFeedbackObservationMode:(BITFeedbackObservationMode)feedbackObservationMode {
|
||||
|
||||
@@ -36,7 +36,7 @@ extern NSString *const kBITFeedbackUpdateAttachmentThumbnail;
|
||||
|
||||
@class UITapGestureRecognizer;
|
||||
|
||||
@interface BITFeedbackManager () <UIAlertViewDelegate> {
|
||||
@interface BITFeedbackManager () {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
return parentViewController;
|
||||
}
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
|
||||
- (void)showAlertController:(UIViewController *)alertController {
|
||||
|
||||
// always execute this on the main thread
|
||||
@@ -236,7 +236,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)showView:(UIViewController *)viewController {
|
||||
// if we compile Crash only, then BITHockeyBaseViewController is not included
|
||||
|
||||
@@ -77,10 +77,9 @@
|
||||
*
|
||||
* @param alertController The UIAlertController to be presented.
|
||||
*/
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
- (void)showAlertController:(UIViewController *)alertController;
|
||||
*/
|
||||
- (void)showView:(UIViewController *)viewController;
|
||||
|
||||
- (void)showView:(UIViewController *)viewController;
|
||||
#endif
|
||||
|
||||
// Date helpers
|
||||
|
||||
@@ -439,59 +439,33 @@
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!self.updateAlertShowing) {
|
||||
NSString *versionString = [NSString stringWithFormat:@"%@ %@", BITHockeyLocalizedString(@"UpdateVersion"), self.latestStoreVersion];
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateAvailable")
|
||||
message:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), versionString]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *ignoreAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf ignoreAction];
|
||||
}];
|
||||
|
||||
[alertController addAction:ignoreAction];
|
||||
|
||||
UIAlertAction *remindAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateRemindMe")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf remindAction];
|
||||
}];
|
||||
|
||||
[alertController addAction:remindAction];
|
||||
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateAvailable")
|
||||
message:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), versionString]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *ignoreAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf showAction];
|
||||
[strongSelf ignoreAction];
|
||||
}];
|
||||
|
||||
[alertController addAction:showAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateAvailable")
|
||||
message:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), versionString]
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"UpdateRemindMe"), BITHockeyLocalizedString(@"UpdateShow"), nil
|
||||
];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
|
||||
[alertController addAction:ignoreAction];
|
||||
UIAlertAction *remindAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateRemindMe")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf remindAction];
|
||||
}];
|
||||
[alertController addAction:remindAction];
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf showAction];
|
||||
}];
|
||||
[alertController addAction:showAction];
|
||||
[self showAlertController:alertController];
|
||||
self.updateAlertShowing = YES;
|
||||
}
|
||||
});
|
||||
@@ -508,8 +482,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
- (void)ignoreAction {
|
||||
self.updateAlertShowing = NO;
|
||||
[self.userDefaults setObject:self.latestStoreVersion forKey:kBITStoreUpdateIgnoreVersion];
|
||||
@@ -530,22 +502,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// invoke the selected action from the action sheet for a location element
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
if (buttonIndex == [alertView cancelButtonIndex]) {
|
||||
[self ignoreAction];
|
||||
} else if (buttonIndex == [alertView firstOtherButtonIndex]) {
|
||||
// Remind button
|
||||
[self remindAction];
|
||||
} else if (buttonIndex == [alertView firstOtherButtonIndex] + 1) {
|
||||
// Show button
|
||||
[self showAction];
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@end
|
||||
|
||||
#endif /* HOCKEYSDK_FEATURE_STORE_UPDATES */
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#if HOCKEYSDK_FEATURE_STORE_UPDATES
|
||||
|
||||
@interface BITStoreUpdateManager () <UIAlertViewDelegate> {
|
||||
@interface BITStoreUpdateManager () {
|
||||
}
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef NS_ENUM (NSUInteger, BITUpdateSetting) {
|
||||
|
||||
*/
|
||||
|
||||
@interface BITUpdateManager : BITHockeyBaseManager <UIAlertViewDelegate>
|
||||
@interface BITUpdateManager : BITHockeyBaseManager
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name Update Checking
|
||||
|
||||
@@ -87,34 +87,14 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
|
||||
// only show error if we enable that
|
||||
if (self.showFeedback) {
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateError")
|
||||
message:[error localizedDescription]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateError")
|
||||
message:[error localizedDescription]
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
otherButtonTitles:nil];
|
||||
[alert show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateError")
|
||||
message:[error localizedDescription]
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {}];
|
||||
[alertController addAction:okAction];
|
||||
[self showAlertController:alertController];
|
||||
self.showFeedback = NO;
|
||||
}
|
||||
}
|
||||
@@ -555,122 +535,69 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
NSString *title = BITHockeyLocalizedString(@"UpdateAvailable");
|
||||
NSString *message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertMandatoryTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]];
|
||||
if ([self hasNewerMandatoryVersion]) {
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if (strongSelf.blockingView) {
|
||||
[strongSelf.blockingView removeFromSuperview];
|
||||
}
|
||||
[strongSelf showUpdateView];
|
||||
}];
|
||||
|
||||
[alertController addAction:showAction];
|
||||
|
||||
UIAlertAction *installAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
(void)[strongSelf initiateAppDownload];
|
||||
}];
|
||||
|
||||
[alertController addAction:installAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
|
||||
message:message
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"UpdateShow"), BITHockeyLocalizedString(@"UpdateInstall"), nil
|
||||
];
|
||||
[alertView setTag:BITUpdateAlertViewTagMandatoryUpdate];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if (strongSelf.blockingView) {
|
||||
[strongSelf.blockingView removeFromSuperview];
|
||||
}
|
||||
[strongSelf showUpdateView];
|
||||
}];
|
||||
[alertController addAction:showAction];
|
||||
UIAlertAction *installAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
(void)[strongSelf initiateAppDownload];
|
||||
}];
|
||||
[alertController addAction:installAction];
|
||||
[self showAlertController:alertController];
|
||||
self.updateAlertShowing = YES;
|
||||
} else {
|
||||
message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]];
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *ignoreAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if ([strongSelf expiryDateReached] && !strongSelf.blockingView) {
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
}];
|
||||
|
||||
[alertController addAction:ignoreAction];
|
||||
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *ignoreAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if (strongSelf.blockingView) {
|
||||
[strongSelf.blockingView removeFromSuperview];
|
||||
if ([strongSelf expiryDateReached] && !strongSelf.blockingView) {
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
[strongSelf showUpdateView];
|
||||
}];
|
||||
|
||||
[alertController addAction:showAction];
|
||||
|
||||
if (self.isShowingDirectInstallOption) {
|
||||
UIAlertAction *installAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
(void)[strongSelf initiateAppDownload];
|
||||
}];
|
||||
|
||||
[alertController addAction:installAction];
|
||||
}
|
||||
|
||||
[self showAlertController:alertController ];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
|
||||
message:message
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"UpdateIgnore")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"UpdateShow"), nil
|
||||
];
|
||||
if (self.isShowingDirectInstallOption) {
|
||||
[alertView addButtonWithTitle:BITHockeyLocalizedString(@"UpdateInstall")];
|
||||
}
|
||||
[alertView setTag:BITUpdateAlertViewTagDefaultUpdate];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
}];
|
||||
[alertController addAction:ignoreAction];
|
||||
UIAlertAction *showAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if (strongSelf.blockingView) {
|
||||
[strongSelf.blockingView removeFromSuperview];
|
||||
}
|
||||
[strongSelf showUpdateView];
|
||||
}];
|
||||
[alertController addAction:showAction];
|
||||
if (self.isShowingDirectInstallOption) {
|
||||
UIAlertAction *installAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
(void)[strongSelf initiateAppDownload];
|
||||
}];
|
||||
[alertController addAction:installAction];
|
||||
}
|
||||
[self showAlertController:alertController ];
|
||||
self.updateAlertShowing = YES;
|
||||
}
|
||||
}
|
||||
@@ -744,55 +671,27 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
|
||||
// nag the user with neverending alerts if we cannot find out the window for presenting the covering sheet
|
||||
- (void)alertFallback:(NSString *)message {
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
if (!self.disableUpdateCheckOptionWhenExpired && [message isEqualToString:self.blockingScreenMessage]) {
|
||||
UIAlertAction *checkAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateButtonCheck")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf checkForUpdateForExpiredVersion];
|
||||
}];
|
||||
|
||||
[alertController addAction:checkAction];
|
||||
}
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
|
||||
message:message
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
otherButtonTitles:nil
|
||||
];
|
||||
|
||||
if (!self.disableUpdateCheckOptionWhenExpired && [message isEqualToString:self.blockingScreenMessage]) {
|
||||
[alertView addButtonWithTitle:BITHockeyLocalizedString(@"UpdateButtonCheck")];
|
||||
}
|
||||
|
||||
[alertView setTag:BITUpdateAlertViewTagNeverEndingAlertView];
|
||||
[alertView show];
|
||||
/*}*/
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}];
|
||||
[alertController addAction:okAction];
|
||||
if (!self.disableUpdateCheckOptionWhenExpired && [message isEqualToString:self.blockingScreenMessage]) {
|
||||
UIAlertAction *checkAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateButtonCheck")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf checkForUpdateForExpiredVersion];
|
||||
}];
|
||||
[alertController addAction:checkAction];
|
||||
}
|
||||
[self showAlertController:alertController];
|
||||
}
|
||||
|
||||
#pragma mark - RequestComments
|
||||
@@ -915,33 +814,15 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
|
||||
#if TARGET_OS_SIMULATOR
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateWarning")
|
||||
message:BITHockeyLocalizedString(@"UpdateSimulatorMessage")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateWarning")
|
||||
message:BITHockeyLocalizedString(@"UpdateSimulatorMessage")
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
otherButtonTitles:nil];
|
||||
[alert show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateWarning")
|
||||
message:BITHockeyLocalizedString(@"UpdateSimulatorMessage")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {}];
|
||||
[alertController addAction:okAction];
|
||||
[self showAlertController:alertController];
|
||||
return NO;
|
||||
|
||||
#else
|
||||
@@ -1087,41 +968,21 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
versionString = [shortVersionString length] ? [NSString stringWithFormat:@"(%@)", versionString] : versionString;
|
||||
NSString *currentVersionString = [NSString stringWithFormat:@"%@ %@ %@%@", self.newestAppVersion.name, BITHockeyLocalizedString(@"UpdateVersion"), shortVersionString, versionString];
|
||||
NSString *alertMsg = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableMessage"), currentVersionString];
|
||||
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
|
||||
// requires iOS 8
|
||||
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
|
||||
if (uialertcontrollerClass) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableTitle")
|
||||
message:alertMsg
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if ([strongSelf expiryDateReached] && !strongSelf.blockingView) {
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
}];
|
||||
|
||||
[alertController addAction:okAction];
|
||||
|
||||
[self showAlertController:alertController];
|
||||
} else {
|
||||
*/
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableTitle")
|
||||
message:alertMsg
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
otherButtonTitles:nil];
|
||||
[alert show];
|
||||
#pragma clang diagnostic pop
|
||||
/*}*/
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableTitle")
|
||||
message:alertMsg
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction __unused *action) {
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
self.updateAlertShowing = NO;
|
||||
if ([strongSelf expiryDateReached] && !strongSelf.blockingView) {
|
||||
[strongSelf alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
}];
|
||||
[alertController addAction:okAction];
|
||||
[self showAlertController:alertController];
|
||||
}
|
||||
|
||||
if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self hasNewerMandatoryVersion])) {
|
||||
@@ -1286,40 +1147,6 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// invoke the selected action from the action sheet for a location element
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
if ([alertView tag] == BITUpdateAlertViewTagNeverEndingAlertView) {
|
||||
if (buttonIndex == 1) {
|
||||
[self checkForUpdateForExpiredVersion];
|
||||
} else {
|
||||
[self alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
self.updateAlertShowing = NO;
|
||||
if (buttonIndex == [alertView firstOtherButtonIndex]) {
|
||||
// YES button has been clicked
|
||||
if (self.blockingView) {
|
||||
[self.blockingView removeFromSuperview];
|
||||
}
|
||||
[self showUpdateView];
|
||||
} else if (buttonIndex == [alertView firstOtherButtonIndex] + 1) {
|
||||
// YES button has been clicked
|
||||
(void)[self initiateAppDownload];
|
||||
} else {
|
||||
if ([self expiryDateReached] && !self.blockingView) {
|
||||
[self alertFallback:self.blockingScreenMessage];
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@end
|
||||
|
||||
#endif /* HOCKEYSDK_FEATURE_UPDATES */
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
- (NSURLRequest *)requestForUpdateCheck;
|
||||
|
||||
// initiates app-download call. displays an system UIAlertView
|
||||
// initiates app-download call. displays an system UIAlertController
|
||||
- (BOOL)initiateAppDownload;
|
||||
|
||||
// get/set current active hockey view controller
|
||||
|
||||
Reference in New Issue
Block a user