Merge branch 'develop' of gitlab.verizon.com:BPHV_MIPS/mvm_core into develop
This commit is contained in:
commit
2db59f8b44
@ -155,8 +155,10 @@
|
||||
AFFCFA661FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */; };
|
||||
AFFCFA681FCCC0D700FD0730 /* MVMCoreLoadingViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
BB780ADF250F8C890030BD2F /* ActionNoopModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */; };
|
||||
D282AAB62240085300C46919 /* MVMCoreGetterUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */; };
|
||||
D282AAB82240342D00C46919 /* NSNumber+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB72240342D00C46919 /* NSNumber+Extension.swift */; };
|
||||
D2CAC7C82510F0C500C75681 /* MVMCoreAlertHandler+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2CAC7C72510F0C500C75681 /* MVMCoreAlertHandler+Extension.swift */; };
|
||||
D2DEDCB723C63F3B00C44CC4 /* Clamping.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB623C63F3B00C44CC4 /* Clamping.swift */; };
|
||||
D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */; };
|
||||
D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCBA23C65BC300C44CC4 /* Percent.swift */; };
|
||||
@ -306,8 +308,10 @@
|
||||
AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingOverlayHandler.h; sourceTree = "<group>"; };
|
||||
AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreLoadingOverlayHandler.m; sourceTree = "<group>"; };
|
||||
AFFCFA641FCCC0D600FD0730 /* MVMCoreLoadingViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingViewControllerProtocol.h; sourceTree = "<group>"; };
|
||||
BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionNoopModel.swift; sourceTree = "<group>"; };
|
||||
D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreGetterUtility+Extension.swift"; sourceTree = "<group>"; };
|
||||
D282AAB72240342D00C46919 /* NSNumber+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSNumber+Extension.swift"; sourceTree = "<group>"; };
|
||||
D2CAC7C72510F0C500C75681 /* MVMCoreAlertHandler+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreAlertHandler+Extension.swift"; sourceTree = "<group>"; };
|
||||
D2DEDCB623C63F3B00C44CC4 /* Clamping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clamping.swift; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
@ -467,6 +471,7 @@
|
||||
94C014D2242119E6005811A9 /* ActionPreviousSubmitModel.swift */,
|
||||
94C014D424211AF0005811A9 /* ActionCancelModel.swift */,
|
||||
94C014D824212360005811A9 /* ActionSettingModel.swift */,
|
||||
BB780ADE250F8C890030BD2F /* ActionNoopModel.swift */,
|
||||
0184D3FE24BE554A00A05369 /* AlertModel.swift */,
|
||||
);
|
||||
path = ActionType;
|
||||
@ -594,6 +599,7 @@
|
||||
AFBB967F1FBA3A9A0008D868 /* MVMCoreAlertHandler.m */,
|
||||
AFBB96801FBA3A9A0008D868 /* MVMCoreAlertObject.h */,
|
||||
AFBB96811FBA3A9A0008D868 /* MVMCoreAlertObject.m */,
|
||||
D2CAC7C72510F0C500C75681 /* MVMCoreAlertHandler+Extension.swift */,
|
||||
0184D3E224B8D0C600A05369 /* MVMCoreAlertObject+Swift.swift */,
|
||||
AFBB96821FBA3A9A0008D868 /* MVMCoreAlertOperation.h */,
|
||||
AFBB96831FBA3A9A0008D868 /* MVMCoreAlertOperation.m */,
|
||||
@ -867,6 +873,7 @@
|
||||
AFBB96641FBA3A570008D868 /* MVMCoreLoadHandler.m in Sources */,
|
||||
AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */,
|
||||
AFBB968E1FBA3A9A0008D868 /* MVMCoreNavigationHandler.m in Sources */,
|
||||
BB780ADF250F8C890030BD2F /* ActionNoopModel.swift in Sources */,
|
||||
D2E1FAD92260C3E400AEFD8C /* DelegateObject.swift in Sources */,
|
||||
01F2A03623A80A7300D954D8 /* ActionModelProtocol.swift in Sources */,
|
||||
AFBB96991FBA3A9A0008D868 /* MVMCoreAlertController.m in Sources */,
|
||||
@ -902,6 +909,7 @@
|
||||
AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */,
|
||||
AFBB96691FBA3A570008D868 /* MVMCoreRequestParameters.m in Sources */,
|
||||
AFED77A31FCCA29400BAE689 /* MVMCoreViewControllerNibMappingObject.m in Sources */,
|
||||
D2CAC7C82510F0C500C75681 /* MVMCoreAlertHandler+Extension.swift in Sources */,
|
||||
8876D5EB1FB50AB000EB2E3D /* NSDecimalNumber+MFConvenience.m in Sources */,
|
||||
0184D3DB24B7D5A600A05369 /* ActionAlertModel.swift in Sources */,
|
||||
AFBB96A41FBA3A9A0008D868 /* MVMCoreTopAlertObject.m in Sources */,
|
||||
|
||||
@ -94,6 +94,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
||||
} else if ([actionType isEqualToString:KeyActionTypeAlert]) {
|
||||
[self showAlert:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
|
||||
} else if ([actionType isEqualToString:KeyActionTypeNoop]){
|
||||
} else if (![self handleOtherActions:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject]) {
|
||||
// not a known action type.
|
||||
[self unknownAction:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
//
|
||||
// MVMCoreAlertHandler+Extension.swift
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Scott Pfeil on 9/15/20.
|
||||
// Copyright © 2020 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// Temporary, until we can move page checking logic into isReady of topAlertOperation.
|
||||
@objcMembers public class NotificationPagesOperation: Operation {
|
||||
public let pages: [String]
|
||||
|
||||
public init(with pages: [String]) {
|
||||
self.pages = pages
|
||||
}
|
||||
|
||||
public override var isReady: Bool {
|
||||
get {
|
||||
return super.isReady && isCancelled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Move this type of logic into isReady for the top alert operation... then can remove this dependency operation.
|
||||
public extension MVMCoreAlertHandler {
|
||||
|
||||
/// Adds a page type dependency to the operation
|
||||
@objc func addPagesDependency(to operation: MVMCoreTopAlertOperation) {
|
||||
// This notification may only show for certain pages.
|
||||
guard let pages = operation.topAlertObject.json?.optionalArrayForKey("pages") as? [String],
|
||||
pages.count > 0 else { return }
|
||||
let pagesOperation = NotificationPagesOperation(with: pages)
|
||||
pageOperations.addOperation(pagesOperation)
|
||||
operation.addDependency(pagesOperation)
|
||||
}
|
||||
|
||||
/// checks top alerts for page dependencies with the new pageType
|
||||
@objc func checkPagesDependency(for pageType: String?) {
|
||||
// If the current running operation should not show on the current page, cancel it. If it's persistent, re-add it. If another operation has had the dependency remove previously, add it back.
|
||||
for case let operation as MVMCoreTopAlertOperation in topAlertQueue.operations {
|
||||
if !operation.isCancelled,
|
||||
let pages = operation.topAlertObject.json?.optionalArrayForKey("pages") as? [String],
|
||||
(pageType == nil || !pages.contains(pageType!)) {
|
||||
if operation.isExecuting {
|
||||
operation.reAddAfterCancel = operation.topAlertObject.persistent
|
||||
operation.cancel()
|
||||
} else if !operation.dependencies.contains(where: { !$0.isFinished }) {
|
||||
let pagesOperation = NotificationPagesOperation(with: pages)
|
||||
pageOperations.addOperation(pagesOperation)
|
||||
operation.addDependency(pagesOperation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the dependency if it contains the current page.
|
||||
guard let pageType = pageType else { return }
|
||||
for case let operation as NotificationPagesOperation in pageOperations.operations {
|
||||
if operation.pages.contains(pageType) {
|
||||
operation.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,15 @@
|
||||
|
||||
@interface MVMCoreAlertHandler : NSObject
|
||||
|
||||
// An operation queue for displaying popup alerts.
|
||||
@property (nonnull, strong, nonatomic) NSOperationQueue *popupAlertQueue;
|
||||
|
||||
// An operation queue for top alerts
|
||||
@property (nonnull, strong, nonatomic) NSOperationQueue *topAlertQueue;
|
||||
|
||||
/// Stores any page dependencies for top alerts
|
||||
@property (nonnull, strong, nonatomic) NSOperationQueue *pageOperations;
|
||||
|
||||
/// Returns the shared instance of this singleton
|
||||
+ (nullable instancetype)sharedAlertHandler;
|
||||
|
||||
|
||||
@ -14,18 +14,13 @@
|
||||
#import "MVMCoreJSONConstants.h"
|
||||
#import "NSDictionary+MFConvenience.h"
|
||||
#import "NSArray+MFConvenience.h"
|
||||
#import <MVMCore/MVMCore-Swift.h>
|
||||
|
||||
@interface MVMCoreAlertHandler ()
|
||||
|
||||
// Flag that keeps track of if the alerts are supressed or not.
|
||||
@property (assign, nonatomic) BOOL mfAlertsSupressed;
|
||||
|
||||
// An operation queue for displaying popup alerts.
|
||||
@property (nonnull, strong, nonatomic) NSOperationQueue *popupAlertQueue;
|
||||
|
||||
// An operation queue for top alerts
|
||||
@property (nonnull, strong, nonatomic) NSOperationQueue *topAlertQueue;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MVMCoreAlertHandler
|
||||
@ -47,6 +42,7 @@
|
||||
self.popupAlertQueue.maxConcurrentOperationCount = 1;
|
||||
self.topAlertQueue = [[NSOperationQueue alloc] init];
|
||||
self.topAlertQueue.maxConcurrentOperationCount = 1;
|
||||
self.pageOperations = [[NSOperationQueue alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -167,14 +163,19 @@
|
||||
if (topAlertObject) {
|
||||
|
||||
__block MVMCoreTopAlertOperation *alertOperation = [[MVMCoreTopAlertOperation alloc] initWithTopAlertObject:topAlertObject];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[alertOperation setCompletionBlock:^{
|
||||
|
||||
// If the alert was cancelled to show another with higher priority, re-add to the operation when cancelled to the queue.
|
||||
if (alertOperation.reAddAfterCancel) {
|
||||
[self showTopAlertWithObject:alertOperation.topAlertObject];
|
||||
[weakSelf showTopAlertWithObject:alertOperation.topAlertObject];
|
||||
}
|
||||
alertOperation = nil;
|
||||
}];
|
||||
|
||||
// This notification may only show for certain pages.
|
||||
[self addPagesDependencyTo:alertOperation];
|
||||
|
||||
[self.topAlertQueue addOperation:alertOperation];
|
||||
|
||||
// If the current running operation is persistent and has a lower queue priority then the added operation, cancel it and re-add it.
|
||||
|
||||
@ -15,6 +15,7 @@ extern NSUInteger const TopAlertDismissTime;
|
||||
|
||||
@property (nonatomic) BOOL persistent;
|
||||
@property (nullable, nonatomic) NSString *type;
|
||||
@property (nonatomic) NSOperationQueuePriority queuePriority;
|
||||
|
||||
// The text
|
||||
@property (nullable, strong, nonatomic) NSString *title;
|
||||
@ -49,6 +50,9 @@ extern NSUInteger const TopAlertDismissTime;
|
||||
@property (nullable, strong, nonatomic) UIColor *backgroundColor;
|
||||
@property (nullable, strong, nonatomic) UIColor *textColor;
|
||||
|
||||
// The full top alert json. Currently only used for molecular.
|
||||
@property (nullable, strong, nonatomic) NSDictionary *json;
|
||||
|
||||
- (nullable instancetype)initWithResponseInfo:(nullable NSDictionary *)responseInfo;
|
||||
|
||||
- (nullable instancetype)initWithType:(nullable NSString *)type message:(nullable NSString *)message;
|
||||
|
||||
@ -42,6 +42,7 @@ extern NSString * const KeyActionTypeTopAlert;
|
||||
extern NSString * const KeyActionTypeSettings;
|
||||
extern NSString * const KeyActionTypeCollapseNotification;
|
||||
extern NSString * const KeyActionTypeAlert;
|
||||
extern NSString * const KeyActionTypeNoop;
|
||||
extern NSString * const KeyActionInformation;
|
||||
extern NSString * const KeyLinkAwayAppURL;
|
||||
extern NSString * const KeyLinkAwayURL;
|
||||
|
||||
@ -42,6 +42,7 @@ NSString * const KeyActionTypeTopAlert = @"topAlert";
|
||||
NSString * const KeyActionTypeSettings = @"openSettings";
|
||||
NSString * const KeyActionTypeCollapseNotification = @"collapseNotification";
|
||||
NSString * const KeyActionTypeAlert = @"alert";
|
||||
NSString * const KeyActionTypeNoop = @"noop";
|
||||
NSString * const KeyActionInformation = @"actionInformation";
|
||||
NSString * const KeyLinkAwayAppURL = @"appURL";
|
||||
NSString * const KeyLinkAwayURL = @"browserUrl";
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
@property (nonatomic) BOOL pageDataFromCache;
|
||||
@property (nonatomic) BOOL moduleDataFromCache;
|
||||
|
||||
// The full response json
|
||||
@property (nullable, strong, nonatomic) NSDictionary *responseJSON;
|
||||
|
||||
- (nullable instancetype)initWithPageJSON:(nullable NSDictionary *)pageJSON modulesJSON:(nullable NSDictionary *)modulesJSON requestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
- (nullable instancetype)initWithRequestParameters:(nullable MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
@ -354,6 +354,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
loadObject.responseJSON = jsonDictionary;
|
||||
|
||||
// Store the new page data if we didn't load page data from the cache.
|
||||
NSDictionary *pageJSON = [jsonDictionary objectForKey:KeyPage ofType:[NSDictionary class]];
|
||||
if (!loadObject.pageDataFromCache) {
|
||||
|
||||
27
MVMCore/MVMCore/Models/ActionType/ActionNoopModel.swift
Normal file
27
MVMCore/MVMCore/Models/ActionType/ActionNoopModel.swift
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// ActionNoopModel.swift
|
||||
// MVMCore
|
||||
//
|
||||
// Created by Dhamodaram Nandi on 14/09/20.
|
||||
// Copyright © 2020 myverizon. All rights reserved.
|
||||
//
|
||||
|
||||
@objcMembers public class ActionNoopModel: ActionModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public static var identifier: String = "noop"
|
||||
public var actionType: String = ActionNoopModel.identifier
|
||||
public var extraParameters: JSONValueDictionary?
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
}
|
||||
@ -22,5 +22,6 @@ import Foundation
|
||||
try? ModelRegistry.register(ActionCancelModel.self)
|
||||
try? ModelRegistry.register(ActionSettingModel.self)
|
||||
try? ModelRegistry.register(ActionAlertModel.self)
|
||||
try? ModelRegistry.register(ActionNoopModel.self)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user