Do not request sinks list

Rely on it being sent at connect and on any update.

It requires this desktop app change to be merged and released, since we
were not sending the list at connect time before:
https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/763
This commit is contained in:
Albert Vaca Cintora
2024-12-22 17:22:25 +01:00
parent 553bae4a33
commit 8eac1d7f6b
3 changed files with 7 additions and 13 deletions

View File

@@ -100,7 +100,7 @@ public class SystemVolumeFragment
}
this.plugin = plugin;
plugin.addSinkListener(SystemVolumeFragment.this);
plugin.requestSinkList();
sinksChanged();
}
private void disconnectFromPlugin(final String deviceId) {

View File

@@ -113,12 +113,6 @@ public class SystemVolumePlugin extends Plugin {
getDevice().sendPacket(np);
}
void requestSinkList() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_SYSTEMVOLUME_REQUEST);
np.set("requestSinks", true);
getDevice().sendPacket(np);
}
@Override
public @NonNull String[] getSupportedPacketTypes() {
return new String[]{PACKET_TYPE_SYSTEMVOLUME};

View File

@@ -155,21 +155,21 @@ class SystemVolumeProvider private constructor(plugin: SystemVolumePlugin) :
return sink != null
}
fun startListeningForSinks() {
systemVolumePlugin.addSinkListener(this)
systemVolumePlugin.requestSinkList()
}
fun release() {
stopListeningForSinks()
stateListeners.clear()
currentProvider = null
}
private fun startListeningForSinks() {
systemVolumePlugin.addSinkListener(this)
sinksChanged();
}
private fun stopListeningForSinks() {
for (sink in systemVolumePlugin.sinks) {
sink.removeListener(this)
}
systemVolumePlugin.removeSinkListener(this)
}
}
}