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

Commit c6231dd2 authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Issue 5887: Add device info to token dispenser.

parent 0c7e08e9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -12,6 +12,19 @@ def versionMajor = 2
def versionMinor = 4
def versionPatch = 0

def getGitHash = { ->
    def stdOut = new ByteArrayOutputStream()
    exec {
        commandLine 'git', 'log', '--pretty=format:%h', '-n', '1'
        standardOutput = stdOut
    }
    return stdOut.toString().trim()
}

def getDate = { ->
    return new Date().format('yyyyMMddHHmmss')
}

android {
    compileSdk 31

@@ -22,6 +35,8 @@ android {
        versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"

        buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\""

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

+3 −10
Original line number Diff line number Diff line
@@ -54,11 +54,11 @@ import foundation.e.apps.utils.enums.Status
import foundation.e.apps.utils.eventBus.AppEvent
import foundation.e.apps.utils.eventBus.EventBus
import foundation.e.apps.utils.exceptions.GPlayValidationException
import foundation.e.apps.utils.modules.CommonUtilsFunctions
import foundation.e.apps.utils.modules.CommonUtilsModule
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.launch
import org.json.JSONObject
import timber.log.Timber
import java.io.File
import java.util.UUID
@@ -129,14 +129,7 @@ class MainActivity : AppCompatActivity() {
                    viewModel.gPlayAuthData = data as AuthData
                } else if (exception is GPlayValidationException) {
                    val email = otherPayload.toString()
                    val descriptionJson = JSONObject().apply {
                        put("versionName", BuildConfig.VERSION_NAME)
                        put("versionCode", BuildConfig.VERSION_CODE)
                        put("debuggable", BuildConfig.DEBUG)
                        put("device", Build.DEVICE)
                        put("api", Build.VERSION.SDK_INT)
                    }
                    viewModel.uploadFaultyTokenToEcloud(email, descriptionJson.toString())
                    viewModel.uploadFaultyTokenToEcloud(email, CommonUtilsFunctions.getAppBuildInfo())
                }
            }
        }
+10 −1
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ import foundation.e.apps.utils.modules.PWAManagerModule
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import ru.beryukhov.reactivenetwork.ReactiveNetwork
import ru.beryukhov.reactivenetwork.internet.observing.InternetObservingSettings
import ru.beryukhov.reactivenetwork.internet.observing.strategy.SocketInternetObservingStrategy
import java.io.ByteArrayOutputStream
import javax.inject.Inject

@@ -331,7 +333,14 @@ class MainActivityViewModel @Inject constructor(
    }

    val internetConnection = liveData {
        emitSource(ReactiveNetwork().observeInternetConnectivity().asLiveData(Dispatchers.Default))
        emitSource(
            ReactiveNetwork().observeInternetConnectivity(
                InternetObservingSettings.builder()
                    .host("http://204.ecloud.global")
                    .strategy(SocketInternetObservingStrategy())
                    .build()
            ).asLiveData(Dispatchers.Default)
        )
    }

    fun updateStatusOfFusedApps(
+5 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ package foundation.e.apps.api.gplay.utils

import com.aurora.gplayapi.data.models.PlayResponse
import com.aurora.gplayapi.network.IHttpClient
import foundation.e.apps.utils.modules.CommonUtilsFunctions
import okhttp3.Cache
import okhttp3.Headers.Companion.toHeaders
import okhttp3.HttpUrl
@@ -81,7 +82,11 @@ class GPlayHttpClient @Inject constructor(

    override fun postAuth(url: String, body: ByteArray): PlayResponse {
        val requestBody = body.toRequestBody("application/json".toMediaType(), 0, body.size)
        val headers = mapOf(
            "User-Agent" to CommonUtilsFunctions.getAppBuildInfo()
        )
        val request = Request.Builder()
            .headers(headers.toHeaders())
            .url(url)
            .method(POST, requestBody)
            .build()
+6 −2
Original line number Diff line number Diff line
@@ -227,9 +227,13 @@ class LoginSourceGPlay @Inject constructor(
            ResultSupreme.Success(formattedAuthData)
        } else {
            val message =
                "Validating AuthData failed.\n\n" +
                "Validating AuthData failed.\n" +
                    "Network code: ${playResponse?.code}\n" +
                    "Success: ${playResponse?.isSuccessful}" +
                    (validityResponse.exception?.let { "\n${it.message}" } ?: "")
                    playResponse?.errorString?.run {
                        if (isNotBlank()) "\nError message: $this"
                        else ""
                    }

            ResultSupreme.Error(
                message,
Loading