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

Commit d4092a84 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '4320-main-app_login' into 'main'

Allow to login from backup app

See merge request !804
parents 96266c0f 06c765f4
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ jacoco {

def versionMajor = 2
def versionMinor = 18
def versionPatch = 1
def versionPatch = 2

def getGitHashProvider = providers.exec {
    commandLine 'git', 'log', '--pretty=format:%h', '-n', '1'
+0 −1
Original line number Diff line number Diff line
@@ -34,5 +34,4 @@ object Constants {
        "${BuildConfig.PACKAGE_NAME_PARENTAL_CONTROL}.action.APP_LOUNGE_LOGIN"

    const val REQUEST_GPLAY_LOGIN = "request_gplay_login"
    const val ACTION_LOGIN = "foundation.e.apps.action.LOGIN"
}
+5 −2
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import foundation.e.apps.feature.auth.login.LoginUiEvent
import foundation.e.apps.feature.auth.login.LoginViewModel
import foundation.e.apps.feature.auth.session.SessionRateLimitNotifier
import foundation.e.apps.feature.auth.session.SessionViewModel
import foundation.e.apps.installapp.Constants.ACTION_LOGIN
import foundation.e.apps.ui.application.ApplicationFragmentArgs
import foundation.e.apps.ui.application.subFrags.ApplicationDialogFragment
import foundation.e.apps.ui.error.AppUnavailableDialogDirections
@@ -232,7 +233,7 @@ class MainActivity : AppCompatActivity() {
    }

    private fun checkGPlayLoginRequest(intent: Intent?) {
        val isLoginAction = intent?.action == Constants.ACTION_LOGIN
        val isLoginAction = intent?.action == ACTION_LOGIN
        viewModel.setGPlayLoginRequested(
            isLoginAction || (intent?.getBooleanExtra(Constants.REQUEST_GPLAY_LOGIN, false) ?: false),
        )
@@ -246,7 +247,9 @@ class MainActivity : AppCompatActivity() {
                return@launch
            }

            if (viewModel.resolveCurrentSession() !is AuthSession.PlayStoreSession) {
            val requestLogout =
                isLoginAction || viewModel.resolveCurrentSession() !is AuthSession.PlayStoreSession
            if (requestLogout) {
                loginViewModel.onEvent(LoginUiEvent.LogoutRequested)
            }
        }
+3 −1
Original line number Diff line number Diff line
@@ -65,7 +65,9 @@ internal class MainActivityStartupStateMachine(
        val authRefreshSnapshot = (authRefreshState as? AuthRefreshState.Completed)?.snapshot

        if (authRefreshSnapshot != null && gPlayLoginRequested) {
            closeAfterLogin = !authRefreshSnapshot.hasActiveSessions
            if (!authRefreshSnapshot.hasActiveSessions) {
                closeAfterLogin = true
            }

            if (
                authRefreshSnapshot.hasActiveSessions &&
+2 −1
Original line number Diff line number Diff line
@@ -129,7 +129,8 @@ fun serializeAuthSessionForInstallAppLib(session: AuthSession): String {
        AuthSession.Unauthenticated -> GPlayAccountTypes.NOT_CONFIGURED
        is AuthSession.PlayStoreSession -> when (session.loginMode) {
            PlayStoreLoginMode.ANONYMOUS -> GPlayAccountTypes.ANONYMOUS
            PlayStoreLoginMode.GOOGLE, PlayStoreLoginMode.MICROG -> GPlayAccountTypes.GOOGLE
            PlayStoreLoginMode.GOOGLE -> GPlayAccountTypes.GOOGLE
            PlayStoreLoginMode.MICROG -> GPlayAccountTypes.MICROG
        }
    }.name
}
Loading