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

Commit 6db61c90 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

Merge branch '3728-app-lounge-anonymous-install-fail' into 'main'

fix: resolve Play Store app installation problem in anonymous mode

See merge request !598
parents 709ee8d2 6501e3e6
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ plugins {
    id 'kotlin-android'
    id 'com.google.devtools.ksp'
    alias libs.plugins.ktlint
    alias libs.plugins.kotlin.serialization
    id 'androidx.navigation.safeargs.kotlin'
    id 'com.google.dagger.hilt.android'
    id 'kotlin-allopen'
@@ -227,6 +228,7 @@ dependencies {
    implementation(libs.kotlinx.coroutines.android)
    testImplementation(libs.kotlinx.coroutines.test)
    testImplementation(libs.kotlin.test)
    implementation(libs.kotlinx.serialization.json)

    // Testing dependencies
    testImplementation(libs.truth)
+7 −5
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022-2024 E FOUNDATION
 * Copyright (C) 2022-2025 e Foundation
 *
 * 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
@@ -18,10 +18,12 @@

package foundation.e.apps.data.blockedApps

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AppWarningInfo(
    @SerializedName("not_working_apps") val notWorkingApps: List<String>,
    @SerializedName("zero_privacy_apps") val zeroPrivacyApps: List<String>,
    @SerializedName("third_party_store_apps") val thirdPartyStoreApps: List<String> = emptyList()
    @SerialName("not_working_apps") val notWorkingApps: List<String>,
    @SerialName("zero_privacy_apps") val zeroPrivacyApps: List<String>,
    @SerialName("third_party_store_apps") val thirdPartyStoreApps: List<String> = emptyList()
)
+4 −4
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022-2024 E FOUNDATION
 * Copyright (C) 2022-2025 e Foundation
 *
 * 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
@@ -17,10 +17,10 @@
 */
package foundation.e.apps.data.blockedApps

import com.google.gson.Gson
import foundation.e.apps.data.DownloadManager
import foundation.e.apps.data.install.FileManager
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.serialization.json.Json
import timber.log.Timber
import java.io.File
import javax.inject.Inject
@@ -31,7 +31,7 @@ import kotlin.coroutines.resume
@Singleton
class BlockedAppRepository @Inject constructor(
    private val downloadManager: DownloadManager,
    private val gson: Gson,
    private val json: Json,
    @Named("cacheDir") private val cacheDir: String,
) {

@@ -79,7 +79,7 @@ class BlockedAppRepository @Inject constructor(
            Timber.d("Blocked list file exists: ${downloadedFile.exists()}")
            val blockedAppInfoJson = String(downloadedFile.inputStream().readBytes())
            Timber.d("Blocked list file contents: $blockedAppInfoJson")
            gson.fromJson(blockedAppInfoJson, AppWarningInfo::class.java)
            json.decodeFromString<AppWarningInfo>(blockedAppInfoJson)
        } catch (exception: Exception) {
            Timber.e(exception.localizedMessage ?: "", exception)
            AppWarningInfo(listOf(), listOf(), listOf())
+31 −0
Original line number Diff line number Diff line
/*
 *  Aurora Store
 *  Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
 *
 *  Aurora Store 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 2 of the License, or
 *  (at your option) any later version.
 *
 *  Aurora Store 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 Aurora Store.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package foundation.e.apps.data.login

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class Auth(
    val email: String,

    @SerialName("authToken")
    val auth: String,
)
+5 −5
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ package foundation.e.apps.data.login

import android.content.Context
import com.aurora.gplayapi.data.models.AuthData
import com.google.gson.Gson
import dagger.hilt.android.qualifiers.ApplicationContext
import foundation.e.apps.data.ResultSupreme
import foundation.e.apps.data.enums.ResultStatus
@@ -33,6 +32,7 @@ import foundation.e.apps.data.preference.AppLoungeDataStore
import foundation.e.apps.data.preference.AppLoungePreference
import foundation.e.apps.data.preference.getSync
import foundation.e.apps.data.retryWithBackoff
import kotlinx.serialization.json.Json
import timber.log.Timber
import java.util.Locale
import javax.inject.Inject
@@ -47,7 +47,7 @@ import javax.inject.Singleton
@Singleton
class PlayStoreAuthenticator @Inject constructor(
    @ApplicationContext private val context: Context,
    private val gson: Gson,
    private val json: Json,
    private val appLoungeDataStore: AppLoungeDataStore,
    private val appLoungePreference: AppLoungePreference,
) : StoreAuthenticator, AuthDataValidator {
@@ -122,7 +122,7 @@ class PlayStoreAuthenticator @Inject constructor(
        val authJson = appLoungeDataStore.authData.getSync()
        return if (authJson.isBlank()) null
        else try {
            gson.fromJson(authJson, AuthData::class.java)
            json.decodeFromString<AuthData>(authJson)
        } catch (e: Exception) {
            e.printStackTrace()
            null
@@ -149,8 +149,8 @@ class PlayStoreAuthenticator @Inject constructor(
     * Converting [authData] to Json and back to [AuthData] fixed it.
     */
    private fun formatAuthData(authData: AuthData): AuthData {
        val localAuthDataJson = gson.toJson(authData)
        return gson.fromJson(localAuthDataJson, AuthData::class.java)
        val localAuthDataJson = json.encodeToString(authData)
        return json.decodeFromString<AuthData>(localAuthDataJson)
    }

    private suspend fun getAuthDataAnonymously(): ResultSupreme<AuthData?> {
Loading