From caba0464d22f0ad5048aa42e944116719a4551eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Sena?= Date: Sat, 13 Apr 2024 10:21:23 -0300 Subject: [PATCH] Lint kotlin --- .../java/com/forcetower/uefs/GooglePlayGamesInstance.kt | 4 ---- app/src/main/java/com/forcetower/uefs/UApplication.kt | 2 +- .../uefs/core/injection/module/ActivityScopedModule.kt | 2 +- .../forcetower/uefs/core/injection/module/AppModule.kt | 1 - .../com/forcetower/uefs/core/model/edge/PasskeyAssert.kt | 2 +- .../forcetower/uefs/core/model/edge/PasskeyRegister.kt | 2 +- .../forcetower/uefs/core/storage/network/EdgeService.kt | 3 +-- .../core/storage/repository/cloud/EdgeAuthRepository.kt | 2 +- .../uefs/domain/usecase/CompleteAssertionUseCase.kt | 2 +- .../uefs/domain/usecase/RegisterPasskeyUseCase.kt | 2 +- .../uefs/domain/usecase/StartAssertionUseCase.kt | 2 +- .../forcetower/uefs/feature/login/LoginFormViewModel.kt | 4 ++-- .../com/forcetower/uefs/feature/login/LoginFragment.kt | 6 ++---- .../com/forcetower/uefs/feature/shared/UGameActivity.kt | 9 --------- 14 files changed, 13 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/forcetower/uefs/GooglePlayGamesInstance.kt b/app/src/main/java/com/forcetower/uefs/GooglePlayGamesInstance.kt index c0c236f5c..d04c83027 100644 --- a/app/src/main/java/com/forcetower/uefs/GooglePlayGamesInstance.kt +++ b/app/src/main/java/com/forcetower/uefs/GooglePlayGamesInstance.kt @@ -27,13 +27,9 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.preference.PreferenceManager import com.forcetower.core.lifecycle.Event -import com.google.android.gms.games.AchievementsClient -import com.google.android.gms.games.GamesClient -import com.google.android.gms.games.GamesSignInClient import com.google.android.gms.games.PlayGames import kotlinx.coroutines.tasks.await - class GooglePlayGamesInstance( private val activity: Activity ) : ContextWrapper(activity) { diff --git a/app/src/main/java/com/forcetower/uefs/UApplication.kt b/app/src/main/java/com/forcetower/uefs/UApplication.kt index 3c7924e3c..bb83bd2d5 100644 --- a/app/src/main/java/com/forcetower/uefs/UApplication.kt +++ b/app/src/main/java/com/forcetower/uefs/UApplication.kt @@ -63,7 +63,7 @@ class UApplication : Application(), Configuration.Provider { } super.onCreate() - PlayGamesSdk.initialize(this); + PlayGamesSdk.initialize(this) setupDayNightTheme(this) defineWorker() } diff --git a/app/src/main/java/com/forcetower/uefs/core/injection/module/ActivityScopedModule.kt b/app/src/main/java/com/forcetower/uefs/core/injection/module/ActivityScopedModule.kt index 48d286638..b26476f68 100644 --- a/app/src/main/java/com/forcetower/uefs/core/injection/module/ActivityScopedModule.kt +++ b/app/src/main/java/com/forcetower/uefs/core/injection/module/ActivityScopedModule.kt @@ -13,4 +13,4 @@ object ActivityScopedModule { @Provides fun providePlayGames(activity: Activity): GooglePlayGamesInstance = GooglePlayGamesInstance(activity) -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/core/injection/module/AppModule.kt b/app/src/main/java/com/forcetower/uefs/core/injection/module/AppModule.kt index af7313139..811dbfd6f 100644 --- a/app/src/main/java/com/forcetower/uefs/core/injection/module/AppModule.kt +++ b/app/src/main/java/com/forcetower/uefs/core/injection/module/AppModule.kt @@ -29,7 +29,6 @@ import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.preferencesDataStoreFile import androidx.preference.PreferenceManager import androidx.room.Room -import com.forcetower.uefs.GooglePlayGamesInstance import com.forcetower.uefs.core.storage.apidatabase.APIDatabase import com.forcetower.uefs.core.storage.database.M50TO51 import com.forcetower.uefs.core.storage.database.M51TO52 diff --git a/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyAssert.kt b/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyAssert.kt index 611ea8c0d..26ea26df1 100644 --- a/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyAssert.kt +++ b/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyAssert.kt @@ -10,4 +10,4 @@ data class SimplifiedPublicKey( data class PasskeyAssert( val publicKey: SimplifiedPublicKey -) \ No newline at end of file +) diff --git a/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyRegister.kt b/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyRegister.kt index 9e68ab9fc..683ffcd18 100644 --- a/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyRegister.kt +++ b/app/src/main/java/com/forcetower/uefs/core/model/edge/PasskeyRegister.kt @@ -26,4 +26,4 @@ data class PublicKey( data class PasskeyRegister( val publicKey: PublicKey -) \ No newline at end of file +) diff --git a/app/src/main/java/com/forcetower/uefs/core/storage/network/EdgeService.kt b/app/src/main/java/com/forcetower/uefs/core/storage/network/EdgeService.kt index 8c7b01e13..5e79a6b31 100644 --- a/app/src/main/java/com/forcetower/uefs/core/storage/network/EdgeService.kt +++ b/app/src/main/java/com/forcetower/uefs/core/storage/network/EdgeService.kt @@ -7,7 +7,6 @@ import com.forcetower.uefs.core.model.edge.RegisterPasskeyStart import com.forcetower.uefs.core.model.unes.AccessToken import retrofit2.http.Body import retrofit2.http.GET -import retrofit2.http.Headers import retrofit2.http.POST interface EdgeService { @@ -22,4 +21,4 @@ interface EdgeService { @POST("passkeys/register/finish") suspend fun registerPasskeyFinish(@Body data: RegisterPasskeyCredential) -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/core/storage/repository/cloud/EdgeAuthRepository.kt b/app/src/main/java/com/forcetower/uefs/core/storage/repository/cloud/EdgeAuthRepository.kt index 730456b73..cfd416fcf 100644 --- a/app/src/main/java/com/forcetower/uefs/core/storage/repository/cloud/EdgeAuthRepository.kt +++ b/app/src/main/java/com/forcetower/uefs/core/storage/repository/cloud/EdgeAuthRepository.kt @@ -29,4 +29,4 @@ class EdgeAuthRepository @Inject constructor( suspend fun registerFinish(flowId: String, credential: String) { return service.registerPasskeyFinish(RegisterPasskeyCredential(flowId, credential)) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/domain/usecase/CompleteAssertionUseCase.kt b/app/src/main/java/com/forcetower/uefs/domain/usecase/CompleteAssertionUseCase.kt index b4a41876a..38412eef4 100644 --- a/app/src/main/java/com/forcetower/uefs/domain/usecase/CompleteAssertionUseCase.kt +++ b/app/src/main/java/com/forcetower/uefs/domain/usecase/CompleteAssertionUseCase.kt @@ -13,4 +13,4 @@ class CompleteAssertionUseCase @Inject constructor( Timber.d("Credential: $response") auth.completeAssertion(flowId, response) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/domain/usecase/RegisterPasskeyUseCase.kt b/app/src/main/java/com/forcetower/uefs/domain/usecase/RegisterPasskeyUseCase.kt index b76fd4623..4ff371a66 100644 --- a/app/src/main/java/com/forcetower/uefs/domain/usecase/RegisterPasskeyUseCase.kt +++ b/app/src/main/java/com/forcetower/uefs/domain/usecase/RegisterPasskeyUseCase.kt @@ -23,4 +23,4 @@ class RegisterPasskeyUseCase @Inject constructor( suspend fun finish(flowId: String, credential: String) { return edge.registerFinish(flowId, credential) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/domain/usecase/StartAssertionUseCase.kt b/app/src/main/java/com/forcetower/uefs/domain/usecase/StartAssertionUseCase.kt index f51d68989..e85bf3bac 100644 --- a/app/src/main/java/com/forcetower/uefs/domain/usecase/StartAssertionUseCase.kt +++ b/app/src/main/java/com/forcetower/uefs/domain/usecase/StartAssertionUseCase.kt @@ -17,4 +17,4 @@ class StartAssertionUseCase @Inject constructor( val parsed = gson.fromJson(data.challenge, PasskeyAssert::class.java) return data.copy(challenge = gson.toJson(parsed.publicKey)) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/feature/login/LoginFormViewModel.kt b/app/src/main/java/com/forcetower/uefs/feature/login/LoginFormViewModel.kt index de6b16381..b7bcdcccf 100644 --- a/app/src/main/java/com/forcetower/uefs/feature/login/LoginFormViewModel.kt +++ b/app/src/main/java/com/forcetower/uefs/feature/login/LoginFormViewModel.kt @@ -32,7 +32,7 @@ class LoginFormViewModel @Inject constructor( runCatching { val data = registerPasskey.start() _register.value = data - }.onFailure { + }.onFailure { Timber.e(it, "Failed to request challenge") } } @@ -71,4 +71,4 @@ class LoginFormViewModel @Inject constructor( } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/forcetower/uefs/feature/login/LoginFragment.kt b/app/src/main/java/com/forcetower/uefs/feature/login/LoginFragment.kt index 329520252..74abaaf3e 100644 --- a/app/src/main/java/com/forcetower/uefs/feature/login/LoginFragment.kt +++ b/app/src/main/java/com/forcetower/uefs/feature/login/LoginFragment.kt @@ -22,7 +22,6 @@ package com.forcetower.uefs.feature.login import android.content.SharedPreferences import android.os.Bundle -import android.util.Patterns import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -70,7 +69,6 @@ class LoginFragment : UFragment() { allowOnlyUEFS() return FragmentLoginFormBinding.inflate(inflater, container, false).also { binding = it - Patterns.EMAIL_ADDRESS binding.btnInstitution.setOnClickListener { showInstitutionSelector() } @@ -114,7 +112,7 @@ class LoginFragment : UFragment() { request = request, ) handlePasskeyRegistrationResult(result, start) - } catch (e : CreateCredentialException) { + } catch (e: CreateCredentialException) { Timber.e(e, "Failed to create passkey") showSnack("Não foi possível recuperar credenciais.") } @@ -150,7 +148,7 @@ class LoginFragment : UFragment() { request = request ) onCredentialSignInCompleted(result) - } catch (e : GetCredentialException) { + } catch (e: GetCredentialException) { Timber.e(e, "Failed to get credentials") showSnack("Não foi possível recuperar credenciais.") } diff --git a/app/src/main/java/com/forcetower/uefs/feature/shared/UGameActivity.kt b/app/src/main/java/com/forcetower/uefs/feature/shared/UGameActivity.kt index 2704c89dd..c0b187bc3 100644 --- a/app/src/main/java/com/forcetower/uefs/feature/shared/UGameActivity.kt +++ b/app/src/main/java/com/forcetower/uefs/feature/shared/UGameActivity.kt @@ -20,20 +20,11 @@ package com.forcetower.uefs.feature.shared -import android.content.Intent import android.os.Bundle import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes import com.forcetower.uefs.GooglePlayGamesInstance -import com.forcetower.uefs.PLAY_GAMES_ACHIEVEMENTS -import com.forcetower.uefs.PLAY_GAMES_SIGN_IN import com.forcetower.uefs.R -import com.google.android.gms.auth.api.signin.GoogleSignIn -import com.google.android.gms.auth.api.signin.GoogleSignInAccount -import com.google.android.gms.auth.api.signin.GoogleSignInStatusCodes.SIGN_IN_CANCELLED -import com.google.android.gms.auth.api.signin.GoogleSignInStatusCodes.SIGN_IN_CURRENTLY_IN_PROGRESS -import com.google.android.gms.common.ConnectionResult.NETWORK_ERROR -import com.google.android.gms.common.api.ApiException import com.google.android.material.snackbar.Snackbar import kotlinx.coroutines.tasks.await import timber.log.Timber