mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-11-23 23:57:23 +00:00
code refactor
This commit is contained in:
1 parent
acc9a39bb1
commit
9c398043ec
2 files changed
+54
-26
No files matched your search
+9
-5
@@ -65,10 +65,13 @@ class AndroidDownloadStorageActions(context: Context) : DownloadStorageActions {
|
||||
val bridge = host
|
||||
currentOnResult(
|
||||
when {
|
||||
folder == null || bridge == null ->
|
||||
folder == null || bridge == null -> {
|
||||
FolderPickResult.Failed(DownloadFolderError.INVALID_DIRECTORY)
|
||||
}
|
||||
|
||||
else -> bridge.acquireFolder(folder)
|
||||
else -> {
|
||||
bridge.acquireFolder(folder)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -93,9 +96,10 @@ class AndroidDownloadStorageActions(context: Context) : DownloadStorageActions {
|
||||
}
|
||||
}
|
||||
|
||||
private fun newPipeFolderIn(directoryName: String): String = File(File(Environment.getExternalStorageDirectory(), directoryName), NEWPIPE_FOLDER)
|
||||
.toURI()
|
||||
.toString()
|
||||
private fun newPipeFolderIn(directoryName: String): String {
|
||||
val directory = File(Environment.getExternalStorageDirectory(), directoryName)
|
||||
return File(directory, NEWPIPE_FOLDER).toURI().toString()
|
||||
}
|
||||
|
||||
private fun loadHost(context: Context): DownloadStorageHost? = runCatching {
|
||||
Class.forName(HOST_CLASS)
|
||||
|
||||
Reference in new issue
Block a user