diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index e5931ea..f108113 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -398,9 +398,13 @@ #pragma mark - Loading Functions - (MVMCoreLoadRequestOperation *)loadRequest:(nonnull MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject { - MVMCoreLoadRequestOperation *loadOperation = [[MVMCoreLoadRequestOperation alloc] initWithRequestParameters:requestParameters dataForPage:dataForPage delegateObject:delegateObject backgroundLoad:NO]; - [self.blockingLoadQueue addOperation:loadOperation]; - return loadOperation; + if (requestParameters.backgroundRequest) { + return [self loadBackgroundRequest:requestParameters dataForPage:dataForPage delegateObject:delegateObject]; + } else { + MVMCoreLoadRequestOperation *loadOperation = [[MVMCoreLoadRequestOperation alloc] initWithRequestParameters:requestParameters dataForPage:dataForPage delegateObject:delegateObject backgroundLoad:NO]; + [self.blockingLoadQueue addOperation:loadOperation]; + return loadOperation; + } } - (MVMCoreLoadRequestOperation *)loadBackgroundRequest:(nonnull MVMCoreRequestParameters *)requestParameters dataForPage:(nullable NSDictionary *)dataForPage delegateObject:(nullable DelegateObject *)delegateObject { diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.h b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.h index b53ae9d..80702a4 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.h @@ -93,6 +93,9 @@ typedef NS_ENUM(NSInteger, MFLoadStyle) { // A list of page types that this operation should NOT be loaded in parallel with. @property (nullable, strong, nonatomic) NSArray * successivePageTypes; +/// A flag for if it should be a background request or not. +@property (assign, nonatomic) BOOL backgroundRequest; + // Creates an object with the given page type and extra parameters. Adds the extra parameters to the standard request parameters. Will add any modules needed by the page type by default. - (nullable instancetype)initWithPageType:(nonnull NSString *)pageType extraParameters:(nullable NSDictionary *)extraParameters; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m index 5030046..9986bd7 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m @@ -134,6 +134,7 @@ copyObject.openSupportPanel = self.openSupportPanel; copyObject.imageData = self.imageData; copyObject.customTimeoutTime = self.customTimeoutTime; + copyObject.backgroundRequest = self.backgroundRequest; return copyObject; }