mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-12-12 20:35:58 +01:00
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:
@@ -100,7 +100,7 @@ public class SystemVolumeFragment
|
||||
}
|
||||
this.plugin = plugin;
|
||||
plugin.addSinkListener(SystemVolumeFragment.this);
|
||||
plugin.requestSinkList();
|
||||
sinksChanged();
|
||||
}
|
||||
|
||||
private void disconnectFromPlugin(final String deviceId) {
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user