lifting voip setting to a voip config

This commit is contained in:
Adam Brown 2022-06-30 16:46:32 +01:00
parent 56afac26ad
commit b6d052e58d
5 changed files with 35 additions and 6 deletions

View File

@ -55,6 +55,12 @@ object Config {
*/ */
val ONBOARDING_VARIANT = OnboardingVariant.FTUE_AUTH val ONBOARDING_VARIANT = OnboardingVariant.FTUE_AUTH
/**
* If set, MSC3086 asserted identity messages sent on VoIP calls will cause the call to appear in the room corresponding to the asserted identity.
* This *must* only be set in trusted environments.
*/
const val HANDLE_CALL_ASSERTED_IDENTITY_EVENTS = false
/** /**
* The analytics configuration to use for the Debug build type. * The analytics configuration to use for the Debug build type.
* Can be disabled by providing Analytics.Disabled * Can be disabled by providing Analytics.Disabled
@ -113,7 +119,6 @@ sealed interface Analytics {
) : Analytics ) : Analytics
} }
enum class OnboardingVariant { enum class OnboardingVariant {
LEGACY, LEGACY,
LOGIN_2, LOGIN_2,

View File

@ -156,10 +156,6 @@ android {
buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\"" buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\""
buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\"" buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""
// If set, MSC3086 asserted identity messages sent on VoIP calls will cause the call to appear in the room corresponding to the asserted identity.
// This *must* only be set in trusted environments.
buildConfigField "Boolean", "handleCallAssertedIdentityEvents", "false"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Keep abiFilter for the universalApk // Keep abiFilter for the universalApk

View File

@ -25,6 +25,7 @@ import im.vector.app.config.Analytics
import im.vector.app.config.Config import im.vector.app.config.Config
import im.vector.app.config.KeySharingStrategy import im.vector.app.config.KeySharingStrategy
import im.vector.app.features.analytics.AnalyticsConfig import im.vector.app.features.analytics.AnalyticsConfig
import im.vector.app.features.call.webrtc.VoipConfig
import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy
import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageConfig import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageConfig
import im.vector.app.features.location.LocationSharingConfig import im.vector.app.features.location.LocationSharingConfig
@ -69,4 +70,9 @@ object ConfigurationModule {
fun providesLocationSharingConfig() = LocationSharingConfig( fun providesLocationSharingConfig() = LocationSharingConfig(
mapTilerKey = Config.LOCATION_MAP_TILER_KEY, mapTilerKey = Config.LOCATION_MAP_TILER_KEY,
) )
@Provides
fun providesVoipConfig() = VoipConfig(
handleCallAssertedIdentityEvents = Config.HANDLE_CALL_ASSERTED_IDENTITY_EVENTS
)
} }

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.call.webrtc
data class VoipConfig(
val handleCallAssertedIdentityEvents: Boolean
)

View File

@ -74,6 +74,7 @@ class WebRtcCallManager @Inject constructor(
private val activeSessionDataSource: ActiveSessionDataSource, private val activeSessionDataSource: ActiveSessionDataSource,
private val analyticsTracker: AnalyticsTracker, private val analyticsTracker: AnalyticsTracker,
private val unifiedPushHelper: UnifiedPushHelper, private val unifiedPushHelper: UnifiedPushHelper,
private val voipConfig: VoipConfig,
) : CallListener, ) : CallListener,
DefaultLifecycleObserver { DefaultLifecycleObserver {
@ -444,7 +445,7 @@ class WebRtcCallManager @Inject constructor(
} }
override fun onCallAssertedIdentityReceived(callAssertedIdentityContent: CallAssertedIdentityContent) { override fun onCallAssertedIdentityReceived(callAssertedIdentityContent: CallAssertedIdentityContent) {
if (!BuildConfig.handleCallAssertedIdentityEvents) { if (!voipConfig.handleCallAssertedIdentityEvents) {
return return
} }
val call = callsByCallId[callAssertedIdentityContent.callId] val call = callsByCallId[callAssertedIdentityContent.callId]