Fix crash when opening reactions bottom sheet.

fork-5.53.8
Alex Hart 2022-01-20 11:25:32 -04:00 zatwierdzone przez Greyson Parrelli
rodzic fd6a2c6b10
commit 6919e352d6
2 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -1582,16 +1582,16 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
@Override
public void onReactionClicked(@NonNull MultiselectPart multiselectPart, long messageId, boolean isMms) {
if (getContext() == null) return;
if (getParentFragment() == null) return;
ReactionsBottomSheetDialogFragment.create(messageId, isMms).show(requireFragmentManager(), null);
ReactionsBottomSheetDialogFragment.create(messageId, isMms).show(getParentFragmentManager(), null);
}
@Override
public void onGroupMemberClicked(@NonNull RecipientId recipientId, @NonNull GroupId groupId) {
if (getContext() == null) return;
if (getParentFragment() == null) return;
RecipientBottomSheetDialogFragment.create(recipientId, groupId).show(requireFragmentManager(), "BOTTOM");
RecipientBottomSheetDialogFragment.create(recipientId, groupId).show(getParentFragmentManager(), "BOTTOM");
}
@Override
@ -1647,7 +1647,11 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
@Override
public void onGroupMigrationLearnMoreClicked(@NonNull GroupMigrationMembershipChange membershipChange) {
GroupsV1MigrationInfoBottomSheetDialogFragment.show(requireFragmentManager(), membershipChange);
if (getParentFragment() == null) {
return;
}
GroupsV1MigrationInfoBottomSheetDialogFragment.show(getParentFragmentManager(), membershipChange);
}
@Override

Wyświetl plik

@ -57,7 +57,13 @@ public final class ReactionsBottomSheetDialogFragment extends BottomSheetDialogF
public void onAttach(@NonNull Context context) {
super.onAttach(context);
callback = (Callback) context;
if (context instanceof Callback) {
callback = (Callback) context;
} else if (getParentFragment() instanceof Callback) {
callback = (Callback) getParentFragment();
} else {
throw new IllegalStateException("Parent component does not implement Callback");
}
}
@Override