refactor: wrapper use corrected session description, set title to recipient displayName, indicate session calls

This commit is contained in:
jubb
2021-12-07 11:10:17 +11:00
parent ca0f8c5d7d
commit 02feba25d2
5 changed files with 28 additions and 19 deletions

View File

@@ -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 {

View File

@@ -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))

View File

@@ -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<SessionDescription>()
@@ -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) {

View File

@@ -42,6 +42,19 @@
app:layout_constraintTop_toBottomOf="@id/remote_recipient"
tools:visibility="visible" />
<TextView
android:id="@+id/sessionCallText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/WebRtcCallActivity_Session_Call"
android:textColor="@color/text"
android:textSize="11sp"
app:layout_constraintBottom_toTopOf="@+id/controlGroupBarrier"
android:layout_marginBottom="@dimen/small_spacing"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<TextView
android:id="@+id/callTime"
android:textSize="@dimen/medium_font_size"
@@ -49,8 +62,7 @@
tools:text="00:05:20"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/controlGroupBarrier"
android:layout_marginBottom="@dimen/very_large_spacing"
app:layout_constraintBottom_toTopOf="@+id/sessionCallText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View File

@@ -919,5 +919,6 @@
<string name="dialog_voice_video_message">The current implementation of voice / video calls will expose your IP address to the Oxen Foundation servers and the calling / called user</string>
<string name="CallNotificationBuilder_first_call_title">Call Missed</string>
<string name="CallNotificationBuilder_first_call_message">You missed a call because you need to enable the \'Voice and video calls\' permission in the Privacy Settings.</string>
<string name="WebRtcCallActivity_Session_Call">Session Call</string>
</resources>