Skip to content

Commit

Permalink
fix: Last minute change, use normalized app name as default folder name
Browse files Browse the repository at this point in the history
Fixes GH-27
  • Loading branch information
null2264 committed Feb 12, 2024
1 parent 9a4149f commit ceb4eba
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## Changes
- Added splash to reader (in case it being opened from shortcut)
- Increased long strip split height
- Use normalized app name by default as folder name

## Fixes
- Fixed cutout support being broken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ class PreferencesHelper(val context: Context, val preferenceStore: PreferenceSto
private val defaultDownloadsDir = Uri.fromFile(
File(
Environment.getExternalStorageDirectory().absolutePath + File.separator +
context.getString(R.string.app_name),
context.getString(R.string.app_normalized_name),
"downloads",
),
)

private val defaultBackupDir = Uri.fromFile(
File(
Environment.getExternalStorageDirectory().absolutePath + File.separator +
context.getString(R.string.app_name),
context.getString(R.string.app_normalized_name),
"backup",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,14 @@ class MangaDetailsPresenter(
val directory = if (preferences.folderPerManga().get()) {
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
File.separator + Environment.DIRECTORY_PICTURES +
File.separator + preferences.context.getString(R.string.app_name)
File.separator + preferences.context.getString(R.string.app_normalized_name)

File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
} else {
File(
Environment.getExternalStorageDirectory().absolutePath +
File.separator + Environment.DIRECTORY_PICTURES +
File.separator + preferences.context.getString(R.string.app_name),
File.separator + preferences.context.getString(R.string.app_normalized_name),
)
}
val file = saveCover(directory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ class ReaderViewModel(
// Pictures directory.
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
File.separator + Environment.DIRECTORY_PICTURES +
File.separator + context.getString(R.string.app_name)
File.separator + context.getString(R.string.app_normalized_name)
val destDir = if (preferences.folderPerManga().get()) {
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
} else {
Expand Down Expand Up @@ -850,7 +850,7 @@ class ReaderViewModel(
// Pictures directory.
val baseDir = Environment.getExternalStorageDirectory().absolutePath +
File.separator + Environment.DIRECTORY_PICTURES +
File.separator + context.getString(R.string.app_name)
File.separator + context.getString(R.string.app_normalized_name)
val destDir = if (preferences.folderPerManga().get()) {
File(baseDir + File.separator + DiskUtil.buildValidFilename(manga.title))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class SettingsDownloadController : SettingsController() {

private fun getExternalDirs(): List<File> {
val defaultDir = Environment.getExternalStorageDirectory().absolutePath +
File.separator + activity.resources?.getString(R.string.app_name) +
File.separator + activity.resources?.getString(R.string.app_normalized_name) +
File.separator + "downloads"

return mutableListOf(File(defaultDir)) +
Expand Down

0 comments on commit ceb4eba

Please sign in to comment.