Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b55af19e authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Merge branch '5159-signature_mismatch' into 'main'

5159 signature mismatch

See merge request !166
parents b96e25f4 70208c08
Loading
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -43,8 +43,12 @@ import foundation.e.apps.purchase.AppPurchaseFragmentDirections
import foundation.e.apps.setup.signin.SignInViewModel
import foundation.e.apps.updates.UpdatesNotifier
import foundation.e.apps.utils.enums.Status
import foundation.e.apps.utils.eventBus.AppEvent
import foundation.e.apps.utils.eventBus.EventBus
import foundation.e.apps.utils.modules.CommonUtilsModule
import foundation.e.apps.utils.parentFragment.TimeoutFragment
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.launch
import timber.log.Timber
import java.io.File
@@ -199,6 +203,19 @@ class MainActivity : AppCompatActivity() {
        }

        viewModel.updateAppWarningList()

        lifecycleScope.launchWhenResumed {
            EventBus.events.filter { appEvent ->
                appEvent is AppEvent.SignatureMissMatchError
            }.collectLatest {
                val appName = viewModel.getAppNameByPackageName(it.data.toString())
                ApplicationDialogFragment(
                    title = getString(R.string.update_error),
                    message = getString(R.string.error_signature_mismatch, appName),
                    positiveButtonText = getString(R.string.ok)
                ).show(supportFragmentManager, TAG)
            }
        }
    }

    private fun handleFusedDownloadQueued(
@@ -246,7 +263,7 @@ class MainActivity : AppCompatActivity() {
    }

    fun showSnackbarMessage(message: String) {
        Snackbar.make(binding.root, message, Snackbar.LENGTH_SHORT).show()
        Snackbar.make(binding.root, message, Snackbar.LENGTH_LONG).show()
    }

    private fun showNoInternet() {
+4 −0
Original line number Diff line number Diff line
@@ -561,4 +561,8 @@ class MainActivityViewModel @Inject constructor(
    fun updateAppWarningList() {
        blockedAppRepository.fetchUpdateOfAppWarningList()
    }

    fun getAppNameByPackageName(packageName: String): String {
        return pkgManagerModule.getAppNameFromPackageName(packageName)
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -6,17 +6,20 @@ import androidx.room.Room
import androidx.room.RoomDatabase
import foundation.e.apps.api.exodus.Tracker
import foundation.e.apps.api.exodus.TrackerDao
import foundation.e.apps.api.faultyApps.FaultyApp
import foundation.e.apps.api.faultyApps.FaultyAppDao
import foundation.e.apps.api.fdroid.FdroidDao
import foundation.e.apps.api.fdroid.models.FdroidEntity

@Database(
    entities = [Tracker::class, FdroidEntity::class],
    version = 2,
    entities = [Tracker::class, FdroidEntity::class, FaultyApp::class],
    version = 3,
    exportSchema = false
)
abstract class AppDatabase : RoomDatabase() {
    abstract fun trackerDao(): TrackerDao
    abstract fun fdroidDao(): FdroidDao
    abstract fun faultyAppsDao(): FaultyAppDao

    companion object {
        private lateinit var INSTANCE: AppDatabase
+27 −0
Original line number Diff line number Diff line
/*
 *
 *  * Copyright ECORP SAS 2022
 *  * Apps  Quickly and easily install Android apps onto your device!
 *  *
 *  * 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.faultyApps

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity
data class FaultyApp(@PrimaryKey val packageName: String, val error: String)
+38 −0
Original line number Diff line number Diff line
/*
 *
 *  * Copyright ECORP SAS 2022
 *  * Apps  Quickly and easily install Android apps onto your device!
 *  *
 *  * 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.faultyApps

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query

@Dao
interface FaultyAppDao {
    @Insert(onConflict = REPLACE)
    suspend fun addFaultyApp(faultyApp: FaultyApp): Long

    @Query("SELECT * FROM FAULTYAPP")
    suspend fun getFaultyApps(): List<FaultyApp>

    @Query("DELETE FROM FaultyApp WHERE packageName = :packageName")
    suspend fun deleteFaultyAppByPackageName(packageName: String): Int
}
Loading