Loading app/src/main/java/foundation/e/apps/AppLoungeApplication.kt +3 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ import timber.log.Timber import timber.log.Timber.Forest.plant import java.util.concurrent.Executors import javax.inject.Inject import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking @HiltAndroidApp @DelicateCoroutinesApi Loading Loading @@ -74,7 +76,7 @@ class AppLoungeApplication : Application(), Configuration.Provider { val pkgManagerBR = object : PkgManagerBR() {} registerReceiver(pkgManagerBR, pkgManagerModule.getFilter(), RECEIVER_EXPORTED) val currentVersion = dataStoreModule.getTOSVersion() val currentVersion = runBlocking { dataStoreModule.tosVersion.first() } if (!currentVersion.contentEquals(TOS_VERSION)) { MainScope().launch { dataStoreModule.saveTOCStatus(false, "") Loading app/src/main/java/foundation/e/apps/data/application/AppsApi.kt +18 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * 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.data.application import com.aurora.gplayapi.data.models.AuthData Loading app/src/main/java/foundation/e/apps/data/application/AppsApiImpl.kt +21 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * 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.data.application import android.content.Context Loading Loading @@ -50,6 +68,7 @@ class AppsApiImpl @Inject constructor( application.updateFilterLevel(null) } return Pair(application, result.getResultStatus()) } Loading Loading @@ -232,6 +251,7 @@ class AppsApiImpl @Inject constructor( return true } } return false } Loading @@ -246,6 +266,7 @@ class AppsApiImpl @Inject constructor( return true } } return false } Loading app/src/main/java/foundation/e/apps/data/login/CleanApkAuthenticator.kt +6 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package foundation.e.apps.data.login import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.DataStoreModule import foundation.e.apps.data.preference.PreferenceManagerModule import javax.inject.Inject import javax.inject.Singleton Loading @@ -28,11 +30,12 @@ import javax.inject.Singleton */ @Singleton class CleanApkAuthenticator @Inject constructor( val loginData: LoginData, private val dataStoreModule: DataStoreModule, private val preferenceManagerModule: PreferenceManagerModule, ) : StoreAuthenticator { private val user: User get() = loginData.getUserType() get() = dataStoreModule.getUserType() override fun isStoreActive(): Boolean { if (user == User.UNAVAILABLE) { Loading @@ -41,7 +44,7 @@ class CleanApkAuthenticator @Inject constructor( */ return false } return loginData.isOpenSourceSelected() || loginData.isPWASelected() return preferenceManagerModule.isOpenSourceSelected() || preferenceManagerModule.isPWASelected() } override suspend fun login(): AuthObject.CleanApk { Loading app/src/main/java/foundation/e/apps/data/login/LoginCommon.kt +16 −13 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package foundation.e.apps.data.login import foundation.e.apps.data.Constants import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.DataStoreModule import foundation.e.apps.data.preference.PreferenceManagerModule import javax.inject.Inject import javax.inject.Singleton Loading @@ -30,33 +32,34 @@ import javax.inject.Singleton */ @Singleton class LoginCommon @Inject constructor( private val loginData: LoginData, private val dataStoreModule: DataStoreModule, private val preferenceManagerModule: PreferenceManagerModule, ) { suspend fun saveUserType(user: User) { loginData.saveUserType(user) dataStoreModule.saveUserType(user) } fun getUserType(): User { return loginData.getUserType() return dataStoreModule.getUserType() } suspend fun saveGoogleLogin(email: String, oauth: String) { loginData.saveGoogleLogin(email, oauth) dataStoreModule.saveGoogleLogin(email, oauth) } suspend fun setNoGoogleMode() { loginData.setSource(Constants.PREFERENCE_SHOW_FOSS, true) loginData.setSource(Constants.PREFERENCE_SHOW_PWA, true) loginData.setSource(Constants.PREFERENCE_SHOW_GPLAY, false) loginData.saveUserType(User.NO_GOOGLE) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_FOSS, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_PWA, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_GPLAY, false) dataStoreModule.saveUserType(User.NO_GOOGLE) } suspend fun logout() { loginData.destroyCredentials() loginData.clearUserType() dataStoreModule.destroyCredentials() dataStoreModule.saveUserType(null) // reset app source preferences on logout. loginData.setSource(Constants.PREFERENCE_SHOW_FOSS, true) loginData.setSource(Constants.PREFERENCE_SHOW_PWA, true) loginData.setSource(Constants.PREFERENCE_SHOW_GPLAY, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_FOSS, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_PWA, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_GPLAY, true) } } Loading
app/src/main/java/foundation/e/apps/AppLoungeApplication.kt +3 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ import timber.log.Timber import timber.log.Timber.Forest.plant import java.util.concurrent.Executors import javax.inject.Inject import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking @HiltAndroidApp @DelicateCoroutinesApi Loading Loading @@ -74,7 +76,7 @@ class AppLoungeApplication : Application(), Configuration.Provider { val pkgManagerBR = object : PkgManagerBR() {} registerReceiver(pkgManagerBR, pkgManagerModule.getFilter(), RECEIVER_EXPORTED) val currentVersion = dataStoreModule.getTOSVersion() val currentVersion = runBlocking { dataStoreModule.tosVersion.first() } if (!currentVersion.contentEquals(TOS_VERSION)) { MainScope().launch { dataStoreModule.saveTOCStatus(false, "") Loading
app/src/main/java/foundation/e/apps/data/application/AppsApi.kt +18 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * 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.data.application import com.aurora.gplayapi.data.models.AuthData Loading
app/src/main/java/foundation/e/apps/data/application/AppsApiImpl.kt +21 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * 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.data.application import android.content.Context Loading Loading @@ -50,6 +68,7 @@ class AppsApiImpl @Inject constructor( application.updateFilterLevel(null) } return Pair(application, result.getResultStatus()) } Loading Loading @@ -232,6 +251,7 @@ class AppsApiImpl @Inject constructor( return true } } return false } Loading @@ -246,6 +266,7 @@ class AppsApiImpl @Inject constructor( return true } } return false } Loading
app/src/main/java/foundation/e/apps/data/login/CleanApkAuthenticator.kt +6 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package foundation.e.apps.data.login import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.DataStoreModule import foundation.e.apps.data.preference.PreferenceManagerModule import javax.inject.Inject import javax.inject.Singleton Loading @@ -28,11 +30,12 @@ import javax.inject.Singleton */ @Singleton class CleanApkAuthenticator @Inject constructor( val loginData: LoginData, private val dataStoreModule: DataStoreModule, private val preferenceManagerModule: PreferenceManagerModule, ) : StoreAuthenticator { private val user: User get() = loginData.getUserType() get() = dataStoreModule.getUserType() override fun isStoreActive(): Boolean { if (user == User.UNAVAILABLE) { Loading @@ -41,7 +44,7 @@ class CleanApkAuthenticator @Inject constructor( */ return false } return loginData.isOpenSourceSelected() || loginData.isPWASelected() return preferenceManagerModule.isOpenSourceSelected() || preferenceManagerModule.isPWASelected() } override suspend fun login(): AuthObject.CleanApk { Loading
app/src/main/java/foundation/e/apps/data/login/LoginCommon.kt +16 −13 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package foundation.e.apps.data.login import foundation.e.apps.data.Constants import foundation.e.apps.data.enums.User import foundation.e.apps.data.preference.DataStoreModule import foundation.e.apps.data.preference.PreferenceManagerModule import javax.inject.Inject import javax.inject.Singleton Loading @@ -30,33 +32,34 @@ import javax.inject.Singleton */ @Singleton class LoginCommon @Inject constructor( private val loginData: LoginData, private val dataStoreModule: DataStoreModule, private val preferenceManagerModule: PreferenceManagerModule, ) { suspend fun saveUserType(user: User) { loginData.saveUserType(user) dataStoreModule.saveUserType(user) } fun getUserType(): User { return loginData.getUserType() return dataStoreModule.getUserType() } suspend fun saveGoogleLogin(email: String, oauth: String) { loginData.saveGoogleLogin(email, oauth) dataStoreModule.saveGoogleLogin(email, oauth) } suspend fun setNoGoogleMode() { loginData.setSource(Constants.PREFERENCE_SHOW_FOSS, true) loginData.setSource(Constants.PREFERENCE_SHOW_PWA, true) loginData.setSource(Constants.PREFERENCE_SHOW_GPLAY, false) loginData.saveUserType(User.NO_GOOGLE) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_FOSS, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_PWA, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_GPLAY, false) dataStoreModule.saveUserType(User.NO_GOOGLE) } suspend fun logout() { loginData.destroyCredentials() loginData.clearUserType() dataStoreModule.destroyCredentials() dataStoreModule.saveUserType(null) // reset app source preferences on logout. loginData.setSource(Constants.PREFERENCE_SHOW_FOSS, true) loginData.setSource(Constants.PREFERENCE_SHOW_PWA, true) loginData.setSource(Constants.PREFERENCE_SHOW_GPLAY, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_FOSS, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_PWA, true) preferenceManagerModule.setSource(Constants.PREFERENCE_SHOW_GPLAY, true) } }