Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
machiav3lli committed Jul 9, 2024
1 parent 1ac5320 commit 2ddfec4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,27 @@ class DownloadWorker(
val partialRelease =
Cache.getPartialReleaseFile(applicationContext, task.release.cacheFileName)

val callback: suspend (read: Long, total: Long?, downloadID: Long) -> Unit = { read, total, downloadID ->
val progress = if (total != null) {
workDataOf(
ARG_PROGRESS to (100f * read / total).roundToInt(),
ARG_READ to read,
ARG_TOTAL to total
)
} else {
workDataOf(
ARG_PROGRESS to -1,
ARG_READ to read,
ARG_TOTAL to 0,
)
}
if (!isStopped) setProgress(progress)
else if (downloadID != -1L) {
ContextCompat.getSystemService(context, DownloadManager::class.java)
?.remove(downloadID)
val callback: suspend (read: Long, total: Long?, downloadID: Long) -> Unit =
{ read, total, downloadID ->
val progress = if (total != null) {
workDataOf(
ARG_PROGRESS to (100f * read / total).roundToInt(),
ARG_READ to read,
ARG_TOTAL to total
)
} else {
workDataOf(
ARG_PROGRESS to -1,
ARG_READ to read,
ARG_TOTAL to 0,
)
}
if (!isStopped) setProgress(progress)
else if (downloadID != -1L) {
ContextCompat.getSystemService(context, DownloadManager::class.java)
?.remove(downloadID)
}
}
}

(if (Preferences[Preferences.Key.DownloadManager])
Downloader.dmDownload(context, task, partialRelease, callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.afollestad.materialdialogs.ModalDialog
import com.machiav3lli.fdroid.ANTIFEATURES_WEBSITE
import com.machiav3lli.fdroid.EXODUS_TRACKER_WEBSITE
import com.machiav3lli.fdroid.NeoActivity
Expand Down Expand Up @@ -272,7 +271,6 @@ fun PrivacyPanel(
Uri.parse("market://search?q=$TC_PACKAGENAME")
)
)
ModalDialog.onDismiss()
} else context.startActivity(
tcIntent.putExtra(
TC_INTENT_EXTRA_SEARCH,
Expand Down

0 comments on commit 2ddfec4

Please sign in to comment.