From ba14681a390d1156e5d43e9b32157354b4b72329 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Tue, 18 Apr 2023 11:33:47 -0400 Subject: [PATCH] review feedback --- MVMCoreUI/Alerts/TopNotificationHandler.swift | 2 +- MVMCoreUI/Atomic/Actions/AlertModel.swift | 1 + MVMCoreUI/TopAlert/MVMCoreTopAlertOperation.m | 54 +++++++++---------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/MVMCoreUI/Alerts/TopNotificationHandler.swift b/MVMCoreUI/Alerts/TopNotificationHandler.swift index c711fb3e..937d174e 100644 --- a/MVMCoreUI/Alerts/TopNotificationHandler.swift +++ b/MVMCoreUI/Alerts/TopNotificationHandler.swift @@ -18,7 +18,7 @@ public class TopNotificationHandler { return MVMCoreActionUtility.fatalClassCheck(object: CoreUIObject.sharedInstance()?.topNotificationHandler) } - init() { + public init() { registerWithNotificationCenter() registerForPageChanges() } diff --git a/MVMCoreUI/Atomic/Actions/AlertModel.swift b/MVMCoreUI/Atomic/Actions/AlertModel.swift index b1428b99..96e90054 100644 --- a/MVMCoreUI/Atomic/Actions/AlertModel.swift +++ b/MVMCoreUI/Atomic/Actions/AlertModel.swift @@ -88,6 +88,7 @@ public struct AlertModel: Codable, Identifiable { public init(title: String, message: String, buttonModels: [AlertButtonModel], style: UIAlertController.Style = .alert, delegateObject: DelegateObject?, id: String = UUID().uuidString) { self.title = title self.message = message + self.buttonModels = buttonModels actions = buttonModels.map({ alertButtonModel in return alertButtonModel.generateAction(delegateObject: delegateObject) }) diff --git a/MVMCoreUI/TopAlert/MVMCoreTopAlertOperation.m b/MVMCoreUI/TopAlert/MVMCoreTopAlertOperation.m index acdf3b1c..0692de34 100644 --- a/MVMCoreUI/TopAlert/MVMCoreTopAlertOperation.m +++ b/MVMCoreUI/TopAlert/MVMCoreTopAlertOperation.m @@ -164,34 +164,34 @@ } // Do nothing if paused - if (!self.isPaused) { - - // Show - if (![[CoreUIObject sharedInstance].globalTopAlertDelegate respondsToSelector:@selector(getTopAlertView)]) { - - // Needs to be a top alert view.... - [self markAsFinished]; - } else { - UIView *topAlertView = [[CoreUIObject sharedInstance].globalTopAlertDelegate getTopAlertView]; - [topAlertView showWithTopAlertObject:self.topAlertObject animationDelegate:self completionHandler:^(BOOL finished) { - - self.displayed = YES; - if (self.isCancelled) { - - // Cancelled, dismiss immediately. - [self dismissAlertView:YES]; - } else if (self.isPaused) { - - // Paused, dismiss for the time being if persistent. - [self dismissAlertView:YES]; - } else { - [self updateDismissTimer]; - } - }]; - } - } else { - [self pause]; + if (self.isPaused) { + return; } + + // Show + if (![[CoreUIObject sharedInstance].globalTopAlertDelegate respondsToSelector:@selector(getTopAlertView)]) { + + // Needs to be a top alert view.... + [self markAsFinished]; + return; + } + + UIView *topAlertView = [[CoreUIObject sharedInstance].globalTopAlertDelegate getTopAlertView]; + [topAlertView showWithTopAlertObject:self.topAlertObject animationDelegate:self completionHandler:^(BOOL finished) { + + self.displayed = YES; + if (self.isCancelled) { + + // Cancelled, dismiss immediately. + [self dismissAlertView:YES]; + } else if (self.isPaused) { + + // Paused, dismiss for the time being if persistent. + [self dismissAlertView:YES]; + } else { + [self updateDismissTimer]; + } + }]; } /// Updates the timer to dismiss the top alert.