Loading app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +15 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.aurora.gplayapi.exceptions.ApiException import com.google.gson.Gson import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.api.cleanapk.blockedApps.BlockedAppRepository import foundation.e.apps.api.ecloud.EcloudRepository import foundation.e.apps.api.fused.FusedAPIImpl import foundation.e.apps.api.fused.FusedAPIRepository import foundation.e.apps.api.fused.data.FusedApp Loading Loading @@ -69,7 +70,8 @@ class MainActivityViewModel @Inject constructor( private val fusedAPIRepository: FusedAPIRepository, private val fusedManagerRepository: FusedManagerRepository, private val pkgManagerModule: PkgManagerModule, private val blockedAppRepository: BlockedAppRepository private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, ) : ViewModel() { val authDataJson: LiveData<String> = dataStoreModule.authData.asLiveData() Loading Loading @@ -231,6 +233,18 @@ class MainActivityViewModel @Inject constructor( authValidity.postValue(false) } fun uploadFaultyTokenToEcloud(description: String){ viewModelScope.launch { authData.value?.let { authData -> val email: String = authData.run { if (email != "null") email else userProfile?.email ?: "null" } ecloudRepository.uploadFaultyEmail(email, description) } } } fun getAuthData() { if (!authRequestRunning) { authRequestRunning = true Loading app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import foundation.e.apps.api.ecloud.EcloudApiInterface import foundation.e.apps.api.exodus.ExodusTrackerApi import foundation.e.apps.api.fdroid.FdroidApiInterface import okhttp3.Cache Loading Loading @@ -94,6 +95,17 @@ object RetrofitModule { .create(FdroidApiInterface::class.java) } @Singleton @Provides fun provideEcloudApi(okHttpClient: OkHttpClient, moshi: Moshi): EcloudApiInterface { return Retrofit.Builder() .baseUrl(EcloudApiInterface.BASE_URL) .client(okHttpClient) .addConverterFactory(MoshiConverterFactory.create(moshi)) .build() .create(EcloudApiInterface::class.java) } @Singleton @Provides fun getMoshi(): Moshi { Loading app/src/main/java/foundation/e/apps/api/ecloud/EcloudApiInterface.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud import foundation.e.apps.api.ecloud.modules.FaultyToken import retrofit2.http.Body import retrofit2.http.Header import retrofit2.http.POST interface EcloudApiInterface { companion object { val BASE_URL = "https://eu.gtoken.ecloud.global/" } @POST("report") suspend fun uploadFaultyEmail( @Body faultyToken: FaultyToken, @Header("Content-Type") contentType: String = "application/json", ) } No newline at end of file app/src/main/java/foundation/e/apps/api/ecloud/EcloudRepository.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud import foundation.e.apps.api.ecloud.modules.FaultyToken import javax.inject.Inject import javax.inject.Singleton @Singleton class EcloudRepository @Inject constructor( private val ecloudApi: EcloudApiInterface, ) { suspend fun uploadFaultyEmail(email: String, description: String) { try { ecloudApi.uploadFaultyEmail( FaultyToken(email, description) ) } catch (e: Exception) { e.printStackTrace() } } } No newline at end of file app/src/main/java/foundation/e/apps/api/ecloud/modules/FaultyToken.kt 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud.modules data class FaultyToken(val email: String, val description: String) No newline at end of file Loading
app/src/main/java/foundation/e/apps/MainActivityViewModel.kt +15 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.aurora.gplayapi.exceptions.ApiException import com.google.gson.Gson import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.api.cleanapk.blockedApps.BlockedAppRepository import foundation.e.apps.api.ecloud.EcloudRepository import foundation.e.apps.api.fused.FusedAPIImpl import foundation.e.apps.api.fused.FusedAPIRepository import foundation.e.apps.api.fused.data.FusedApp Loading Loading @@ -69,7 +70,8 @@ class MainActivityViewModel @Inject constructor( private val fusedAPIRepository: FusedAPIRepository, private val fusedManagerRepository: FusedManagerRepository, private val pkgManagerModule: PkgManagerModule, private val blockedAppRepository: BlockedAppRepository private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, ) : ViewModel() { val authDataJson: LiveData<String> = dataStoreModule.authData.asLiveData() Loading Loading @@ -231,6 +233,18 @@ class MainActivityViewModel @Inject constructor( authValidity.postValue(false) } fun uploadFaultyTokenToEcloud(description: String){ viewModelScope.launch { authData.value?.let { authData -> val email: String = authData.run { if (email != "null") email else userProfile?.email ?: "null" } ecloudRepository.uploadFaultyEmail(email, description) } } } fun getAuthData() { if (!authRequestRunning) { authRequestRunning = true Loading
app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import foundation.e.apps.api.ecloud.EcloudApiInterface import foundation.e.apps.api.exodus.ExodusTrackerApi import foundation.e.apps.api.fdroid.FdroidApiInterface import okhttp3.Cache Loading Loading @@ -94,6 +95,17 @@ object RetrofitModule { .create(FdroidApiInterface::class.java) } @Singleton @Provides fun provideEcloudApi(okHttpClient: OkHttpClient, moshi: Moshi): EcloudApiInterface { return Retrofit.Builder() .baseUrl(EcloudApiInterface.BASE_URL) .client(okHttpClient) .addConverterFactory(MoshiConverterFactory.create(moshi)) .build() .create(EcloudApiInterface::class.java) } @Singleton @Provides fun getMoshi(): Moshi { Loading
app/src/main/java/foundation/e/apps/api/ecloud/EcloudApiInterface.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud import foundation.e.apps.api.ecloud.modules.FaultyToken import retrofit2.http.Body import retrofit2.http.Header import retrofit2.http.POST interface EcloudApiInterface { companion object { val BASE_URL = "https://eu.gtoken.ecloud.global/" } @POST("report") suspend fun uploadFaultyEmail( @Body faultyToken: FaultyToken, @Header("Content-Type") contentType: String = "application/json", ) } No newline at end of file
app/src/main/java/foundation/e/apps/api/ecloud/EcloudRepository.kt 0 → 100644 +37 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud import foundation.e.apps.api.ecloud.modules.FaultyToken import javax.inject.Inject import javax.inject.Singleton @Singleton class EcloudRepository @Inject constructor( private val ecloudApi: EcloudApiInterface, ) { suspend fun uploadFaultyEmail(email: String, description: String) { try { ecloudApi.uploadFaultyEmail( FaultyToken(email, description) ) } catch (e: Exception) { e.printStackTrace() } } } No newline at end of file
app/src/main/java/foundation/e/apps/api/ecloud/modules/FaultyToken.kt 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 ECORP * * 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.api.ecloud.modules data class FaultyToken(val email: String, val description: String) No newline at end of file