mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-02 16:19:41 +07:00
Switched persistent turn notification to false for pre-Oreo Android phones, as they may display an annoying icon in status bar. (#1957)
Fixed potential hanging notifier service due to not resetting error counter. https://github.com/yairm210/Unciv/issues/1680
This commit is contained in:
@ -156,7 +156,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
||||
gameId = gameInfo.gameId
|
||||
userId = settings.userId
|
||||
configuredDelay = settings.multiplayerTurnCheckerDelayInMinutes
|
||||
persistentNotificationEnabled = settings.multiplayerTurnCheckerPermanentNotificationEnabled
|
||||
persistentNotificationEnabled = settings.multiplayerTurnCheckerPersistentNotificationEnabled
|
||||
|
||||
showPersistentNotification(applicationContext,
|
||||
"—", settings.multiplayerTurnCheckerDelayInMinutes.toString())
|
||||
@ -185,6 +185,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
|
||||
with(NotificationManagerCompat.from(applicationContext)) {
|
||||
cancel(NOTIFICATION_ID_SERVICE)
|
||||
}
|
||||
failCount = 0 // Otherwise the notification service would be forever stuck in error mode.
|
||||
return Result.failure()
|
||||
} else {
|
||||
// If check fails, retry in one minute.
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.unciv.models.metadata
|
||||
|
||||
import com.badlogic.gdx.Application
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.unciv.logic.GameSaver
|
||||
|
||||
class GameSettings {
|
||||
@ -27,9 +29,16 @@ class GameSettings {
|
||||
var continuousRendering = true
|
||||
var userId = ""
|
||||
var multiplayerTurnCheckerEnabled = true
|
||||
var multiplayerTurnCheckerPermanentNotificationEnabled = true
|
||||
var multiplayerTurnCheckerPersistentNotificationEnabled = true
|
||||
var multiplayerTurnCheckerDelayInMinutes = 5L
|
||||
|
||||
init {
|
||||
// 26 = Android Oreo. Version below may display permanent icon in notification bar.
|
||||
if (Gdx.app.type == Application.ApplicationType.Android && Gdx.app.version < 26) {
|
||||
multiplayerTurnCheckerPersistentNotificationEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
fun save(){
|
||||
GameSaver().setGeneralSettings(this)
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen){
|
||||
addMultiplayerTurnCheckerDelayBox(innerTable)
|
||||
|
||||
innerTable.add("Show persistent notification for turn notifier service".toLabel())
|
||||
addButton(innerTable, if (settings.multiplayerTurnCheckerPermanentNotificationEnabled) "Yes" else "No") {
|
||||
settings.multiplayerTurnCheckerPermanentNotificationEnabled = !settings.multiplayerTurnCheckerPermanentNotificationEnabled
|
||||
addButton(innerTable, if (settings.multiplayerTurnCheckerPersistentNotificationEnabled) "Yes" else "No") {
|
||||
settings.multiplayerTurnCheckerPersistentNotificationEnabled = !settings.multiplayerTurnCheckerPersistentNotificationEnabled
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user