Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix persistent connection notification command #3753

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ class MessagingManager @Inject constructor(
}
}
COMMAND_PERSISTENT_CONNECTION -> {
togglePersistentConnection(data[PERSISTENT].toString())
togglePersistentConnection(data[PERSISTENT].toString(), serverId.toIntOrNull() ?: ServerManager.SERVER_ID_ACTIVE)
}
COMMAND_AUTO_SCREEN_BRIGHTNESS, COMMAND_SCREEN_BRIGHTNESS_LEVEL, COMMAND_SCREEN_OFF_TIMEOUT -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand Down Expand Up @@ -1809,28 +1809,28 @@ class MessagingManager @Inject constructor(
}
}

private fun togglePersistentConnection(mode: String) {
private fun togglePersistentConnection(mode: String, serverId: Int) {
when (mode.uppercase()) {
WebsocketSetting.NEVER.name -> {
settingsDao.get(0)?.let {
settingsDao.get(serverId)?.let {
it.websocketSetting = WebsocketSetting.NEVER
settingsDao.update(it)
}
}
WebsocketSetting.ALWAYS.name -> {
settingsDao.get(0)?.let {
settingsDao.get(serverId)?.let {
it.websocketSetting = WebsocketSetting.ALWAYS
settingsDao.update(it)
}
}
WebsocketSetting.HOME_WIFI.name -> {
settingsDao.get(0)?.let {
settingsDao.get(serverId)?.let {
it.websocketSetting = WebsocketSetting.HOME_WIFI
settingsDao.update(it)
}
}
WebsocketSetting.SCREEN_ON.name -> {
settingsDao.get(0)?.let {
settingsDao.get(serverId)?.let {
it.websocketSetting = WebsocketSetting.SCREEN_ON
settingsDao.update(it)
}
Expand Down