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

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

use contracts module

parent e78209f2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -154,6 +154,8 @@ allOpen {

dependencies {

    implementation project(":contracts")

    // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628
    api files('libs/splitinstall-lib.jar')

+2 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.aurora.gplayapi.exceptions.ApiException
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import foundation.e.apps.contracts.ProviderContracts.COLUMN_LOGIN_TYPE
import foundation.e.apps.data.Constants
import foundation.e.apps.data.enums.User
import foundation.e.apps.data.install.models.AppInstall
@@ -50,7 +51,6 @@ import foundation.e.apps.data.login.PlayStoreAuthenticator
import foundation.e.apps.data.login.exceptions.GPlayValidationException
import foundation.e.apps.databinding.ActivityMainBinding
import foundation.e.apps.install.updates.UpdatesNotifier
import foundation.e.apps.provider.ProviderConstants.LOGIN_TYPE
import foundation.e.apps.ui.MainActivityViewModel
import foundation.e.apps.ui.application.subFrags.ApplicationDialogFragment
import foundation.e.apps.ui.purchase.AppPurchaseFragmentDirections
@@ -377,7 +377,7 @@ class MainActivity : AppCompatActivity() {
    private fun broadcastGPlayLogin() {
        val intent = Intent(Constants.ACTION_PARENTAL_CONTROL_APP_LOUNGE_LOGIN).apply {
            setPackage(BuildConfig.PACKAGE_NAME_PARENTAL_CONTROL)
            putExtra(LOGIN_TYPE, viewModel.getUser().name)
            putExtra(COLUMN_LOGIN_TYPE, viewModel.getUser().name)
        }
        sendBroadcast(intent)
    }
+10 −7
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import foundation.e.apps.BuildConfig
import foundation.e.apps.contracts.ProviderContracts.COLUMN_LOGIN_TYPE
import foundation.e.apps.contracts.ProviderContracts.COLUMN_PACKAGE_NAME
import foundation.e.apps.contracts.ProviderContracts.PATH_BLOCKLIST
import foundation.e.apps.contracts.ProviderContracts.PATH_LOGIN_TYPE
import foundation.e.apps.contracts.ProviderContracts.getAppLoungeProviderAuthority
import foundation.e.apps.data.blockedApps.ContentRatingsRepository
import foundation.e.apps.data.enums.Origin
import foundation.e.apps.data.install.models.AppInstall
@@ -36,11 +42,6 @@ import foundation.e.apps.data.login.AuthenticatorRepository
import foundation.e.apps.data.preference.DataStoreManager
import foundation.e.apps.domain.ValidateAppAgeLimitUseCase
import foundation.e.apps.install.pkg.AppLoungePackageManager
import foundation.e.apps.provider.ProviderConstants.AUTHORITY
import foundation.e.apps.provider.ProviderConstants.LOGIN_TYPE
import foundation.e.apps.provider.ProviderConstants.PACKAGE_NAME
import foundation.e.apps.provider.ProviderConstants.PATH_BLOCKLIST
import foundation.e.apps.provider.ProviderConstants.PATH_LOGIN_TYPE
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
@@ -68,6 +69,8 @@ class AgeRatingProvider : ContentProvider() {
    private val CODE_LOGIN_TYPE = 1
    private val CODE_AGE_RATING = 2

    private val AUTHORITY = getAppLoungeProviderAuthority(BuildConfig.DEBUG)

    private val uriMatcher by lazy {
        UriMatcher(UriMatcher.NO_MATCH).apply {
            addURI(AUTHORITY, PATH_LOGIN_TYPE, CODE_LOGIN_TYPE)
@@ -91,13 +94,13 @@ class AgeRatingProvider : ContentProvider() {
    }

    private fun getLoginType(): Cursor {
        val cursor = MatrixCursor(arrayOf(LOGIN_TYPE))
        val cursor = MatrixCursor(arrayOf(COLUMN_LOGIN_TYPE))
        cursor.addRow(arrayOf(dataStoreManager.getUserType()))
        return cursor
    }

    private fun getAgeRatings(): Cursor {
        val cursor = MatrixCursor(arrayOf(PACKAGE_NAME))
        val cursor = MatrixCursor(arrayOf(COLUMN_PACKAGE_NAME))
        val packagesNames = appLoungePackageManager.getAllUserApps().map { it.packageName }
        runBlocking {
            withContext(IO) {
+0 −31
Original line number Diff line number Diff line
/*
 *  Copyright MURENA SAS 2024
 *  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.provider

import foundation.e.apps.BuildConfig

object ProviderConstants {
    const val PACKAGE_NAME = "package_name"
    const val LOGIN_TYPE = "login_type"

    const val AUTHORITY = "${BuildConfig.APPLICATION_ID}.provider"
    const val PATH_LOGIN_TYPE = "login_type"
    const val PATH_BLOCKLIST = "block_list"
}
+1 −1

File changed.

Contains only whitespace changes.