Loading app/src/main/java/foundation/e/apps/data/enums/User.kt +5 −6 Original line number Diff line number Diff line Loading @@ -3,6 +3,5 @@ package foundation.e.apps.data.enums enum class User { NO_GOOGLE, ANONYMOUS, GOOGLE, UNAVAILABLE GOOGLE } app/src/main/java/foundation/e/apps/data/login/api/LoginManager.kt 0 → 100644 +5 −0 Original line number Diff line number Diff line package foundation.e.apps.data.login.api interface LoginManager<T> { suspend fun login(): T } app/src/main/java/foundation/e/apps/data/login/api/PlayStoreLoginManager.ktdeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line /* * Copyright (C) 2019-2022 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 * 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.login.api import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.PlayResponse interface PlayStoreLoginManager { suspend fun login(): AuthData? suspend fun validate(authData: AuthData): PlayResponse } app/src/main/java/foundation/e/apps/data/login/CleanApkAuthenticator.kt→app/src/main/java/foundation/e/apps/data/login/cleanapk/CleanApkAuthenticator.kt +15 −7 Original line number Diff line number Diff line Loading @@ -15,10 +15,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.data.login package foundation.e.apps.data.login.cleanapk import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.login.core.AuthObject import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreAuthenticator import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.data.login.state.LoginState import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.preference.AppLoungePreference import javax.inject.Inject Loading @@ -33,25 +38,28 @@ class CleanApkAuthenticator @Inject constructor( private val appLoungeDataStore: AppLoungeDataStore, private val appLoungePreference: AppLoungePreference, ) : StoreAuthenticator { override val storeType: StoreType = StoreType.CLEAN_APK private val user: User get() = appLoungeDataStore.getUser() override fun isStoreActive(): Boolean { if (user == User.UNAVAILABLE) { if (appLoungeDataStore.getLoginState() == LoginState.UNAVAILABLE) { /* * UNAVAILABLE user means first login is not completed. * UNAVAILABLE login state means first login is not completed. */ return false } return appLoungePreference.isOpenSourceSelected() || appLoungePreference.isPWASelected() } override suspend fun login(): AuthObject.CleanApk { return AuthObject.CleanApk( override suspend fun login(): StoreAuthResult { return StoreAuthResult( authObject = AuthObject.CleanApk( ResultSupreme.Success(Unit), user, ) ) } override suspend fun logout() { Loading app/src/main/java/foundation/e/apps/data/login/Auth.kt→app/src/main/java/foundation/e/apps/data/login/core/Auth.kt +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ * */ package foundation.e.apps.data.login package foundation.e.apps.data.login.core import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable Loading Loading
app/src/main/java/foundation/e/apps/data/enums/User.kt +5 −6 Original line number Diff line number Diff line Loading @@ -3,6 +3,5 @@ package foundation.e.apps.data.enums enum class User { NO_GOOGLE, ANONYMOUS, GOOGLE, UNAVAILABLE GOOGLE }
app/src/main/java/foundation/e/apps/data/login/api/LoginManager.kt 0 → 100644 +5 −0 Original line number Diff line number Diff line package foundation.e.apps.data.login.api interface LoginManager<T> { suspend fun login(): T }
app/src/main/java/foundation/e/apps/data/login/api/PlayStoreLoginManager.ktdeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line /* * Copyright (C) 2019-2022 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 * 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.login.api import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.PlayResponse interface PlayStoreLoginManager { suspend fun login(): AuthData? suspend fun validate(authData: AuthData): PlayResponse }
app/src/main/java/foundation/e/apps/data/login/CleanApkAuthenticator.kt→app/src/main/java/foundation/e/apps/data/login/cleanapk/CleanApkAuthenticator.kt +15 −7 Original line number Diff line number Diff line Loading @@ -15,10 +15,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.data.login package foundation.e.apps.data.login.cleanapk import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.login.core.AuthObject import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreAuthenticator import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.data.login.state.LoginState import foundation.e.apps.data.preference.AppLoungeDataStore import foundation.e.apps.data.preference.AppLoungePreference import javax.inject.Inject Loading @@ -33,25 +38,28 @@ class CleanApkAuthenticator @Inject constructor( private val appLoungeDataStore: AppLoungeDataStore, private val appLoungePreference: AppLoungePreference, ) : StoreAuthenticator { override val storeType: StoreType = StoreType.CLEAN_APK private val user: User get() = appLoungeDataStore.getUser() override fun isStoreActive(): Boolean { if (user == User.UNAVAILABLE) { if (appLoungeDataStore.getLoginState() == LoginState.UNAVAILABLE) { /* * UNAVAILABLE user means first login is not completed. * UNAVAILABLE login state means first login is not completed. */ return false } return appLoungePreference.isOpenSourceSelected() || appLoungePreference.isPWASelected() } override suspend fun login(): AuthObject.CleanApk { return AuthObject.CleanApk( override suspend fun login(): StoreAuthResult { return StoreAuthResult( authObject = AuthObject.CleanApk( ResultSupreme.Success(Unit), user, ) ) } override suspend fun logout() { Loading
app/src/main/java/foundation/e/apps/data/login/Auth.kt→app/src/main/java/foundation/e/apps/data/login/core/Auth.kt +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ * */ package foundation.e.apps.data.login package foundation.e.apps.data.login.core import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable Loading