Skip to content

Commit 2f9c0fd

Browse files
Fix: Add missing imports and fix structural issues in ScreenCaptureService and PhotoReasoningViewModel
1 parent b0d5244 commit 2f9c0fd

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/ScreenCaptureService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import kotlinx.serialization.MissingFieldException
4848
import kotlinx.serialization.json.JsonClassDiscriminator
4949
import kotlinx.serialization.modules.SerializersModule
5050
import kotlinx.serialization.modules.polymorphic
51+
import kotlinx.serialization.modules.subclass
5152
import androidx.core.app.NotificationCompat
5253
import androidx.localbroadcastmanager.content.LocalBroadcastManager
5354
import okhttp3.MediaType.Companion.toMediaType
@@ -639,9 +640,9 @@ class ScreenCaptureService : Service() {
639640
}
640641

641642
// List existing screenshot files
642-
val screenshotFiles = picturesDir.listFiles { _, name ->
643+
val screenshotFiles = picturesDir.listFiles({ _, name ->
643644
name.startsWith("screenshot_") && name.endsWith(".png")
644-
)?.toMutableList() ?: mutableListOf()
645+
})?.toMutableList() ?: mutableListOf()
645646

646647
// Sort files by name (timestamp) to find the oldest
647648
screenshotFiles.sortBy { it.name }

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,10 +1137,10 @@ private fun reasonWithMistral(
11371137
}
11381138

11391139
val jsonSerializer = Json {
1140-
serializersModule = kotlinx.serialization.modules.SerializersModule {
1141-
kotlinx.serialization.modules.polymorphic(MistralContent::class) {
1142-
subclass(MistralTextContent::class, MistralTextContent.serializer())
1143-
subclass(MistralImageContent::class, MistralImageContent.serializer())
1140+
serializersModule = SerializersModule {
1141+
polymorphic(MistralContent::class) {
1142+
subclass(MistralTextContent::class)
1143+
subclass(MistralImageContent::class)
11441144
}
11451145
}
11461146
ignoreUnknownKeys = true

0 commit comments

Comments
 (0)