Reformat code

parent caad1206
Pipeline #526 passed with stages
in 20 minutes and 37 seconds
......@@ -415,36 +415,36 @@ class MessageListFragment : ServiceBoundFragment() {
modelHelper.sessionManager.mapSwitchMap(SessionManager::state).distinctUntilChanged())
.toLiveData().observe(this, Observer { (bufferSyncer, state) ->
if (state?.orNull() == ConnectionState.CONNECTED) {
runInBackgroundDelayed(16) {
modelHelper.chat.bufferId { bufferId ->
val currentNetwork = bufferSyncer.orNull()?.bufferInfo(bufferId)?.networkId
?: NetworkId(0)
val currentServerBuffer = bufferSyncer.orNull()?.find(
networkId = currentNetwork,
type = Buffer_Type.of(Buffer_Type.StatusBuffer)
)?.bufferId ?: BufferId(0)
val filtered = database.filtered().get(accountId,
bufferId,
accountDatabase.accounts().findById(accountId)?.defaultFiltered
?: 0)
// Try loading messages when switching to isEmpty bufferId
val hasVisibleMessages = database.message().hasVisibleMessages(currentNetwork,
currentServerBuffer,
bufferId,
filtered,
redirectionSettings.userNotices,
redirectionSettings.serverNotices,
redirectionSettings.errors)
if (!hasVisibleMessages) {
if (bufferId.isValidId() && bufferId != BufferId.MAX_VALUE) {
loadMore(initial = true)
runInBackgroundDelayed(16) {
modelHelper.chat.bufferId { bufferId ->
val currentNetwork = bufferSyncer.orNull()?.bufferInfo(bufferId)?.networkId
?: NetworkId(0)
val currentServerBuffer = bufferSyncer.orNull()?.find(
networkId = currentNetwork,
type = Buffer_Type.of(Buffer_Type.StatusBuffer)
)?.bufferId ?: BufferId(0)
val filtered = database.filtered().get(accountId,
bufferId,
accountDatabase.accounts().findById(accountId)?.defaultFiltered
?: 0)
// Try loading messages when switching to isEmpty bufferId
val hasVisibleMessages = database.message().hasVisibleMessages(currentNetwork,
currentServerBuffer,
bufferId,
filtered,
redirectionSettings.userNotices,
redirectionSettings.serverNotices,
redirectionSettings.errors)
if (!hasVisibleMessages) {
if (bufferId.isValidId() && bufferId != BufferId.MAX_VALUE) {
loadMore(initial = true)
}
}
}
}
}
}
})
})
modelHelper.connectedSession.toLiveData().zip(lastMessageId).observe(
this, Observer {
......
......@@ -872,7 +872,7 @@ class Network constructor(
}
private var _myNick: String? = null
private var _latency: Int = 0
set (value) {
set(value) {
field = value
live_latency.onNext(value)
}
......@@ -883,7 +883,7 @@ class Network constructor(
live_networkInfo.onNext(Unit)
}
private var _currentServer: String = ""
set (value) {
set(value) {
field = value
live_currentServer.onNext(value)
}
......@@ -902,7 +902,7 @@ class Network constructor(
private val live_ircChannels = BehaviorSubject.createDefault(Unit)
// stores results from RPL_ISUPPORT
private var _supports: MutableMap<String, String?> = mutableMapOf()
set (value) {
set(value) {
field = value
live_caps.onNext(Unit)
}
......@@ -914,7 +914,7 @@ class Network constructor(
* SASL EXTERNAL isn't available.
*/
private var _caps: MutableMap<String, String?> = mutableMapOf()
set (value) {
set(value) {
field = value
live_caps.onNext(Unit)
}
......@@ -924,7 +924,7 @@ class Network constructor(
* _capsEnabled uses the same values from the <name>=<value> pairs stored in _caps
*/
private var _capsEnabled: MutableSet<String> = mutableSetOf()
set (value) {
set(value) {
field = value
live_capsEnabled.onNext(Unit)
}
......
......@@ -21,5 +21,5 @@ package de.kuschku.libquassel.util.helper
import io.reactivex.subjects.BehaviorSubject
val <T : Any> BehaviorSubject<T>.safeValue : T
val <T : Any> BehaviorSubject<T>.safeValue: T
get() = value!!
......@@ -174,11 +174,11 @@ open class EditorViewModelHelper @Inject constructor(
processResults(
when (lastWord.first.firstOrNull()) {
'/' -> getAliases()
'@' -> getNicks()
'#' -> getBuffers()
':' -> getEmojis()
else -> getAliases() + getNicks() + getBuffers() + getEmojis()
'/' -> getAliases()
'@' -> getNicks()
'#' -> getBuffers()
':' -> getEmojis()
else -> getAliases() + getNicks() + getBuffers() + getEmojis()
}
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment