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

Commit 8fa07354 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Merge branch 'app_abhishek' into 'epic_176-all-refactorAndGplay'

Add Google Authentication

See merge request ecorp/apps/apps!12
parents 2c64ce54 463474b5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ class MainActivity : AppCompatActivity() {
                        }
                    }
                    USER.UNAVAILABLE -> {
                        viewModel.destroyCredentials()
                        navController.navigate(R.id.signInFragment, null, navOptions)
                    }
                    USER.GOOGLE -> {}
@@ -102,6 +103,7 @@ class MainActivity : AppCompatActivity() {
                R.id.screenshotFragment,
                R.id.descriptionFragment,
                R.id.TOSFragment,
                R.id.googleSignInFragment,
                R.id.signInFragment -> {
                    bottomNavigationView.visibility = View.GONE
                }
+4 −0
Original line number Diff line number Diff line
@@ -146,6 +146,10 @@ class FusedAPIImpl @Inject constructor(
        return gPlayAPIRepository.fetchAuthData()
    }

    suspend fun fetchAuthData(email: String, aasToken: String) {
        return gPlayAPIRepository.fetchAuthData(email, aasToken)
    }

    suspend fun validateAuthData(authData: AuthData): Boolean {
        return gPlayAPIRepository.validateAuthData(authData)
    }
+4 −0
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ class FusedAPIRepository @Inject constructor(
        return fusedAPIImpl.fetchAuthData()
    }

    suspend fun fetchAuthData(email: String, aasToken: String) {
        return fusedAPIImpl.fetchAuthData(email, aasToken)
    }

    suspend fun getSearchResults(query: String, authData: AuthData): List<FusedApp> {
        return fusedAPIImpl.getSearchResults(query, authData)
    }
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ class GPlayAPIImpl @Inject constructor(
        data.await()?.let { dataStoreModule.saveCredentials(it) }
    }

    suspend fun fetchAuthData(email: String, aasToken: String) = withContext(Dispatchers.IO) {
        val data = async { tokenRepository.getAuthData(email, aasToken) }
        dataStoreModule.saveCredentials(data.await())
    }

    suspend fun validateAuthData(authData: AuthData): Boolean {
        var validity: Boolean
        withContext(Dispatchers.IO) {
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@ class GPlayAPIRepository @Inject constructor(
        return gPlayAPIImpl.fetchAuthData()
    }

    suspend fun fetchAuthData(email: String, aasToken: String) {
        return gPlayAPIImpl.fetchAuthData(email, aasToken)
    }

    suspend fun validateAuthData(authData: AuthData): Boolean {
        return gPlayAPIImpl.validateAuthData(authData)
    }
Loading