Remove ParcelableGroupId.

This commit is contained in:
Alex Hart
2025-09-18 16:21:45 -03:00
committed by Jeffrey Starke
parent d49ef1dd7d
commit 146a5f5701
17 changed files with 28 additions and 90 deletions

View File

@@ -1,52 +0,0 @@
package org.thoughtcrime.securesms.groups;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
public final class ParcelableGroupId implements Parcelable {
private final GroupId groupId;
public static ParcelableGroupId from(@Nullable GroupId groupId) {
return new ParcelableGroupId(groupId);
}
public static @Nullable GroupId get(@Nullable ParcelableGroupId parcelableGroupId) {
if (parcelableGroupId == null) {
return null;
}
return parcelableGroupId.groupId;
}
ParcelableGroupId(@Nullable GroupId groupId) {
this.groupId = groupId;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (groupId != null) {
dest.writeString(groupId.toString());
} else {
dest.writeString(null);
}
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<ParcelableGroupId> CREATOR = new Creator<ParcelableGroupId>() {
@Override
public ParcelableGroupId createFromParcel(Parcel in) {
return new ParcelableGroupId(GroupId.parseNullableOrThrow(in.readString()));
}
@Override
public ParcelableGroupId[] newArray(int size) {
return new ParcelableGroupId[size];
}
};
}

View File

@@ -17,7 +17,6 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
import org.thoughtcrime.securesms.groups.GroupId;
import org.thoughtcrime.securesms.groups.LiveGroup;
import org.thoughtcrime.securesms.groups.ParcelableGroupId;
import org.thoughtcrime.securesms.groups.v2.GroupDescriptionUtil;
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
@@ -46,7 +45,7 @@ public final class GroupDescriptionDialog extends DialogFragment {
private static void show(@NonNull FragmentManager fragmentManager, @Nullable GroupId groupId, @Nullable String title, @Nullable String description, boolean linkify) {
Bundle arguments = new Bundle();
arguments.putParcelable(ARGUMENT_GROUP_ID, ParcelableGroupId.from(groupId));
arguments.putParcelable(ARGUMENT_GROUP_ID, groupId);
arguments.putString(ARGUMENT_TITLE, title);
arguments.putString(ARGUMENT_DESCRIPTION, description);
arguments.putBoolean(ARGUMENT_LINKIFY, linkify);
@@ -62,7 +61,7 @@ public final class GroupDescriptionDialog extends DialogFragment {
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.group_description_dialog, null, false);
String argumentTitle = requireArguments().getString(ARGUMENT_TITLE, null);
String argumentDescription = requireArguments().getString(ARGUMENT_DESCRIPTION, null);
GroupId argumentGroupId = ParcelableGroupId.get(requireArguments().getParcelable(ARGUMENT_GROUP_ID));
GroupId argumentGroupId = requireArguments().getParcelable(ARGUMENT_GROUP_ID);
boolean linkify = requireArguments().getBoolean(ARGUMENT_LINKIFY, false);
LiveGroup liveGroup = argumentGroupId != null ? new LiveGroup(argumentGroupId) : null;