fix: remove redundant NotificationPoller to prevent duplicate notifications #82

Merged
rafaga21 merged 3 commits from feat/version-update-notification into master 2026-06-13 17:51:28 -04:00
3 changed files with 0 additions and 27 deletions
Showing only changes of commit 19fc37c1f3 - Show all commits

View File

@@ -62,19 +62,6 @@ class MainActivity : ComponentActivity() {
requestNotificationPermission() requestNotificationPermission()
checkForUpdates() checkForUpdates()
lifecycle.addObserver(LifecycleEventObserver { _, event ->
when (event) {
Lifecycle.Event.ON_RESUME -> {
ServerManagerApp.instance.notificationPoller?.start()
ServerManagerApp.instance.notificationPoller?.checkNow()
}
Lifecycle.Event.ON_PAUSE -> {
ServerManagerApp.instance.notificationPoller?.stop()
}
else -> {}
}
})
setContent { setContent {
ServerManagerTheme { ServerManagerTheme {
AppRoot() AppRoot()
@@ -158,15 +145,6 @@ fun AppRoot() {
} }
} }
DisposableEffect(Unit) {
ServerManagerApp.instance.notificationPoller?.onCountChanged = { count ->
unreadCount = count
}
onDispose {
ServerManagerApp.instance.notificationPoller?.onCountChanged = null
}
}
Scaffold( Scaffold(
bottomBar = { bottomBar = {
if (inLoggedInArea) { if (inLoggedInArea) {

View File

@@ -3,20 +3,15 @@ package com.devlab.app
import android.app.Application import android.app.Application
import com.devlab.app.service.NotificationForegroundService import com.devlab.app.service.NotificationForegroundService
import com.devlab.app.util.NotificationHelper import com.devlab.app.util.NotificationHelper
import com.devlab.app.util.NotificationPoller
import com.devlab.app.worker.NotificationWorker import com.devlab.app.worker.NotificationWorker
class ServerManagerApp : Application() { class ServerManagerApp : Application() {
var notificationPoller: NotificationPoller? = null
private set
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
instance = this instance = this
NotificationHelper.createChannels(this) NotificationHelper.createChannels(this)
NotificationWorker.schedule(this) NotificationWorker.schedule(this)
NotificationForegroundService.start(this) NotificationForegroundService.start(this)
notificationPoller = NotificationPoller(this)
} }
companion object { companion object {

Binary file not shown.