Skip to content

Commit

Permalink
[AN/USER] feat: 앱 아이콘 및 스플래시 화면 추가 및 원격 버전관리(#779) (#847)
Browse files Browse the repository at this point in the history
* feat: 페스타고 아이콘 변경

* feat: 축제 목록 화면 페스타고 텍스트 로고 추가

* feat(build.gradle): debug 모드 추가

* feat(themes): splash 화면 themes 에 적용

* feat(themes): splash 화면 생성 및 버전 체크

* feat(Splash): 선택적 업데이트를 거절하면 다시 물어보지 않는다.

* feat(icon): app icon 디자인 변경

* refactor(splash): 사용하지 않는 변수 코드 제거

* refactor(app): 앱 모듈 중복 코드 제거
  • Loading branch information
SeongHoonC authored Apr 11, 2024
1 parent e4b753a commit e733da9
Show file tree
Hide file tree
Showing 55 changed files with 329 additions and 236 deletions.
5 changes: 5 additions & 0 deletions android/festago/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}

release {
isMinifyEnabled = true
isShrinkResources = true
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down
6 changes: 3 additions & 3 deletions android/festago/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Festago"
android:theme="@style/Base.Theme.Festago"
android:usesCleartextTraffic="true"
tools:targetApi="31">
tools:targetApi="34">
</application>

</manifest>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion android/festago/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}
release {
isMinifyEnabled = false
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand All @@ -42,5 +46,6 @@ dependencies {
implementation(platform("com.google.firebase:firebase-bom:32.2.0"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx:23.2.1")
implementation("com.google.firebase:firebase-messaging-ktx:23.4.1")
implementation("com.google.firebase:firebase-config:21.6.3")
}
5 changes: 5 additions & 0 deletions android/festago/data-legacy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}

release {
isMinifyEnabled = false
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down
5 changes: 5 additions & 0 deletions android/festago/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}

release {
isMinifyEnabled = false
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down
4 changes: 4 additions & 0 deletions android/festago/presentation-legacy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}
release {
isMinifyEnabled = false
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down
6 changes: 6 additions & 0 deletions android/festago/presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ android {
}

buildTypes {
debug {
buildConfigField("Boolean", "DEBUG_MODE", "true")
}

release {
isMinifyEnabled = false
buildConfigField("Boolean", "DEBUG_MODE", "false")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down Expand Up @@ -58,6 +63,7 @@ dependencies {
// Feature module Support
implementation("androidx.navigation:navigation-dynamic-features-fragment:2.7.7")
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
implementation("com.google.firebase:firebase-config-ktx:21.6.3")

// Testing Navigation
androidTestImplementation("androidx.navigation:navigation-testing:2.7.7")
Expand Down
18 changes: 12 additions & 6 deletions android/festago/presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@

<application>
<activity
android:name=".ui.notificationlist.NotificationListActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.home.HomeActivity"
android:name=".ui.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.Festago">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.notificationlist.NotificationListActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.home.HomeActivity"
android:exported="false"
android:screenOrientation="portrait" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
package com.festago.festago.presentation.ui.splash

import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.core.splashscreen.SplashScreen
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.festago.festago.presentation.BuildConfig
import com.festago.festago.presentation.R
import com.festago.festago.presentation.databinding.ActivitySplashBinding
import com.festago.festago.presentation.ui.home.HomeActivity
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.AndroidEntryPoint

@SuppressLint("CustomSplashScreen")
@AndroidEntryPoint
class SplashActivity : ComponentActivity() {

private val binding by lazy { ActivitySplashBinding.inflate(layoutInflater) }
private val firebaseRemoteConfig by lazy { FirebaseRemoteConfig.getInstance() }
private lateinit var splashScreen: SplashScreen
private val configSettings by lazy {
FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(if (BuildConfig.DEBUG) DEBUG_REMOTE_CONFIG_FETCH_INTERVAL else RELEASE_REMOTE_CONFIG_FETCH_INTERVAL)
.build()
}

init {
firebaseRemoteConfig.setConfigSettingsAsync(configSettings)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
splashScreen = installSplashScreen()
splashScreen.setKeepOnScreenCondition { true }
initKakaoSdk()
setContentView(binding.root)
}

override fun onResume() {
super.onResume()
checkAppUpdate()
}

private fun initKakaoSdk() {
KakaoSdk.init(this.applicationContext, BuildConfig.KAKAO_NATIVE_APP_KEY)
}

private fun checkAppUpdate() {
firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(this) {
if (it.isSuccessful) {
val currentVersion = try {
packageManager.getPackageInfo(packageName, 0).longVersionCode
} catch (e: Exception) {
e.printStackTrace()
handleError()
return@addOnCompleteListener
}
val latestVersion = firebaseRemoteConfig.getLong(KEY_LATEST_VERSION)
if (latestVersion == currentVersion) {
navigateToHome()
return@addOnCompleteListener
}
splashScreen.setKeepOnScreenCondition { false }
requestUpdate(latestVersion)
}
}
}

private fun requestUpdate(latestVersion: Long) {
val isForceUpdateVersion = firebaseRemoteConfig.getBoolean(KEY_FORCE_UPDATE_REQUIRED)
val latestVersionDescription =
firebaseRemoteConfig.getString(KEY_LATEST_VERSION_DESCRIPTION)
if (isForceUpdateVersion) {
requestForceUpdate(message = latestVersionDescription)
return
}
requestOptionalUpdate(latestVersion = latestVersion, message = latestVersionDescription)
}

private fun requestForceUpdate(message: String) {
alertUpdate(message = message, update = ::handleUpdate, cancel = ::handleCancelForceUpdate)
}

private fun requestOptionalUpdate(latestVersion: Long, message: String) {
val sharedPref = getPreferences(MODE_PRIVATE) ?: return
val storedLatestVersion = sharedPref.getLong(KEY_STORED_LATEST_VERSION, 0L)
if (latestVersion == storedLatestVersion) {
navigateToHome()
return
}
alertUpdate(message = message, update = ::handleUpdate) {
handleOptionalUpdateCancel(sharedPref, latestVersion)
}
}

private fun handleOptionalUpdateCancel(sharedPref: SharedPreferences, latestVersion: Long) {
updateStoredLatestVersion(sharedPref, latestVersion)
navigateToHome()
}

private fun updateStoredLatestVersion(sharedPref: SharedPreferences, latestVersion: Long) {
with(sharedPref.edit()) {
putLong(KEY_STORED_LATEST_VERSION, latestVersion)
apply()
}
}

private fun handleUpdate() {
navigateToAppStore()
finish()
}

private fun navigateToHome() {
startActivity(HomeActivity.getIntent(this))
finish()
}

private fun navigateToAppStore() {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")))
finish()
}

private fun handleError() {
Toast.makeText(
this@SplashActivity,
getString(R.string.splash_app_default_error_message),
Toast.LENGTH_SHORT,
).show()
finish()
}

private fun alertUpdate(message: String, update: () -> Unit, cancel: () -> Unit) {
AlertDialog.Builder(this).apply {
setTitle(getString(R.string.splash_app_update_request_dialog_title))
setMessage(message)
setPositiveButton(R.string.ok_dialog_btn_update) { _, _ -> update() }
setNegativeButton(R.string.ok_dialog_btn_cancel) { _, _ -> cancel() }
setCancelable(false)
}.show()
}

private fun handleCancelForceUpdate() {
Toast.makeText(
this@SplashActivity,
getString(R.string.splash_app_update_denied),
Toast.LENGTH_SHORT,
).show()
finish()
}

companion object {
private const val KEY_STORED_LATEST_VERSION = "KEY_STORED_LATEST_VERSION"
private const val DEBUG_REMOTE_CONFIG_FETCH_INTERVAL = 0L
private const val RELEASE_REMOTE_CONFIG_FETCH_INTERVAL = 3600L
private const val KEY_FORCE_UPDATE_REQUIRED = "FORCE_UPDATE_REQUIRED"
private const val KEY_LATEST_VERSION = "LATEST_VERSION"
private const val KEY_LATEST_VERSION_DESCRIPTION = "LATEST_VERSION_DESCRIPTION"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="88dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h87.237v24h-87.237z"/>
<path
android:pathData="M31.107,17.041L34.944,13.046L38.781,17.041C39.076,17.349 39.47,17.502 39.865,17.502C40.24,17.502 40.613,17.362 40.906,17.084C41.505,16.508 41.525,15.559 40.949,14.961L36.028,9.837C35.745,9.542 35.354,9.377 34.944,9.377C34.533,9.377 34.143,9.544 33.86,9.837L28.939,14.961C28.363,15.559 28.383,16.511 28.981,17.084C29.58,17.657 30.531,17.64 31.104,17.041H31.107Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M39.867,20.996H30.025C29.196,20.996 28.523,21.67 28.523,22.498C28.523,23.327 29.196,24 30.025,24H39.867C40.696,24 41.369,23.327 41.369,22.498C41.369,21.67 40.696,20.996 39.867,20.996Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M76.648,9.377H68.573C67.745,9.377 67.071,10.05 67.071,10.879C67.071,11.707 67.745,12.38 68.573,12.38H75.146V16.088C75.146,16.916 75.82,17.59 76.648,17.59C77.477,17.59 78.15,16.916 78.15,16.088V10.879C78.15,10.05 77.477,9.377 76.648,9.377Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M76.648,20.996H70.075V19.089C70.075,18.26 69.402,17.587 68.573,17.587C67.745,17.587 67.071,18.26 67.071,19.089V22.498C67.071,23.327 67.745,24 68.573,24H76.648C77.477,24 78.15,23.327 78.15,22.498C78.15,21.67 77.477,20.996 76.648,20.996Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M79.257,0.013C78.433,-0.098 77.68,0.481 77.57,1.302L77.119,4.678C77.009,5.499 77.587,6.255 78.408,6.365C78.476,6.375 78.543,6.378 78.608,6.378C79.349,6.378 79.995,5.83 80.095,5.074L80.546,1.697C80.656,0.876 80.078,0.12 79.257,0.01V0.013Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M86.828,5.114C86.26,4.511 85.309,4.483 84.706,5.051L82.425,7.199C81.822,7.767 81.792,8.718 82.363,9.322C82.658,9.635 83.056,9.795 83.457,9.795C83.827,9.795 84.195,9.66 84.485,9.387L86.766,7.239C87.369,6.671 87.399,5.72 86.828,5.116V5.114Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M62.308,9.377H58.515C57.687,9.377 57.014,10.05 57.014,10.879V20.093C57.014,20.921 57.687,21.594 58.515,21.594C59.344,21.594 60.017,20.921 60.017,20.093V12.38H62.308C63.136,12.38 63.81,11.707 63.81,10.879C63.81,10.05 63.136,9.377 62.308,9.377Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M52.33,9.377H46.515C45.687,9.377 45.014,10.05 45.014,10.879C45.014,11.707 45.687,12.38 46.515,12.38H52.33C53.159,12.38 53.832,11.707 53.832,10.879C53.832,10.05 53.159,9.377 52.33,9.377Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M52.33,17.502C53.159,17.502 53.832,16.829 53.832,16C53.832,15.172 53.159,14.498 52.33,14.498H46.515C45.687,14.498 45.014,15.172 45.014,16V22.498C45.014,22.986 45.251,23.442 45.65,23.725C45.907,23.907 46.21,24 46.515,24C46.683,24 46.854,23.972 47.016,23.915L52.831,21.86C53.612,21.584 54.022,20.726 53.747,19.942C53.472,19.162 52.613,18.751 51.83,19.026L48.017,20.375V17.504H52.33V17.502Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M11.925,12.38C12.753,12.38 13.427,11.707 13.427,10.879C13.427,10.05 12.753,9.377 11.925,9.377H1.502C0.673,9.377 0,10.05 0,10.879C0,11.707 0.673,12.38 1.502,12.38H2.255V20.093C2.255,20.921 2.929,21.594 3.757,21.594C4.586,21.594 5.259,20.921 5.259,20.093V12.38H7.514V20.093C7.514,20.618 7.79,21.106 8.24,21.379C8.478,21.524 8.748,21.594 9.016,21.594C9.257,21.594 9.497,21.537 9.715,21.422L12.623,19.892C13.357,19.507 13.64,18.598 13.254,17.865C12.869,17.131 11.96,16.849 11.226,17.234L10.521,17.604V12.378H11.927L11.925,12.38Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M23.76,9.377C22.931,9.377 22.258,10.05 22.258,10.879V18.18C22.258,19.009 22.931,19.682 23.76,19.682C24.588,19.682 25.262,19.009 25.262,18.18V10.879C25.262,10.05 24.588,9.377 23.76,9.377Z"
android:fillColor="#043BFF"/>
<path
android:pathData="M18.498,9.377H16.048C15.219,9.377 14.546,10.05 14.546,10.879C14.546,11.707 15.219,12.38 16.048,12.38H16.997V20.093C16.997,20.921 17.67,21.594 18.498,21.594C19.327,21.594 20,20.921 20,20.093V10.879C20,10.05 19.327,9.377 18.498,9.377Z"
android:fillColor="#043BFF"/>
</group>
</vector>
Loading

0 comments on commit e733da9

Please sign in to comment.