diff --git a/app/src/main/java/io/heckel/ntfy/util/Util.kt b/app/src/main/java/io/heckel/ntfy/util/Util.kt index d987e41..d03fe92 100644 --- a/app/src/main/java/io/heckel/ntfy/util/Util.kt +++ b/app/src/main/java/io/heckel/ntfy/util/Util.kt @@ -443,6 +443,10 @@ fun String.readBitmapFromUriOrNull(context: Context): Bitmap? { } } +fun Long.nullIfZero(): Long? { + return if (this == 0L) return null else this +} + // TextWatcher that only implements the afterTextChanged method class AfterChangedTextWatcher(val afterTextChangedFn: (s: Editable?) -> Unit) : TextWatcher { override fun afterTextChanged(s: Editable?) { diff --git a/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt b/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt index 1a367ab..830b92d 100644 --- a/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt +++ b/app/src/play/java/io/heckel/ntfy/firebase/FirebaseService.kt @@ -14,6 +14,7 @@ import io.heckel.ntfy.msg.ApiService import io.heckel.ntfy.msg.NotificationDispatcher import io.heckel.ntfy.msg.NotificationParser import io.heckel.ntfy.service.SubscriberService +import io.heckel.ntfy.util.nullIfZero import io.heckel.ntfy.util.toPriority import io.heckel.ntfy.util.topicShortUrl import io.heckel.ntfy.work.PollWorker @@ -94,8 +95,8 @@ class FirebaseService : FirebaseMessagingService() { val encoding = data["encoding"] val attachmentName = data["attachment_name"] ?: "attachment.bin" val attachmentType = data["attachment_type"] - val attachmentSize = data["attachment_size"]?.toLongOrNull() - val attachmentExpires = data["attachment_expires"]?.toLongOrNull() + val attachmentSize = data["attachment_size"]?.toLongOrNull()?.nullIfZero() + val attachmentExpires = data["attachment_expires"]?.toLongOrNull()?.nullIfZero() val attachmentUrl = data["attachment_url"] val truncated = (data["truncated"] ?: "") == "1" if (id == null || topic == null || message == null || timestamp == null) { diff --git a/fastlane/metadata/android/en-US/changelog/29.txt b/fastlane/metadata/android/en-US/changelog/29.txt index 805d904..84dd455 100644 --- a/fastlane/metadata/android/en-US/changelog/29.txt +++ b/fastlane/metadata/android/en-US/changelog/29.txt @@ -12,6 +12,7 @@ Bug fixes + maintenance: * Fix topics do not re-subscribe to Firebase after restoring from backup (#511) * Fix crashes from large images (#474, thanks to @daedric7 for reporting) * Fix notification click opens wrong subscription (#261, thanks to @SMAW for reporting) +* Fix Firebase-only "link expired" issue (#529) * Add donate button (no ticket) Additional translations: