Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
fix photo name
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Oct 13, 2023
1 parent ce5203a commit db8ed30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ class PhotoViewModel : ViewModel() {
val outputFile =
saveDir.createFile(
"image/jpg",
"${meme.title.take(64)}-${UUID.randomUUID().toString().take(8)}"
"${meme.title.take(64)}-${
UUID.randomUUID().toString().take(8)
}.jpg".replace("[\\\\/:*?\"<>|]", "")
)
if (outputFile == null) {
withContext(Dispatchers.Main) {
downloadState = DownloadState.Error
}
Toast.makeText(context, "Failed to create file", Toast.LENGTH_LONG).show()
withContext(Dispatchers.Main) {
Toast.makeText(context, "Failed to create file", Toast.LENGTH_LONG).show()
}
return@launch
}
if (bitmap != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class PlayerViewModel() : ViewModel() {

@RequiresApi(Build.VERSION_CODES.O)
fun downloadVideo(context: Context, meme: Meme) {
val fileName = "${meme.title.take(64)}-${UUID.randomUUID().toString().take(8)}"
val fileName = "${meme.title.take(64)}-${
UUID.randomUUID().toString().take(8)
}".replace("[\\\\/:*?\"<>|]", "")
viewModelScope.launch {
downloadState = DownloadState.Loading
val downloader = RedditVideoDownloader()
Expand Down

0 comments on commit db8ed30

Please sign in to comment.