Merge branch 'feature/actiontopnotification_model' into 'develop'
top notification action implementation See merge request BPHV_MIPS/mvm_core_ui!647
This commit is contained in:
commit
e31ddb4664
@ -290,6 +290,7 @@
|
||||
BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC0C4FE24811DCA0087C44F /* TagModel.swift */; };
|
||||
C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; };
|
||||
C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; };
|
||||
C6687441259D92D400F32D13 /* ActionTopNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6687440259D92D400F32D13 /* ActionTopNotificationModel.swift */; };
|
||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; };
|
||||
C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A68023C9830D00BFB94E /* NumberedListModel.swift */; };
|
||||
C695A69423C9909000BFB94E /* DoughnutChartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69323C9909000BFB94E /* DoughnutChartModel.swift */; };
|
||||
@ -833,6 +834,7 @@
|
||||
BBC0C4FE24811DCA0087C44F /* TagModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagModel.swift; sourceTree = "<group>"; };
|
||||
C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
|
||||
C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; };
|
||||
C6687440259D92D400F32D13 /* ActionTopNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionTopNotificationModel.swift; sourceTree = "<group>"; };
|
||||
C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; };
|
||||
C695A68023C9830D00BFB94E /* NumberedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedListModel.swift; sourceTree = "<group>"; };
|
||||
C695A69323C9909000BFB94E /* DoughnutChartModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartModel.swift; sourceTree = "<group>"; };
|
||||
@ -1308,6 +1310,7 @@
|
||||
D2ED27E9254B0CE600A1C293 /* ActionAlertModel.swift */,
|
||||
D2ED27EA254B0CE700A1C293 /* AlertModel.swift */,
|
||||
D2ED27E8254B0CE600A1C293 /* ActionPopupModel.swift */,
|
||||
C6687440259D92D400F32D13 /* ActionTopNotificationModel.swift */,
|
||||
);
|
||||
path = Actions;
|
||||
sourceTree = "<group>";
|
||||
@ -2432,6 +2435,7 @@
|
||||
32F8804824765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift in Sources */,
|
||||
D2CAC7CF2511052300C75681 /* CollapsableNotificationModel.swift in Sources */,
|
||||
DBC4391822442197001AB423 /* CaretView.swift in Sources */,
|
||||
C6687441259D92D400F32D13 /* ActionTopNotificationModel.swift in Sources */,
|
||||
C07065C42395677300FBF997 /* Link.swift in Sources */,
|
||||
0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */,
|
||||
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */,
|
||||
|
||||
@ -12,8 +12,7 @@ import Foundation
|
||||
|
||||
public static var identifier: String = "topAlert"
|
||||
public var actionType: String = ActionTopAlertModel.identifier
|
||||
public var pageType: String?
|
||||
public var topNotification: TopNotificationModel?
|
||||
public var pageType: String
|
||||
public var extraParameters: JSONValueDictionary?
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
@ -22,10 +21,4 @@ import Foundation
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
|
||||
public init(topNotification: TopNotificationModel, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||
self.topNotification = topNotification
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
}
|
||||
|
||||
24
MVMCoreUI/Atomic/Actions/ActionTopNotificationModel.swift
Normal file
24
MVMCoreUI/Atomic/Actions/ActionTopNotificationModel.swift
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// ActionTopNotificationModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Murugan, Vimal on 31/12/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class ActionTopNotificationModel: ActionModelProtocol {
|
||||
|
||||
public static var identifier: String = "topNotification"
|
||||
public var actionType: String = ActionTopNotificationModel.identifier
|
||||
public var topNotification: TopNotificationModel
|
||||
public var extraParameters: JSONValueDictionary?
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
public init(topNotification: TopNotificationModel, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||
self.topNotification = topNotification
|
||||
self.extraParameters = extraParameters
|
||||
self.analyticsData = analyticsData
|
||||
}
|
||||
}
|
||||
@ -259,6 +259,7 @@ import Foundation
|
||||
try? ModelRegistry.register(ActionTopAlertModel.self)
|
||||
try? ModelRegistry.register(ActionCollapseNotificationModel.self)
|
||||
try? ModelRegistry.register(ActionOpenPanelModel.self)
|
||||
try? ModelRegistry.register(ActionTopNotificationModel.self)
|
||||
|
||||
// MARK:- Behaviors
|
||||
try? ModelRegistry.register(ScreenBrightnessModifierBehavior.self)
|
||||
|
||||
@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Collapses the current top notification
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
// Shows a topnotification new molecular
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
#pragma mark - Deprecated
|
||||
|
||||
// Shows a popup
|
||||
@ -32,6 +35,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Shows a top alert
|
||||
- (void)topAlertAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
// Shows a molecular top alert
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
// Collapses the current top notification
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
} else if ([actionType isEqualToString:KeyActionTypeAlert]) {
|
||||
[self showAlert:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
return YES;
|
||||
} else if ([actionType isEqualToString:KeyActionTypeTopNotification]) {
|
||||
[self topNotificationAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@ -81,28 +84,18 @@
|
||||
|
||||
- (void)topAlertAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
// Perform a top alert.
|
||||
NSString *pageTypeForTopAlert = [actionInformation string:KeyPageType];
|
||||
if (pageTypeForTopAlert) {
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForTopAlert queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
|
||||
if (responseInfo) {
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData delegateObject:delegateObject];
|
||||
if ([delegateObject.actionDelegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
|
||||
[((id <MVMCoreUIActionDelegateProtocol>)delegateObject.actionDelegate) willShowTopAlertWithAlertObject:alertObject alertJson:actionInformation];
|
||||
}
|
||||
[alertObject showAlert];
|
||||
NSString *pageTypeForTopAlert = [actionInformation stringForKey:KeyPageType];
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForTopAlert queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
|
||||
if (responseInfo) {
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData delegateObject:delegateObject];
|
||||
if ([delegateObject.actionDelegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
|
||||
[((id <MVMCoreUIActionDelegateProtocol>)delegateObject.actionDelegate) willShowTopAlertWithAlertObject:alertObject alertJson:actionInformation];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
NSDictionary *topNotification = [actionInformation dict:@"topNotification"];
|
||||
if (topNotification) {
|
||||
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:topNotification];
|
||||
} else {
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeParsingJSON domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegateObject.actionDelegate class]),KeyActionTypeTopAlert]];
|
||||
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||
[alertObject showAlert];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
@ -112,6 +105,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||
//Handle molecular topnotification
|
||||
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:[actionInformation dict:@"topNotification"] ?: @{}];
|
||||
}
|
||||
|
||||
- (void)defaultHandleActionError:(nonnull MVMCoreErrorObject *)error additionalData:(nullable NSDictionary *)additionalData {
|
||||
[super defaultHandleActionError:error additionalData:additionalData];
|
||||
if (!error.silentError) {
|
||||
@ -136,6 +134,9 @@
|
||||
} else if ([actionType isEqualToString:KeyActionTypeCollapseNotification]) {
|
||||
[self collapseNotificationAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
} else if ([actionType isEqualToString:KeyActionTypeTopNotification]) {
|
||||
[self topNotificationAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@ -162,27 +163,17 @@
|
||||
- (void)topAlertAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
// Perform a top alert.
|
||||
NSString *pageTypeForTopAlert = [actionInformation stringForKey:KeyPageType];
|
||||
if (pageTypeForTopAlert) {
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForTopAlert queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
|
||||
if (responseInfo) {
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData actionDelegate:delegate];
|
||||
if ([delegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
|
||||
alertObject = [((id <MVMCoreUIActionDelegateProtocol>)delegate) willShowTopAlertWithAlertObject:alertObject alertJson:jsonDictionary];
|
||||
}
|
||||
[alertObject showAlert];
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForTopAlert queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
|
||||
if (responseInfo) {
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData actionDelegate:delegate];
|
||||
if ([delegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
|
||||
alertObject = [((id <MVMCoreUIActionDelegateProtocol>)delegate) willShowTopAlertWithAlertObject:alertObject alertJson:jsonDictionary];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
NSDictionary *topNotification = [actionInformation dict:@"topNotification"];
|
||||
if (topNotification) {
|
||||
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:topNotification];
|
||||
} else {
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] code:ErrorCodeParsingJSON domain:ErrorDomainNative location:[NSString stringWithFormat:@"%@_%@",NSStringFromClass([delegate class]),KeyActionTypeTopAlert]];
|
||||
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegate:delegate];
|
||||
[alertObject showAlert];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
@ -192,4 +183,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
//Handle molecular topnotification
|
||||
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:[actionInformation dict:@"topNotification"] ?: @{}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -48,6 +48,7 @@ extern NSString * const KeyActionTypePopup;
|
||||
extern NSString * const KeyActionTypeAlert;
|
||||
extern NSString * const KeyActionTypeTopAlert;
|
||||
extern NSString * const KeyActionTypeCollapseNotification;
|
||||
extern NSString * const KeyActionTypeTopNotification;
|
||||
|
||||
/// Key for molecular top notification architecture.
|
||||
extern NSString * const KeyTopAlert;
|
||||
|
||||
@ -47,6 +47,7 @@ NSString * const KeyActionTypeAlert = @"alert";
|
||||
NSString * const KeyActionTypeTopAlert = @"topAlert";
|
||||
NSString * const KeyActionTypeCollapseNotification = @"collapseNotification";
|
||||
|
||||
NSString * const KeyActionTypeTopNotification = @"topNotification";
|
||||
NSString * const KeyTopAlert = @"TopNotification";
|
||||
|
||||
#pragma mark - Values
|
||||
|
||||
Loading…
Reference in New Issue
Block a user