|
|
@ -106,6 +106,9 @@ class AndroidImageStorage( |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
suspend fun getUri(context: Context, picture: PictureData): Uri = withContext(Dispatchers.IO) { |
|
|
|
suspend fun getUri(context: Context, picture: PictureData): Uri = withContext(Dispatchers.IO) { |
|
|
|
|
|
|
|
if (!sharedImagesDir.exists()) { |
|
|
|
|
|
|
|
sharedImagesDir.mkdirs() |
|
|
|
|
|
|
|
} |
|
|
|
val tempFileToShare: File = sharedImagesDir.resolve("share_picture.jpg") |
|
|
|
val tempFileToShare: File = sharedImagesDir.resolve("share_picture.jpg") |
|
|
|
when (picture) { |
|
|
|
when (picture) { |
|
|
|
is PictureData.Camera -> { |
|
|
|
is PictureData.Camera -> { |
|
|
@ -113,6 +116,9 @@ class AndroidImageStorage( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
is PictureData.Resource -> { |
|
|
|
is PictureData.Resource -> { |
|
|
|
|
|
|
|
if (!tempFileToShare.exists()) { |
|
|
|
|
|
|
|
tempFileToShare.createNewFile() |
|
|
|
|
|
|
|
} |
|
|
|
tempFileToShare.writeBytes(resource(picture.resource).readBytes()) |
|
|
|
tempFileToShare.writeBytes(resource(picture.resource).readBytes()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|