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

This commit is contained in:
Pfeil, Scott Robert 2020-07-02 17:18:57 -04:00
commit 13ba049a8c
3 changed files with 15 additions and 12 deletions

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

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