From 79915b3f6f75eb90d3ed22722cb7cfa72accaeed Mon Sep 17 00:00:00 2001 From: Sourabh Bhardwaj Date: Mon, 11 Sep 2023 17:05:15 +0530 Subject: [PATCH 1/7] Removing VzAnalytics - VZWYZDL-1051 --- MVMCore/MVMCore/Constants/MVMCoreConstants.h | 1 - MVMCore/MVMCore/Constants/MVMCoreConstants.m | 1 - MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 1 - 3 files changed, 3 deletions(-) diff --git a/MVMCore/MVMCore/Constants/MVMCoreConstants.h b/MVMCore/MVMCore/Constants/MVMCoreConstants.h index 3164798..7aa75bf 100644 --- a/MVMCore/MVMCore/Constants/MVMCoreConstants.h +++ b/MVMCore/MVMCore/Constants/MVMCoreConstants.h @@ -34,7 +34,6 @@ extern NSString * const URLComponentKeepAlive; #pragma mark - Notification Names extern NSString * const NotificationResponseLoaded; -extern NSString * const MVMCoreNotificationGoingToServer; #pragma mark - Image Cache extern NSTimeInterval const ImageTimeOut; diff --git a/MVMCore/MVMCore/Constants/MVMCoreConstants.m b/MVMCore/MVMCore/Constants/MVMCoreConstants.m index cf0761f..b564242 100644 --- a/MVMCore/MVMCore/Constants/MVMCoreConstants.m +++ b/MVMCore/MVMCore/Constants/MVMCoreConstants.m @@ -28,7 +28,6 @@ NSString * const URLComponentKeepAlive = @"isAlive.jsp"; #pragma mark - Notification Names NSString * const NotificationResponseLoaded = @"responseLoaded"; -NSString * const MVMCoreNotificationGoingToServer = @"MVMCoreGoServer"; #pragma mark - Image Cache NSTimeInterval const ImageTimeOut = 60; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index 61e532e..ab36e99 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -312,7 +312,6 @@ MVMCoreLog(@"Cookie Name: %@, Cookie Value: %@, Domain: %@", obj.name, obj.value, obj.domain); }]; - [[NSNotificationCenter defaultCenter] postNotificationName:MVMCoreNotificationGoingToServer object:nil]; NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate]; NSURLSessionTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { From c93fe59b5c71d7d83cce09a38acfa89ca33af772 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 28 Sep 2023 09:26:17 -0400 Subject: [PATCH 2/7] improvement to hardcoded debugging functions --- .../MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 10 ++++++---- .../MVMCore/MainProtocols/MVMCoreGlobalLoadProtocol.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 45127b5..4ec531f 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -297,10 +297,12 @@ } #if ENABLE_HARD_CODED_RESPONSE - if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getJSONForPageType:)]) { - NSDictionary *json = [[MVMCoreObject sharedInstance].globalLoadDelegate getJSONForPageType:requestParameters.pageType]; - completionHandler(json); - return; + if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getJSONForRequestParameters:)]) { + NSDictionary *json = [[MVMCoreObject sharedInstance].globalLoadDelegate getJSONForRequestParameters:requestParameters]; + if (json) { + completionHandler(json); + return; + } } #endif diff --git a/MVMCore/MVMCore/MainProtocols/MVMCoreGlobalLoadProtocol.h b/MVMCore/MVMCore/MainProtocols/MVMCoreGlobalLoadProtocol.h index 938b13c..76fede6 100644 --- a/MVMCore/MVMCore/MainProtocols/MVMCoreGlobalLoadProtocol.h +++ b/MVMCore/MVMCore/MainProtocols/MVMCoreGlobalLoadProtocol.h @@ -42,7 +42,7 @@ - (BOOL)hasContentToShow:(nonnull MVMCoreLoadObject *)loadObject error:(nullable MVMCoreErrorObject *)error; #if ENABLE_HARD_CODED_RESPONSE -- (nonnull NSDictionary *)getJSONForPageType:(nonnull NSString *)pageType; +- (nullable NSDictionary *)getJSONForRequestParameters:(nonnull MVMCoreRequestParameters *)requestParameters; - (nonnull NSDictionary *)modifyJSON:(nonnull NSDictionary *)json; #endif From a5d237df8be7cf8fd0f3c5ddbc6ac02985693300 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 2 Oct 2023 12:32:00 -0400 Subject: [PATCH 3/7] push model in action events for model specfic attributes --- .../ActionHandling/MVMCoreActionHandler.swift | 6 +++--- MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.swift b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.swift index c206300..7868be5 100644 --- a/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.swift +++ b/MVMCore/MVMCore/ActionHandling/MVMCoreActionHandler.swift @@ -97,14 +97,14 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol { do { let handlerType = try ModelRegistry.getHandler(model) as! MVMCoreActionHandlerProtocol.Type let handler = handlerType.init() - MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionInvoked(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid)) + MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionInvoked(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid, model: model)) if let handler = handler as? MVMCoreJSONActionHandlerProtocol { // Needed until we can remove legacy delegate functions. try await handler.performAction(with: json, model: model, delegateObject: delegateObject, additionalData: additionalData) } else { try await handler.execute(with: model, delegateObject: delegateObject, additionalData: additionalData) } - MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionComplete(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid)) + MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionComplete(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid, model: model)) } catch ModelRegistry.Error.handlerNotMapped { try Task.checkCancellation() // Allows custom handling if there no handler for the action. @@ -114,7 +114,7 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol { throw ActionError.unknownAction(type: model.actionType) } } catch { - MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionFailed(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid, error: error)) + MVMCoreLoggingHandler.shared()?.logCoreEvent(.actionFailed(name: model.actionType, pageType: pageType(from: delegateObject), uuid: uuid, model: model, error: error)) MVMCoreActionHandler.log(string: "Failed Action \(error)", additionalData: additionalData) throw error } diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift b/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift index 8ccae44..d5bd26c 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift @@ -29,26 +29,29 @@ public enum MVMCoreEvent { pageType: String ) - /// The webview bridge action handler was invoked and is in progress. + /// The core action handler was invoked and is in progress. case actionInvoked( name: String, pageType: String, - uuid: String + uuid: String, + model: ActionModelProtocol ) - /// The action failed.. + /// The core action handler fail to complete the action. case actionFailed( name: String, pageType: String, uuid: String, + model: ActionModelProtocol, error: Error? ) - /// The action is completed. + /// The core action handler completed an action. case actionComplete( name: String, pageType: String, - uuid: String + uuid: String, + model: ActionModelProtocol ) // ---------------------------- From a94cc27168b1b10fcde9a84de21f0f7e86a43f89 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 2 Oct 2023 20:22:44 -0400 Subject: [PATCH 4/7] comment typos --- MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift b/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift index d5bd26c..0091b71 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreEvent.swift @@ -23,7 +23,7 @@ public enum MVMCoreEvent { error: Error? ) - /// Could not find the action specified.. + /// Could not find the action specified. case actionNotFound( name: String, pageType: String @@ -37,7 +37,7 @@ public enum MVMCoreEvent { model: ActionModelProtocol ) - /// The core action handler fail to complete the action. + /// The core action handler failed to complete the action. case actionFailed( name: String, pageType: String, @@ -64,7 +64,7 @@ public enum MVMCoreEvent { actionId: String ) - /// The client perameter handler was invoked and is in progress. + /// The client parameter handler was invoked and is in progress. case clientParameterStartFetch( name: String, uuid: String, From 51597121bdec92d7dad59392dd6e7214eff70b8a Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 4 Oct 2023 10:18:52 -0400 Subject: [PATCH 5/7] MVMCoreObject to swift --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 12 ++---- .../MVMCoreLoadingOverlayHandler.m | 3 +- .../MVMCore/LoadHandling/MVMCoreLoadHandler.m | 1 - .../MVMCoreLoadRequestOperation.m | 1 - MVMCore/MVMCore/MVMCore.h | 1 - MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m | 2 +- .../OtherHandlers/MVMCoreLoggingHandler.m | 1 - .../MVMCore/Session/MVMCoreSessionObject.m | 1 - .../MVMCore/Singletons/HandlerSingleton.swift | 43 +++++++++++++++++++ MVMCore/MVMCore/Singletons/MVMCoreObject.m | 34 --------------- .../Utility/Helpers/MVMCoreActionUtility.m | 1 - MVMCore/MVMCore/Utility/MVMCoreErrorObject.m | 1 - .../MVMCoreViewControllerMappingObject.m | 2 +- 13 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 MVMCore/MVMCore/Singletons/HandlerSingleton.swift delete mode 100644 MVMCore/MVMCore/Singletons/MVMCoreObject.m diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index df679b9..a0e9008 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -72,6 +72,7 @@ AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF130B8E2788DF6E00C6C03C /* OpenURLOptionsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF130B8D2788DF6E00C6C03C /* OpenURLOptionsModel.swift */; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; + AF3A3F3F2ACC716A005094B2 /* HandlerSingleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */; }; AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */; }; AF43A57B1FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5791FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -84,8 +85,6 @@ AF43A6FD1FBE2F65008E9347 /* Reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A6FA1FBE2F2A008E9347 /* Reachability.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A6FF1FBE3252008E9347 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A6FB1FBE2F2A008E9347 /* Reachability.m */; }; AF43A7011FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A7001FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AF43A7061FC4D7A2008E9347 /* MVMCoreObject.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A7041FC4D7A2008E9347 /* MVMCoreObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AF43A7071FC4D7A2008E9347 /* MVMCoreObject.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A7051FC4D7A2008E9347 /* MVMCoreObject.m */; }; AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A7081FC4F415008E9347 /* MVMCoreCache.m */; }; AF43A70B1FC4F415008E9347 /* MVMCoreCache.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A7091FC4F415008E9347 /* MVMCoreCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A71B1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A71A1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -225,6 +224,7 @@ AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF130B8D2788DF6E00C6C03C /* OpenURLOptionsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenURLOptionsModel.swift; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandlerSingleton.swift; sourceTree = ""; }; AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreJSONConstants.h; sourceTree = ""; }; AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreJSONConstants.m; sourceTree = ""; }; AF43A5791FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreHardcodedStringsConstants.h; sourceTree = ""; }; @@ -240,8 +240,6 @@ AF43A6FB1FBE2F2A008E9347 /* Reachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; AF43A6FE1FBE2FEE008E9347 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; AF43A7001FC4B227008E9347 /* MVMCoreGlobalLoadProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreGlobalLoadProtocol.h; sourceTree = ""; }; - AF43A7041FC4D7A2008E9347 /* MVMCoreObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreObject.h; sourceTree = ""; }; - AF43A7051FC4D7A2008E9347 /* MVMCoreObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreObject.m; sourceTree = ""; }; AF43A7081FC4F415008E9347 /* MVMCoreCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreCache.m; sourceTree = ""; }; AF43A7091FC4F415008E9347 /* MVMCoreCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreCache.h; sourceTree = ""; }; AF43A71A1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewControllerProtocol.h; sourceTree = ""; }; @@ -666,8 +664,7 @@ AFBB96DE1FBA48CE0008D868 /* Singletons */ = { isa = PBXGroup; children = ( - AF43A7041FC4D7A2008E9347 /* MVMCoreObject.h */, - AF43A7051FC4D7A2008E9347 /* MVMCoreObject.m */, + AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */, ); path = Singletons; sourceTree = ""; @@ -728,7 +725,6 @@ AF43A5871FBB67D6008E9347 /* MVMCoreActionUtility.h in Headers */, AF43A6FD1FBE2F65008E9347 /* Reachability.h in Headers */, AFBB96601FBA3A570008D868 /* MVMCoreLoadObject.h in Headers */, - AF43A7061FC4D7A2008E9347 /* MVMCoreObject.h in Headers */, AFED77A11FCCA29400BAE689 /* MVMCoreViewControllerNibMappingObject.h in Headers */, AF43A71B1FC5BEBB008E9347 /* MVMCoreViewControllerProtocol.h in Headers */, AFBB96381FBA39E70008D868 /* MVMCoreLoadDelegateProtocol.h in Headers */, @@ -913,7 +909,6 @@ 8876D5F51FB50AB000EB2E3D /* UILabel+MFCustom.m in Sources */, AFBB96B31FBA3B590008D868 /* MVMCoreGetterUtility.m in Sources */, 2723337B28BD534D004EAEE0 /* MVMCoreEvent.swift in Sources */, - AF43A7071FC4D7A2008E9347 /* MVMCoreObject.m in Sources */, 94C014D924212360005811A9 /* ActionSettingModel.swift in Sources */, D2DEDCB723C63F3B00C44CC4 /* Clamping.swift in Sources */, AF70699E2880D01400077CF6 /* ActionShareHandler.swift in Sources */, @@ -926,6 +921,7 @@ AFEA17A9209B6A1C00BC6740 /* MVMCoreBlockOperation.m in Sources */, AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */, AF43A6FF1FBE3252008E9347 /* Reachability.m in Sources */, + AF3A3F3F2ACC716A005094B2 /* HandlerSingleton.swift in Sources */, EA09CD62282ACDDB00A7835F /* Decoder+UserInfo.swift in Sources */, EA09CD99282BF83600A7835F /* DecodableDefault.swift in Sources */, 01C851D123CF97FE0021F976 /* ActionBackModel.swift in Sources */, diff --git a/MVMCore/MVMCore/LoadHandling/LoadingOverlay/MVMCoreLoadingOverlayHandler.m b/MVMCore/MVMCore/LoadHandling/LoadingOverlay/MVMCoreLoadingOverlayHandler.m index f3c953e..bc49369 100644 --- a/MVMCore/MVMCore/LoadHandling/LoadingOverlay/MVMCoreLoadingOverlayHandler.m +++ b/MVMCore/MVMCore/LoadHandling/LoadingOverlay/MVMCoreLoadingOverlayHandler.m @@ -6,11 +6,12 @@ // Copyright (c) 2014 Verizon Wireless. All rights reserved. // +@import UIKit; #import "MVMCoreLoadingOverlayHandler.h" #import "MVMCoreSessionObject.h" #import #import "MVMCoreLoadingViewControllerProtocol.h" -#import "MVMCoreObject.h" +#import @interface MVMCoreLoadingOverlayHandler () // The loading ui elements diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index ab36e99..12d6014 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -18,7 +18,6 @@ #import "MVMCoreErrorObject.h" #import "MVMCoreErrorConstants.h" #import "MVMCoreHardcodedStringsConstants.h" -#import "MVMCoreObject.h" #import "MVMCoreConstants.h" #import "MVMCoreActionUtility.h" #import diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 4ec531f..d6e352b 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -22,7 +22,6 @@ #import "MVMCoreHardcodedStringsConstants.h" #import "MVMCoreErrorConstants.h" #import "MVMCoreActionUtility.h" -#import "MVMCoreObject.h" #import "MVMCoreConstants.h" #import diff --git a/MVMCore/MVMCore/MVMCore.h b/MVMCore/MVMCore/MVMCore.h index 3b4bd31..1f56b24 100644 --- a/MVMCore/MVMCore/MVMCore.h +++ b/MVMCore/MVMCore/MVMCore.h @@ -34,7 +34,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreVersionString[]; #import #import #import -#import #import #import diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index 4c121bf..74aa41f 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -11,12 +11,12 @@ #import "MVMCoreErrorObject.h" #import "MVMCoreLoggingHandler.h" #import "MVMCoreGetterUtility.h" -#import "MVMCoreObject.h" #import "MVMCoreConstants.h" #import "MVMCoreActionUtility.h" #import "MVMCoreLoggingHandler.h" #import "MVMCoreDispatchUtility.h" #import "MVMCoreErrorConstants.h" +#import @interface MVMCoreCache () diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index 6978815..2931aef 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -7,7 +7,6 @@ // #import "MVMCoreLoggingHandler.h" -#import "MVMCoreObject.h" #import "MVMCoreActionUtility.h" #import diff --git a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m index 7f00093..628f7a6 100644 --- a/MVMCore/MVMCore/Session/MVMCoreSessionObject.m +++ b/MVMCore/MVMCore/Session/MVMCoreSessionObject.m @@ -7,7 +7,6 @@ // #import "MVMCoreSessionObject.h" -#import "MVMCoreObject.h" #import "MVMCoreActionUtility.h" #import diff --git a/MVMCore/MVMCore/Singletons/HandlerSingleton.swift b/MVMCore/MVMCore/Singletons/HandlerSingleton.swift new file mode 100644 index 0000000..2da3ea5 --- /dev/null +++ b/MVMCore/MVMCore/Singletons/HandlerSingleton.swift @@ -0,0 +1,43 @@ +// +// HandlerSingleton.swift +// MVMCore +// +// Created by Scott Pfeil on 10/3/23. +// Copyright © 2023 myverizon. All rights reserved. +// + +import Foundation + +public typealias HandlerSingleton = MVMCoreObject + +@objcMembers +public class MVMCoreObject: NSObject { + private static var singleton = MVMCoreObject() + public static func sharedInstance() -> MVMCoreObject? { singleton } + private override init() {} + + public var session: MVMCoreSessionObject? + public var cache: MVMCoreCache? + public var actionHandler: MVMCoreActionHandler? + public var viewControllerMapping: MVMCoreViewControllerMappingObject? + public var sessionHandler: MVMCoreSessionTimeHandler? + public var loadHandler: MVMCoreLoadHandler? + public var globalLoadDelegate: MVMCoreGlobalLoadProtocol? + public var loadingProtocol: MVMCoreLoadingOverlayDelegateProtocol? + public var loggingDelegate: MVMCoreLoggingDelegateProtocol? + + /// A reference to the calling application delegate that should be set. For a normal app, could be the UIApplicationDelegate. For watch, could be WKExtensionDelegate. For iMessage, could be MSMessagesAppViewController. etc, etc. Useful for the framework to call delegate specific functions. + public weak var applicationDelegate: AnyObject? + + /// Convenience function. Sets up with a default session, cache, view controller mapping, action handler, session handler, and logging delegate. + public func defaultInitialSetup() { + ModelMapping.registerObjects() + session = MVMCoreSessionObject() + cache = MVMCoreCache() + viewControllerMapping = MVMCoreViewControllerMappingObject() + sessionHandler = MVMCoreSessionTimeHandler() + actionHandler = MVMCoreActionHandler() + loggingDelegate = MVMCoreLoggingHandler() + loadHandler = MVMCoreLoadHandler() + } +} diff --git a/MVMCore/MVMCore/Singletons/MVMCoreObject.m b/MVMCore/MVMCore/Singletons/MVMCoreObject.m deleted file mode 100644 index 21eb44e..0000000 --- a/MVMCore/MVMCore/Singletons/MVMCoreObject.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// MVMCoreObject.m -// MVMCore -// -// Created by Pfeil, Scott Robert on 11/21/17. -// Copyright © 2017 myverizon. All rights reserved. -// - -#import "MVMCoreObject.h" -#import - -@implementation MVMCoreObject - -+ (nullable instancetype)sharedInstance { - static dispatch_once_t once; - static id sharedInstance; - dispatch_once(&once, ^{ - sharedInstance = [[self alloc] init]; - }); - return sharedInstance; -} - -- (void)defaultInitialSetup { - [ModelMapping registerObjects]; - self.session = [[MVMCoreSessionObject alloc] init]; - self.cache = [[MVMCoreCache alloc] init]; - self.viewControllerMapping = [[MVMCoreViewControllerMappingObject alloc] init]; - self.sessionHandler = [[MVMCoreSessionTimeHandler alloc] init]; - self.actionHandler = [[MVMCoreActionHandler alloc] init]; - self.loggingDelegate = [[MVMCoreLoggingHandler alloc] init]; - self.loadHandler = [[MVMCoreLoadHandler alloc] init]; -} - -@end diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m index 3cb82df..f479e2a 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m @@ -15,7 +15,6 @@ #import "MVMCoreRequestParameters.h" #import "NSDictionary+MFConvenience.h" #import "MVMCoreJSONConstants.h" -#import "MVMCoreObject.h" #import @implementation MVMCoreActionUtility diff --git a/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m b/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m index 9b316dd..9cf85b6 100644 --- a/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m +++ b/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m @@ -7,7 +7,6 @@ // #import "MVMCoreErrorObject.h" -#import "MVMCoreObject.h" #import "MVMCoreErrorConstants.h" #import "MVMCoreGetterUtility.h" #import "NSDictionary+MFConvenience.h" diff --git a/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m b/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m index 99fc136..f79d501 100644 --- a/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m +++ b/MVMCore/MVMCore/ViewControllerMapping/MVMCoreViewControllerMappingObject.m @@ -17,8 +17,8 @@ #import "MVMCoreViewControllerProgrammaticMappingObject.h" #import "MVMCoreErrorConstants.h" #import "MVMCoreHardcodedStringsConstants.h" -#import "MVMCoreObject.h" #import "MVMCoreActionUtility.h" +#import @interface MVMCoreViewControllerMappingObject () From db9bd9e3b305865e27324da4079c8c6f36eb37f3 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 4 Oct 2023 11:37:43 -0400 Subject: [PATCH 6/7] change name back.... wishful thinking removed --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 8 ++++---- .../{HandlerSingleton.swift => MVMCoreObject.swift} | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) rename MVMCore/MVMCore/Singletons/{HandlerSingleton.swift => MVMCoreObject.swift} (97%) diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index a0e9008..c0749ae 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -72,7 +72,7 @@ AF1201832108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF130B8E2788DF6E00C6C03C /* OpenURLOptionsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF130B8D2788DF6E00C6C03C /* OpenURLOptionsModel.swift */; }; AF26DDAE1FCE6A37004E8F65 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF26DDB01FCE6A37004E8F65 /* Localizable.strings */; }; - AF3A3F3F2ACC716A005094B2 /* HandlerSingleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */; }; + AF3A3F3F2ACC716A005094B2 /* MVMCoreObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF3A3F3E2ACC716A005094B2 /* MVMCoreObject.swift */; }; AF43A5771FBA5B7C008E9347 /* MVMCoreJSONConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */; }; AF43A57B1FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = AF43A5791FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -224,7 +224,7 @@ AF1201812108C9B400E2F592 /* MVMCoreViewManagerViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreViewManagerViewControllerProtocol.h; sourceTree = ""; }; AF130B8D2788DF6E00C6C03C /* OpenURLOptionsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenURLOptionsModel.swift; sourceTree = ""; }; AF26DDAF1FCE6A37004E8F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandlerSingleton.swift; sourceTree = ""; }; + AF3A3F3E2ACC716A005094B2 /* MVMCoreObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreObject.swift; sourceTree = ""; }; AF43A5751FBA5B7C008E9347 /* MVMCoreJSONConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreJSONConstants.h; sourceTree = ""; }; AF43A5761FBA5B7C008E9347 /* MVMCoreJSONConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreJSONConstants.m; sourceTree = ""; }; AF43A5791FBA5E6A008E9347 /* MVMCoreHardcodedStringsConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreHardcodedStringsConstants.h; sourceTree = ""; }; @@ -664,7 +664,7 @@ AFBB96DE1FBA48CE0008D868 /* Singletons */ = { isa = PBXGroup; children = ( - AF3A3F3E2ACC716A005094B2 /* HandlerSingleton.swift */, + AF3A3F3E2ACC716A005094B2 /* MVMCoreObject.swift */, ); path = Singletons; sourceTree = ""; @@ -921,7 +921,7 @@ AFEA17A9209B6A1C00BC6740 /* MVMCoreBlockOperation.m in Sources */, AF43A70A1FC4F415008E9347 /* MVMCoreCache.m in Sources */, AF43A6FF1FBE3252008E9347 /* Reachability.m in Sources */, - AF3A3F3F2ACC716A005094B2 /* HandlerSingleton.swift in Sources */, + AF3A3F3F2ACC716A005094B2 /* MVMCoreObject.swift in Sources */, EA09CD62282ACDDB00A7835F /* Decoder+UserInfo.swift in Sources */, EA09CD99282BF83600A7835F /* DecodableDefault.swift in Sources */, 01C851D123CF97FE0021F976 /* ActionBackModel.swift in Sources */, diff --git a/MVMCore/MVMCore/Singletons/HandlerSingleton.swift b/MVMCore/MVMCore/Singletons/MVMCoreObject.swift similarity index 97% rename from MVMCore/MVMCore/Singletons/HandlerSingleton.swift rename to MVMCore/MVMCore/Singletons/MVMCoreObject.swift index 2da3ea5..2f3fe67 100644 --- a/MVMCore/MVMCore/Singletons/HandlerSingleton.swift +++ b/MVMCore/MVMCore/Singletons/MVMCoreObject.swift @@ -8,8 +8,6 @@ import Foundation -public typealias HandlerSingleton = MVMCoreObject - @objcMembers public class MVMCoreObject: NSObject { private static var singleton = MVMCoreObject() From b1e4c55281bc67c669c6337aab2ed1b65db230eb Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 4 Oct 2023 16:45:06 -0400 Subject: [PATCH 7/7] remove missing file --- MVMCore/MVMCore/Singletons/MVMCoreObject.h | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 MVMCore/MVMCore/Singletons/MVMCoreObject.h diff --git a/MVMCore/MVMCore/Singletons/MVMCoreObject.h b/MVMCore/MVMCore/Singletons/MVMCoreObject.h deleted file mode 100644 index dd7f22f..0000000 --- a/MVMCore/MVMCore/Singletons/MVMCoreObject.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// MVMCoreObject.h -// MVMCore -// -// Created by Pfeil, Scott Robert on 11/21/17. -// Copyright © 2017 myverizon. All rights reserved. -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import -@class MVMCoreActionHandler; -@class MVMCoreSessionTimeHandler; - -@interface MVMCoreObject : NSObject - -@property (nullable, strong, nonatomic) MVMCoreSessionObject *session; -@property (nullable, strong, nonatomic) MVMCoreCache *cache; -@property (nullable, strong, nonatomic) MVMCoreViewControllerMappingObject *viewControllerMapping; -@property (nullable, strong, nonatomic) MVMCoreActionHandler *actionHandler; -@property (nullable, strong, nonatomic) MVMCoreSessionTimeHandler *sessionHandler; -@property (nullable, strong, nonatomic) MVMCoreLoadHandler *loadHandler; - -// The delegates -@property (nullable, strong, nonatomic) id globalLoadDelegate; -@property (nullable, strong, nonatomic) id loadingProtocol; -@property (nullable, strong, nonatomic) NSObject *loggingDelegate; - -// A reference to the calling application delegate that should be set. For a normal app, could be the UIApplicationDelegate. For watch, could be WKExtensionDelegate. For iMessage, could be MSMessagesAppViewController. etc, etc. Useful for the framework to call delegate specific functions. -@property (nullable, weak, nonatomic) id applicationDelegate; - -// A singleton. -+ (nullable instancetype)sharedInstance; - -// Sets up with a default session, cache, view controller mapping, action handler, session handler, and logging delegate. -- (void)defaultInitialSetup; - -@end