diff --git a/demo/src/main/assets/screener-questionnaire.json b/demo/src/main/assets/screener-questionnaire.json index 749234c2a8..2d331dfe50 100644 --- a/demo/src/main/assets/screener-questionnaire.json +++ b/demo/src/main/assets/screener-questionnaire.json @@ -1144,16 +1144,7 @@ { "text": "Add instructions for capturing temperature", "type": "display", - "linkId": "5.1.0", - "extension": [ - { - "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemMedia", - "valueAttachment" : { - "contentType": "image/png", - "url": "https://hapi.fhir.org/baseR4/Binary/android-fhir-thermometer-image" - } - } - ] + "linkId": "5.1.0" }, { "linkId": "5.2.0", diff --git a/demo/src/main/java/com/google/android/fhir/demo/ReferenceUrlResolver.kt b/demo/src/main/java/com/google/android/fhir/demo/ReferenceUrlResolver.kt index 4bcad5ee8b..5a92176626 100644 --- a/demo/src/main/java/com/google/android/fhir/demo/ReferenceUrlResolver.kt +++ b/demo/src/main/java/com/google/android/fhir/demo/ReferenceUrlResolver.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2022-2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,23 @@ import android.content.Context import android.graphics.Bitmap import android.graphics.BitmapFactory import com.google.android.fhir.datacapture.UrlResolver +import com.google.android.fhir.db.ResourceNotFoundException import com.google.android.fhir.get import org.hl7.fhir.r4.model.Binary import org.hl7.fhir.r4.model.ResourceType +import timber.log.Timber class ReferenceUrlResolver(val context: Context) : UrlResolver { override suspend fun resolveBitmapUrl(url: String): Bitmap? { val logicalId = getLogicalIdFromFhirUrl(url, ResourceType.Binary) - val binary = FhirApplication.fhirEngine(context).get(logicalId) - return BitmapFactory.decodeByteArray(binary.data, 0, binary.data.size) + return try { + val binary = FhirApplication.fhirEngine(context).get(logicalId) + BitmapFactory.decodeByteArray(binary.data, 0, binary.data.size) + } catch (e: ResourceNotFoundException) { + Timber.e(e) + null + } } } diff --git a/demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt b/demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt index d1d43a993f..144f11162c 100644 --- a/demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt +++ b/demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt @@ -36,13 +36,7 @@ import org.hl7.fhir.r4.model.ResourceType class TimestampBasedDownloadWorkManagerImpl(private val dataStore: DemoDataStore) : DownloadWorkManager { private val resourceTypeList = ResourceType.values().map { it.name } - private val urls = - LinkedList( - listOf( - "Patient?address-city=NAIROBI&_sort=_lastUpdated", - "Binary?_id=android-fhir-thermometer-image" - ) - ) + private val urls = LinkedList(listOf("Patient?address-city=NAIROBI&_sort=_lastUpdated")) override suspend fun getNextRequest(): DownloadRequest? { var url = urls.poll() ?: return null