Bump, review; update 5->3min
This commit is contained in:
parent
9d8a04f527
commit
a9c5cda4bd
4 changed files with 11 additions and 9 deletions
|
|
@ -89,11 +89,11 @@ android.applicationVariants.all { variant ->
|
|||
dependencies {
|
||||
// AndroidX, The Basics
|
||||
implementation "androidx.appcompat:appcompat:1.7.1"
|
||||
implementation "androidx.core:core-ktx:1.17.0"
|
||||
implementation "androidx.core:core-ktx:1.18.0"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
|
||||
implementation "androidx.activity:activity-ktx:1.12.4"
|
||||
implementation "androidx.activity:activity-ktx:1.13.0"
|
||||
implementation "androidx.fragment:fragment-ktx:1.8.9"
|
||||
implementation "androidx.work:work-runtime-ktx:2.11.1"
|
||||
implementation "androidx.work:work-runtime-ktx:2.11.2"
|
||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||
|
||||
// JSON serialization
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ class SubscriberService : Service() {
|
|||
val snoozeShortIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_SNOOZE_SHORT,
|
||||
Intent(this, ConnectionAlertBroadcastReceiver::class.java).apply { action = CONNECTION_ALERT_ACTION_SNOOZE_SHORT },
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
val snoozeIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_SNOOZE_LONG,
|
||||
val snoozeLongIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_SNOOZE_LONG,
|
||||
Intent(this, ConnectionAlertBroadcastReceiver::class.java).apply { action = CONNECTION_ALERT_ACTION_SNOOZE_LONG },
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
val neverAlertIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_NEVER,
|
||||
|
|
@ -384,7 +384,7 @@ class SubscriberService : Service() {
|
|||
.setOnlyAlertOnce(true)
|
||||
.setDeleteIntent(deleteIntent)
|
||||
.addAction(NotificationCompat.Action.Builder(0, getString(R.string.connection_alert_action_snooze, CONNECTION_ALERT_SNOOZE_SHORT_HOURS), snoozeShortIntent).build())
|
||||
.addAction(NotificationCompat.Action.Builder(0, getString(R.string.connection_alert_action_snooze, CONNECTION_ALERT_SNOOZE_LONG_HOURS), snoozeIntent).build())
|
||||
.addAction(NotificationCompat.Action.Builder(0, getString(R.string.connection_alert_action_snooze, CONNECTION_ALERT_SNOOZE_LONG_HOURS), snoozeLongIntent).build())
|
||||
.addAction(NotificationCompat.Action.Builder(0, getString(R.string.connection_alert_action_never), neverAlertIntent).build())
|
||||
.build()
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ object HttpUtil {
|
|||
|
||||
/**
|
||||
* Client for WebSocket connections.
|
||||
* No read timeout, 5 minute ping interval, 10s connect timeout.
|
||||
* No read timeout, 3 minute ping interval, 10s connect timeout.
|
||||
*
|
||||
* Dead connections are normally caught by one of two faster mechanisms:
|
||||
* 1. Device-side network changes (Wi-Fi <-> cellular, network drop/return) are
|
||||
|
|
@ -55,15 +55,17 @@ object HttpUtil {
|
|||
* 2. Server-side failures (crash, restart, server's own pong timeout) surface as
|
||||
* TCP FIN/RST and are detected instantly via OkHttp's onClosed/onFailure.
|
||||
*
|
||||
* The 5-minute client ping is only a fallback for the rare case where neither of
|
||||
* The 3-minute client ping is only a fallback for the rare case where neither of
|
||||
* the above fires: silent server hangs, NAT eviction, asymmetric routing breaks, etc.
|
||||
* We use a long interval so the modem can fully power down between pings, which is
|
||||
* the dominant battery factor for the foreground service.
|
||||
*
|
||||
* See discussion in https://github.com/binwiederhier/ntfy-android/pull/113
|
||||
*/
|
||||
suspend fun wsClient(context: Context, baseUrl: String): OkHttpClient {
|
||||
return emptyClientBuilder(context, baseUrl)
|
||||
.readTimeout(0, TimeUnit.MILLISECONDS)
|
||||
.pingInterval(5, TimeUnit.MINUTES)
|
||||
.pingInterval(3, TimeUnit.MINUTES)
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Features:
|
|||
* Add configurable "Alert when connection is lost" setting (#1665, #1662, #1652, #1655, thanks to @tintamarre, @sjozs, @TheRealOne78, and @DAE51D for reporting)
|
||||
* Suppress connection alerts and stop foreground service when there is no network (ntfy-android#165, thanks to @tintamarre for the contribution)
|
||||
* Restart the foreground service immediately when network returns, even if the app process was killed while offline
|
||||
* Improve battery life by increasing WebSocket client ping interval from 1 min to 5 min, and reconnect instantly on Wi-Fi/cellular/VPN transitions (ntfy-android#113, thanks to @ftilde for the investigation)
|
||||
* Improve battery life by increasing WebSocket client ping interval from 1 min to 3 min, and reconnect instantly on Wi-Fi/cellular/VPN transitions (ntfy-android#113, thanks to @ftilde for the investigation)
|
||||
* Disable UnifiedPush components when UnifiedPush is disabled in settings (ntfy-android#168, thanks to @p1gp1g for the contribution)
|
||||
|
||||
Bug fixes + maintenance:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue