Browse Source

add a simple user constructor

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
f89f0ef542
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 55
      app/src/main/java/awais/instagrabber/repositories/responses/User.java
  2. 8
      app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java
  3. 6
      app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
  4. 6
      app/src/main/java/awais/instagrabber/viewmodels/CommentsViewerViewModel.java
  5. 35
      app/src/main/java/awais/instagrabber/webservices/GraphQLService.java
  6. 68
      app/src/main/java/awais/instagrabber/webservices/StoriesService.java

55
app/src/main/java/awais/instagrabber/repositories/responses/User.java

@ -28,11 +28,10 @@ public class User implements Serializable {
private final long usertagsCount; private final long usertagsCount;
private final String publicEmail; private final String publicEmail;
private final HdProfilePicUrlInfo hdProfilePicUrlInfo; private final HdProfilePicUrlInfo hdProfilePicUrlInfo;
private final String profileContext;
private final List<UserProfileContextLink> profileContextLinksWithUserIds;
private final String socialContext;
// if a DM member is a Facebook user, this is present
private final String interopMessagingUserFbid;
private final String profileContext; // "also followed by" your friends
private final List<UserProfileContextLink> profileContextLinksWithUserIds; // ^
private final String socialContext; // AYML
private final String interopMessagingUserFbid; // in DMs only: Facebook user ID
public User(final long pk, public User(final long pk,
final String username, final String username,
@ -90,6 +89,52 @@ public class User implements Serializable {
this.interopMessagingUserFbid = interopMessagingUserFbid; this.interopMessagingUserFbid = interopMessagingUserFbid;
} }
public User(final long pk,
final String username,
final String fullName,
final boolean isPrivate,
final String profilePicUrl,
final boolean isVerified) {
this.pk = pk;
this.username = username;
this.fullName = fullName;
this.isPrivate = isPrivate;
this.profilePicUrl = profilePicUrl;
this.profilePicId = null;
this.friendshipStatus = new FriendshipStatus(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
);
this.isVerified = isVerified;
this.hasAnonymousProfilePicture = false;
this.isUnpublished = false;
this.isFavorite = false;
this.isDirectappInstalled = false;
this.reelAutoArchive = null;
this.allowedCommenterType = null;
this.mediaCount = 0;
this.followerCount = 0;
this.followingCount = 0;
this.followingTagCount = 0;
this.biography = null;
this.externalUrl = null;
this.usertagsCount = 0;
this.publicEmail = null;
this.hdProfilePicUrlInfo = null;
this.profileContext = null;
this.profileContextLinksWithUserIds = null;
this.socialContext = null;
this.interopMessagingUserFbid = null;
}
public long getPk() { public long getPk() {
return pk; return pk;
} }

8
app/src/main/java/awais/instagrabber/repositories/responses/search/SearchItem.java

@ -191,9 +191,7 @@ public class SearchItem {
recentSearch.getName(), recentSearch.getName(),
false, false,
recentSearch.getPicUrl(), recentSearch.getPicUrl(),
null, null, false, false, false, false, false,
null, null, 0, 0, 0, 0, null, null,
0, null, null, null, null, null, null
false
); );
} }
@ -205,9 +203,7 @@ public class SearchItem {
favorite.getDisplayName(), favorite.getDisplayName(),
false, false,
favorite.getPicUrl(), favorite.getPicUrl(),
null, null, false, false, false, false, false,
null, null, 0, 0, 0, 0, null, null,
0, null, null, null, null, null, null
false
); );
} }

6
app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java

@ -767,11 +767,7 @@ public final class ResponseBodyUtils {
owner.optString("full_name"), owner.optString("full_name"),
false, false,
owner.optString("profile_pic_url"), owner.optString("profile_pic_url"),
null,
friendshipStatus,
owner.optBoolean("is_verified"),
false, false, false, false, null, null, 0, 0, 0, 0, null, null, 0, null, null,
null, null, null, null);
owner.optBoolean("is_verified"));
} }
final String id = feedItem.getString(Constants.EXTRAS_ID); final String id = feedItem.getString(Constants.EXTRAS_ID);
VideoVersion videoVersion = null; VideoVersion videoVersion = null;

6
app/src/main/java/awais/instagrabber/viewmodels/CommentsViewerViewModel.java

@ -238,11 +238,7 @@ public class CommentsViewerViewModel extends ViewModel {
null, null,
false, false,
owner.getString("profile_pic_url"), owner.getString("profile_pic_url"),
null,
new FriendshipStatus(false, false, false, false, false, false, false, false, false, false),
owner.optBoolean("is_verified"),
false, false, false, false, null, null, 0, 0, 0, 0, null, null, 0, null, null, null, null,
null, null);
owner.optBoolean("is_verified"));
final JSONObject likedBy = commentJsonObject.optJSONObject("edge_liked_by"); final JSONObject likedBy = commentJsonObject.optJSONObject("edge_liked_by");
final String commentId = commentJsonObject.getString("id"); final String commentId = commentJsonObject.getString("id");
final JSONObject childCommentsJsonObject = commentJsonObject.optJSONObject("edge_threaded_comments"); final JSONObject childCommentsJsonObject = commentJsonObject.optJSONObject("edge_threaded_comments");

35
app/src/main/java/awais/instagrabber/webservices/GraphQLService.java

@ -34,7 +34,6 @@ import retrofit2.Response;
public class GraphQLService extends BaseService { public class GraphQLService extends BaseService {
private static final String TAG = "GraphQLService"; private static final String TAG = "GraphQLService";
// private static final boolean loadFromMock = false;
private final GraphQLRepository repository; private final GraphQLRepository repository;
@ -230,39 +229,7 @@ public class GraphQLService extends BaseService {
userObject.optString("full_name"), userObject.optString("full_name"),
userObject.optBoolean("is_private"), userObject.optBoolean("is_private"),
userObject.getString("profile_pic_url"), userObject.getString("profile_pic_url"),
null,
new FriendshipStatus(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
),
userObject.optBoolean("is_verified"),
false,
false,
false,
false,
null,
null,
0,
0,
0,
0,
null,
null,
0,
null,
null,
null,
null,
null,
null
userObject.optBoolean("is_verified")
)); ));
// userModels.add(new ProfileModel(userObject.optBoolean("is_private"), // userModels.add(new ProfileModel(userObject.optBoolean("is_private"),
// false, // false,

68
app/src/main/java/awais/instagrabber/webservices/StoriesService.java

@ -143,39 +143,7 @@ public class StoriesService extends BaseService {
userJson.optString("full_name"), userJson.optString("full_name"),
userJson.optBoolean("is_private"), userJson.optBoolean("is_private"),
userJson.getString("profile_pic_url"), userJson.getString("profile_pic_url"),
null,
new FriendshipStatus(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
),
userJson.optBoolean("is_verified"),
false,
false,
false,
false,
null,
null,
0,
0,
0,
0,
null,
null,
0,
null,
null,
null,
null,
null,
null
userJson.optBoolean("is_verified")
); );
final long timestamp = node.getLong("latest_reel_media"); final long timestamp = node.getLong("latest_reel_media");
final boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp; final boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp;
@ -210,39 +178,7 @@ public class StoriesService extends BaseService {
userJson.optString("full_name"), userJson.optString("full_name"),
userJson.optBoolean("is_private"), userJson.optBoolean("is_private"),
userJson.getString("profile_pic_url"), userJson.getString("profile_pic_url"),
null,
new FriendshipStatus(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
),
userJson.optBoolean("is_verified"),
false,
false,
false,
false,
null,
null,
0,
0,
0,
0,
null,
null,
0,
null,
null,
null,
null,
null,
null
userJson.optBoolean("is_verified")
); );
feedStoryModels.add(new FeedStoryModel( feedStoryModels.add(new FeedStoryModel(
node.getString("id"), node.getString("id"),

Loading…
Cancel
Save