Bump version

This commit is contained in:
Philipp Heckel 2022-01-11 22:31:18 -05:00
parent b176bfe35e
commit 83d0d5ff78
2 changed files with 6 additions and 4 deletions

View file

@ -12,8 +12,8 @@ android {
minSdkVersion 21
targetSdkVersion 30
versionCode 15
versionName "1.5.2"
versionCode 16
versionName "1.6.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -89,11 +89,11 @@ class DownloadWorker(private val context: Context, params: WorkerParameters) : W
val out = resolver.openOutputStream(uri) ?: throw Exception("Cannot open output stream")
out.use { fileOut ->
val fileIn = response.body!!.byteStream()
val buffer = ByteArray(8 * 1024)
val buffer = ByteArray(BUFFER_SIZE)
var bytes = fileIn.read(buffer)
var lastProgress = 0L
while (bytes >= 0) {
if (System.currentTimeMillis() - lastProgress > 500) {
if (System.currentTimeMillis() - lastProgress > NOTIFICATION_UPDATE_INTERVAL_MILLIS) {
if (isStopped) {
Log.d(TAG, "Attachment download was canceled")
val newAttachment = attachment.copy(progress = PROGRESS_NONE)
@ -167,5 +167,7 @@ class DownloadWorker(private val context: Context, params: WorkerParameters) : W
companion object {
private const val TAG = "NtfyAttachDownload"
private const val FILE_PROVIDER_AUTHORITY = BuildConfig.APPLICATION_ID + ".provider" // See AndroidManifest.xml
private const val BUFFER_SIZE = 8 * 1024
private const val NOTIFICATION_UPDATE_INTERVAL_MILLIS = 800
}
}