mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-06 03:50:23 +02:00
Allow ignoring system connection status
This commit is contained in:
parent
674420f8c9
commit
827b42b37a
6 changed files with 16 additions and 1 deletions
|
@ -194,4 +194,5 @@ object ExperimentalFlags {
|
|||
const val SYSTEM_LEVEL_BLOCKING = 2L
|
||||
const val MANIPULATION_ANNOY_USER_ONLY = 4L
|
||||
const val MANIPULATION_ANNOY_USER = MANIPULATION_ANNOY_USER_ONLY or DISABLE_BLOCK_ON_MANIPULATION // otherwise there would be a conflict between both features
|
||||
const val IGNORE_SYSTEM_CONNECTION_STATUS = 8L
|
||||
}
|
|
@ -20,6 +20,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import io.timelimit.android.BuildConfig
|
||||
import io.timelimit.android.coroutines.runAsync
|
||||
import io.timelimit.android.coroutines.runAsyncExpectForever
|
||||
import io.timelimit.android.data.model.ExperimentalFlags
|
||||
import io.timelimit.android.data.model.UserType
|
||||
import io.timelimit.android.livedata.*
|
||||
import io.timelimit.android.sync.websocket.NetworkStatus
|
||||
|
@ -53,7 +54,7 @@ class WebsocketClientLogic(
|
|||
|
||||
val okFromNetworkStatus = appLogic.networkStatus.map { networkStatus ->
|
||||
networkStatus == NetworkStatus.Online
|
||||
}
|
||||
}.or(appLogic.database.config().isExperimentalFlagsSetAsync(ExperimentalFlags.IGNORE_SYSTEM_CONNECTION_STATUS))
|
||||
|
||||
okForCurrentUser.and(okFromNetworkStatus)
|
||||
} else {
|
||||
|
@ -93,6 +94,7 @@ class WebsocketClientLogic(
|
|||
// shutdown any current connection
|
||||
currentWebsocketClient?.shutdown()
|
||||
currentWebsocketClient = null
|
||||
isConnectedInternal.postValue(false)
|
||||
|
||||
if (deviceAuthToken.isNotEmpty()) {
|
||||
val serverConfig = appLogic.serverLogic.getServerConfigCoroutine()
|
||||
|
|
|
@ -67,6 +67,10 @@ class SocketIoWebsocketClient(serverUrl: String, private val deviceAuthTokenToCo
|
|||
listener.onConnectionLost()
|
||||
}
|
||||
|
||||
client.on(Socket.EVENT_RECONNECT) {
|
||||
listener.onConnectionLost()
|
||||
}
|
||||
|
||||
client.on("should sync") {
|
||||
val params = it[0] as JSONObject
|
||||
|
||||
|
|
|
@ -116,6 +116,12 @@ data class DiagnoseExperimentalFlagItem(
|
|||
enableFlags = ExperimentalFlags.MANIPULATION_ANNOY_USER,
|
||||
disableFlags = ExperimentalFlags.MANIPULATION_ANNOY_USER_ONLY,
|
||||
enable = { !BuildConfig.storeCompilant }
|
||||
),
|
||||
DiagnoseExperimentalFlagItem(
|
||||
label = R.string.diagnose_exf_isc,
|
||||
enableFlags = ExperimentalFlags.IGNORE_SYSTEM_CONNECTION_STATUS,
|
||||
disableFlags = ExperimentalFlags.IGNORE_SYSTEM_CONNECTION_STATUS,
|
||||
enable = { true }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<string name="diagnose_exf_lom">Sperrung nach Manipulationen deaktivieren</string>
|
||||
<string name="diagnose_exf_slb">Apps auf Systemebene sperren</string>
|
||||
<string name="diagnose_exf_mau">Nutzer nach Manipulation nerven</string>
|
||||
<string name="diagnose_exf_isc">Systemverbindungsstatus ignorieren</string>
|
||||
|
||||
<string name="diagnose_bg_task_loop_ex">Hintergrundaufgabenschleifenfehler</string>
|
||||
</resources>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
<string name="diagnose_exf_lom">Disable locking after manipulations</string>
|
||||
<string name="diagnose_exf_slb">Block Apps at system level</string>
|
||||
<string name="diagnose_exf_mau">Annoy user after manipulation</string>
|
||||
<string name="diagnose_exf_isc">Ignore system connection status</string>
|
||||
|
||||
<string name="diagnose_bg_task_loop_ex">Background task loop exception</string>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue