support fb thread members

This commit is contained in:
Austin Huang 2021-03-16 20:24:19 -04:00
parent a55def53c5
commit 6a524b7616
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
6 changed files with 27 additions and 9 deletions

View File

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

View File

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

View File

@ -31,6 +31,8 @@ public class User implements Serializable {
private final String profileContext; private final String profileContext;
private final List<UserProfileContextLink> profileContextLinksWithUserIds; private final List<UserProfileContextLink> profileContextLinksWithUserIds;
private final String socialContext; private final String socialContext;
// if a DM member is a Facebook user, this is present
private final String interopMessagingUserFbid;
public User(final long pk, public User(final long pk,
final String username, final String username,
@ -57,7 +59,8 @@ public class User implements Serializable {
final HdProfilePicUrlInfo hdProfilePicUrlInfo, final HdProfilePicUrlInfo hdProfilePicUrlInfo,
final String profileContext, final String profileContext,
final List<UserProfileContextLink> profileContextLinksWithUserIds, final List<UserProfileContextLink> profileContextLinksWithUserIds,
final String socialContext) { final String socialContext,
final String interopMessagingUserFbid) {
this.pk = pk; this.pk = pk;
this.username = username; this.username = username;
this.fullName = fullName; this.fullName = fullName;
@ -84,6 +87,7 @@ public class User implements Serializable {
this.profileContext = profileContext; this.profileContext = profileContext;
this.profileContextLinksWithUserIds = profileContextLinksWithUserIds; this.profileContextLinksWithUserIds = profileContextLinksWithUserIds;
this.socialContext = socialContext; this.socialContext = socialContext;
this.interopMessagingUserFbid = interopMessagingUserFbid;
} }
public long getPk() { public long getPk() {
@ -194,6 +198,9 @@ public class User implements Serializable {
return profileContextLinksWithUserIds; return profileContextLinksWithUserIds;
} }
public String getFbId() {
return interopMessagingUserFbid;
}
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {

View File

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

View File

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

View File

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