-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔒️ In filekit-coil and Apple targets, use security scope when display…
…ing the image
- Loading branch information
Showing
4 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
filekit-coil/src/appleMain/kotlin/io/github/vinceglb/filekit/coil/FileKitCoil.apple.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
package io.github.vinceglb.filekit.coil | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.DisposableEffect | ||
import io.github.vinceglb.filekit.PlatformFile | ||
|
||
public actual val PlatformFile.coilModel: Any | ||
get() = nsUrl | ||
|
||
@Composable | ||
internal actual fun AsyncImagePlatformEffects(file: PlatformFile?) { | ||
DisposableEffect(file) { | ||
file?.nsUrl?.startAccessingSecurityScopedResource() | ||
|
||
onDispose { | ||
file?.nsUrl?.stopAccessingSecurityScopedResource() | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
filekit-coil/src/jvmMain/kotlin/io/github/vinceglb/filekit/coil/FileKitCoil.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package io.github.vinceglb.filekit.coil | ||
|
||
import androidx.compose.runtime.Composable | ||
import io.github.vinceglb.filekit.PlatformFile | ||
|
||
public actual val PlatformFile.coilModel: Any | ||
get() = file | ||
|
||
@Composable | ||
internal actual fun AsyncImagePlatformEffects(file: PlatformFile?) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters