review feedback
This commit is contained in:
parent
800cc7671a
commit
ba14681a39
@ -18,7 +18,7 @@ public class TopNotificationHandler {
|
|||||||
return MVMCoreActionUtility.fatalClassCheck(object: CoreUIObject.sharedInstance()?.topNotificationHandler)
|
return MVMCoreActionUtility.fatalClassCheck(object: CoreUIObject.sharedInstance()?.topNotificationHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
public init() {
|
||||||
registerWithNotificationCenter()
|
registerWithNotificationCenter()
|
||||||
registerForPageChanges()
|
registerForPageChanges()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) {
|
public init(title: String, message: String, buttonModels: [AlertButtonModel], style: UIAlertController.Style = .alert, delegateObject: DelegateObject?, id: String = UUID().uuidString) {
|
||||||
self.title = title
|
self.title = title
|
||||||
self.message = message
|
self.message = message
|
||||||
|
self.buttonModels = buttonModels
|
||||||
actions = buttonModels.map({ alertButtonModel in
|
actions = buttonModels.map({ alertButtonModel in
|
||||||
return alertButtonModel.generateAction(delegateObject: delegateObject)
|
return alertButtonModel.generateAction(delegateObject: delegateObject)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -164,34 +164,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do nothing if paused
|
// Do nothing if paused
|
||||||
if (!self.isPaused) {
|
if (self.isPaused) {
|
||||||
|
return;
|
||||||
// Show
|
|
||||||
if (![[CoreUIObject sharedInstance].globalTopAlertDelegate respondsToSelector:@selector(getTopAlertView)]) {
|
|
||||||
|
|
||||||
// Needs to be a top alert view....
|
|
||||||
[self markAsFinished];
|
|
||||||
} else {
|
|
||||||
UIView <MVMCoreTopAlertViewProtocol>*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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show
|
||||||
|
if (![[CoreUIObject sharedInstance].globalTopAlertDelegate respondsToSelector:@selector(getTopAlertView)]) {
|
||||||
|
|
||||||
|
// Needs to be a top alert view....
|
||||||
|
[self markAsFinished];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIView <MVMCoreTopAlertViewProtocol>*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.
|
/// Updates the timer to dismiss the top alert.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user