Skip to content

Commit

Permalink
Fix saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambada10 committed Sep 20, 2024
1 parent d61183f commit 75d0f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class LyricsFetchViewModel(
val lrcContent = generateLrcContent(song, lyrics, generatedUsingString)
val file = newLyricsFilePath(filePath, song)

if (isLegacyFileAccessRequired(filePath)) {
if (!isLegacyFileAccessRequired(filePath)) {
file.writeText(lrcContent)
} else {
saveToExternalPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import android.os.Build
import android.widget.Toast

fun isLegacyFileAccessRequired(filePath: String?): Boolean {
// Before Android 11, not in internal storage
return Build.VERSION.SDK_INT < Build.VERSION_CODES.R
|| filePath?.contains("/storage/emulated/0/") == true
&& filePath?.contains("/storage/emulated/0/") == false
}

fun showToast(context: Context, messageResId: Int, vararg args: Any, long: Boolean = true) {
Expand Down

0 comments on commit 75d0f7e

Please sign in to comment.