From 6a524b7616a433334350fabff5135abbf4fb0a6c Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 16 Mar 2021 20:24:19 -0400 Subject: [PATCH] support fb thread members --- .../instagrabber/asyncs/CommentsFetcher.java | 6 +++--- .../DirectMessageSettingsFragment.java | 15 +++++++++++---- .../instagrabber/repositories/responses/User.java | 9 ++++++++- .../instagrabber/utils/ResponseBodyUtils.java | 2 +- .../instagrabber/webservices/GraphQLService.java | 2 ++ .../instagrabber/webservices/StoriesService.java | 2 ++ 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java b/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java index 48dcc401..044ebfe0 100755 --- a/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java +++ b/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java @@ -116,7 +116,7 @@ public final class CommentsFetcher extends AsyncTask { - final ProfileNavGraphDirections.ActionGlobalProfileFragment directions = ProfileNavGraphDirections - .actionGlobalProfileFragment() - .setUsername("@" + user.getUsername()); - NavHostFragment.findNavController(this).navigate(directions); + 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> options = viewModel.createUserOptions(user); diff --git a/app/src/main/java/awais/instagrabber/repositories/responses/User.java b/app/src/main/java/awais/instagrabber/repositories/responses/User.java index 1be7b245..403ef285 100644 --- a/app/src/main/java/awais/instagrabber/repositories/responses/User.java +++ b/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 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 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) { diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java index 77cc3502..9a22a9c9 100644 --- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java +++ b/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( diff --git a/app/src/main/java/awais/instagrabber/webservices/GraphQLService.java b/app/src/main/java/awais/instagrabber/webservices/GraphQLService.java index 2af7738c..c83ee008 100644 --- a/app/src/main/java/awais/instagrabber/webservices/GraphQLService.java +++ b/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); diff --git a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java b/app/src/main/java/awais/instagrabber/webservices/StoriesService.java index adfd27c6..fd05af17 100644 --- a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java +++ b/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");