Browse Source

support fb thread members

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
6a524b7616
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 6
      app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java
  2. 7
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java
  3. 9
      app/src/main/java/awais/instagrabber/repositories/responses/User.java
  4. 2
      app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
  5. 2
      app/src/main/java/awais/instagrabber/webservices/GraphQLService.java
  6. 2
      app/src/main/java/awais/instagrabber/webservices/StoriesService.java

6
app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java

@ -116,7 +116,7 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
null,
new FriendshipStatus(false, false, false, false, false, false, false, false, false, false),
false, false, false, false, false, null, null, 0, 0, 0, 0, null, null, 0, null, null, null,
null, null);
null, null, null);
final JSONObject likedBy = childComment.optJSONObject("edge_liked_by");
commentModels.add(new CommentModel(childComment.getString(Constants.EXTRAS_ID),
childComment.getString("text"),
@ -195,7 +195,7 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
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, null);
final JSONObject likedBy = comment.optJSONObject("edge_liked_by");
final String commentId = comment.getString(Constants.EXTRAS_ID);
final CommentModel commentModel = new CommentModel(commentId,
@ -237,7 +237,7 @@ public final class CommentsFetcher extends AsyncTask<Void, Void, List<CommentMod
null,
new FriendshipStatus(false, false, false, false, false, false, false, false, false, false),
tempJsonObject.optBoolean("is_verified"), false, false, false, false, null, null, 0, 0, 0, 0, null, null, 0,
null, null, null, null, null);
null, null, null, null, null, null);
tempJsonObject = childComment.optJSONObject("edge_liked_by");
childCommentModels.add(new CommentModel(childComment.getString(Constants.EXTRAS_ID),

7
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java

@ -52,6 +52,8 @@ import awais.instagrabber.models.Resource;
import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.repositories.responses.directmessages.DirectThreadParticipantRequestsResponse;
import awais.instagrabber.repositories.responses.directmessages.RankedRecipient;
import awais.instagrabber.utils.TextUtils;
import awais.instagrabber.utils.Utils;
import awais.instagrabber.viewmodels.AppStateViewModel;
import awais.instagrabber.viewmodels.DirectSettingsViewModel;
import awais.instagrabber.viewmodels.factories.DirectSettingsViewModelFactory;
@ -343,10 +345,15 @@ public class DirectMessageSettingsFragment extends Fragment implements ConfirmDi
usersAdapter = new DirectUsersAdapter(
inviter != null ? inviter.getPk() : -1,
(position, user, selected) -> {
if (!TextUtils.isEmpty(user.getFbId())) {
Utils.openURL(context, "https://facebook.com/" + user.getFbId());
}
else {
final ProfileNavGraphDirections.ActionGlobalProfileFragment directions = ProfileNavGraphDirections
.actionGlobalProfileFragment()
.setUsername("@" + user.getUsername());
NavHostFragment.findNavController(this).navigate(directions);
}
},
(position, user) -> {
final ArrayList<Option<String>> options = viewModel.createUserOptions(user);

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

@ -31,6 +31,8 @@ public class User implements Serializable {
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;
public User(final long pk,
final String username,
@ -57,7 +59,8 @@ public class User implements Serializable {
final HdProfilePicUrlInfo hdProfilePicUrlInfo,
final String profileContext,
final List<UserProfileContextLink> profileContextLinksWithUserIds,
final String socialContext) {
final String socialContext,
final String interopMessagingUserFbid) {
this.pk = pk;
this.username = username;
this.fullName = fullName;
@ -84,6 +87,7 @@ public class User implements Serializable {
this.profileContext = profileContext;
this.profileContextLinksWithUserIds = profileContextLinksWithUserIds;
this.socialContext = socialContext;
this.interopMessagingUserFbid = interopMessagingUserFbid;
}
public long getPk() {
@ -194,6 +198,9 @@ public class User implements Serializable {
return profileContextLinksWithUserIds;
}
public String getFbId() {
return interopMessagingUserFbid;
}
@Override
public boolean equals(final Object o) {

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

@ -779,7 +779,7 @@ public final class ResponseBodyUtils {
friendshipStatus,
owner.optBoolean("is_verified"),
false, false, false, false, null, null, 0, 0, 0, 0, null, null, 0, null, null,
null, null, null);
null, null, null, null);
}
final String id = feedItem.getString(Constants.EXTRAS_ID);
final ImageVersions2 imageVersions2 = new ImageVersions2(

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

@ -246,6 +246,7 @@ public class GraphQLService extends BaseService {
null,
null,
null,
null,
null
));
// userModels.add(new ProfileModel(userObject.optBoolean("is_private"),
@ -340,6 +341,7 @@ public class GraphQLService extends BaseService {
null,
null,
null,
null,
null));
} catch (JSONException e) {
Log.e(TAG, "onResponse", e);

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

@ -176,6 +176,7 @@ public class StoriesService extends BaseService {
null,
null,
null,
null,
null
);
final String id = node.getString("id");
@ -238,6 +239,7 @@ public class StoriesService extends BaseService {
null,
null,
null,
null,
null
);
final String id = node.getString("id");

Loading…
Cancel
Save