Revert liked variable to equal only user like

This commit is contained in:
Ammar Githam 2020-08-21 22:45:07 +09:00
parent 8e43519c5b
commit cbf5795a22

View File

@ -3,6 +3,7 @@ package awais.instagrabber.models.direct_messages;
import androidx.annotation.NonNull;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import awais.instagrabber.models.ProfileModel;
@ -12,6 +13,8 @@ import awais.instagrabber.models.enums.RavenExpiringMediaType;
import awais.instagrabber.models.enums.RavenMediaViewType;
import awais.instagrabber.utils.Utils;
import static awais.instagrabber.utils.Constants.COOKIE;
public final class DirectItemModel implements Serializable, Comparable<DirectItemModel> {
private final long userId, timestamp;
private final DirectItemType itemType;
@ -30,20 +33,19 @@ public final class DirectItemModel implements Serializable, Comparable<DirectIte
private final DirectItemVideoCallEventModel videoCallEventModel;
private final Date date;
// private final String myId = Utils.getUserIdFromCookie(Utils.settingsHelper.getString(COOKIE));
public DirectItemModel(final long userId, final long timestamp, final String itemId, final String[] likes,
final DirectItemType itemType, final CharSequence text, final DirectItemLinkModel linkModel,
final ProfileModel profileModel, final DirectItemReelShareModel reelShare, final DirectItemMediaModel mediaModel,
final DirectItemActionLogModel actionLogModel, final DirectItemVoiceMediaModel voiceMediaModel,
final DirectItemRavenMediaModel ravenMediaModel, final DirectItemVideoCallEventModel videoCallEventModel,
final DirectItemAnimatedMediaModel animatedMediaModel) {
final String myId = Utils.getUserIdFromCookie(Utils.settingsHelper.getString(COOKIE));
this.userId = userId;
this.timestamp = timestamp;
this.itemType = itemType;
this.itemId = itemId;
this.likes = likes;
this.liked = likes != null && likes.length != 0;
this.liked = likes != null && Arrays.asList(likes).contains(myId);
this.text = text;
this.linkModel = linkModel;
this.profileModel = profileModel;