Merge branch 'feature/oneApp_4156-LoggingHandlerSwiftMigration' into 'develop'

story: ONEAPP-4156 LoggingHandler Swift migration

### Summary
Swiftify Logging handler

### JIRA Ticket
https://onejira.verizon.com/browse/ONEAPP-4156

Co-authored-by: Nandhini Rajendran <nandhini.rajendran@verizon.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/290
This commit is contained in:
Hedden, Kyle Matthew 2023-12-21 16:29:40 +00:00
commit 7e02aa17b6
16 changed files with 111 additions and 151 deletions

View File

@ -41,6 +41,9 @@
1DAD0FFE26AAB40000216E83 /* ActionRunJavaScriptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DAD0FFD26AAB3FF00216E83 /* ActionRunJavaScriptModel.swift */; };
2723337B28BD534D004EAEE0 /* MVMCoreEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2723337A28BD534D004EAEE0 /* MVMCoreEvent.swift */; };
2723337D28BD53C2004EAEE0 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2723337C28BD53C2004EAEE0 /* Date+Extension.swift */; };
6042E8FC2B317B190031644B /* MVMCoreLoggingHandlerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 6042E8FB2B3094680031644B /* MVMCoreLoggingHandlerHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
605A9A2A2ABD712F00487E47 /* MVMCoreLoggingHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 605A9A292ABD712F00487E47 /* MVMCoreLoggingHandler.swift */; };
6079EDCE2AD97AA5004B7A85 /* MVMCoreLoggingDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6079EDCD2AD97AA5004B7A85 /* MVMCoreLoggingDelegateProtocol.swift */; };
60CBD0542A02397A00056CB0 /* MVMCoreSessionTimeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60CBD0532A02397A00056CB0 /* MVMCoreSessionTimeHandler.swift */; };
881D26931FCC9D180079C521 /* MVMCoreErrorObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 881D268F1FCC9D180079C521 /* MVMCoreErrorObject.m */; };
881D26941FCC9D180079C521 /* MVMCoreOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 881D26901FCC9D180079C521 /* MVMCoreOperation.m */; };
@ -141,9 +144,6 @@
AFED77A61FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AFED779E1FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.m */; };
AFED77A71FCCA29400BAE689 /* MVMCoreViewControllerProgrammaticMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AFED779F1FCCA29400BAE689 /* MVMCoreViewControllerProgrammaticMappingObject.m */; };
AFED77A81FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AFED77A01FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
AFEEE8191FCDEB8D00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AFEEE8181FCDDE6B00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
AFEEE81E1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = AFEEE81C1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
AFEEE81F1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AFEEE81D1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m */; };
AFFCFA651FCCC0D700FD0730 /* MVMCoreLoadingOverlayDelegateProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA611FCCC0D600FD0730 /* MVMCoreLoadingOverlayDelegateProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
AFFCFA661FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
AFFCFA671FCCC0D700FD0730 /* MVMCoreLoadingOverlayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */; };
@ -191,6 +191,9 @@
2723337C28BD53C2004EAEE0 /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
581FABEE2A71D0E6003A8508 /* mvmcore_dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mvmcore_dev.xcconfig; sourceTree = "<group>"; };
5836B8E22A4338DF002553D9 /* mvmcore.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mvmcore.xcconfig; sourceTree = "<group>"; };
6042E8FB2B3094680031644B /* MVMCoreLoggingHandlerHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoggingHandlerHelper.h; sourceTree = "<group>"; };
605A9A292ABD712F00487E47 /* MVMCoreLoggingHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreLoggingHandler.swift; sourceTree = "<group>"; };
6079EDCD2AD97AA5004B7A85 /* MVMCoreLoggingDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreLoggingDelegateProtocol.swift; sourceTree = "<group>"; };
60CBD0532A02397A00056CB0 /* MVMCoreSessionTimeHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreSessionTimeHandler.swift; sourceTree = "<group>"; };
881D268F1FCC9D180079C521 /* MVMCoreErrorObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreErrorObject.m; sourceTree = "<group>"; };
881D26901FCC9D180079C521 /* MVMCoreOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreOperation.m; sourceTree = "<group>"; };
@ -297,9 +300,6 @@
AFED779E1FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreViewControllerStoryBoardMappingObject.m; sourceTree = "<group>"; };
AFED779F1FCCA29400BAE689 /* MVMCoreViewControllerProgrammaticMappingObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreViewControllerProgrammaticMappingObject.m; sourceTree = "<group>"; };
AFED77A01FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerStoryBoardMappingObject.h; sourceTree = "<group>"; };
AFEEE8181FCDDE6B00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoggingDelegateProtocol.h; sourceTree = "<group>"; };
AFEEE81C1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoggingHandler.h; sourceTree = "<group>"; };
AFEEE81D1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreLoggingHandler.m; sourceTree = "<group>"; };
AFFCFA611FCCC0D600FD0730 /* MVMCoreLoadingOverlayDelegateProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingOverlayDelegateProtocol.h; sourceTree = "<group>"; };
AFFCFA621FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreLoadingOverlayHandler.h; sourceTree = "<group>"; };
AFFCFA631FCCC0D600FD0730 /* MVMCoreLoadingOverlayHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreLoadingOverlayHandler.m; sourceTree = "<group>"; };
@ -517,7 +517,7 @@
D268D82926700292008BD413 /* MVMCoreViewManagerViewControllerProtocolHelper.h */,
D268D82A26700292008BD413 /* MVMCoreViewManagerViewControllerProtocolHelper.m */,
AF43A7401FC5FA6F008E9347 /* MVMCoreViewProtocol.h */,
AFEEE8181FCDDE6B00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h */,
6079EDCD2AD97AA5004B7A85 /* MVMCoreLoggingDelegateProtocol.swift */,
AF43A7001FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h */,
);
path = MainProtocols;
@ -653,8 +653,8 @@
children = (
AF43A7091FC4F415008E9347 /* MVMCoreCache.h */,
AF43A7081FC4F415008E9347 /* MVMCoreCache.m */,
AFEEE81C1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h */,
AFEEE81D1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m */,
605A9A292ABD712F00487E47 /* MVMCoreLoggingHandler.swift */,
6042E8FB2B3094680031644B /* MVMCoreLoggingHandlerHelper.h */,
D288D5F426C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift */,
2723337A28BD534D004EAEE0 /* MVMCoreEvent.swift */,
);
@ -710,6 +710,7 @@
AF43A7411FC5FA6F008E9347 /* MVMCoreViewProtocol.h in Headers */,
AFBB96EC1FBA4A260008D868 /* MFHardCodedServerResponse.h in Headers */,
AFBB96B21FBA3B590008D868 /* MVMCoreGetterUtility.h in Headers */,
6042E8FC2B317B190031644B /* MVMCoreLoggingHandlerHelper.h in Headers */,
8876D5F21FB50AB000EB2E3D /* UIFont+MFSpacing.h in Headers */,
8876D5EC1FB50AB000EB2E3D /* NSDictionary+MFConvenience.h in Headers */,
AFFCFA651FCCC0D700FD0730 /* MVMCoreLoadingOverlayDelegateProtocol.h in Headers */,
@ -732,7 +733,6 @@
8876D5E81FB50AB000EB2E3D /* NSArray+MFConvenience.h in Headers */,
AFBB96621FBA3A570008D868 /* MVMCoreRequestParameters.h in Headers */,
AFBB96531FBA3A570008D868 /* MVMCoreLoadHandler.h in Headers */,
AFEEE81E1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h in Headers */,
AF43A7011FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h in Headers */,
AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */,
AFBB96631FBA3A570008D868 /* MVMCoreLoadRequestOperation.h in Headers */,
@ -744,7 +744,6 @@
AFEA17A8209B6A1C00BC6740 /* MVMCoreBlockOperation.h in Headers */,
AF43A5831FBB66DE008E9347 /* MVMCoreConstants.h in Headers */,
AFED77A81FCCA29400BAE689 /* MVMCoreViewControllerStoryBoardMappingObject.h in Headers */,
AFEEE8191FCDEB8D00B5EDD0 /* MVMCoreLoggingDelegateProtocol.h in Headers */,
AF43A74C1FC6109F008E9347 /* MVMCoreSessionObject.h in Headers */,
8876D5F41FB50AB000EB2E3D /* UILabel+MFCustom.h in Headers */,
AFFCFA681FCCC0D700FD0730 /* MVMCoreLoadingViewControllerProtocol.h in Headers */,
@ -865,6 +864,7 @@
01F2A04C23A82B1B00D954D8 /* ActionCallModel.swift in Sources */,
8876D5ED1FB50AB000EB2E3D /* NSDictionary+MFConvenience.m in Sources */,
AF686FDA2A8A876A008F666A /* NavigationOperation.swift in Sources */,
605A9A2A2ABD712F00487E47 /* MVMCoreLoggingHandler.swift in Sources */,
AFBB96ED1FBA4A260008D868 /* MFHardCodedServerResponse.m in Sources */,
AF43A74D1FC6109F008E9347 /* MVMCoreSessionObject.m in Sources */,
D282AAB62240085300C46919 /* MVMCoreGetterUtility+Extension.swift in Sources */,
@ -882,6 +882,7 @@
946EE1B0237B5EF70036751F /* JSONHelper.swift in Sources */,
D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */,
94C014D3242119E6005811A9 /* ActionPreviousSubmitModel.swift in Sources */,
6079EDCE2AD97AA5004B7A85 /* MVMCoreLoggingDelegateProtocol.swift in Sources */,
AF60A7F2289212CA00919EEB /* MVMError.swift in Sources */,
8876D5E91FB50AB000EB2E3D /* NSArray+MFConvenience.m in Sources */,
D27073B725BB45C4001C7246 /* ActionActionsModel.swift in Sources */,
@ -902,7 +903,6 @@
AF69D4F7286EA0B800BC6862 /* ActionPreviousSubmitHandler.swift in Sources */,
AF43A57C1FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.m in Sources */,
0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */,
AFEEE81F1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m in Sources */,
AF69D4F5286E9F5900BC6862 /* ActionSettingHandler.swift in Sources */,
D27073CD25BB4CEF001C7246 /* MVMCoreActionHandler.swift in Sources */,
01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */,

View File

@ -82,7 +82,7 @@ open class ActionOpenUrlHandler: MVMCoreJSONActionHandlerProtocol {
// Log error and continue
MVMCoreLoggingHandler.shared()?.handleDebugMessage("Failed to open app url: \(appURL)")
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: MVMCoreActionHandler.getErrorLocation(with: delegateObject?.actionDelegate, actionType: model.actionType)) {
MVMCoreLoggingHandler.addError(toLog: errorObject)
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
}
}
}

View File

@ -131,7 +131,7 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol {
/// Logs the error.
@objc open func defaultHandleActionError(_ error: MVMCoreErrorObject, additionalData: [AnyHashable: Any]? = nil, delegateObject: DelegateObject? = nil) {
guard error.logError else { return }
MVMCoreLoggingHandler.addError(toLog: error)
MVMCoreLoggingHandler.shared()?.addError(toLog: error)
error.logError = false // Further attempts to log the same error will be skipped. (Legacy action flow.)
}

View File

@ -8,7 +8,6 @@
#import "MVMCoreLoadHandler.h"
#import "MVMCoreGetterUtility.h"
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreLoadRequestOperation.h"
#import "MVMCoreCache.h"
#import "MFHardCodedServerResponse.h"
@ -20,6 +19,7 @@
#import "MVMCoreHardcodedStringsConstants.h"
#import "MVMCoreConstants.h"
#import "MVMCoreActionUtility.h"
#import "MVMCoreLoggingHandlerHelper.h"
#import <MVMCore/MVMCore-Swift.h>
@interface MVMCoreLoadHandler ()
@ -332,8 +332,6 @@
MVMCoreLog(@"Set-Cookie %@ Value: %@", requestParameters.pageType, [(NSHTTPURLResponse *)response allHeaderFields][@"Set-Cookie"]);
[MVMCoreLoggingHandler logWithDelegateWithObject:nil withName:@"httpRequestStatus" withExtraInfo:trackInfo];
id jsonObject = nil;
MVMCoreErrorObject *errorObject = nil;
if (!error) {

View File

@ -6,11 +6,11 @@
// Copyright © 2015 Verizon Wireless. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MVMCore/MVMCoreLoadRequestOperation.h>
#import "MVMCoreLoadHandler.h"
#import "MVMCoreLoadingOverlayHandler.h"
#import "MVMCoreCache.h"
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreSessionObject.h"
#import "MVMCoreViewControllerMappingObject.h"
#import <MVMCore/MVMCoreDispatchUtility.h>
@ -23,6 +23,7 @@
#import "MVMCoreErrorConstants.h"
#import "MVMCoreActionUtility.h"
#import "MVMCoreConstants.h"
#import "MVMCoreLoggingHandlerHelper.h"
#import <MVMCore/MVMCore-Swift.h>
@interface MVMCoreLoadRequestOperation ()
@ -555,13 +556,13 @@
if (error.errorScreenError) {
error.silentError = NO;
if (error.nativeDrivenErrorScreen) {
[MVMCoreLoggingHandler addErrorToLog:error];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:error];
}
[MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error];
} else if (!loadObject.requestParameters.dontDisplayViewController) {
[MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error];
} else {
[MVMCoreLoggingHandler addErrorToLog:error];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:error];
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:viewController errorObject:error];
}
} else if (!loadObject.requestParameters.shouldNotGoToServerOnCacheFail && (loadObject.pageDataFromCache || loadObject.moduleDataFromCache)) {
@ -573,7 +574,7 @@
loadObject.operation.errorForAlertToShow = nil;
[loadObject.operation main];
} else {
[MVMCoreLoggingHandler addErrorToLog:error];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:error];
// Otherwise the request is finished.
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
}
@ -723,7 +724,7 @@
// Logs the error.
if (errorObject) {
[MVMCoreLoggingHandler addErrorToLog:errorObject];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:errorObject];
}
}];
@ -803,7 +804,7 @@
// Logs the error. If its a native driven error screen postpone until the native screen is define with its messaging.
if (error.logError && !error.nativeDrivenErrorScreen) {
[MVMCoreLoggingHandler addErrorToLog:error];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:error];
}
}

View File

@ -67,11 +67,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[];
#import <MVMCore/MVMCoreViewManagerViewControllerProtocol.h>
#import <MVMCore/MVMCoreViewManagerViewControllerProtocolHelper.h>
#import <MVMCore/MVMCoreViewProtocol.h>
#import <MVMCore/MVMCoreLoggingDelegateProtocol.h>
// Other Handlers and Protocols
#import <MVMCore/MVMCoreLoggingHandler.h>
// Singletons
#import <MVMCore/MVMCoreCache.h>
#import <MVMCore/MVMCoreSessionObject.h>
#import <MVMCore/MVMCoreLoggingHandlerHelper.h>

View File

@ -1,27 +0,0 @@
//
// MVMCoreLoggingDelegateProtocol.h
// MVMCore
//
// Created by Pfeil, Scott Robert on 11/28/17.
// Copyright © 2017 myverizon. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol MVMCoreLoggingDelegateProtocol <NSObject>
@optional
// Can be used to log different actions performed by the core.
- (void)handleDebugMessage:(nullable NSString *)message;
// Can be used to log different actions performed by the core.
- (void)logWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
// Can be used to choose how to log error objects.
- (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject;
// Log that the load has finished.
- (void)logLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
@end

View File

@ -0,0 +1,24 @@
//
// MVMCoreLoggingDelegateProtocol.swift
// MVMCore
//
// Created by Nandhini Rajendran on 13/10/23.
// Copyright © 2023 myverizon. All rights reserved.
//
public protocol MVMCoreLoggingDelegateProtocol {
// Can be used to log different actions performed by the core.
func handleDebugMessage(_ message: String?)
// Can be used to choose how to log error objects.
func addError(toLog errorObject: MVMCoreErrorObject)
// Log that the load has finished.
func logLoadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: MVMCoreViewControllerProtocol?, error: MVMCoreErrorObject?)
}
public extension MVMCoreLoggingDelegateProtocol {
func addError(toLog errorObject: MVMCoreErrorObject) {}
func logLoadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: MVMCoreViewControllerProtocol?, error: MVMCoreErrorObject?) {}
}

View File

@ -16,7 +16,7 @@
return parameterType.init(clientParameterModel)
} catch {
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: #function) {
MVMCoreLoggingHandler.addError(toLog: errorObject)
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
}
return nil
}
@ -109,7 +109,7 @@
return
}
guard returnedList[index] == nil else {
MVMCoreLoggingHandler.addError(toLog: MVMCoreErrorObject(title: nil, message: "Client parameter \(parameterType) has already executed. The completion handler should only be called once!", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: String(describing: ClientParameterHandler.self))!)
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, message: "Client parameter \(parameterType) has already executed. The completion handler should only be called once!", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: String(describing: ClientParameterHandler.self))!)
return
}
MVMCoreLoggingHandler.shared()?.logCoreEvent(.clientParameterFetchComplete(name: parameterType, uuid: requestUUID[index], actionId: actionId))

View File

@ -103,7 +103,7 @@ public struct ModelRegistry {
errorObject.title = "Unknown Model Registry Error"
}
MVMCoreLoggingHandler.addError(toLog: errorObject)
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
#if DEBUG
triggerCrashInDebug()
#endif

View File

@ -9,14 +9,13 @@
#import "MVMCoreCache.h"
#import <MVMCore/NSDictionary+MFConvenience.h>
#import "MVMCoreErrorObject.h"
#import "MVMCoreLoggingHandler.h"
#import <MVMCore/MVMCore-Swift.h>
#import "MVMCoreGetterUtility.h"
#import "MVMCoreConstants.h"
#import "MVMCoreActionUtility.h"
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreDispatchUtility.h"
#import "MVMCoreErrorConstants.h"
#import <MVMCore/MVMCore-Swift.h>
#import "MVMCoreLoggingHandlerHelper.h"
@interface MVMCoreCache ()
@ -593,9 +592,9 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
//need to manually store cache for response
[sharedCache storeCachedResponse:cachedReponse forRequest:request];
} else if (error) {
[MVMCoreLoggingHandler addErrorToLog:[MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreCache->downloadImage"]];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:[MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreCache->downloadImage"]];
} else {
[MVMCoreLoggingHandler addErrorToLog:[[MVMCoreErrorObject alloc] initWithTitle:nil messageToLog:[NSString stringWithFormat:@"Failed to download image %@", request.URL.absoluteString] code:0 domain:ErrorDomainSystem location:@"MVMCoreCache->downloadImage"]];
[[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:[[MVMCoreErrorObject alloc] initWithTitle:nil messageToLog:[NSString stringWithFormat:@"Failed to download image %@", request.URL.absoluteString] code:0 domain:ErrorDomainSystem location:@"MVMCoreCache->downloadImage"]];
}
if (isGif) {
[self checkImage:nil imageData:data fallbackImage:fallbackImageName completionHandler:completionHandler];

View File

@ -1,31 +0,0 @@
//
// MVMCoreLoggingHandler.h
// MVMCore
//
// Created by Pfeil, Scott Robert on 11/28/17.
// Copyright © 2017 myverizon. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MVMCore/MVMCoreErrorObject.h>
#import <MVMCore/MVMCoreViewControllerProtocol.h>
#import <MVMCore/MVMCoreLoadObject.h>
#import <MVMCore/MVMCoreLoggingDelegateProtocol.h>
#define MVMCoreLog(fmt, ...) \
[MVMCoreLoggingHandler logDebugMessageWithDelegate:[NSString stringWithFormat:(@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__]];
@interface MVMCoreLoggingHandler : NSObject <MVMCoreLoggingDelegateProtocol>
+ (nullable instancetype)sharedLoggingHandler;
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject;
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message;
+ (void)logWithDelegateWithObject:(nullable id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra;
+ (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error;
- (void)recordEvent:(nonnull NSString *)name attributes:(nullable NSDictionary<NSString *, id> *)attributes;
#pragma mark MVMCoreLoggingDelegateProtocol
- (void)handleDebugMessage:(nullable NSString *)message;
@end

View File

@ -1,57 +0,0 @@
//
// MVMCoreLoggingHandler.m
// MVMCore
//
// Created by Pfeil, Scott Robert on 11/28/17.
// Copyright © 2017 myverizon. All rights reserved.
//
#import "MVMCoreLoggingHandler.h"
#import "MVMCoreActionUtility.h"
#import <MVMCore/MVMCore-Swift.h>
@implementation MVMCoreLoggingHandler
+ (nullable instancetype)sharedLoggingHandler {
if ([MVMCoreObject sharedInstance].loggingDelegate && [MVMCoreActionUtility classIsInstanceTypeOfClass:[MVMCoreObject sharedInstance].loggingDelegate.class otherClass:self throwException:NO]) {
return (MVMCoreLoggingHandler *)[MVMCoreObject sharedInstance].loggingDelegate;
} else {
return nil;
}
}
+ (void)addErrorToLog:(nonnull MVMCoreErrorObject *)errorObject {
if (errorObject && [[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(addErrorToLog:)]) {
[[MVMCoreObject sharedInstance].loggingDelegate addErrorToLog:errorObject];
}
}
+ (void)logDebugMessageWithDelegate:(nullable NSString *)message {
if (message && [[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(handleDebugMessage:)]) {
[[MVMCoreObject sharedInstance].loggingDelegate handleDebugMessage:message];
}
}
+ (void)logWithDelegateWithObject:(id)object withName:(nullable NSString *)name withExtraInfo:(nullable NSDictionary *)extra {
if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logWithObject:withName:withExtraInfo:)]) {
[[MVMCoreObject sharedInstance].loggingDelegate logWithObject:object withName:name withExtraInfo:extra];
}
}
+ (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController <MVMCoreViewControllerProtocol> *)loadedViewController error:(nullable MVMCoreErrorObject *)error {
if ([[MVMCoreObject sharedInstance].loggingDelegate respondsToSelector:@selector(logLoadFinished:loadedViewController:error:)]) {
[[MVMCoreObject sharedInstance].loggingDelegate logLoadFinished:loadObject loadedViewController:loadedViewController error:error];
}
}
- (void)recordEvent:(nonnull NSString *)name attributes:(nullable NSDictionary<NSString *, id> *)attributes {}
#pragma mark - logging delegate
- (void)handleDebugMessage:(nullable NSString *)message {
#ifdef LOGGING
[self printWith:message];
#endif
}
@end

View File

@ -0,0 +1,41 @@
//
// MVMCoreLoggingHandler.swift
// MVMCore
//
// Created by Nandhini Rajendran on 22/09/23.
// Copyright © 2023 myverizon. All rights reserved.
//
import Foundation
@objc open class MVMCoreLoggingHandler: NSObject, MVMCoreLoggingDelegateProtocol {
@objc(sharedLoggingHandler)
public static func shared() -> Self? {
return MVMCoreActionUtility.initializerClassCheck(MVMCoreObject.sharedInstance()?.loggingDelegate as? NSObject, classToVerify: self) as? Self
}
@objc public class func logDebugMessage(withDelegate message: String) {
MVMCoreObject.sharedInstance()?.loggingDelegate?.handleDebugMessage(message)
}
@objc(logWithDelegateLoadFinished:loadedViewController:error:)
public class func log(withDelegateLoadFinished loadObject: MVMCoreLoadObject?, loadedViewController: UIViewController?, error: MVMCoreErrorObject?) {
MVMCoreObject.sharedInstance()?.loggingDelegate?.logLoadFinished(loadObject, loadedViewController: loadedViewController as? MVMCoreViewControllerProtocol, error: error)
}
func recordEvent(_ name: String, attributes: [String : Any]?) {}
// MARK: - logging delegate
@objc public func handleDebugMessage(_ message: String?) {
#if LOGGING
guard let message = message else { return }
self.print(with: message)
#endif
}
@objc(addErrorToLog:)
open func addError(toLog errorObject: MVMCoreErrorObject) {
MVMCoreObject.sharedInstance()?.loggingDelegate?.addError(toLog: errorObject)
}
}

View File

@ -0,0 +1,14 @@
//
// MVMCoreLoggingHandlerHelper.h
// MVMCore
//
// Created by Nandhini Rajendran on 18/12/23.
// Copyright © 2023 myverizon. All rights reserved.
//
#ifndef MVMCoreLoggingHandlerHelper_h
#define MVMCoreLoggingHandlerHelper_h
#define MVMCoreLog(fmt, ...) \
[MVMCoreLoggingHandler logDebugMessageWithDelegate:[NSString stringWithFormat:(@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__]];
#endif

View File

@ -9,7 +9,8 @@
#import "MFHardCodedServerResponse.h"
#import "MVMCoreRequestParameters.h"
#import "NSDictionary+MFConvenience.h"
#import "MVMCoreLoggingHandler.h"
#import <MVMCore/MVMCore-Swift.h>
#import "MVMCoreLoggingHandlerHelper.h"
#if ENABLE_HARD_CODED_RESPONSE