mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-10-06 00:23:01 +02:00
Do not create an intermediate list
This commit is contained in:
@@ -429,11 +429,15 @@ class Device : PacketReceiver {
|
||||
Log.w("Device", "Ignoring packet with type ${np.type} because no plugin can handle it")
|
||||
return
|
||||
}
|
||||
targetPlugins.mapNotNull { it to loadedPlugins[it] }.forEach { (pluginKey, plugin) ->
|
||||
plugin.runCatching {
|
||||
if (isPaired) onPacketReceived(np) else onUnpairedDevicePacketReceived(np)
|
||||
targetPlugins.asSequence().mapNotNull { loadedPlugins[it] }.forEach { plugin ->
|
||||
runCatching {
|
||||
if (isPaired) {
|
||||
plugin.onPacketReceived(np)
|
||||
} else {
|
||||
plugin.onUnpairedDevicePacketReceived(np)
|
||||
}
|
||||
}.onFailure { e ->
|
||||
Log.e("Device", "Exception in ${pluginKey}'s onPacketReceived()", e)
|
||||
Log.e("Device", "Exception in ${plugin.pluginKey}'s onPacketReceived()", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user