Merge branch 'main' of github.com:binwiederhier/ntfy-android into message-bar-2

This commit is contained in:
Philipp Heckel 2025-12-23 20:11:23 -05:00
commit 692b53ea74
4 changed files with 23 additions and 11 deletions

View file

@ -37,6 +37,9 @@ android {
minifyEnabled false
shrinkResources false
debuggable false
// DEV/TEST ONLY: Uncomment this to test the release build with a debug key.
// This is required to test against the production Firebase config.
// signingConfig signingConfigs.debug
}
debug {
minifyEnabled false

View file

@ -47,15 +47,20 @@ class SubscriberServiceManager(private val context: Context) {
val app = context.applicationContext as Application
val subscriptionIdsWithInstantStatus = app.repository.getSubscriptionIdsWithInstantStatus()
val instantSubscriptions = subscriptionIdsWithInstantStatus.toList().filter { (_, instant) -> instant }.size
val action = if (instantSubscriptions > 0) SubscriberService.Action.START else SubscriberService.Action.STOP
val serviceState = SubscriberService.readServiceState(context)
if (serviceState == SubscriberService.ServiceState.STOPPED && action == SubscriberService.Action.STOP) {
return@withContext Result.success()
}
Log.d(TAG, "ServiceStartWorker: Starting foreground service with action $action (work ID: ${id})")
Intent(context, SubscriberService::class.java).also {
it.action = action.name
ContextCompat.startForegroundService(context, it)
if (instantSubscriptions > 0) {
// We have instant subscriptions, start the service
Log.d(TAG, "ServiceStartWorker: Starting foreground service (work ID: ${id})")
Intent(context, SubscriberService::class.java).also {
it.action = SubscriberService.Action.START.name
ContextCompat.startForegroundService(context, it)
}
} else {
// No instant subscriptions, stop the service using stopService()
// This avoids ForegroundServiceDidNotStartInTimeException, see #1520
Log.d(TAG, "ServiceStartWorker: Stopping service (work ID: ${id})")
Intent(context, SubscriberService::class.java).also {
context.stopService(it)
}
}
}
return Result.success()

View file

@ -516,7 +516,9 @@ class MainActivity : AppCompatActivity(), AddFragment.SubscribeListener, Notific
}
}
if (rerenderList) {
redrawList()
mainList.post {
redrawList()
}
}
}
}

View file

@ -1,3 +1,5 @@
Maintenance + bug fixes:
* Updated target SDK version to 36
* Updated dependencies, minimum SDK version to 26, clean up legacy code, upgrade Gradle (ntfy-android#140, thanks to @cyb3rko)
* Updated target SDK version to 36
* Fixed crashes with redrawing the list when temporarily muted topics expire
* Fixed ForegroundServiceDidNotStartInTimeException (#1520)