From ea08526ce7331b29be7c3b371c47d4fd72d540cb Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 30 Oct 2018 16:11:28 -0400 Subject: [PATCH] revert and change slightly --- .../MVMCore/AlertHandling/MVMCoreAlertHandler.h | 6 ++---- .../MVMCore/AlertHandling/MVMCoreAlertHandler.m | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h index 7247245..9e80bb0 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.h @@ -29,17 +29,15 @@ - (BOOL)greedyAlertShowing; /** Shows the popup with the passed in parameter. - * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. * @param isGreedy Sets up a greedy popup. In other words, any popups currently shown or queued are dismissed. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy; /** Shows the alert. - * @param alertObject The origonal alertObject * @param title The title of the alert. * @param message The message of the alert. * @param actions An array of actions for the alert. @@ -48,7 +46,7 @@ * @param alertDelegate The delegate to be notified. * @return Returns the UIAlertController. */ -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate; /** Shows the popup with the passed in alert object. This is a convenience method that automatically handles using the proper alert type based on what's available. * @param alertObject The alert object to use for the alert. diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m index eabd816..ccc30ae 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertHandler.m @@ -72,16 +72,16 @@ return NO; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { - return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy { + return [self showAlertWithTitle:title message:message actions:actions isGreedy:isGreedy alertDelegate:nil]; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - return [self showAlertWithAlertObject:alertObject title:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { + return [self showAlertWithTitle:title message:message actions:actions alertStyle:UIAlertControllerStyleAlert isGreedy:isGreedy alertDelegate:alertDelegate]; } -- (nonnull UIAlertController *)showAlertWithAlertObject:(nullable MVMCoreAlertObject *)alertObject title:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - +- (nonnull UIAlertController *)showAlertWithTitle:(nullable NSString *)title message:(nullable NSString *)message actions:(nullable NSArray*)actions alertStyle:(UIAlertControllerStyle)alertStyle isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { + // It's a greedy alert! Clear all alerts that are queued up and the one that is showing if (isGreedy) { [self removeAllAlertViews]; @@ -89,7 +89,6 @@ // Create the alert. Adds the actions one by one. MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle]; - alertController.alertObject = alertObject; alertController.delegate = alertDelegate; for (NSUInteger i = 0; i < [actions count]; i++) { UIAlertAction *action = [actions objectAtIndex:i ofType:[UIAlertAction class]]; @@ -104,7 +103,9 @@ } - (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject { - return [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + MVMCoreAlertController *controller = [self showAlertWithAlertObject:alertObject title:alertObject.title message:alertObject.message actions:alertObject.actions alertStyle:alertObject.alertStyle isGreedy:alertObject.isGreedy alertDelegate:alertObject.alertDelegate]; + controller.alertObject = alertObject; + return controller; } - (void)removeAllAlertViews {