Skip to content

Commit

Permalink
#91 앱 릴리즈 모드 처리 코드 추가, 앱 비밀키 처리 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Jun 10, 2023
1 parent 8682c70 commit c320631
Show file tree
Hide file tree
Showing 47 changed files with 271 additions and 143 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ render.experimental.xml
# Keystore files
*.jks
*.keystore
secretkey/

# Google Services (e.g. APIs or Firebase)
google-services.json
Expand Down
28 changes: 20 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
plugins {

id("mediproject.android.application")
id("mediproject.android.hilt")
id("androidx.navigation.safeargs.kotlin")
alias(libs.plugins.gms)
alias(libs.plugins.firebase.crashlytics)
}

android {
defaultConfig {
applicationId = "com.android.mediproject"
versionCode = 1
versionName = "1.0.0"
versionName = "1.0.0-alpha01"

vectorDrawables {
useSupportLibrary = true
}

// testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes {
debug {

}
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
"proguard-glide.pro",
"proguard-okhttp3.pro",
"proguard-room.pro",
"proguard-retrofit2.pro")
}
}
}
namespace = "com.android.mediproject"

buildFeatures {
buildConfig = true
}

lint {
checkDependencies = true
ignoreTestSources = true
}


}

hilt {
Expand Down Expand Up @@ -69,6 +78,9 @@ dependencies {
implementation(libs.androidx.splash)
kapt(libs.bundles.glides.kapt)

implementation(libs.firebase.crashlytics)
implementation(libs.firebase.analytics)

/*
androidTestImplementation(libs.bundles.testUIs)
testImplementation(libs.bundles.testUIs)
Expand Down
20 changes: 20 additions & 0 deletions app/debug/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.android.mediproject",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0.0-alpha01",
"outputFile": "app-debug.apk"
}
],
"elementType": "File"
}
11 changes: 11 additions & 0 deletions app/proguard-glide.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
3 changes: 3 additions & 0 deletions app/proguard-okhttp3.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-dontwarn okhttp3.**
-dontwarn okio.**
-dontnote okhttp3.**
45 changes: 45 additions & 0 deletions app/proguard-retrofit2.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Begin: Proguard rules for retrofit2

# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement.*

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

# End: Proguard rules for retrofit2
3 changes: 3 additions & 0 deletions app/proguard-room.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-keep class * extends androidx.room.RoomDatabase
-keep @androidx.room.Entity class *
-dontwarn androidx.room.paging.**
47 changes: 45 additions & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,51 @@

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-keepattributes SourceFile,LineNumberTable,RuntimeVisibleAnnotations,AnnotationDefault

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

#keep
-keep public class * { public protected *; }
-keep class com.luckycatlabs.sunrisesunset.** { *;}
-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite* {
<fields>;
}


# Keep `Companion` object fields of serializable classes.
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}

# Keep `serializer()` on companion objects (both default and named) of serializable classes.
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}

# Keep `INSTANCE.serializer()` of serializable objects.
-if @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
}
-keepclassmembers class <1> {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}

-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn org.tensorflow.lite.gpu.**
20 changes: 20 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.android.mediproject",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0.0-alpha01",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.App.Starting"
android:windowSoftInputMode="adjustUnspecified">
android:windowSoftInputMode="adjustPan|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
31 changes: 31 additions & 0 deletions app/src/main/java/com/android/mediproject/DevDialogFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.android.mediproject

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.android.mediproject.databinding.ViewNetworkStateBinding
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class DevDialogFragment : BottomSheetDialogFragment() {

private var _binding: ViewNetworkStateBinding? = null

private val binding get() = _binding!!

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View = ViewNetworkStateBinding.inflate(layoutInflater, container, false).also {
_binding = it
}.root

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.okButton.setOnClickListener {
dismiss()
requireActivity().finish()
}
}
}
3 changes: 1 addition & 2 deletions app/src/main/java/com/android/mediproject/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>(ActivityMa
internetNetworkListener.activityLifeCycle = this.lifecycle
internetNetworkListener.networkStateCallback = InternetNetworkListener.NetworkStateCallback { isConnected ->
if (!isConnected) {
//val modalBottomSheet = NetworkStateDialogFragment()
//modalBottomSheet.show(supportFragmentManager, NetworkStateDialogFragment::class.java.name)
NetworkStateDialogFragment().show(supportFragmentManager, NetworkStateDialogFragment::class.java.name)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal fun Project.configureAndroidCompose(
commonExtension.apply {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

buildFeatures {
@Suppress("UnstableApiUsage") buildFeatures {
compose = true
}

Expand Down Expand Up @@ -48,19 +48,15 @@ private fun Project.buildComposeMetricsParameters(): List<String> {
if (enableMetrics) {
val metricsFolder = File(project.buildDir, "compose-metrics")
metricParameters.add("-P")
metricParameters.add(
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + metricsFolder.absolutePath
)
metricParameters.add("plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + metricsFolder.absolutePath)
}

val enableReportsProvider = project.providers.gradleProperty("enableComposeCompilerReports")
val enableReports = (enableReportsProvider.orNull == "true")
if (enableReports) {
val reportsFolder = File(project.buildDir, "compose-reports")
metricParameters.add("-P")
metricParameters.add(
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath
)
metricParameters.add("plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath)
}
return metricParameters.toList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ internal fun Project.configureKotlinAndroid(
commonExtension.apply {
compileSdk = libs.findVersion("compileSdk").get().toString().toInt()


defaultConfig {
minSdk = libs.findVersion("minSdk").get().toString().toInt()
}
Expand Down Expand Up @@ -60,7 +59,6 @@ internal fun Project.configureKotlinJvm() {
}

private fun Project.configureKotlin() {
// Use withType to workaround https://youtrack.jetbrains.com/issue/KT-55947
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
val warningsAsErrors: String? by project
Expand All @@ -70,13 +68,10 @@ private fun Project.configureKotlin() {
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlin.Experimental",
"-Xdebug",
"-opt-in=kotlin.Experimental"
)

jvmTarget = JavaVersion.VERSION_17.toString()


}
}
}
1 change: 1 addition & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories {
google()
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ buildscript {
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
//alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.gms) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.kotlin.serialization) apply false
Expand All @@ -21,10 +20,11 @@ plugins {
alias(libs.plugins.kapt) apply false
// alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.firebase.crashlytics) apply false
}


gradle.projectsEvaluated {
gradle.allprojects {
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs = options.compilerArgs + "-Xmaxerrs" + "1000"
}
Expand Down
2 changes: 1 addition & 1 deletion core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
android {
namespace = "com.android.mediproject.core.common"

buildFeatures {
@Suppress("UnstableApiUsage") buildFeatures {
buildConfig = true
}

Expand Down
Loading

0 comments on commit c320631

Please sign in to comment.