Skip to content

Commit

Permalink
fix: clear stale image file
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Lord committed Jan 27, 2024
1 parent 9a8748a commit 9f8f262
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "moe.lyniko.replacecursor"
minSdk 29
targetSdk 34
versionCode 202
versionName "2.0.2"
versionCode 203
versionName "2.0.3"
}

buildTypes {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/moe/lyniko/replacecursor/ui/HomeView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private fun MainSettings(recomposeEntries: MutableState<Int>) {
)
// copy to data dir
val inputStream = activity.contentResolver.openInputStream(uri)!!
if(resultFile.isNotEmpty()) preferenceUtils.removeImageBinary(resultFile)
resultFile = "${resourceId}_${System.currentTimeMillis()}"
preferenceUtils.setImageBinary(resultFile, inputStream.readBytes())
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PreferenceUtils( // init context on constructor
// Log.e("PreferenceUtils", "getImageBinary: $filename")
return getImageBinaryFrom(funcPref, filename)
}
private fun removeImageBinary(filename: String) {
fun removeImageBinary(filename: String) {
// Log.e("PreferenceUtils", "removeImageBinary: $filename")
funcPref.edit().remove(imageBinaryPrefix+filename).apply()
}
Expand Down

0 comments on commit 9f8f262

Please sign in to comment.