Skip to content

Commit

Permalink
fixed nits
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumo0922 committed Oct 9, 2024
1 parent b43ab33 commit 04cde56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class DownloadPostsRepositoryImpl(
}

override suspend fun getSaveDirectory(requestType: FanboxDownloadItems.RequestType): String {
return (getParentFile(requestType) ?: getOldParentFile(requestType)).filePath ?: "Unknown"
return (getParentFile(requestType) ?: getOldParentFile(requestType, true)).filePath ?: "Unknown"
}

private fun FanboxPostDetail.ImageItem.toDownloadItem(): FanboxDownloadItems.Item {
Expand Down Expand Up @@ -208,7 +208,7 @@ class DownloadPostsRepositoryImpl(
}.getOrNull()
}

private fun getOldParentFile(requestType: FanboxDownloadItems.RequestType): UniFile {
private fun getOldParentFile(requestType: FanboxDownloadItems.RequestType, isDryRun: Boolean = false): UniFile {
val environmentDir = when (requestType) {
is FanboxDownloadItems.RequestType.Image -> Environment.DIRECTORY_PICTURES
is FanboxDownloadItems.RequestType.File -> Environment.DIRECTORY_DOWNLOADS
Expand All @@ -224,12 +224,14 @@ class DownloadPostsRepositoryImpl(
val dir = File("${Environment.getExternalStorageDirectory().path}/$environmentDir", "FANBOX")
val childDir = File(dir, child)

if (!dir.exists()) {
dir.mkdir()
}
if (!isDryRun) {
if (!dir.exists()) {
dir.mkdir()
}

if (child.isNotBlank() && !childDir.exists()) {
childDir.mkdir()
if (child.isNotBlank() && !childDir.exists()) {
childDir.mkdir()
}
}

return UniFile.fromFile(childDir)!!
Expand Down
4 changes: 2 additions & 2 deletions core/ui/src/commonMain/composeResources/files/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
},
{
"versionName": "2.1.7",
"versionCode": 43,
"date": "2024/10/08",
"versionCode": 46,
"date": "2024/10/10",
"logJp": "・ダウンロード中のUIを改善\n・ダウンロードしたファイルの保存先を指定できるように変更\n・常にオリジナルサイズの画像をダウンロードできるオプションを用意\n・大きなファイルをダウンロードした際にアプリがクラッシュする問題を修正",
"logEn": "・Improved the UI during downloading\n・Changed so that you can specify the destination to save downloaded files\n・Option to always download images in their original size\n・Fixed issue where app would crash when downloading large files"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
# Application
versionName = "2.1.7"
versionCode = "44"
versionCode = "46"

# SDK
minSdk = "26"
Expand Down

0 comments on commit 04cde56

Please sign in to comment.