From bd2e98680034b59280beb3ea8c080a900025d3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=B0=E0=A5=8B=E0=A4=B9=E0=A4=BF=E0=A4=A4=20=E0=A4=AF?= =?UTF-8?q?=E0=A4=BE=E0=A4=A6=E0=A4=B5?= Date: Tue, 4 Oct 2022 14:39:47 +0530 Subject: [PATCH] turned of minifyEnabled and Shirking of resources and fixed some bugs --- app/build.gradle | 10 ++++----- app/proguard-rules.pro | 16 +++++++++++++- .../vcriatequiz/main/QuestionFragment.kt | 4 +++- .../vcriatequiz/splash/LoginFragment.kt | 22 ++++++++++++------- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fb0d48b..4ffb7ce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,20 +15,20 @@ android { applicationId "io.itsydv.vcriatequiz" minSdk 23 targetSdk 33 - versionCode 1 - versionName "0.1" + versionCode 2 + versionName "0.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { - minifyEnabled true - shrinkResources true + minifyEnabled false + shrinkResources false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { - minifyEnabled true + minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2749a66..51c551b 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -39,4 +39,18 @@ # Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater -keepclassmembers class kotlin.coroutines.SafeContinuation { volatile ; -} \ No newline at end of file +} + +# Firebase +-keep class com.firebase.** { *; } +-keep class org.apache.** { *; } +-keepnames class com.fasterxml.jackson.** { *; } +-keepnames class javax.servlet.** { *; } +-keepnames class org.ietf.jgss.** { *; } +-dontwarn org.w3c.dom.** +-dontwarn org.joda.time.** +-dontwarn org.shaded.apache.** +-dontwarn org.ietf.jgss.** + +# Only necessary if you downloaded the SDK jar directly instead of from maven. +-keep class com.shaded.fasterxml.jackson.** { *; } \ No newline at end of file diff --git a/app/src/main/java/io/itsydv/vcriatequiz/main/QuestionFragment.kt b/app/src/main/java/io/itsydv/vcriatequiz/main/QuestionFragment.kt index d2fe455..e9ce7ab 100644 --- a/app/src/main/java/io/itsydv/vcriatequiz/main/QuestionFragment.kt +++ b/app/src/main/java/io/itsydv/vcriatequiz/main/QuestionFragment.kt @@ -183,7 +183,9 @@ class QuestionFragment : Fragment() { } override fun onDestroyView() { - timer.cancel() + if (this::timer.isInitialized) { + timer.cancel() + } super.onDestroyView() _binding = null } diff --git a/app/src/main/java/io/itsydv/vcriatequiz/splash/LoginFragment.kt b/app/src/main/java/io/itsydv/vcriatequiz/splash/LoginFragment.kt index 2669893..7b41f15 100644 --- a/app/src/main/java/io/itsydv/vcriatequiz/splash/LoginFragment.kt +++ b/app/src/main/java/io/itsydv/vcriatequiz/splash/LoginFragment.kt @@ -3,6 +3,7 @@ package io.itsydv.vcriatequiz.splash import android.app.Activity import android.content.Intent import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -89,16 +90,21 @@ class LoginFragment : Fragment() { val account = task.getResult(ApiException::class.java) if (account != null) { val credential = GoogleAuthProvider.getCredential(account.idToken, null) - auth.signInWithCredential(credential).addOnCompleteListener { firebaseTask -> - if (firebaseTask.isSuccessful) { - val intent = Intent(requireActivity(), MainActivity::class.java) - startActivity(intent) - requireActivity().finish() - } else { - // If sign in fails, display a message to the user. + auth.signInWithCredential(credential) + .addOnCompleteListener { firebaseTask -> + if (firebaseTask.isSuccessful) { + val intent = Intent(requireActivity(), MainActivity::class.java) + startActivity(intent) + requireActivity().finish() + } else { + // If sign in fails, display a message to the user. + Toast.makeText(requireContext(), "Authentication Failed", Toast.LENGTH_SHORT).show() + } + } + .addOnFailureListener { Toast.makeText(requireContext(), "Authentication Failed", Toast.LENGTH_SHORT).show() + it.printStackTrace() } - } } } catch (e: ApiException) { Toast.makeText(requireContext(), e.toString(), Toast.LENGTH_SHORT).show()