global headers

This commit is contained in:
Suresh, Kamlesh 2020-05-22 19:32:05 -04:00
parent e5e46662a6
commit 519348f6bb
4 changed files with 7 additions and 10 deletions

View File

@ -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;

View File

@ -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"];

View File

@ -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;

View File

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