From c8398695f4fa6554997b90967cb00b711157a48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 22 Nov 2022 19:37:02 +0100 Subject: [PATCH] Remove no longer needed code after removing EventBus message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- .../talk/events/MediaStreamEvent.java | 96 ------------------- .../talk/events/PeerConnectionEvent.java | 60 +----------- .../talk/webrtc/WebRtcAudioManager.java | 6 +- 3 files changed, 6 insertions(+), 156 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/events/MediaStreamEvent.java diff --git a/app/src/main/java/com/nextcloud/talk/events/MediaStreamEvent.java b/app/src/main/java/com/nextcloud/talk/events/MediaStreamEvent.java deleted file mode 100644 index 9db02e2b4..000000000 --- a/app/src/main/java/com/nextcloud/talk/events/MediaStreamEvent.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.talk.events; - -import org.webrtc.MediaStream; - -import androidx.annotation.Nullable; - -public class MediaStreamEvent { - private final MediaStream mediaStream; - private final String session; - private final String videoStreamType; - - public MediaStreamEvent(@Nullable MediaStream mediaStream, String session, String videoStreamType) { - this.mediaStream = mediaStream; - this.session = session; - this.videoStreamType = videoStreamType; - } - - public MediaStream getMediaStream() { - return this.mediaStream; - } - - public String getSession() { - return this.session; - } - - public String getVideoStreamType() { - return this.videoStreamType; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof MediaStreamEvent)) { - return false; - } - final MediaStreamEvent other = (MediaStreamEvent) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$mediaStream = this.getMediaStream(); - final Object other$mediaStream = other.getMediaStream(); - if (this$mediaStream == null ? other$mediaStream != null : !this$mediaStream.equals(other$mediaStream)) { - return false; - } - final Object this$session = this.getSession(); - final Object other$session = other.getSession(); - if (this$session == null ? other$session != null : !this$session.equals(other$session)) { - return false; - } - final Object this$videoStreamType = this.getVideoStreamType(); - final Object other$videoStreamType = other.getVideoStreamType(); - - return this$videoStreamType == null ? other$videoStreamType == null : this$videoStreamType.equals(other$videoStreamType); - } - - protected boolean canEqual(final Object other) { - return other instanceof MediaStreamEvent; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $mediaStream = this.getMediaStream(); - result = result * PRIME + ($mediaStream == null ? 43 : $mediaStream.hashCode()); - final Object $session = this.getSession(); - result = result * PRIME + ($session == null ? 43 : $session.hashCode()); - final Object $videoStreamType = this.getVideoStreamType(); - result = result * PRIME + ($videoStreamType == null ? 43 : $videoStreamType.hashCode()); - return result; - } - - public String toString() { - return "MediaStreamEvent(mediaStream=" + this.getMediaStream() + ", session=" + this.getSession() + ", videoStreamType=" + this.getVideoStreamType() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/events/PeerConnectionEvent.java b/app/src/main/java/com/nextcloud/talk/events/PeerConnectionEvent.java index 28ff31ab3..143325e5c 100644 --- a/app/src/main/java/com/nextcloud/talk/events/PeerConnectionEvent.java +++ b/app/src/main/java/com/nextcloud/talk/events/PeerConnectionEvent.java @@ -20,44 +20,17 @@ package com.nextcloud.talk.events; -import androidx.annotation.Nullable; - public class PeerConnectionEvent { private final PeerConnectionEventType peerConnectionEventType; - private final String sessionId; - private final String nick; - private final Boolean changeValue; - private final String videoStreamType; - public PeerConnectionEvent(PeerConnectionEventType peerConnectionEventType, @Nullable String sessionId, - @Nullable String nick, Boolean changeValue, @Nullable String videoStreamType) { + public PeerConnectionEvent(PeerConnectionEventType peerConnectionEventType) { this.peerConnectionEventType = peerConnectionEventType; - this.nick = nick; - this.changeValue = changeValue; - this.sessionId = sessionId; - this.videoStreamType = videoStreamType; } public PeerConnectionEventType getPeerConnectionEventType() { return this.peerConnectionEventType; } - public String getSessionId() { - return this.sessionId; - } - - public String getNick() { - return this.nick; - } - - public Boolean getChangeValue() { - return this.changeValue; - } - - public String getVideoStreamType() { - return this.videoStreamType; - } - public boolean equals(final Object o) { if (o == this) { return true; @@ -74,25 +47,8 @@ public class PeerConnectionEvent { if (this$peerConnectionEventType == null ? other$peerConnectionEventType != null : !this$peerConnectionEventType.equals(other$peerConnectionEventType)) { return false; } - final Object this$sessionId = this.getSessionId(); - final Object other$sessionId = other.getSessionId(); - if (this$sessionId == null ? other$sessionId != null : !this$sessionId.equals(other$sessionId)) { - return false; - } - final Object this$nick = this.getNick(); - final Object other$nick = other.getNick(); - if (this$nick == null ? other$nick != null : !this$nick.equals(other$nick)) { - return false; - } - final Object this$changeValue = this.getChangeValue(); - final Object other$changeValue = other.getChangeValue(); - if (this$changeValue == null ? other$changeValue != null : !this$changeValue.equals(other$changeValue)) { - return false; - } - final Object this$videoStreamType = this.getVideoStreamType(); - final Object other$videoStreamType = other.getVideoStreamType(); - return this$videoStreamType == null ? other$videoStreamType == null : this$videoStreamType.equals(other$videoStreamType); + return true; } protected boolean canEqual(final Object other) { @@ -104,22 +60,14 @@ public class PeerConnectionEvent { int result = 1; final Object $peerConnectionEventType = this.getPeerConnectionEventType(); result = result * PRIME + ($peerConnectionEventType == null ? 43 : $peerConnectionEventType.hashCode()); - final Object $sessionId = this.getSessionId(); - result = result * PRIME + ($sessionId == null ? 43 : $sessionId.hashCode()); - final Object $nick = this.getNick(); - result = result * PRIME + ($nick == null ? 43 : $nick.hashCode()); - final Object $changeValue = this.getChangeValue(); - result = result * PRIME + ($changeValue == null ? 43 : $changeValue.hashCode()); - final Object $videoStreamType = this.getVideoStreamType(); - result = result * PRIME + ($videoStreamType == null ? 43 : $videoStreamType.hashCode()); return result; } public String toString() { - return "PeerConnectionEvent(peerConnectionEventType=" + this.getPeerConnectionEventType() + ", sessionId=" + this.getSessionId() + ", nick=" + this.getNick() + ", changeValue=" + this.getChangeValue() + ", videoStreamType=" + this.getVideoStreamType() + ")"; + return "PeerConnectionEvent(peerConnectionEventType=" + this.getPeerConnectionEventType() + ")"; } public enum PeerConnectionEventType { - PEER_NEW, PEER_CHECKING, PEER_CONNECTED, PEER_COMPLETED, PEER_DISCONNECTED, PEER_FAILED, PEER_CLOSED, SENSOR_FAR, SENSOR_NEAR + SENSOR_FAR, SENSOR_NEAR } } diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java index dd0818a4f..1d3914849 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java @@ -136,15 +136,13 @@ public class WebRtcAudioManager { setAudioDeviceInternal(AudioDevice.EARPIECE); Log.d(TAG, "switched to EARPIECE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=near"); - EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType - .SENSOR_NEAR, null, null, null, null)); + EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.SENSOR_NEAR)); } else { setAudioDeviceInternal(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE); Log.d(TAG, "switched to SPEAKER_PHONE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=far"); - EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType - .SENSOR_FAR, null, null, null, null)); + EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.SENSOR_FAR)); } } }