Skip to content

Commit 235317a

Browse files
committed
Add asynchronous API for loading current config.
1 parent 51cb9e8 commit 235317a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Parse/PFConfig.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ typedef void(^PFConfigResultBlock)(PFConfig *_Nullable config, NSError *_Nullabl
3838
*/
3939
+ (PFConfig *)currentConfig;
4040

41+
/**
42+
Returns the task that encapsulates the most recently fetched config.
43+
44+
If there was no config fetched - this method will return an empty instance of `PFConfig`.
45+
46+
@return Task that encapsulates current, last fetched instance of PFConfig.
47+
*/
48+
+ (BFTask<__kindof PFConfig *> *)getCurrentConfigInBackground;
49+
4150
///--------------------------------------
4251
#pragma mark - Retrieving Config
4352
///--------------------------------------

Parse/PFConfig.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ + (PFConfigController *)_configController {
4040
#pragma mark Public
4141

4242
+ (PFConfig *)currentConfig {
43-
return [[[self _configController].currentConfigController getCurrentConfigAsync] waitForResult:nil
44-
withMainThreadWarning:NO];
43+
return [[self getCurrentConfigInBackground] waitForResult:nil withMainThreadWarning:NO];
44+
}
45+
46+
+ (BFTask<__kindof PFConfig *> *)getCurrentConfigInBackground {
47+
return [[self _configController].currentConfigController getCurrentConfigAsync];
4548
}
4649

4750
///--------------------------------------

0 commit comments

Comments
 (0)