diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index df679b9..c0749ae 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 /* 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, ); }; }; @@ -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 /* 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 = ""; }; @@ -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 /* MVMCoreObject.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 /* 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/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/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 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/Singletons/MVMCoreObject.swift b/MVMCore/MVMCore/Singletons/MVMCoreObject.swift new file mode 100644 index 0000000..2f3fe67 --- /dev/null +++ b/MVMCore/MVMCore/Singletons/MVMCoreObject.swift @@ -0,0 +1,41 @@ +// +// HandlerSingleton.swift +// MVMCore +// +// Created by Scott Pfeil on 10/3/23. +// Copyright © 2023 myverizon. All rights reserved. +// + +import Foundation + +@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/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 ()