Skip to content

Commit 2504c19

Browse files
committed
Add asynchronous API for fetching current installation.
1 parent f4a9e4b commit 2504c19

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Parse/PFInstallation.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,23 @@ PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFInstallation : PFObject<PFSu
4444
/**
4545
Gets the currently-running installation from disk and returns an instance of it.
4646
47-
If this installation is not stored on disk, returns a `PFInstallation`
48-
with `deviceType` and `installationId` fields set to those of the
49-
current installation.
47+
If this installation is not stored on disk this method will create a new `PFInstallation`
48+
with `deviceType` and `installationId` fields set to those of the current installation.
5049
5150
@result Returns a `PFInstallation` that represents the currently-running installation.
5251
*/
5352
+ (instancetype)currentInstallation;
5453

54+
/**
55+
*Asynchronously* loads the currently-running installation from disk and returns an instance of it.
56+
57+
If this installation is not stored on disk this method will create a new `PFInstallation`
58+
with `deviceType` and `installationId` fields set to those of the current installation.
59+
60+
@result Returns a task that incapsulates the current installation.
61+
*/
62+
+ (BFTask<__kindof PFInstallation *> *)getCurrentInstallationInBackground;
63+
5564
///--------------------------------------
5665
#pragma mark - Installation Properties
5766
///--------------------------------------

Parse/PFInstallation.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ + (PFQuery *)query {
132132
///--------------------------------------
133133

134134
+ (instancetype)currentInstallation {
135-
BFTask *task = [[self _currentInstallationController] getCurrentObjectAsync];
136-
return [task waitForResult:nil withMainThreadWarning:NO];
135+
return [[self getCurrentInstallationInBackground] waitForResult:nil withMainThreadWarning:NO];
136+
}
137+
138+
+ (BFTask<__kindof PFInstallation *> *)getCurrentInstallationInBackground {
139+
return [[self _currentInstallationController] getCurrentObjectAsync];
137140
}
138141

139142
///--------------------------------------

0 commit comments

Comments
 (0)