Merge branch 'develop' of gitlab.verizon.com:BPHV_MIPS/mvm_core into develop

This commit is contained in:
Suresh, Kamlesh 2020-07-09 14:45:34 -04:00
commit 52bfcd6b38
7 changed files with 16 additions and 41 deletions

View File

@ -26,7 +26,6 @@
01DF561421F90ADC00CC099B /* Dictionary+MFConvenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */; };
01F2A03623A80A7300D954D8 /* ActionModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */; };
01F2A03923A812DD00D954D8 /* ActionOpenUrlModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */; };
01F2A03B23A8159900D954D8 /* ActionOpenAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */; };
01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */; };
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; };
01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A05123A8325100D954D8 /* ModelMapping.swift */; };
@ -175,7 +174,6 @@
01DF561321F90ADC00CC099B /* Dictionary+MFConvenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Dictionary+MFConvenience.swift"; sourceTree = "<group>"; };
01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelProtocol.swift; sourceTree = "<group>"; };
01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenUrlModel.swift; sourceTree = "<group>"; };
01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionOpenAppModel.swift; sourceTree = "<group>"; };
01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionCallModel.swift; sourceTree = "<group>"; };
01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionPopupModel.swift; sourceTree = "<group>"; };
01F2A05123A8325100D954D8 /* ModelMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMapping.swift; sourceTree = "<group>"; };
@ -460,7 +458,6 @@
01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */,
946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */,
01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */,
01F2A03A23A8159900D954D8 /* ActionOpenAppModel.swift */,
01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */,
01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */,
01C851D023CF97FE0021F976 /* ActionBackModel.swift */,
@ -950,7 +947,6 @@
AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */,
AF43A6FF1FBE3252008E9347 /* Reachability.m in Sources */,
01C851D123CF97FE0021F976 /* ActionBackModel.swift in Sources */,
01F2A03B23A8159900D954D8 /* ActionOpenAppModel.swift in Sources */,
AFBB96921FBA3A9A0008D868 /* MVMCoreNavigationOperation.m in Sources */,
AFBB96611FBA3A570008D868 /* MVMCoreLoadObject.m in Sources */,
946EE1B4237B619D0036751F /* Encoder.swift in Sources */,

View File

@ -93,6 +93,9 @@ extern NSString * _Nonnull const KeyActionTypeOpen;
#pragma mark - Default Action Protocol Functions
// Currently no default log action but this will eventually be server driven.
+ (void)defaultLogAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
// Sends the request to the load handler.
+ (void)defaultHandleOpenPageForRequestParameters:(nonnull MVMCoreRequestParameters *)requestParameters additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;

View File

@ -110,7 +110,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
if ([delegateObject.actionDelegate respondsToSelector:@selector(logActionWithActionInformation:additionalData:)]) {
[delegateObject.actionDelegate logActionWithActionInformation:actionInformation additionalData:additionalData];
} else {
[MVMCoreActionHandler defaultLogAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
[[self class] defaultLogAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
}
}

View File

@ -1,24 +0,0 @@
//
// ActionOpenAppModel.swift
// MVMCore
//
// Created by Suresh, Kamlesh on 12/16/19.
// Copyright © 2019 myverizon. All rights reserved.
//
import Foundation
@objcMembers public class ActionOpenAppModel: ActionModelProtocol {
public static var identifier: String = "openApp"
public var actionType: String = ActionOpenAppModel.identifier
// TODO: decode into url once action handler is re-written
public var appURL: String
public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary?
public init(appURL: String, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
self.appURL = appURL
self.extraParameters = extraParameters
self.analyticsData = analyticsData
}
}

View File

@ -15,6 +15,7 @@ import Foundation
public var browserUrl: String
public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary?
public var appURL: String?
//TODO: Should be removed in future releases. This should be MF specific.
//Missing params

View File

@ -16,8 +16,8 @@ public struct ModelRegistry {
case encoderError
case decoderError
case decoderOther(message: String)
case decoderErrorObjectNotPresent
case decoderErrorModelNotMapped
case decoderErrorObjectNotPresent(codingKey: CodingKey, codingPath: [CodingKey])
case decoderErrorModelNotMapped(identifer: String? = nil, codingKey: CodingKey? = nil, codingPath: [CodingKey]? = nil)
case other(message: String)
}
@ -75,8 +75,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
/// Decodes to a registered model based on the identifier
public func decodeModel<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> T {
guard let model: T = try decodeModelIfPresent(codingKey: codingKey) else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
}
return model
}
@ -84,8 +84,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
/// Decodes an array of registered model based on the identifiers.
public func decodeModels<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [T] {
guard let model: [T] = try decodeModelsIfPresent(codingKey: codingKey) else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
}
return model
}
@ -93,8 +93,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
/// Decodes an array with arrays of models based on the identifiers.
public func decodeModels2D<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[T]] {
guard let models: [[T]] = try decodeModels2DIfPresent(codingKey: codingKey) else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
}
return models
}
@ -114,7 +114,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
//get the type from the identifier value in the Registry
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelProtocol not mapped: \(identifier)")
throw ModelRegistry.Error.decoderErrorModelNotMapped
throw ModelRegistry.Error.decoderErrorModelNotMapped(identifer: identifier, codingKey: typeCodingKey, codingPath: container.codingPath)
}
//decode the type using the decoder
@ -208,7 +208,7 @@ public extension UnkeyedDecodingContainer {
let identifier = try nestedContainer.decode(String.self, forKey: typeCodingKey)
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(identifier)")
throw ModelRegistry.Error.decoderErrorModelNotMapped
throw ModelRegistry.Error.decoderErrorModelNotMapped(identifer: identifier, codingKey: typeCodingKey, codingPath: nestedContainer.codingPath)
}
// Now get the decoder to use for the type
let decoder = try self.superDecoder()
@ -233,7 +233,7 @@ public extension UnkeyedDecodingContainer {
var arraycontainerCopy = try containerCopy.nestedUnkeyedContainer()
guard let models: [T] = try arraycontainerCopy.decodeModelsIfPresent() else {
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(typeCodingKey)")
throw ModelRegistry.Error.decoderErrorModelNotMapped
throw ModelRegistry.Error.decoderErrorModelNotMapped(identifer: typeCodingKey.stringValue, codingKey: typeCodingKey, codingPath: arraycontainerCopy.codingPath)
}
modelLists.append(models)
}

View File

@ -13,7 +13,6 @@ import Foundation
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(ActionBackModel.self)