Skip to content

Commit 153e9af

Browse files
committed
Add generic types to PFOfflineStore.
1 parent c7e8645 commit 153e9af

File tree

2 files changed

+142
-118
lines changed

2 files changed

+142
-118
lines changed

Parse/Internal/LocalDataStore/OfflineStore/PFOfflineStore.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
4444
/// @name Fetch
4545
///--------------------------------------
4646

47-
- (BFTask *)fetchObjectLocallyAsync:(PFObject *)object;
47+
- (BFTask PF_GENERIC(PFObject *)*)fetchObjectLocallyAsync:(PFObject *)object;
4848

4949
/**
5050
Gets the data for the given object from the offline database. Returns a task that will be
@@ -54,15 +54,15 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
5454
@param object The object to fetch.
5555
@param database A database connection to use.
5656
*/
57-
- (BFTask *)fetchObjectLocallyAsync:(PFObject *)object database:(PFSQLiteDatabase *)database;
57+
- (BFTask PF_GENERIC(PFObject *)*)fetchObjectLocallyAsync:(PFObject *)object database:(PFSQLiteDatabase *)database;
5858

5959
///--------------------------------------
6060
/// @name Save
6161
///--------------------------------------
6262

6363
//TODO: (nlutsenko) Remove `includChildren` method, replace with PFLocalStore that wraps OfflineStore + Pin.
64-
- (BFTask *)saveObjectLocallyAsync:(PFObject *)object includeChildren:(BOOL)includeChildren;
65-
- (BFTask *)saveObjectLocallyAsync:(PFObject *)object withChildren:(NSArray *)children;
64+
- (BFTask PF_GENERIC(PFVoid)*)saveObjectLocallyAsync:(PFObject *)object includeChildren:(BOOL)includeChildren;
65+
- (BFTask PF_GENERIC(PFVoid)*)saveObjectLocallyAsync:(PFObject *)object withChildren:(NSArray PF_GENERIC(PFObject *)*)children;
6666

6767
/**
6868
Stores an object (and optionally, every object it points to recursively) in the local database.
@@ -77,9 +77,9 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
7777
@param children If non-empty - these children will be saved to LDS as well.
7878
@param database A database connection to use.
7979
*/
80-
- (BFTask *)saveObjectLocallyAsync:(PFObject *)object
81-
withChildren:(NSArray *)children
82-
database:(PFSQLiteDatabase *)database;
80+
- (BFTask PF_GENERIC(PFVoid)*)saveObjectLocallyAsync:(PFObject *)object
81+
withChildren:(NSArray PF_GENERIC(PFObject *)*)children
82+
database:(PFSQLiteDatabase *)database;
8383

8484
///--------------------------------------
8585
/// @name Find
@@ -90,22 +90,20 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
9090
9191
@return The objects that match the query's constraint.
9292
*/
93-
- (BFTask *)findAsyncForQueryState:(PFQueryState *)queryState
94-
user:(PFUser *)user
95-
pin:(PFPin *)pin;
93+
- (BFTask PF_GENERIC(NSArray<PFObject *> *)*)findAsyncForQueryState:(PFQueryState *)queryState user:(PFUser *)user pin:(PFPin *)pin;
9694

9795
/**
9896
Runs a PFQueryState against the store's contents.
9997
10098
@return The count of objects that match the query's constraint.
10199
*/
102-
- (BFTask *)countAsyncForQueryState:(PFQueryState *)queryState
103-
user:(PFUser *)user
104-
pin:(PFPin *)pin;
100+
- (BFTask PF_GENERIC(NSNumber *)*)countAsyncForQueryState:(PFQueryState *)queryState user:(PFUser *)user pin:(PFPin *)pin;
105101

106102
/**
107103
Runs a PFQueryState against the store's contents.
108104
105+
//TODO: (nlutsenko) A task that could yield to 2 different result types? Fix this logic!
106+
109107
@return The objects that match the query's constraint.
110108
*/
111109
- (BFTask *)findAsyncForQueryState:(PFQueryState *)queryState
@@ -117,6 +115,8 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
117115
Runs a PFQueryState against the store's contents. May cause any instances of the object to get fetched from
118116
offline database. (TODO (hallucinogen): should we consider objects in memory but not in Offline Store?)
119117
118+
//TODO: (nlutsenko) A task that could yield to 2 different result types? Fix this logic!
119+
120120
@param queryState The query.
121121
@param user The user making the query.
122122
@param pin (Optional) The pin we're querying across. If null, all pins.
@@ -140,7 +140,7 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
140140
data is in memory. This will only be used when data comes back from the server after a fetch
141141
or a save.
142142
*/
143-
- (BFTask *)updateDataForObjectAsync:(PFObject *)object;
143+
- (BFTask PF_GENERIC(PFVoid)*)updateDataForObjectAsync:(PFObject *)object;
144144

145145
///--------------------------------------
146146
/// @name Delete
@@ -149,13 +149,13 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
149149
/**
150150
Deletes the given object from Offline Store's pins
151151
*/
152-
- (BFTask *)deleteDataForObjectAsync:(PFObject *)object;
152+
- (BFTask PF_GENERIC(PFVoid)*)deleteDataForObjectAsync:(PFObject *)object;
153153

154154
///--------------------------------------
155155
/// @name Unpin
156156
///--------------------------------------
157157

158-
- (BFTask *)unpinObjectAsync:(PFObject *)object;
158+
- (BFTask PF_GENERIC(PFVoid)*)unpinObjectAsync:(PFObject *)object;
159159

160160
///--------------------------------------
161161
/// @name Internal Helper Methods
@@ -165,8 +165,8 @@ typedef NS_OPTIONS(uint8_t, PFOfflineStoreOptions)
165165
Gets the UUID for the given object, if it has one. Otherwise, creates a new UUID for the object
166166
and adds a new row to the database for the object with no data.
167167
*/
168-
- (BFTask *)getOrCreateUUIDAsyncForObject:(PFObject *)object
169-
database:(PFSQLiteDatabase *)database;
168+
- (BFTask PF_GENERIC(NSString *)*)getOrCreateUUIDAsyncForObject:(PFObject *)object
169+
database:(PFSQLiteDatabase *)database;
170170

171171
/**
172172
This should only be called from `PFObject.objectWithoutDataWithClassName`.

0 commit comments

Comments
 (0)