Loading app/src/main/java/foundation/e/apps/data/exodus/repositories/AppPrivacyInfoRepositoryImpl.kt +13 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.lang.reflect.Modifier import javax.inject.Inject import javax.inject.Singleton import foundation.e.apps.data.Result import okio.IOException @Singleton class AppPrivacyInfoRepositoryImpl @Inject constructor( Loading Loading @@ -72,6 +73,7 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor( .post(jsonBody.toRequestBody("application/json".toMediaType())) .build() try { okHttpClient.newCall(request).execute().use { response -> if (response.isSuccessful) { val responseBody = response.body?.string() Loading @@ -80,6 +82,11 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor( throw IllegalStateException("Failed to fetch reports") } } } catch (exception: IOException) { exception.printStackTrace() } return emptyList() } private fun parseReports(response: String): List<Report> { Loading app/src/main/java/foundation/e/apps/data/login/AuthenticatorRepository.kt +11 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.login.exceptions.GPlayLoginException import foundation.e.apps.data.preference.AppLoungeDataStore import javax.inject.Inject import javax.inject.Singleton Loading @@ -29,16 +30,19 @@ import javax.inject.Singleton class AuthenticatorRepository @Inject constructor( private val loginCommon: LoginCommon, private val authenticators: List<StoreAuthenticator>, private val appLoungeDataStore: AppLoungeDataStore ) { private var gPlayAuth: AuthData? = null fun getGPlayAuthOrThrow(): AuthData { return gPlayAuth ?: throw GPlayLoginException(false, "AuthData is not available!", getUserType()) return kotlin.runCatching { appLoungeDataStore.getAuthData() }.getOrElse { throw GPlayLoginException(false, "AuthData is not available", appLoungeDataStore.getUserType()) } } fun setGPlayAuth(auth: AuthData) { gPlayAuth = auth suspend fun setGPlayAuth(auth: AuthData) { appLoungeDataStore.saveAuthData(auth) } suspend fun getAuthObjects(clearAuthTypes: List<String> = listOf()): List<AuthObject> { Loading @@ -55,7 +59,7 @@ class AuthenticatorRepository @Inject constructor( authObjectsLocal.add(authObject) if (authObject is AuthObject.GPlayAuth) { gPlayAuth = authObject.result.data appLoungeDataStore.saveAuthData(authObject.result.data) } } Loading @@ -81,7 +85,7 @@ class AuthenticatorRepository @Inject constructor( suspend fun getValidatedAuthData(): ResultSupreme<AuthData?> { val authDataValidator = (authenticators.find { it is AuthDataValidator } as AuthDataValidator) val validateAuthData = authDataValidator.validateAuthData() this.gPlayAuth = validateAuthData.data appLoungeDataStore.saveAuthData(validateAuthData.data) return validateAuthData } Loading app/src/main/java/foundation/e/apps/data/preference/AppLoungeDataStore.kt +4 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,10 @@ class AppLoungeDataStore @Inject constructor( } } fun getAuthData(): AuthData { return gson.fromJson(authData.getSync(), AuthData::class.java) } /** * Destroy auth credentials if they are no longer valid. * Loading app/src/main/java/foundation/e/apps/data/preference/DataStoreManager.ktdeleted 100644 → 0 +0 −42 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.data.preference import com.aurora.gplayapi.data.models.AuthData import com.google.gson.Gson import foundation.e.apps.data.enums.User import javax.inject.Inject import javax.inject.Singleton @Singleton class DataStoreManager @Inject constructor() { @Inject lateinit var appLoungeDataStore: AppLoungeDataStore @Inject lateinit var gson: Gson fun getAuthData(): AuthData { val authDataJson = appLoungeDataStore.authData.getSync() return gson.fromJson(authDataJson, AuthData::class.java) ?: AuthData("", "") } fun getUserType(): User { return appLoungeDataStore.getUserType() } } app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,7 @@ class SplitInstallBinder( val url = fetchModuleUrl(packageName, moduleName, versionCode) if (url == null) { Timber.e("Could not find split module named $moduleName for $packageName package") Timber.w("Could not find split module named $moduleName for $packageName package") return@withContext } Loading Loading
app/src/main/java/foundation/e/apps/data/exodus/repositories/AppPrivacyInfoRepositoryImpl.kt +13 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.lang.reflect.Modifier import javax.inject.Inject import javax.inject.Singleton import foundation.e.apps.data.Result import okio.IOException @Singleton class AppPrivacyInfoRepositoryImpl @Inject constructor( Loading Loading @@ -72,6 +73,7 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor( .post(jsonBody.toRequestBody("application/json".toMediaType())) .build() try { okHttpClient.newCall(request).execute().use { response -> if (response.isSuccessful) { val responseBody = response.body?.string() Loading @@ -80,6 +82,11 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor( throw IllegalStateException("Failed to fetch reports") } } } catch (exception: IOException) { exception.printStackTrace() } return emptyList() } private fun parseReports(response: String): List<Report> { Loading
app/src/main/java/foundation/e/apps/data/login/AuthenticatorRepository.kt +11 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.aurora.gplayapi.data.models.AuthData import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.login.exceptions.GPlayLoginException import foundation.e.apps.data.preference.AppLoungeDataStore import javax.inject.Inject import javax.inject.Singleton Loading @@ -29,16 +30,19 @@ import javax.inject.Singleton class AuthenticatorRepository @Inject constructor( private val loginCommon: LoginCommon, private val authenticators: List<StoreAuthenticator>, private val appLoungeDataStore: AppLoungeDataStore ) { private var gPlayAuth: AuthData? = null fun getGPlayAuthOrThrow(): AuthData { return gPlayAuth ?: throw GPlayLoginException(false, "AuthData is not available!", getUserType()) return kotlin.runCatching { appLoungeDataStore.getAuthData() }.getOrElse { throw GPlayLoginException(false, "AuthData is not available", appLoungeDataStore.getUserType()) } } fun setGPlayAuth(auth: AuthData) { gPlayAuth = auth suspend fun setGPlayAuth(auth: AuthData) { appLoungeDataStore.saveAuthData(auth) } suspend fun getAuthObjects(clearAuthTypes: List<String> = listOf()): List<AuthObject> { Loading @@ -55,7 +59,7 @@ class AuthenticatorRepository @Inject constructor( authObjectsLocal.add(authObject) if (authObject is AuthObject.GPlayAuth) { gPlayAuth = authObject.result.data appLoungeDataStore.saveAuthData(authObject.result.data) } } Loading @@ -81,7 +85,7 @@ class AuthenticatorRepository @Inject constructor( suspend fun getValidatedAuthData(): ResultSupreme<AuthData?> { val authDataValidator = (authenticators.find { it is AuthDataValidator } as AuthDataValidator) val validateAuthData = authDataValidator.validateAuthData() this.gPlayAuth = validateAuthData.data appLoungeDataStore.saveAuthData(validateAuthData.data) return validateAuthData } Loading
app/src/main/java/foundation/e/apps/data/preference/AppLoungeDataStore.kt +4 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,10 @@ class AppLoungeDataStore @Inject constructor( } } fun getAuthData(): AuthData { return gson.fromJson(authData.getSync(), AuthData::class.java) } /** * Destroy auth credentials if they are no longer valid. * Loading
app/src/main/java/foundation/e/apps/data/preference/DataStoreManager.ktdeleted 100644 → 0 +0 −42 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.data.preference import com.aurora.gplayapi.data.models.AuthData import com.google.gson.Gson import foundation.e.apps.data.enums.User import javax.inject.Inject import javax.inject.Singleton @Singleton class DataStoreManager @Inject constructor() { @Inject lateinit var appLoungeDataStore: AppLoungeDataStore @Inject lateinit var gson: Gson fun getAuthData(): AuthData { val authDataJson = appLoungeDataStore.authData.getSync() return gson.fromJson(authDataJson, AuthData::class.java) ?: AuthData("", "") } fun getUserType(): User { return appLoungeDataStore.getUserType() } }
app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt +1 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,7 @@ class SplitInstallBinder( val url = fetchModuleUrl(packageName, moduleName, versionCode) if (url == null) { Timber.e("Could not find split module named $moduleName for $packageName package") Timber.w("Could not find split module named $moduleName for $packageName package") return@withContext } Loading