change draft attachment directory (#2070)

This commit is contained in:
Konrad Pozniak 2021-02-09 19:45:43 +01:00 committed by GitHub
parent 657a8a0b8c
commit be77d91e91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,13 +59,19 @@ class DraftHelper @Inject constructor(
): Completable { ): Completable {
return Single.fromCallable { return Single.fromCallable {
val draftDirectory = context.getExternalFilesDir("Tusky") val externalFilesDir = context.getExternalFilesDir("Tusky")
if (draftDirectory == null || !(draftDirectory.exists())) { if (externalFilesDir == null || !(externalFilesDir.exists())) {
Log.e("DraftHelper", "Error obtaining directory to save media.") Log.e("DraftHelper", "Error obtaining directory to save media.")
throw Exception() throw Exception()
} }
val draftDirectory = File(externalFilesDir, "Drafts")
if (!draftDirectory.exists()) {
draftDirectory.mkdir()
}
val uris = mediaUris.map { uriString -> val uris = mediaUris.map { uriString ->
uriString.toUri() uriString.toUri()
}.map { uri -> }.map { uri ->