Loading app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,7 @@ class MainActivityViewModel @Inject constructor( if (shouldShowPaidAppsSnackBar(app)) { return } viewModelScope.launch { val fusedDownload: FusedDownload try { Loading app/src/main/java/foundation/e/apps/api/DownloadManager.kt +26 −1 Original line number Diff line number Diff line Loading @@ -127,11 +127,36 @@ class DownloadManager @Inject constructor( } } private fun tickerFlow(downloadId: Long, period: Duration, initialDelay: Duration = Duration.ZERO) = flow { private fun tickerFlow( downloadId: Long, period: Duration, initialDelay: Duration = Duration.ZERO ) = flow { delay(initialDelay) while (downloadsMaps[downloadId]!!) { emit(Unit) delay(period) } } fun isDownloadSuccessful(downloadId: Long): Boolean { return getDownloadStatus(downloadId) == DownloadManager.STATUS_SUCCESSFUL } private fun getDownloadStatus(downloadId: Long): Int { try { downloadManager.query(downloadManagerQuery.setFilterById(downloadId)) .use { cursor -> if (cursor.moveToFirst()) { val status = cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)) Timber.d("Download Failed: downloadId: $downloadId $status") return status } } } catch (e: Exception) { Timber.e(e) } return DownloadManager.STATUS_FAILED } } app/src/main/java/foundation/e/apps/api/cleanapk/ApkSignatureManager.kt +11 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import org.bouncycastle.openpgp.PGPUtil import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator import timber.log.Timber import java.io.BufferedInputStream import java.io.FileInputStream import java.io.InputStream Loading @@ -35,11 +36,16 @@ import java.security.Security object ApkSignatureManager { fun verifyFdroidSignature(context: Context, apkFilePath: String, signature: String): Boolean { Security.addProvider(BouncyCastleProvider()) try { return verifyAPKSignature( BufferedInputStream(FileInputStream(apkFilePath)), signature.byteInputStream(Charsets.UTF_8), context.assets.open("f-droid.org-signing-key.gpg") ) } catch (e: Exception) { Timber.e(e) } return false } private fun verifyAPKSignature( Loading app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt +7 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import foundation.e.apps.utils.modules.PreferenceManagerModule import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.withTimeout import timber.log.Timber import java.text.NumberFormat import javax.inject.Inject import javax.inject.Singleton Loading Loading @@ -1350,8 +1351,12 @@ class FusedAPIImpl @Inject constructor( other_images_path = this.screenshots.transformToList(), package_name = this.packageName, ratings = Ratings( usageQualityScore = if (this.labeledRating.isNotEmpty()) this.labeledRating.toDoubleOrNull() ?: -1.0 else -1.0 usageQualityScore = this.labeledRating.run { if (isNotEmpty()) { NumberFormat.getInstance().parse(this)?.toDouble() ?: -1.0 } else -1.0 } ), offer_type = this.offerType, origin = Origin.GPLAY, Loading app/src/main/java/foundation/e/apps/api/fused/UpdatesDao.kt 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.api.fused import foundation.e.apps.api.fused.data.FusedApp object UpdatesDao { var appsAwaitingForUpdate: List<FusedApp> = listOf() fun hasAnyAppsForUpdate() = appsAwaitingForUpdate.isNotEmpty() } Loading
app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,7 @@ class MainActivityViewModel @Inject constructor( if (shouldShowPaidAppsSnackBar(app)) { return } viewModelScope.launch { val fusedDownload: FusedDownload try { Loading
app/src/main/java/foundation/e/apps/api/DownloadManager.kt +26 −1 Original line number Diff line number Diff line Loading @@ -127,11 +127,36 @@ class DownloadManager @Inject constructor( } } private fun tickerFlow(downloadId: Long, period: Duration, initialDelay: Duration = Duration.ZERO) = flow { private fun tickerFlow( downloadId: Long, period: Duration, initialDelay: Duration = Duration.ZERO ) = flow { delay(initialDelay) while (downloadsMaps[downloadId]!!) { emit(Unit) delay(period) } } fun isDownloadSuccessful(downloadId: Long): Boolean { return getDownloadStatus(downloadId) == DownloadManager.STATUS_SUCCESSFUL } private fun getDownloadStatus(downloadId: Long): Int { try { downloadManager.query(downloadManagerQuery.setFilterById(downloadId)) .use { cursor -> if (cursor.moveToFirst()) { val status = cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)) Timber.d("Download Failed: downloadId: $downloadId $status") return status } } } catch (e: Exception) { Timber.e(e) } return DownloadManager.STATUS_FAILED } }
app/src/main/java/foundation/e/apps/api/cleanapk/ApkSignatureManager.kt +11 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import org.bouncycastle.openpgp.PGPUtil import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator import timber.log.Timber import java.io.BufferedInputStream import java.io.FileInputStream import java.io.InputStream Loading @@ -35,11 +36,16 @@ import java.security.Security object ApkSignatureManager { fun verifyFdroidSignature(context: Context, apkFilePath: String, signature: String): Boolean { Security.addProvider(BouncyCastleProvider()) try { return verifyAPKSignature( BufferedInputStream(FileInputStream(apkFilePath)), signature.byteInputStream(Charsets.UTF_8), context.assets.open("f-droid.org-signing-key.gpg") ) } catch (e: Exception) { Timber.e(e) } return false } private fun verifyAPKSignature( Loading
app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt +7 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import foundation.e.apps.utils.modules.PreferenceManagerModule import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.withTimeout import timber.log.Timber import java.text.NumberFormat import javax.inject.Inject import javax.inject.Singleton Loading Loading @@ -1350,8 +1351,12 @@ class FusedAPIImpl @Inject constructor( other_images_path = this.screenshots.transformToList(), package_name = this.packageName, ratings = Ratings( usageQualityScore = if (this.labeledRating.isNotEmpty()) this.labeledRating.toDoubleOrNull() ?: -1.0 else -1.0 usageQualityScore = this.labeledRating.run { if (isNotEmpty()) { NumberFormat.getInstance().parse(this)?.toDouble() ?: -1.0 } else -1.0 } ), offer_type = this.offerType, origin = Origin.GPLAY, Loading
app/src/main/java/foundation/e/apps/api/fused/UpdatesDao.kt 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.api.fused import foundation.e.apps.api.fused.data.FusedApp object UpdatesDao { var appsAwaitingForUpdate: List<FusedApp> = listOf() fun hasAnyAppsForUpdate() = appsAwaitingForUpdate.isNotEmpty() }