Skip to content

Commit 4f835b2

Browse files
committed
Issue #89: Add linkhub prefix for exported file name
1 parent 3fb6d16 commit 4f835b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/main/java/com/amrdeveloper/linkhub/ui/importexport/ImportExportViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ImportExportViewModel @Inject constructor(
7979
fileType: ImportExportFileType,
8080
data: String
8181
) {
82-
val fileName = System.currentTimeMillis().toString() + fileType.extension
82+
val fileName = "linkhub_${System.currentTimeMillis().toString() + fileType.extension}"
8383
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
8484
val resolver = context.contentResolver
8585
val values = ContentValues()
@@ -92,6 +92,7 @@ class ImportExportViewModel @Inject constructor(
9292
val uri = resolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, values)
9393
val outputStream = uri?.let { resolver.openOutputStream(it) }
9494
outputStream?.write(data.toByteArray())
95+
outputStream?.close()
9596
} else {
9697
val downloadDir =
9798
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)

0 commit comments

Comments
 (0)