Merge branch 'develop'

Conflicts:
	MVMCore/MVMCore/Models/ModelMapping.swift
This commit is contained in:
Kevin G Christiano 2020-02-12 14:17:14 -05:00
commit 4fa67d8138
6 changed files with 98 additions and 25 deletions

View File

@ -163,6 +163,7 @@
D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */; };
D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCBA23C65BC300C44CC4 /* Percent.swift */; };
D2E1FAD92260C3E400AEFD8C /* DelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */; };
EAE09C5E23F4389600765089 /* ActionOpenPanelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -316,6 +317,7 @@
D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitInterval.swift; sourceTree = "<group>"; };
D2DEDCBA23C65BC300C44CC4 /* Percent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Percent.swift; sourceTree = "<group>"; };
D2E1FAD82260C3E400AEFD8C /* DelegateObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelegateObject.swift; sourceTree = "<group>"; };
EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenPanelModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -457,6 +459,7 @@
01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */,
01F2A04F23A82D0800D954D8 /* ActionTopAlertModel.swift */,
01C851D023CF97FE0021F976 /* ActionBackModel.swift */,
EAE09C5D23F4389600765089 /* ActionOpenPanelModel.swift */,
);
path = ActionType;
sourceTree = "<group>";
@ -904,6 +907,7 @@
D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */,
8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */,
946EE1B2237B5F260036751F /* JSONValue.swift in Sources */,
EAE09C5E23F4389600765089 /* ActionOpenPanelModel.swift in Sources */,
AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */,
AFBB96581FBA3A570008D868 /* FreeBeeAuthObject.m in Sources */,
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */,

View File

@ -16,15 +16,15 @@
@interface MVMCoreAlertHandler : NSObject
// Returns the shared instance of this singleton
/// Returns the shared instance of this singleton
+ (nullable instancetype)sharedAlertHandler;
#pragma mark - Popup Alert Functions
// Returns if any alert is currently showing (even if supressed).
/// Returns if any alert is currently showing (even if supressed).
- (BOOL)alertCurrentlyShowing;
// Returns if a greedy alert is currently showing (even if supressed).
/// Returns if a greedy alert is currently showing (even if supressed).
- (BOOL)greedyAlertShowing;
/** Shows the popup with the passed in parameter.
@ -53,38 +53,51 @@
*/
- (nonnull UIAlertController *)showAlertWithAlertObject:(nonnull MVMCoreAlertObject *)alertObject;
// Removes all alerts.
/** Cancels and removes an alert operation for the given alertObject.
* @param alertObject The alertObject scheduled to be shown.
*/
- (void)removeAlertViewForObject:(nonnull MVMCoreAlertObject *)alertObject;
/** Iterates through all scheduled alerts and cancels any that match the provided predicate.
* @param predicate The predicate block to decide whether to cancel an alert.
*/
- (void)removeAlertViewUsingPredicate:(BOOL(^_Nonnull)(MVMCoreAlertObject * _Nonnull obj))predicate;
/// Removes all alerts.
- (void)removeAllAlertViews;
#pragma mark - Supression Functions
// Returns true if alerts are supressed.
/// Returns true if alerts are supressed.
- (BOOL)mfAlertsSupressed;
// Supresses the alerts (Used by other "apps" in our app).
/// Supresses the alerts (Used by other "apps" in our app).
- (void)supressMFAlerts;
// Unsupresses the alerts (Used by other "apps" in our app).
/// Unsupresses the alerts (Used by other "apps" in our app).
- (void)unSupressMFAlerts;
#pragma mark - Top Alert Functions
// Show based on the object. Will be used by the architecture.
/// Show based on the object. Will be used by the architecture.
- (void)showTopAlertWithObject:(nullable MVMCoreTopAlertObject *)topAlertObject;
// Convenience functions
/// Convenience functions
- (void)showTopAlertErrorWithMessage:(nullable NSString *)message;
- (void)showTopAlertConfirmationWithMessage:(nullable NSString *)message;
- (void)showTopAlertWithType:(nullable NSString *)type message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage persistent:(BOOL)persistent actionMap:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData;
- (void)showTopAlertWithType:(nullable NSString *)type message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage persistent:(BOOL)persistent buttonTitle:(nullable NSString *)buttonTitle userActionHandler:(nullable void (^)(id _Nonnull sender))userActionHandler;
// Hides the current alert view.
/// Hides the current alert view.
- (void)hideTopAlertView;
// Hides a persistent alert based on the type string.
/// Hides a persistent alert based on the type string.
- (void)hidePersistentTopAlertViewOfType:(nullable NSString *)type;
// Removes all top alerts.
/// Removes a scheduled top alert given its top alert object.
- (void)removeTopAlertForObject:(nonnull MVMCoreTopAlertObject *)topAlertObject;
/// Removes all top alerts.
- (void)removeAllTopAlerts;
/// Returns YES if the persistent type is already registered in the alert queue.

View File

@ -107,6 +107,25 @@
return controller;
}
- (void)removeAlertViewForObject:(MVMCoreAlertObject *)alertObject {
for (MVMCoreAlertOperation *operation in self.popupAlertQueue.operations) {
if ([operation.currentAlertView isKindOfClass:[MVMCoreAlertController class]] && [(MVMCoreAlertController *)operation.currentAlertView alertObject] == alertObject) {
[operation cancel];
}
}
}
- (void)removeAlertViewUsingPredicate:(BOOL(^)(MVMCoreAlertObject *obj))predicate {
for (MVMCoreAlertOperation *operation in self.popupAlertQueue.operations) {
if ([operation.currentAlertView isKindOfClass:[MVMCoreAlertController class]]) {
MVMCoreAlertObject *alertObject = [(MVMCoreAlertController *)operation.currentAlertView alertObject];
if (alertObject && predicate(alertObject)) {
[operation cancel];
}
}
}
}
- (void)removeAllAlertViews {
[self.popupAlertQueue cancelAllOperations];
}
@ -225,6 +244,16 @@
}
}
- (void)removeTopAlertForObject:(MVMCoreTopAlertObject *)topAlertObject {
for (MVMCoreTopAlertOperation *operation in self.topAlertQueue.operations) {
// Finds an cancels top alerts associated with the object.
if (operation.topAlertObject == topAlertObject) {
operation.reAddAfterCancel = NO;
[operation cancel];
}
}
}
- (void)removeAllTopAlerts {
[self.topAlertQueue cancelAllOperations];
}

View File

@ -14,23 +14,26 @@
@interface MVMCoreAlertOperation : MVMCoreOperation
// If this operation is temporarily paused.
/// Alert controller to be displayed.
@property (nonnull, readonly) UIAlertController *currentAlertView;
/// If this operation is temporarily paused.
@property (readonly, getter=isPaused) BOOL paused;
// If this alert is a greedy alert (See MVMCoreAlertHandler).
/// If this alert is a greedy alert (See MVMCoreAlertHandler).
@property (readonly, getter=isGreedy) BOOL greedy;
// The alert delegate if needed.
/// The alert delegate if needed.
@property (readonly, nullable, nonatomic, weak) NSObject <MVMCoreAlertDelegateProtocol> *alertDelegate;
// Initializes the operation with the alert to display and if it is greedy or not.
/// Initializes the operation with the alert to display and if it is greedy or not.
- (nullable instancetype)initWithAlert:(nonnull UIAlertController *)alert isGreedy:(BOOL)isGreedy;
- (nullable instancetype)initWithAlert:(nonnull UIAlertController *)alert isGreedy:(BOOL)isGreedy alertDelegate:(nullable id <MVMCoreAlertDelegateProtocol>)alertDelegate;
// Pauses the operation. Temporarily removes any alert.
/// Pauses the operation. Temporarily removes any alert.
- (void)pause;
// Unpauses the operation, resuming any alert.
/// Unpauses the operation, resuming any alert.
- (void)unpause;
@end

View File

@ -0,0 +1,23 @@
//
// ActionOpenPanelModel.swift
// MVMCore
//
// Created by Khan, Arshad on 12/02/20.
// Copyright © 2020 myverizon. All rights reserved.
//
import Foundation
@objcMembers public class ActionOpenPanelModel: ActionModelProtocol {
public static var identifier: String = "openPanel"
public var actionType: String?
public var panel: String
public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary?
// Temporary fix till server changes
public var title: String?
public init(panel: String) {
self.panel = panel
}
}

View File

@ -10,12 +10,13 @@ import Foundation
@objcMembers public class ModelMapping: NSObject {
public static func registerObjects() {
try? ModelRegistry.register(ActionOpenPageModel.self)
try? ModelRegistry.register(ActionOpenUrlModel.self)
try? ModelRegistry.register(ActionOpenAppModel.self)
try? ModelRegistry.register(ActionCallModel.self)
try? ModelRegistry.register(ActionPopupModel.self)
try? ModelRegistry.register(ActionTopAlertModel.self)
try? ModelRegistry.register(ActionBackModel.self)
ModelRegistry.register(ActionOpenPageModel.self)
ModelRegistry.register(ActionOpenUrlModel.self)
ModelRegistry.register(ActionOpenAppModel.self)
ModelRegistry.register(ActionCallModel.self)
ModelRegistry.register(ActionPopupModel.self)
ModelRegistry.register(ActionTopAlertModel.self)
ModelRegistry.register(ActionBackModel.self)
ModelRegistry.register(ActionOpenPanelModel.self)
}
}