If the user decides to remain in the system even if the server is not reachable, the dialog will not appear for a fixed period of time

This commit is contained in:
antonio 2023-03-13 10:55:50 +01:00
parent 301142b2c6
commit 281e1ba3ee
4 changed files with 29 additions and 11 deletions

View file

@ -23,6 +23,7 @@ object Preferences {
private const val AUDIO_TRANSCODE_FORMAT_MOBILE = "audio_transcode_format_mobile"
private const val WIFI_ONLY = "wifi_only"
private const val DATA_SAVING_MODE = "data_saving_mode"
private const val SERVER_UNREACHABLE = "server_unreachable"
private const val SYNC_STARRED_TRACKS_FOR_OFFLINE_USE = "sync_starred_tracks_for_offline_use"
@JvmStatic
@ -186,4 +187,15 @@ object Preferences {
SYNC_STARRED_TRACKS_FOR_OFFLINE_USE, isStarredSyncEnabled
).apply()
}
@JvmStatic
fun showServerUnreachableDialog(): Boolean {
return App.getInstance().preferences.getLong(SERVER_UNREACHABLE, 0) + 360000 < System.currentTimeMillis()
}
@JvmStatic
fun setServerUnreachableDatetime(datetime: Long) {
App.getInstance().preferences.edit()
.putLong(SERVER_UNREACHABLE, datetime).apply()
}
}