Skip to content

Commit c4b4e7b

Browse files
committed
chore: tweak
1 parent 9d5ebb0 commit c4b4e7b

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

AVOS/LeanCloudObjcTests/LCUserTestCase.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ class LCUserTestCase: BaseTestCase {
184184
}
185185

186186
expecting { exp in
187-
user_1.getFolloweeObjects { followees, error in
187+
query = user_1.followeeObjectsQuery()
188+
query.findObjectsInBackground { followees, error in
188189
let followee = followees?.first as? LCObject
189190
XCTAssertNotNil(followee)
190191
XCTAssertEqual(followee?["group"] as? String, "music")
@@ -200,7 +201,8 @@ class LCUserTestCase: BaseTestCase {
200201
XCTAssertNil(error)
201202
exp.fulfill()
202203
if succeeded {
203-
user_2.getFolloweeObjects { followees, error in
204+
query = user_2.followeeObjectsQuery()
205+
query.findObjectsInBackground { followees, error in
204206
let followee = followees?.first as? LCObject
205207
XCTAssertNotNil(followee)
206208
XCTAssertEqual(followee?["group"] as? String, "sport")

AVOS/Sources/Foundation/User/LCUser.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ FOUNDATION_EXPORT LeanCloudSocialPlatform const LeanCloudSocialPlatformWeiXin;
540540
*/
541541
- (LCQuery *)followeeQuery;
542542

543+
/// New query for followee objects.
544+
- (LCQuery *)followeeObjectsQuery;
545+
543546
/**
544547
* 通过ID来关注其他用户
545548
* @warning 如果需要被关注者收到消息 需要手动给他发送一条LCStatus.
@@ -581,10 +584,6 @@ FOUNDATION_EXPORT LeanCloudSocialPlatform const LeanCloudSocialPlatformWeiXin;
581584
*/
582585
- (void)getFollowees:(LCArrayResultBlock)callback;
583586

584-
/// Get followee objects.
585-
/// @param callback Result callback.
586-
- (void)getFolloweeObjectsWithCallback:(void (^)(NSArray * _Nullable objects, NSError * _Nullable error))callback;
587-
588587
/**
589588
* 同时获取当前用户的粉丝和关注列表
590589
*

AVOS/Sources/Foundation/User/LCUser.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,13 @@ - (LCQuery *)followerQuery {
13131313
return [LCUser followerQuery:self.objectId];
13141314
}
13151315

1316+
- (LCQuery *)followeeObjectsQuery {
1317+
LCQuery *query = [LCQuery queryWithClassName:@"_Followee"];
1318+
[query whereKey:@"user" equalTo:self];
1319+
[query includeKey:@"followee"];
1320+
return query;
1321+
}
1322+
13161323
- (void)follow:(NSString *)userId andCallback:(LCBooleanResultBlock)callback {
13171324
[self follow:userId userDictionary:nil andCallback:callback];
13181325
}
@@ -1353,13 +1360,6 @@ - (void)getFollowees:(LCArrayResultBlock)callback {
13531360
[query findObjectsInBackgroundWithBlock:callback];
13541361
}
13551362

1356-
- (void)getFolloweeObjectsWithCallback:(void (^)(NSArray * _Nullable, NSError * _Nullable))callback {
1357-
LCQuery *query = [LCQuery queryWithClassName:@"_Followee"];
1358-
[query whereKey:@"user" equalTo:self];
1359-
[query includeKey:@"followee"];
1360-
[query findObjectsInBackgroundWithBlock:callback];
1361-
}
1362-
13631363
- (void)getFollowersAndFollowees:(LCDictionaryResultBlock)callback {
13641364
NSString *path = [NSString stringWithFormat:@"users/%@/followersAndFollowees?include=follower,followee", self.objectId];
13651365

0 commit comments

Comments
 (0)