feat(android): albums from the phone — several files shared at once are one link
Albums.encode and Grant.encode (live grants too) write what TS writes; the album vector is resealed byte for byte from Kotlin. MediaUploader.uploadAlbum seals and uploads one. The demo turns a multi-file share into an album and its player lists an album's items and opens them in place. The live cross-check uploads an album from Kotlin that TS opens. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package no.zyon.shade
|
||||
|
||||
import no.zyon.shade.media.Album
|
||||
import no.zyon.shade.media.Albums
|
||||
import no.zyon.shade.media.FileRangeSource
|
||||
import no.zyon.shade.media.Grants
|
||||
import no.zyon.shade.media.MediaGrant
|
||||
@@ -109,11 +111,20 @@ class MediaLiveTest {
|
||||
assertTrue(uploader.delete(photo.mediaId))
|
||||
assertFalse(uploader.delete(photo.mediaId))
|
||||
|
||||
// The photos of a trip, shared at once: one album link for all of them.
|
||||
val album = uploader.uploadAlbum(Album("Tur — «Lofoten»", listOf(film, fresh)))
|
||||
album.open().use { r ->
|
||||
val back = Albums.read(r)
|
||||
assertEquals("Tur — «Lofoten»", back.title)
|
||||
assertEquals(listOf(film.encode(), fresh.encode()), back.items.map { it.encode() })
|
||||
}
|
||||
|
||||
File(spec.getString("kotlinOut")).writeText(
|
||||
JSONObject()
|
||||
.put("film", JSONObject().put("link", film.capabilityUrl("https://watch.example/")).put("sha256", sha256(plain)).put("size", plain.size))
|
||||
.put("again", again.capabilityUrl("https://watch.example/"))
|
||||
.put("photo", JSONObject().put("url", photo.url))
|
||||
.put("album", album.capabilityUrl("https://watch.example/"))
|
||||
.toString(),
|
||||
)
|
||||
sealedFile.delete()
|
||||
|
||||
Reference in New Issue
Block a user