Ntfy listener: only run when the paired gateway pushes via ntfy — the foreground service (and its permanent 'Listening for messages' notification) is now started/stopped based on the gateway's push backend from hello.ack server_caps (persisted as pushBackend); FCM gateways no longer keep a persistent listener alive, and switching gateways toggles the service on the next connect
This commit is contained in:
1 parent
75d491fd30
commit
acd5fb4ad0
8 files changed
+105
-40
No files matched your search
@@ -30,6 +30,11 @@ interface SecureStore {
|
||||
/** ntfy server URL (M5; from hello.ack server_caps; default ntfy.sh). */
|
||||
var ntfyServer: String
|
||||
|
||||
/** Push backend of the paired gateway ("fcm"/"ntfy"; from hello.ack
|
||||
* server_caps; empty when unknown — decides whether the ntfy listener
|
||||
* foreground service runs at all). */
|
||||
var pushBackend: String
|
||||
|
||||
/** UI setting: show threads (topics) in the chat view. */
|
||||
var threadsEnabled: Boolean
|
||||
|
||||
@@ -61,6 +66,10 @@ interface SecureStore {
|
||||
* system font scale). */
|
||||
var fontSizeScale: Float
|
||||
|
||||
fun savePairing(url: String, token: String)
|
||||
fun savePairing(
|
||||
url: String,
|
||||
token: String,
|
||||
)
|
||||
|
||||
fun clear()
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,13 @@ expect fun postSystemNotification(
|
||||
* Register the active controller with the platform bridge (Android: so the
|
||||
* FCM / ntfy services can reach it). No-op on desktop.
|
||||
*/
|
||||
expect fun setActiveController(controller: Any?)
|
||||
expect fun setActiveController(controller: Any?)
|
||||
|
||||
/**
|
||||
* Align the ntfy listener with the paired gateway's push backend (Android:
|
||||
* start/stop the listener foreground service — and with it the permanent
|
||||
* "Listening for messages" notification; no-op on desktop). The listener
|
||||
* only runs when the gateway actually pushes via ntfy; FCM gateways need
|
||||
* no persistent listener.
|
||||
*/
|
||||
expect fun syncNtfyListener(backend: String)
|
||||
@@ -13,6 +13,7 @@ import iris.platform.PickedFile
|
||||
import iris.platform.isAppForeground
|
||||
import iris.platform.mediaCacheBaseDir
|
||||
import iris.platform.postSystemNotification
|
||||
import iris.platform.syncNtfyListener
|
||||
import iris.protocol.ChannelDeletedPayload
|
||||
import iris.protocol.ChannelInfo
|
||||
import iris.protocol.CommandsCatalogPayload
|
||||
@@ -554,6 +555,11 @@ class IrisController(
|
||||
if (s.caps.pushNtfyServer.isNotBlank()) {
|
||||
store.ntfyServer = s.caps.pushNtfyServer
|
||||
}
|
||||
// M5: align the ntfy listener (and its permanent
|
||||
// "Listening for messages" notification) with the
|
||||
// gateway's push backend — only ntfy gateways need it.
|
||||
store.pushBackend = s.caps.push
|
||||
syncNtfyListener(s.caps.push)
|
||||
// M5: a deep link tapped before we were connected.
|
||||
applyDeepLink()
|
||||
// Slash-command catalog for the composer's "/" drawer
|
||||
|
||||
Reference in new issue
Block a user