Merge branch 'develop' of gitlab.verizon.com:BPHV_MIPS/mvm_core into develop
This commit is contained in:
commit
ebbf922500
@ -35,6 +35,8 @@
|
||||
|
||||
#pragma mark - Request Functions.
|
||||
|
||||
- (void)setHeadersForRequest:(nonnull NSMutableURLRequest *)request requestParameters:(nonnull MVMCoreRequestParameters *)requestParameters;
|
||||
|
||||
// Creates a request object with the given parameters.
|
||||
- (nullable NSURLRequest *)requestWithParameters:(nonnull MVMCoreRequestParameters *)requestParameters error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error;
|
||||
|
||||
|
||||
@ -35,15 +35,7 @@
|
||||
@implementation MVMCoreLoadHandler
|
||||
|
||||
+ (nullable instancetype)sharedGlobal {
|
||||
static dispatch_once_t once;
|
||||
static id sharedInstance;
|
||||
|
||||
dispatch_once(&once, ^
|
||||
{
|
||||
sharedInstance = [[self alloc] init];
|
||||
});
|
||||
|
||||
return sharedInstance;
|
||||
return [MVMCoreActionUtility initializerClassCheck:[MVMCoreObject sharedInstance].loadHandler classToVerify:self];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
@ -234,7 +226,7 @@
|
||||
return boundary;
|
||||
}
|
||||
|
||||
- (void)setHeadersForRequest:(NSMutableURLRequest *)request requestParameters:(MVMCoreRequestParameters *)requestParameters {
|
||||
- (void)setHeadersForRequest:(nonnull NSMutableURLRequest *)request requestParameters:(nonnull MVMCoreRequestParameters *)requestParameters {
|
||||
|
||||
[request setHTTPMethod:@"POST"];
|
||||
[request setValue:@"no-cache, no-store" forHTTPHeaderField:@"Cache-Control"];
|
||||
|
||||
@ -61,4 +61,26 @@ extension Decodable {
|
||||
}
|
||||
}
|
||||
|
||||
public enum DecoderKeyError: Error {
|
||||
case createKey
|
||||
}
|
||||
|
||||
public extension JSONDecoder {
|
||||
/// Adds a delegate object to the decoder for use in the model initializers.
|
||||
func add<T: DelegateObject>(delegateObject: T) throws {
|
||||
guard let key = CodingUserInfoKey(rawValue: "delegateObject") else {
|
||||
throw DecoderKeyError.createKey
|
||||
}
|
||||
userInfo.updateValue(delegateObject, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
public extension Decoder {
|
||||
/// Gets a delegate object from the decoder for use in the model initializers. Had to be added before decode.
|
||||
func get<T: DelegateObject>() throws -> T? {
|
||||
guard let key = CodingUserInfoKey(rawValue: "delegateObject") else {
|
||||
throw DecoderKeyError.createKey
|
||||
}
|
||||
return userInfo[key] as? T
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#import <MVMCore/MVMCoreLoggingDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCoreGlobalTopAlertDelegateProtocol.h>
|
||||
#import <MVMCore/MVMCoreLoggingHandler.h>
|
||||
#import <MVMCore/MVMCoreLoadHandler.h>
|
||||
|
||||
@interface MVMCoreObject : NSObject
|
||||
|
||||
@ -25,6 +26,7 @@
|
||||
@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 <MVMCoreGlobalLoadProtocol> globalLoadDelegate;
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
self.sessionHandler = [[MVMCoreSessionTimeHandler alloc] init];
|
||||
self.actionHandler = [[MVMCoreActionHandler alloc] init];
|
||||
self.loggingDelegate = [[MVMCoreLoggingHandler alloc] init];
|
||||
self.loadHandler = [[MVMCoreLoadHandler alloc] init];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user