Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,8 @@ type ClaimIntentStepContentSummary {
audioRecordings: [ClaimIntentStepContentSummaryAudioRecording!]!
freeTexts: [String!]!
fileUploads: [ClaimIntentStepContentSummaryFileUpload!]!
keyDetails: [ClaimIntentStepContentSummaryItem!]!
answers: [ClaimIntentStepContentSummaryAnswer!]!
}
type ClaimIntentStepContentSummaryAudioRecording {
url: Url!
Expand All @@ -1293,6 +1295,21 @@ type ClaimIntentStepContentSummaryItem {
title: String!
value: String!
}
type ClaimIntentStepContentSummaryAnswer {
title: String!
value: ClaimIntentStepContentSummaryAnswerValue!
}
union ClaimIntentStepContentSummaryAnswerValue = ClaimIntentStepContentSummaryAnswerText|ClaimIntentStepContentSummaryAnswerAudio|ClaimIntentStepContentSummaryAnswerFiles
type ClaimIntentStepContentSummaryAnswerText {
text: String!
}
type ClaimIntentStepContentSummaryAnswerAudio {
url: Url!
transcript: String
}
type ClaimIntentStepContentSummaryAnswerFiles {
files: [ClaimIntentStepContentSummaryFileUpload!]!
}
"""
A task step is one that eventually completes itself.
This is meant to be polled until `isCompleted` is true, and then concluded using `Mutation.claimIntentSubmitTask`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
package com.hedvig.android.audio.player

actual fun CommonMediaPlayer(dataSourceUrl: String): CommonMediaPlayer {
TODO("jvm")
import com.hedvig.audio.player.data.ProgressPercentage

/**
* No JVM/desktop application target ships audio playback — the JVM target exists only for headless
* Compose render tests and previews. This no-op implementation lets audio-backed composables (e.g.
* [HedvigAudioPlayer]) compose and render on the JVM without a real media backend. It never plays
* anything and stays in the initial "preparing" state.
*/
actual fun CommonMediaPlayer(dataSourceUrl: String): CommonMediaPlayer = NoOpCommonMediaPlayer

private object NoOpCommonMediaPlayer : CommonMediaPlayer {
override val isPlaying: Boolean = false
override val duration: Int = 0

override fun pause() {}

override fun start() {}

override fun stop() {}

override fun release() {}

override suspend fun seekToPercent(percentage: ProgressPercentage) {}

override fun hasReachedTheEnd(): Boolean = false

override fun getProgressPercentage(): ProgressPercentage = ProgressPercentage(0f)

override fun setOnErrorListener(block: (what: Int, extra: Int) -> Boolean) {}

override fun setOnPreparedListener(block: () -> Unit) {}

override fun setOnCompletionListener(block: () -> Unit) {}

override fun prepareAsync() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@
<string name="claim_status_claim_details_info_text">Saknas något? Skicka ett meddelande till oss här i appen.</string>
<string name="claim_status_claim_details_submitted">Inskickad</string>
<string name="claim_status_claim_details_title">Detaljer om skadeanmälan</string>
<string name="claim_status_show_all_answers">Visa alla svar</string>
<string name="claim_status_closed_support_text">Ärendet är avslutat. Har du frågor gällande beslutet? Ställ dem direkt i chatten.</string>
<string name="claim_status_files">Filer</string>
<string name="claim_status_files_claim_audio_footer">Du kan lyssna på din inspelade skadeanmälan här.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@
<string name="claim_status_claim_details_info_text">Is something missing? Send us a message here in the app.</string>
<string name="claim_status_claim_details_submitted">Submitted</string>
<string name="claim_status_claim_details_title">Claim details</string>
<string name="claim_status_show_all_answers">Show all answers</string>
<string name="claim_status_closed_support_text">The claim is closed. Do you have any questions regarding your claim? Please ask them directly in the chat.</string>
<string name="claim_status_files">Files</string>
<string name="claim_status_files_claim_audio_footer">You can listen to your recorded claim audio here.</string>
Expand Down
3 changes: 3 additions & 0 deletions app/feature/feature-claim-chat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ kotlin {
implementation(projects.uiForceUpgrade)
implementation(projects.partnersDeflect)
}
jvmTest.dependencies {
implementation(org.jetbrains.compose.ComposePlugin.Dependencies(project).desktop.currentOs)
}
androidMain.dependencies {
implementation(libs.accompanist.permissions)
implementation(libs.androidx.activity.compose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,29 @@ fragment SummaryFragment on ClaimIntentStepContentSummary {
fileName
}
freeTexts
keyDetails {
title
value
}
answers {
title
value {
... on ClaimIntentStepContentSummaryAnswerText {
text
}
... on ClaimIntentStepContentSummaryAnswerAudio {
url
transcript
}
... on ClaimIntentStepContentSummaryAnswerFiles {
files {
url
contentType
fileName
}
}
}
}
}

fragment DeflectionFragment on ClaimIntentStepContentDeflection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ internal sealed interface StepContent {
val audioRecordings: List<AudioRecording>,
val fileUploads: List<FileUpload>,
val freeTexts: List<String>,
val keyDetails: List<Item>,
val answers: List<Answer>,
) : StepContent {
override val isSkippable: Boolean = false

Expand All @@ -164,6 +166,16 @@ internal sealed interface StepContent {
data class AudioRecording(val url: String)

data class FileUpload(val url: String, val contentType: String, val fileName: String)

data class Answer(val title: String, val value: Value) {
sealed interface Value {
data class Text(val text: String) : Value

data class Audio(val url: String, val transcript: String?) : Value

data class Files(val files: List<FileUpload>) : Value
}
}
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,34 @@ private fun ClaimIntentStepContentFragment.toStepContent(locale: CommonLocale):
)
},
freeTexts = freeTexts,
keyDetails = keyDetails.map { StepContent.Summary.Item(it.title, it.value) },
answers = answers.map { answer ->
StepContent.Summary.Answer(
title = answer.title,
value = when (val value = answer.value) {
is SummaryFragment.Answer.ClaimIntentStepContentSummaryAnswerTextValue -> {
StepContent.Summary.Answer.Value.Text(value.text)
}

is SummaryFragment.Answer.ClaimIntentStepContentSummaryAnswerAudioValue -> {
StepContent.Summary.Answer.Value.Audio(value.url, value.transcript)
}

is SummaryFragment.Answer.ClaimIntentStepContentSummaryAnswerFilesValue -> {
StepContent.Summary.Answer.Value.Files(
value.files.map {
StepContent.Summary.FileUpload(it.url, it.contentType, it.fileName)
},
)
}

else -> {
logcat { "SummaryFragment.Answer: Unknown answer value type" }
raise(ClaimChatErrorMessage.NeedsUpdate)
}
},
)
},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,9 @@ private fun StepTopContent(
Spacer(Modifier.height(16.dp))
if (stepItem.stepContent is StepContent.Summary) {
ChatClaimSummaryTopContent(
keyDetails = stepItem.stepContent.keyDetails.ifEmpty { stepItem.stepContent.items },
answers = stepItem.stepContent.answers,
recordingUrls = stepItem.stepContent.audioRecordings.map { it.url },
displayItems = stepItem.stepContent.items.map { (title, value) -> title to value },
onNavigateToImageViewer = onNavigateToImageViewer,
imageLoader = imageLoader,
fileUploads = stepItem.stepContent.fileUploads.map {
Expand All @@ -799,7 +800,6 @@ private fun StepTopContent(
id = it.url,
)
},
freeTexts = stepItem.stepContent.freeTexts,
)
}
}
Expand Down
Loading
Loading