mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
53d8d20634
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
68 lines
1.5 KiB
Java
68 lines
1.5 KiB
Java
package org.thoughtcrime.securesms.linkpreview;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
|
|
import java.io.Serializable;
|
|
|
|
/**
|
|
* Represents metadata extracted from a URL for link preview display.
|
|
*/
|
|
public class LinkPreview implements Serializable {
|
|
|
|
@NonNull
|
|
private final String url;
|
|
|
|
@Nullable
|
|
private final String title;
|
|
|
|
@Nullable
|
|
private final String description;
|
|
|
|
@Nullable
|
|
private final String imageUrl;
|
|
|
|
private final long timestamp;
|
|
|
|
public LinkPreview(@NonNull String url,
|
|
@Nullable String title,
|
|
@Nullable String description,
|
|
@Nullable String imageUrl) {
|
|
this.url = url;
|
|
this.title = title;
|
|
this.description = description;
|
|
this.imageUrl = imageUrl;
|
|
this.timestamp = System.currentTimeMillis();
|
|
}
|
|
|
|
@NonNull
|
|
public String getUrl() {
|
|
return url;
|
|
}
|
|
|
|
@Nullable
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
@Nullable
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
@Nullable
|
|
public String getImageUrl() {
|
|
return imageUrl;
|
|
}
|
|
|
|
public long getTimestamp() {
|
|
return timestamp;
|
|
}
|
|
|
|
public boolean hasContent() {
|
|
return (title != null && !title.trim().isEmpty()) ||
|
|
(description != null && !description.trim().isEmpty()) ||
|
|
(imageUrl != null && !imageUrl.trim().isEmpty());
|
|
}
|
|
}
|