From e1261d9e4d1d66628c81de26c89ae57094c7eff6 Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Wed, 10 Nov 2021 21:16:03 +0530 Subject: [PATCH 1/2] Updated hideTopAlert method name --- MVMCoreUI/Alerts/MVMCoreAlertHandler.h | 4 ++-- MVMCoreUI/Alerts/MVMCoreAlertHandler.m | 6 +++--- MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Alerts/MVMCoreAlertHandler.h b/MVMCoreUI/Alerts/MVMCoreAlertHandler.h index 522c5740..0d9bc7cb 100644 --- a/MVMCoreUI/Alerts/MVMCoreAlertHandler.h +++ b/MVMCoreUI/Alerts/MVMCoreAlertHandler.h @@ -101,8 +101,8 @@ /// Hides the current alert view. - (void)hideTopAlertView; -/// Hides a persistent alert based on the type string. -- (void)hidePersistentTopAlertViewOfType:(nullable NSString *)type; +/// Hides a alert based on the type string. +- (void)hideTopAlertViewOfType:(nullable NSString *)type; /// Removes a scheduled top alert given its top alert object. - (void)removeTopAlertForObject:(nonnull MVMCoreTopAlertObject *)topAlertObject; diff --git a/MVMCoreUI/Alerts/MVMCoreAlertHandler.m b/MVMCoreUI/Alerts/MVMCoreAlertHandler.m index 8b4b02c7..20ea95a1 100644 --- a/MVMCoreUI/Alerts/MVMCoreAlertHandler.m +++ b/MVMCoreUI/Alerts/MVMCoreAlertHandler.m @@ -226,12 +226,12 @@ return hasAlert; } -- (void)hidePersistentTopAlertViewOfType:(nullable NSString *)type { +- (void)hideTopAlertViewOfType:(nullable NSString *)type { if (type) { for (MVMCoreTopAlertOperation *operation in self.topAlertQueue.operations) { - // Cancel all persistent operations of this type. - if (operation.topAlertObject.persistent && [operation.topAlertObject.type isEqualToString:type]) { + // Cancel all operations of this type. + if ([operation.topAlertObject.type isEqualToString:type]) { operation.reAddAfterCancel = NO; [operation cancel]; } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift index 454ea7a2..0328f03c 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView+Extension.swift @@ -31,7 +31,7 @@ public extension MVMCoreUITopAlertView { // Dismiss any top alerts that server wants us to dismiss/ if let disableType = loadObject.responseInfoMap?.optionalStringForKey("disableType") { - MVMCoreAlertHandler.shared()?.hidePersistentTopAlertView(ofType: disableType) + MVMCoreAlertHandler.shared()?.hideTopAlertView(ofType: disableType) } // Show any new top alert. From 2b5ce09b104585f2365c526a9585a5bf49103c47 Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Thu, 11 Nov 2021 23:11:31 +0530 Subject: [PATCH 2/2] added new function hideTopAlertViewOfType --- MVMCoreUI/Alerts/MVMCoreAlertHandler.h | 3 +++ MVMCoreUI/Alerts/MVMCoreAlertHandler.m | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/MVMCoreUI/Alerts/MVMCoreAlertHandler.h b/MVMCoreUI/Alerts/MVMCoreAlertHandler.h index 0d9bc7cb..311b0c61 100644 --- a/MVMCoreUI/Alerts/MVMCoreAlertHandler.h +++ b/MVMCoreUI/Alerts/MVMCoreAlertHandler.h @@ -101,6 +101,9 @@ /// Hides the current alert view. - (void)hideTopAlertView; +/// Hides a persistent alert based on the type string. +- (void)hidePersistentTopAlertViewOfType:(nullable NSString *)type; + /// Hides a alert based on the type string. - (void)hideTopAlertViewOfType:(nullable NSString *)type; diff --git a/MVMCoreUI/Alerts/MVMCoreAlertHandler.m b/MVMCoreUI/Alerts/MVMCoreAlertHandler.m index 20ea95a1..977e6293 100644 --- a/MVMCoreUI/Alerts/MVMCoreAlertHandler.m +++ b/MVMCoreUI/Alerts/MVMCoreAlertHandler.m @@ -226,6 +226,19 @@ return hasAlert; } +- (void)hidePersistentTopAlertViewOfType:(nullable NSString *)type { + if (type) { + for (MVMCoreTopAlertOperation *operation in self.topAlertQueue.operations) { + + // Cancel all persistent operations of this type. + if (operation.topAlertObject.persistent && [operation.topAlertObject.type isEqualToString:type]) { + operation.reAddAfterCancel = NO; + [operation cancel]; + } + } + } +} + - (void)hideTopAlertViewOfType:(nullable NSString *)type { if (type) { for (MVMCoreTopAlertOperation *operation in self.topAlertQueue.operations) {