From ee36ba8c35c013be7a476b7b5baf34fd20eaa265 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Sat, 20 Mar 2021 12:59:55 +0900 Subject: [PATCH] Check for username first, then fb id --- .../DirectMessageSettingsFragment.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java index e99259d2..bbd174f2 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java @@ -347,14 +347,15 @@ public class DirectMessageSettingsFragment extends Fragment implements ConfirmDi usersAdapter = new DirectUsersAdapter( inviter != null ? inviter.getPk() : -1, (position, user, selected) -> { - if (!TextUtils.isEmpty(user.getFbId())) { + if (TextUtils.isEmpty(user.getUsername()) && !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); + return; } + if (TextUtils.isEmpty(user.getUsername())) return; + final ProfileNavGraphDirections.ActionGlobalProfileFragment directions = ProfileNavGraphDirections + .actionGlobalProfileFragment() + .setUsername("@" + user.getUsername()); + NavHostFragment.findNavController(this).navigate(directions); }, (position, user) -> { final ArrayList> options = viewModel.createUserOptions(user);