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

Verified Commit 2d3ad706 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

fix: resolve Play Store app installation problem in anonymous mode

The fix follows the way Aurora Store handles authData using Json from kotlinx serialization library.
parent 55fedc7d
Loading
Loading
Loading
Loading
Loading
+2 −2
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
@@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
data class AppWarningInfo(
    @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(),
    @SerialName("third_party_store_apps") val thirdPartyStoreApps: List<String> = emptyList()
)
+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,
)
+14 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019-2022  E FOUNDATION
 * Copyright (C) 2019-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
@@ -13,17 +13,21 @@
 *
 * 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.data.login.api

import com.aurora.gplayapi.data.models.AuthData
import com.aurora.gplayapi.data.models.PlayResponse
import com.aurora.gplayapi.helpers.AuthHelper
import foundation.e.apps.data.login.Auth
import foundation.e.apps.data.playstore.utils.CustomAuthValidator
import foundation.e.apps.data.playstore.utils.GPlayHttpClient
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlinx.serialization.json.Json
import java.util.Locale
import java.util.Properties

class AnonymousLoginManager(
@@ -56,7 +60,15 @@ class AnonymousLoginManager(
                        }
                )
            } else {
                authData = json.decodeFromString<AuthData>(String(response.responseBytes))
                val auth = json.decodeFromString<Auth>(String(response.responseBytes))
                authData = AuthHelper.build(
                    email = auth.email,
                    token = auth.auth,
                    tokenType = AuthHelper.Token.AUTH,
                    isAnonymous = true,
                    properties = nativeDeviceProperty,
                    locale = Locale.getDefault()
                )
            }
        }
        return authData