From 391b04366bb577281e5f85d06d784c9e484bff02 Mon Sep 17 00:00:00 2001 From: Philipp Heckel <pheckel@datto.com> Date: Tue, 26 Oct 2021 22:56:03 -0400 Subject: [PATCH] Status update; ugggllyy --- app/src/main/java/io/heckel/ntfy/data/Repository.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/data/Repository.kt b/app/src/main/java/io/heckel/ntfy/data/Repository.kt index 87bc8e2..9090e4b 100644 --- a/app/src/main/java/io/heckel/ntfy/data/Repository.kt +++ b/app/src/main/java/io/heckel/ntfy/data/Repository.kt @@ -91,7 +91,11 @@ class Repository { it.doInput = true it.readTimeout = READ_TIMEOUT } - update(topic.copy(status = Status.SUBSCRIBED)) + // TODO ugly + val currentTopic = get(topic.id) + if (currentTopic != null) { + update(currentTopic.copy(status = Status.SUBSCRIBED)) + } try { val input = conn.inputStream.bufferedReader() while (scope.isActive) { @@ -120,7 +124,10 @@ class Repository { } finally { conn.disconnect() } - update(topic.copy(status = Status.CONNECTING)) + val currentTopic2 = get(topic.id) + if (currentTopic2 != null) { + update(currentTopic2.copy(status = Status.CONNECTING)) + } println("Connection terminated: $url") }