Convert PartUriParser into Kotlin.

This commit is contained in:
Alex Hart
2026-01-30 16:33:10 -04:00
committed by Greyson Parrelli
parent b698daa4cf
commit 85408f2b12
2 changed files with 16 additions and 28 deletions

View File

@@ -1,28 +0,0 @@
package org.thoughtcrime.securesms.mms;
import android.content.ContentUris;
import android.net.Uri;
import org.thoughtcrime.securesms.attachments.AttachmentId;
public class PartUriParser {
private final Uri uri;
public PartUriParser(Uri uri) {
this.uri = uri;
}
public AttachmentId getPartId() {
return new AttachmentId(getId());
}
private long getId() {
return ContentUris.parseId(uri);
}
private long getUniqueId() {
return Long.parseLong(uri.getPathSegments().get(1));
}
}

View File

@@ -0,0 +1,16 @@
package org.thoughtcrime.securesms.mms
import android.content.ContentUris
import android.net.Uri
import org.thoughtcrime.securesms.attachments.AttachmentId
/**
* Parses the given [Uri] into either an [AttachmentId] or a [Long]
*/
class PartUriParser(private val uri: Uri) {
val partId: AttachmentId
get() = AttachmentId(id)
private val id: Long
get() = ContentUris.parseId(uri)
}