[Calling][Release][Feature] Rename diagnostics (#589)
This commit is contained in:
Родитель
97bfdc7bbe
Коммит
39cf2483fd
|
@ -11,7 +11,7 @@ import com.azure.android.communication.ui.calling.configuration.CallCompositeCon
|
|||
import com.azure.android.communication.ui.calling.configuration.CallConfiguration;
|
||||
import com.azure.android.communication.ui.calling.configuration.CallType;
|
||||
import com.azure.android.communication.ui.calling.di.DependencyInjectionContainer;
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeDiagnosticsInfo;
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeDiagnostics;
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeGroupCallLocator;
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeJoinLocator;
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeLocalOptions;
|
||||
|
@ -24,7 +24,7 @@ import com.azure.android.communication.ui.calling.models.CallCompositeTeamsMeeti
|
|||
import com.azure.android.communication.ui.calling.presentation.CallCompositeActivity;
|
||||
import com.azure.android.communication.ui.calling.presentation.manager.DiagnosticsManager;
|
||||
|
||||
import static com.azure.android.communication.ui.calling.models.CallCompositeDiagnosticsInfoExtensionsKt.buildCallCompositeDiagnosticsInfo;
|
||||
import static com.azure.android.communication.ui.calling.models.CallCompositeDiagnosticsExtensionsKt.buildCallCompositeDiagnostics;
|
||||
import static com.azure.android.communication.ui.calling.service.sdk.TypeConversionsKt.into;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -211,13 +211,13 @@ public final class CallComposite {
|
|||
/**
|
||||
* Get Call Composite Diagnostics information.
|
||||
*
|
||||
* @return {@link CallCompositeDiagnosticsInfo}
|
||||
* @return {@link CallCompositeDiagnostics}
|
||||
*/
|
||||
public CallCompositeDiagnosticsInfo getDiagnosticsInfo() {
|
||||
public CallCompositeDiagnostics getDiagnostics() {
|
||||
final DiagnosticsManager diagnosticsManager = getDiagnosticsManger();
|
||||
return diagnosticsManager != null
|
||||
? diagnosticsManager.getDiagnosticsInfo()
|
||||
: buildCallCompositeDiagnosticsInfo();
|
||||
? diagnosticsManager.getDiagnostics()
|
||||
: buildCallCompositeDiagnostics();
|
||||
}
|
||||
|
||||
void setDependencyInjectionContainer(final DependencyInjectionContainer diContainer) {
|
||||
|
|
|
@ -6,18 +6,18 @@ package com.azure.android.communication.ui.calling.models;
|
|||
/**
|
||||
* A Call Composite Diagnostics information.
|
||||
*/
|
||||
public final class CallCompositeDiagnosticsInfo {
|
||||
public final class CallCompositeDiagnostics {
|
||||
|
||||
private String lastKnownCallId;
|
||||
|
||||
CallCompositeDiagnosticsInfo() { }
|
||||
CallCompositeDiagnostics() { }
|
||||
|
||||
/**
|
||||
* Set last known call id.
|
||||
* @param lastKnownCallId last known call id.
|
||||
* @return {@link CallCompositeDiagnosticsInfo}
|
||||
* @return {@link CallCompositeDiagnostics}
|
||||
*/
|
||||
CallCompositeDiagnosticsInfo setLastKnownCallId(final String lastKnownCallId) {
|
||||
CallCompositeDiagnostics setLastKnownCallId(final String lastKnownCallId) {
|
||||
this.lastKnownCallId = lastKnownCallId;
|
||||
return this;
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
package com.azure.android.communication.ui.calling.models
|
||||
|
||||
internal fun CallCompositeDiagnosticsInfo.setCallId(lastKnownCallId: String?) {
|
||||
internal fun CallCompositeDiagnostics.setCallId(lastKnownCallId: String?) {
|
||||
this.lastKnownCallId = lastKnownCallId
|
||||
}
|
||||
|
||||
internal fun buildCallCompositeDiagnosticsInfo(): CallCompositeDiagnosticsInfo = CallCompositeDiagnosticsInfo()
|
||||
internal fun buildCallCompositeDiagnostics(): CallCompositeDiagnostics = CallCompositeDiagnostics()
|
|
@ -83,14 +83,14 @@ internal class MoreCallOptionsListView(
|
|||
isOnHold = false,
|
||||
) {
|
||||
menuDrawer.dismiss()
|
||||
shareDiagnosticsInfo()
|
||||
shareDiagnostics()
|
||||
},
|
||||
)
|
||||
|
||||
return bottomCellItems
|
||||
}
|
||||
|
||||
private fun shareDiagnosticsInfo() {
|
||||
private fun shareDiagnostics() {
|
||||
val share = Intent.createChooser(
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
|
|
|
@ -12,7 +12,7 @@ internal class MoreCallOptionsListViewModel(
|
|||
private val unknown = "UNKNOWN"
|
||||
val callId: String
|
||||
get() {
|
||||
val lastKnownCallId = diagnosticsManager.diagnosticsInfo.lastKnownCallId
|
||||
val lastKnownCallId = diagnosticsManager.diagnostics.lastKnownCallId
|
||||
return "Call ID: \"${if (lastKnownCallId.isNullOrEmpty()) unknown else lastKnownCallId}\""
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
package com.azure.android.communication.ui.calling.presentation.manager
|
||||
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeDiagnosticsInfo
|
||||
import com.azure.android.communication.ui.calling.models.buildCallCompositeDiagnosticsInfo
|
||||
import com.azure.android.communication.ui.calling.models.CallCompositeDiagnostics
|
||||
import com.azure.android.communication.ui.calling.models.buildCallCompositeDiagnostics
|
||||
import com.azure.android.communication.ui.calling.models.setCallId
|
||||
import com.azure.android.communication.ui.calling.redux.Store
|
||||
import com.azure.android.communication.ui.calling.redux.state.ReduxState
|
||||
|
@ -14,22 +14,22 @@ import kotlinx.coroutines.launch
|
|||
|
||||
internal interface DiagnosticsManager {
|
||||
fun start(coroutineScope: CoroutineScope)
|
||||
val diagnosticsInfo: CallCompositeDiagnosticsInfo
|
||||
val diagnostics: CallCompositeDiagnostics
|
||||
}
|
||||
|
||||
internal class DiagnosticsManagerImpl(
|
||||
private val store: Store<ReduxState>,
|
||||
) : DiagnosticsManager {
|
||||
|
||||
override var diagnosticsInfo = buildCallCompositeDiagnosticsInfo()
|
||||
override var diagnostics = buildCallCompositeDiagnostics()
|
||||
|
||||
override fun start(coroutineScope: CoroutineScope) {
|
||||
coroutineScope.launch {
|
||||
store.getStateFlow().collect {
|
||||
if (!it.callState.callId.isNullOrEmpty()) {
|
||||
val newDiagnosticsInfo = buildCallCompositeDiagnosticsInfo()
|
||||
newDiagnosticsInfo.setCallId(it.callState.callId)
|
||||
diagnosticsInfo = newDiagnosticsInfo
|
||||
val newDiagnostics = buildCallCompositeDiagnostics()
|
||||
newDiagnostics.setCallId(it.callState.callId)
|
||||
diagnostics = newDiagnostics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ internal class DiagnosticsManagerTest : ACSBaseTestCoroutine() {
|
|||
diagnosticsManager.start(coroutineScope = this)
|
||||
}
|
||||
|
||||
val diagnosticsInfo1 = diagnosticsManager.diagnosticsInfo
|
||||
Assert.assertNotNull(diagnosticsInfo1)
|
||||
Assert.assertNull(diagnosticsInfo1.lastKnownCallId)
|
||||
val diagnostics1 = diagnosticsManager.diagnostics
|
||||
Assert.assertNotNull(diagnostics1)
|
||||
Assert.assertNull(diagnostics1.lastKnownCallId)
|
||||
|
||||
// update state
|
||||
val appState2 = AppReduxState("")
|
||||
|
@ -52,10 +52,10 @@ internal class DiagnosticsManagerTest : ACSBaseTestCoroutine() {
|
|||
appState2.callState = CallingState(CallingStatus.CONNECTING, callID)
|
||||
stateFlow.value = appState2
|
||||
|
||||
val diagnosticsInfo2 = diagnosticsManager.diagnosticsInfo
|
||||
Assert.assertNotSame(diagnosticsInfo1, diagnosticsInfo2)
|
||||
Assert.assertNotNull(diagnosticsInfo2)
|
||||
Assert.assertEquals(callID, diagnosticsInfo2.lastKnownCallId)
|
||||
val diagnostics2 = diagnosticsManager.diagnostics
|
||||
Assert.assertNotSame(diagnostics1, diagnostics2)
|
||||
Assert.assertNotNull(diagnostics2)
|
||||
Assert.assertEquals(callID, diagnostics2.lastKnownCallId)
|
||||
|
||||
// redux state loosing CallID
|
||||
|
||||
|
@ -64,10 +64,10 @@ internal class DiagnosticsManagerTest : ACSBaseTestCoroutine() {
|
|||
appState3.callState = CallingState(CallingStatus.CONNECTING, null)
|
||||
stateFlow.value = appState3
|
||||
|
||||
val diagnosticsInfo3 = diagnosticsManager.diagnosticsInfo
|
||||
Assert.assertSame(diagnosticsInfo2, diagnosticsInfo3)
|
||||
Assert.assertNotNull(diagnosticsInfo3)
|
||||
Assert.assertEquals(callID, diagnosticsInfo3.lastKnownCallId)
|
||||
val diagnostics3 = diagnosticsManager.diagnostics
|
||||
Assert.assertSame(diagnostics2, diagnostics3)
|
||||
Assert.assertNotNull(diagnostics3)
|
||||
Assert.assertEquals(callID, diagnostics3.lastKnownCallId)
|
||||
flowJob.cancel()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ class CallLauncherActivityErrorHandler(
|
|||
|
||||
override fun handle(it: CallCompositeErrorEvent) {
|
||||
println("================= application is logging exception =================")
|
||||
println("call id: " + (callComposite.diagnosticsInfo.lastKnownCallId ?: ""))
|
||||
println("call id: " + (callComposite.diagnostics.lastKnownCallId ?: ""))
|
||||
println(it.cause)
|
||||
println(it.errorCode)
|
||||
activityWr.get()?.showAlert("${it.errorCode} ${it.cause?.message}. Call id: ${callComposite.diagnosticsInfo.lastKnownCallId ?: ""}")
|
||||
activityWr.get()?.showAlert("${it.errorCode} ${it.cause?.message}. Call id: ${callComposite.diagnostics.lastKnownCallId ?: ""}")
|
||||
println("====================================================================")
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче