mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1386 App | Fix | Paste command exception (#80)
This commit is contained in:
parent
1d40e04204
commit
32396a5519
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,8 @@ import android.content.Context
|
|||
import com.anytypeio.anytype.core_models.Block
|
||||
import com.anytypeio.anytype.data.auth.mapper.Serializer
|
||||
import com.anytypeio.anytype.data.auth.repo.clipboard.ClipboardDataStore
|
||||
import java.io.File
|
||||
import timber.log.Timber
|
||||
|
||||
class AnytypeClipboardStorage(
|
||||
private val context: Context,
|
||||
|
@ -19,6 +21,11 @@ class AnytypeClipboardStorage(
|
|||
}
|
||||
|
||||
override fun fetch(): List<Block> {
|
||||
val file = File(context.filesDir, CLIPBOARD_FILE_NAME)
|
||||
if (!file.exists()) {
|
||||
Timber.e( "ClipboardStorage, file does not exist: $file")
|
||||
return emptyList()
|
||||
}
|
||||
val stream = context.openFileInput(CLIPBOARD_FILE_NAME)
|
||||
val blob = stream.use { it.readBytes() }
|
||||
return serializer.deserialize(blob)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue