Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core into develop
This commit is contained in:
commit
13ba049a8c
@ -93,6 +93,9 @@ extern NSString * _Nonnull const KeyActionTypeOpen;
|
|||||||
|
|
||||||
#pragma mark - Default Action Protocol Functions
|
#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.
|
// Sends the request to the load handler.
|
||||||
+ (void)defaultHandleOpenPageForRequestParameters:(nonnull MVMCoreRequestParameters *)requestParameters additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
+ (void)defaultHandleOpenPageForRequestParameters:(nonnull MVMCoreRequestParameters *)requestParameters additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
|||||||
if ([delegateObject.actionDelegate respondsToSelector:@selector(logActionWithActionInformation:additionalData:)]) {
|
if ([delegateObject.actionDelegate respondsToSelector:@selector(logActionWithActionInformation:additionalData:)]) {
|
||||||
[delegateObject.actionDelegate logActionWithActionInformation:actionInformation additionalData:additionalData];
|
[delegateObject.actionDelegate logActionWithActionInformation:actionInformation additionalData:additionalData];
|
||||||
} else {
|
} else {
|
||||||
[MVMCoreActionHandler defaultLogAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
[[self class] defaultLogAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,8 +16,8 @@ public struct ModelRegistry {
|
|||||||
case encoderError
|
case encoderError
|
||||||
case decoderError
|
case decoderError
|
||||||
case decoderOther(message: String)
|
case decoderOther(message: String)
|
||||||
case decoderErrorObjectNotPresent
|
case decoderErrorObjectNotPresent(codingKey: CodingKey, codingPath: [CodingKey])
|
||||||
case decoderErrorModelNotMapped
|
case decoderErrorModelNotMapped(identifer: String? = nil, codingKey: CodingKey? = nil, codingPath: [CodingKey]? = nil)
|
||||||
case other(message: String)
|
case other(message: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
|||||||
/// Decodes to a registered model based on the identifier
|
/// Decodes to a registered model based on the identifier
|
||||||
public func decodeModel<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> T {
|
public func decodeModel<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> T {
|
||||||
guard let model: T = try decodeModelIfPresent(codingKey: codingKey) else {
|
guard let model: T = try decodeModelIfPresent(codingKey: codingKey) else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
|
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
|
||||||
throw ModelRegistry.Error.decoderErrorObjectNotPresent
|
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
|
||||||
}
|
}
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
@ -84,8 +84,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
|||||||
/// Decodes an array of registered model based on the identifiers.
|
/// Decodes an array of registered model based on the identifiers.
|
||||||
public func decodeModels<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [T] {
|
public func decodeModels<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [T] {
|
||||||
guard let model: [T] = try decodeModelsIfPresent(codingKey: codingKey) else {
|
guard let model: [T] = try decodeModelsIfPresent(codingKey: codingKey) else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
|
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
|
||||||
throw ModelRegistry.Error.decoderErrorObjectNotPresent
|
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
|
||||||
}
|
}
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
@ -93,8 +93,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
|||||||
/// Decodes an array with arrays of models based on the identifiers.
|
/// Decodes an array with arrays of models based on the identifiers.
|
||||||
public func decodeModels2D<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[T]] {
|
public func decodeModels2D<T>(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[T]] {
|
||||||
guard let models: [[T]] = try decodeModels2DIfPresent(codingKey: codingKey) else {
|
guard let models: [[T]] = try decodeModels2DIfPresent(codingKey: codingKey) else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey)")
|
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorObjectNotPresent: \(codingKey.stringValue)")
|
||||||
throw ModelRegistry.Error.decoderErrorObjectNotPresent
|
throw ModelRegistry.Error.decoderErrorObjectNotPresent(codingKey: codingKey, codingPath: codingPath)
|
||||||
}
|
}
|
||||||
return models
|
return models
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
|||||||
//get the type from the identifier value in the Registry
|
//get the type from the identifier value in the Registry
|
||||||
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
|
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelProtocol not mapped: \(identifier)")
|
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
|
//decode the type using the decoder
|
||||||
@ -208,7 +208,7 @@ public extension UnkeyedDecodingContainer {
|
|||||||
let identifier = try nestedContainer.decode(String.self, forKey: typeCodingKey)
|
let identifier = try nestedContainer.decode(String.self, forKey: typeCodingKey)
|
||||||
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
|
guard let type = ModelRegistry.getType(for: identifier, with: T.self) else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(identifier)")
|
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
|
// Now get the decoder to use for the type
|
||||||
let decoder = try self.superDecoder()
|
let decoder = try self.superDecoder()
|
||||||
@ -233,7 +233,7 @@ public extension UnkeyedDecodingContainer {
|
|||||||
var arraycontainerCopy = try containerCopy.nestedUnkeyedContainer()
|
var arraycontainerCopy = try containerCopy.nestedUnkeyedContainer()
|
||||||
guard let models: [T] = try arraycontainerCopy.decodeModelsIfPresent() else {
|
guard let models: [T] = try arraycontainerCopy.decodeModelsIfPresent() else {
|
||||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "ModelRegistry Error decoderErrorModelNotMapped: \(typeCodingKey)")
|
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)
|
modelLists.append(models)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user