top notification action implementation

This commit is contained in:
Murugan, Vimal 2020-12-31 14:44:01 +05:30
parent 6132983547
commit 87e02c37b7
8 changed files with 45 additions and 7 deletions

View File

@ -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 */,

View File

@ -13,7 +13,6 @@ import Foundation
public static var identifier: String = "topAlert"
public var actionType: String = ActionTopAlertModel.identifier
public var pageType: String?
public var topNotification: TopNotificationModel?
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
}
}

View 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
}
}

View File

@ -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)

View File

@ -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

View File

@ -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;
}
@ -112,6 +115,14 @@
}
}
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
//Handle molecular topnotification
NSDictionary *topNotification = [actionInformation dict:@"topNotification"];
if (topNotification) {
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:topNotification];
}
}
- (void)defaultHandleActionError:(nonnull MVMCoreErrorObject *)error additionalData:(nullable NSDictionary *)additionalData {
[super defaultHandleActionError:error additionalData:additionalData];
if (!error.silentError) {

View File

@ -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;

View File

@ -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