aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-10 17:09:12 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-10 17:09:12 +0200
commitb39e73cbb279ab0274e8cd0b84304a602fe1d5ef (patch)
tree91e86b70289f5c0252372f4f05b83b38f049c64f /packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt
parentff982773308d042e4ec68fae9cad5c5742bc7395 (diff)
downloadmeshbay-main.tar.gz
fix(android): what the first backup on a phone showedHEADmain
Slices are asked for in the address, not a Range header the WebView drops; a settings change runs at once; the notification is updated once a second; the SMS section says how to lift Android's restricted setting; the photo section says whether videos are included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt')
-rw-r--r--packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt
index 2e7c519..c1de859 100644
--- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt
+++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt
@@ -135,9 +135,11 @@ class PhotoChannels(
if (destinations.get() == null) throw Refused("Refused: no destination")
val next = SyncConfig.fromJson(o, System.currentTimeMillis(), previous)
val edit = prefs.edit().putString(CONFIG, next.toJson().toString())
- // A different scope is a different backup: due at once, and whatever
- // the last one was refused for is not this one's problem.
- if (previous == null || previous.since != next.since) {
+ // Anything that asks for more (another scope, an album, the videos)
+ // is due at once rather than tomorrow: the person just asked for it,
+ // and waits to see it go. Whatever the last run was refused for is
+ // not this one's problem.
+ if (previous == null || previous != next) {
edit.remove(LAST).remove(FAILURE).remove(FAILURE_AT).remove(NOTIFIED)
}
edit.apply()
@@ -367,7 +369,7 @@ class PhotoChannels(
.setContentIntent(pending).setAutoCancel(true).build())
}
- /** `range` of `stream`, `size` bytes long, as a 206 (or a 416 for a range that cannot be served). */
+ /** `range` of `stream`, `size` bytes long (or a 416 for a range that cannot be served). */
fun serveRange(stream: InputStream, size: Long, mime: String, range: String?): WebResourceResponse {
val r = ByteRange.parse(range, size) ?: run {
stream.close()
@@ -377,7 +379,9 @@ class PhotoChannels(
val headers = mapOf("Cache-Control" to "no-store", "X-Content-Type-Options" to "nosniff",
"Content-Range" to "bytes ${r.first}-${r.last}/$size",
"Content-Length" to (r.last - r.first + 1).toString())
- return WebResourceResponse(mime, null, 206, "Partial Content", headers, ByteRange.slice(stream, r))
+ // 200, not 206: what was asked is in the address, and a 206 to a
+ // request that carried no Range is not something to rely on.
+ return WebResourceResponse(mime, null, 200, "OK", headers, ByteRange.slice(stream, r))
}
fun digestOf(s: InputStream): ByteArray {