From 02feba25d2e611f04a8b11c2a64b61e5fb4d602c Mon Sep 17 00:00:00 2001 From: jubb Date: Tue, 7 Dec 2021 11:10:17 +1100 Subject: [PATCH] refactor: wrapper use corrected session description, set title to recipient displayName, indicate session calls --- app/build.gradle | 12 ------------ .../securesms/calls/WebRtcCallActivity.kt | 7 ++++--- .../securesms/webrtc/PeerConnectionWrapper.kt | 11 +++++++++-- app/src/main/res/layout/activity_webrtc.xml | 16 ++++++++++++++-- app/src/main/res/values/strings.xml | 1 + 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 07939e59e7..516dd1b60f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -232,20 +232,8 @@ android { } } - signingConfigs { - release { - def props = new Properties() - rootProject.file("signing.properties").withInputStream { props.load(it) } - storeFile file(props["KEYSTORE_FILE"]) - storePassword props["KEYSTORE_PASS"] - keyAlias props["KEYSTORE_ALIAS"] - keyPassword props["KEYSTORE_ALIAS_PASS"] - } - } - buildTypes { release { - signingConfig signingConfigs.release minifyEnabled false } debug { diff --git a/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt index 52c7a85a0c..c54c24d420 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt @@ -177,21 +177,22 @@ class WebRtcCallActivity: PassphraseRequiredActionBarActivity() { } controlGroup.isVisible = state in listOf(CALL_CONNECTED, CALL_OUTGOING, CALL_INCOMING) remote_loading_view.isVisible = state !in listOf(CALL_CONNECTED, CALL_RINGING) - incomingControlGroup.isVisible = state == CALL_RINGING + incomingControlGroup.isVisible = state in listOf(CALL_RINGING, CALL_PRE_INIT) } } launch { viewModel.recipient.collect { latestRecipient -> if (latestRecipient.recipient != null) { + val publicKey = latestRecipient.recipient.address.serialize() + val displayName = getUserDisplayName(publicKey) + supportActionBar?.title = displayName val signalProfilePicture = latestRecipient.recipient.contactPhoto val avatar = (signalProfilePicture as? ProfileContactPhoto)?.avatarObject if (signalProfilePicture != null && avatar != "0" && avatar != "") { glide.clear(remote_recipient) glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC).circleCrop().into(remote_recipient) } else { - val publicKey = latestRecipient.recipient.address.serialize() - val displayName = getUserDisplayName(publicKey) val sizeInPX = resources.getDimensionPixelSize(R.dimen.extra_large_profile_picture_size) glide.clear(remote_recipient) glide.load(AvatarPlaceholderGenerator.generate(this@WebRtcCallActivity, sizeInPX, publicKey, displayName)) diff --git a/app/src/main/java/org/thoughtcrime/securesms/webrtc/PeerConnectionWrapper.kt b/app/src/main/java/org/thoughtcrime/securesms/webrtc/PeerConnectionWrapper.kt index 7bbe5d4ca9..0fd6fe21bb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/webrtc/PeerConnectionWrapper.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/webrtc/PeerConnectionWrapper.kt @@ -188,7 +188,7 @@ class PeerConnectionWrapper(context: Context, }, mediaConstraints) try { - return future.get() + return correctSessionDescription(future.get()) } catch (e: InterruptedException) { throw AssertionError() } catch (e: ExecutionException) { @@ -196,6 +196,13 @@ class PeerConnectionWrapper(context: Context, } } + private fun correctSessionDescription(sessionDescription: SessionDescription): SessionDescription { + val updatedSdp = sessionDescription.description.replace("(a=fmtp:111 ((?!cbr=).)*)\r?\n".toRegex(), "$1;cbr=1\r\n") + .replace(".+urn:ietf:params:rtp-hdrext:ssrc-audio-level.*\r?\n".toRegex(), "") + + return SessionDescription(sessionDescription.type, updatedSdp) + } + fun createOffer(mediaConstraints: MediaConstraints): SessionDescription { val future = SettableFuture() @@ -218,7 +225,7 @@ class PeerConnectionWrapper(context: Context, }, mediaConstraints) try { - return future.get() + return correctSessionDescription(future.get()) } catch (e: InterruptedException) { throw AssertionError() } catch (e: ExecutionException) { diff --git a/app/src/main/res/layout/activity_webrtc.xml b/app/src/main/res/layout/activity_webrtc.xml index 2b004ead41..d531aacb22 100644 --- a/app/src/main/res/layout/activity_webrtc.xml +++ b/app/src/main/res/layout/activity_webrtc.xml @@ -42,6 +42,19 @@ app:layout_constraintTop_toBottomOf="@id/remote_recipient" tools:visibility="visible" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a61974e5d0..8403d36da6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -919,5 +919,6 @@ The current implementation of voice / video calls will expose your IP address to the Oxen Foundation servers and the calling / called user Call Missed You missed a call because you need to enable the \'Voice and video calls\' permission in the Privacy Settings. + Session Call