Compare commits

...
8 Commits
Author SHA1 Message Date
GitHub Actions ac6321aa3e chore: bump version to 4.11.175 [skip ci] 2026-10-05 03:04:30 +00:00
litruv e54429fa3b ci: add build concurrency + npm/gradle caching to build.yml
Build / increment-version (push) Successful in 5s
Build / build-android (push) Successful in 7m3s
2026-10-05 14:04:23 +11:00
GitHub Actions 47f6e5a890 chore: bump version to 4.11.174 [skip ci] 2026-10-05 03:00:01 +00:00
litruv dd89b87aea notifications: fix Kotlin null-safety in resolveInlineImage (?.takeIf on nullable receivers)
Build / increment-version (push) Successful in 5s
Build / build-android (push) Successful in 4m37s
2026-10-05 13:59:53 +11:00
GitHub Actions d47e42401c chore: bump version to 4.11.173 [skip ci] 2026-10-05 02:54:58 +00:00
litruv 39511a3224 chore: bump cinny submodule to b16263b4 (native HTTP for Capacitor)
Build / increment-version (push) Successful in 6s
Build / build-android (push) Failing after 4m0s
2026-10-05 13:54:51 +11:00
GitHub Actions 1b7bbe4b8a chore: bump version to 4.11.172 [skip ci] 2026-10-05 02:53:36 +00:00
litruv 00c221a805 notifications: fetch inline image preview for m.image/sticker events in background listener
Build / increment-version (push) Successful in 4s
Build / build-android (push) Canceled after 1m41s
2026-10-05 13:53:29 +11:00
4 changed files with 71 additions and 13 deletions
+20
View File
@@ -9,6 +9,10 @@ on:
- 'v*' - 'v*'
workflow_dispatch: workflow_dispatch:
concurrency:
group: build
cancel-in-progress: true
jobs: jobs:
increment-version: increment-version:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -75,6 +79,13 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '22' node-version: '22'
- name: Cache npm packages
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'cinny/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v4 uses: actions/setup-java@v4
@@ -87,6 +98,15 @@ jobs:
with: with:
# Google removed the legacy `tools` package; v3 still tries to install it. # Google removed the legacy `tools` package; v3 still tries to install it.
packages: platform-tools packages: platform-tools
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper/dists
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Install dependencies (root) - name: Install dependencies (root)
run: npm ci --prefer-offline run: npm ci --prefer-offline
@@ -384,22 +384,29 @@ class MatrixSyncService : Service() {
val content = event.optJSONObject("content") ?: JSONObject() val content = event.optJSONObject("content") ?: JSONObject()
val encrypted = eventType == "m.room.encrypted" val encrypted = eventType == "m.room.encrypted"
val msgtype = content.optString("msgtype")
val rawBody = content.optString("body")
val body = when { val body = when {
encrypted -> "Encrypted message" encrypted -> "Encrypted message"
eventType == "m.sticker" -> "Sticker" eventType == "m.sticker" -> "Sticker"
else -> { else -> when (msgtype) {
val msgtype = content.optString("msgtype") "m.image" -> "Photo"
val rawBody = content.optString("body") "m.video" -> rawBody.ifBlank { "Video" }
when (msgtype) { "m.audio" -> rawBody.ifBlank { "Audio" }
"m.image" -> "Photo" "m.file" -> rawBody.ifBlank { "File" }
"m.video" -> rawBody.ifBlank { "Video" } else -> rawBody.takeIf { it.isNotBlank() }
"m.audio" -> rawBody.ifBlank { "Audio" }
"m.file" -> rawBody.ifBlank { "File" }
else -> rawBody.takeIf { it.isNotBlank() }
}
} }
} ?: continue } ?: continue
// Fetch an inline preview for image/sticker events. Plaintext only —
// encrypted media can't be decrypted inside the raw-sync listener.
val inlineImage =
if (!encrypted && (msgtype == "m.image" || eventType == "m.sticker")) {
resolveInlineImage(content, homeserver, token)
} else {
null
}
val profile = try { val profile = try {
resolveProfile(sender, homeserver, token) resolveProfile(sender, homeserver, token)
} catch (e: Exception) { } catch (e: Exception) {
@@ -414,7 +421,7 @@ class MatrixSyncService : Service() {
profile.displayName, profile.displayName,
body, body,
profile.avatar, profile.avatar,
null, inlineImage,
resolveGroupInfo(roomId, notifyCtx), resolveGroupInfo(roomId, notifyCtx),
) )
notifiedForRoom = true notifiedForRoom = true
@@ -678,6 +685,37 @@ class MatrixSyncService : Service() {
} }
} }
/**
* Resolve an inline preview bitmap for an image/sticker event content.
* Prefers a small thumbnail (keeps the notification light), falling back to the
* full download. Only works for plaintext events — encrypted media can't be
* decrypted inside the raw-sync listener.
*/
private fun resolveInlineImage(
content: JSONObject,
homeserver: String,
token: String,
): Bitmap? {
val info = content.optJSONObject("info")
val thumbnailMxc =
info?.optString("thumbnail_url")?.takeIf { it.startsWith("mxc://") }
?: info?.optJSONObject("thumbnail_file")?.optString("url")?.takeIf { it.startsWith("mxc://") }
if (thumbnailMxc != null) {
for (url in mxcToThumbnailUrls(thumbnailMxc, homeserver, 512)) {
downloadBitmap(url, token)?.let { return it }
}
}
val fullMxc =
content.optString("url").takeIf { it.startsWith("mxc://") }
?: content.optJSONObject("file")?.optString("url")?.takeIf { it.startsWith("mxc://") }
if (fullMxc != null) {
for (url in mxcToDownloadUrls(fullMxc, homeserver)) {
downloadBitmap(url, token)?.let { return it }
}
}
return null
}
private data class NotificationGroupInfo( private data class NotificationGroupInfo(
val groupId: String, val groupId: String,
val groupName: String, val groupName: String,
+1 -1
Submodule cinny updated: 47979718eb...b16263b481
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "paarrot", "name": "paarrot",
"version": "4.11.171", "version": "4.11.175",
"description": "Paarrot - A Matrix client based on Cinny", "description": "Paarrot - A Matrix client based on Cinny",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"