Skip to content

Commit

Permalink
[Release] 1.1.9 (11) (#175)
Browse files Browse the repository at this point in the history
* fix: ๋ฉ”๋‰ด ๋ฆฌ์ŠคํŠธ๊ฐ€ ๋น„์—ˆ์œผ๋ฉด ์‹๋‹น ์•„์ดํ…œ ์ž์ฒด๋ฅผ ๋นผ๋ฒ„๋ฆผ

* version: 1.1.9(11)

* setting: timber

* fix: ์•ฑ ์—…๋ฐ์ดํŠธ ๋กœ์ง์„ ๋ณ€๊ฒฝ

๋ฒ„์ „ ๋„ค์ž„ -> ๋ฒ„์ „ ์ฝ”๋“œ

* Revert "version: 1.1.9(11)"

This reverts commit c393543.

* version: 1.1.9
  • Loading branch information
HI-JIN2 authored Apr 2, 2024
1 parent f0126d7 commit 2c84abb
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 36 deletions.
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
minSdk 23
compileSdkVersion 34
targetSdk 34
versionCode 10
versionName "1.1.8"
versionCode 11
versionName "1.1.9"


buildConfigField "String", "BASE_URL", properties["BASE_URL"]
Expand Down Expand Up @@ -125,6 +125,9 @@ dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics'

//Timer
implementation "com.jakewharton.timber:timber:5.0.1"
}

kapt {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/eatssu/android/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ import android.content.Context
import com.google.firebase.FirebaseApp
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class App: Application() {
companion object{
lateinit var appContext : Context
// lateinit var token_prefs : TokenSharedPreferences
}

override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)

// token_prefs = TokenSharedPreferences(applicationContext)

appContext = this
KakaoSdk.init(this,BuildConfig.KAKAO_NATIVE_APP_KEY)

Timber.plant(Timber.DebugTree())
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.eatssu.android.data.repository

import android.util.Log
import com.eatssu.android.R
import com.eatssu.android.data.model.AndroidMessage
import com.eatssu.android.data.model.RestaurantInfo
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
import com.google.gson.Gson
import org.json.JSONArray
import timber.log.Timber

class FirebaseRemoteConfigRepository {
private val instance = FirebaseRemoteConfig.getInstance()
Expand All @@ -23,10 +23,10 @@ class FirebaseRemoteConfigRepository {
// Set the default values locally
instance.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
Log.d("FirebaseRemoteConfigRepository", "fetchAndActivate ์„ฑ๊ณต")
Timber.d("fetchAndActivate ์„ฑ๊ณต")
} else {
// Handle error
Log.d("FirebaseRemoteConfigRepository", "fetchAndActivate error")
Timber.d("fetchAndActivate error")
instance.setDefaultsAsync(R.xml.firebase_remote_config)
// throw RuntimeException("fetchAndActivate ์‹คํŒจ")
}
Expand All @@ -53,6 +53,10 @@ class FirebaseRemoteConfigRepository {
return instance.getString("app_version")
}

fun getVersionCode(): Long {
return instance.getLong("android_version_code")
}

fun getCafeteriaInfo(): ArrayList<RestaurantInfo> {
return parsingJson(instance.getString("cafeteria_info"))
}
Expand All @@ -70,7 +74,7 @@ class FirebaseRemoteConfigRepository {
val etc = jsonObject.optString("etc", "")

val restaurantInfo = RestaurantInfo(name, location, time, etc)
Log.d("FirebaseRemoteConfigRepository", restaurantInfo.toString())
Timber.d(restaurantInfo.toString())
list.add(restaurantInfo)
}
return list
Expand Down
23 changes: 20 additions & 3 deletions app/src/main/java/com/eatssu/android/ui/common/VersionViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.eatssu.android.ui.common

import androidx.lifecycle.ViewModel
import com.eatssu.android.BuildConfig.VERSION_NAME
import com.eatssu.android.BuildConfig.VERSION_CODE
import com.eatssu.android.data.model.AndroidMessage
import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository
import timber.log.Timber

class VersionViewModel(private val repository: FirebaseRemoteConfigRepository) : ViewModel() {

Expand All @@ -13,14 +14,30 @@ class VersionViewModel(private val repository: FirebaseRemoteConfigRepository) :
}

fun checkForceUpdate(): Boolean {
val lastVersion = checkAppVersion()
return VERSION_NAME != lastVersion && repository.getForceUpdate()

val versionCode = checkVersionCode() //์–˜๊ฐ€ ํŒŒ์ด์–ด๋ฒ ์ด์Šค์— ์žˆ๋Š” ์ตœ์‹  ๋ฒ„์ „
val thisCheckVersionCode = VERSION_CODE

Timber.d("์•ฑ์˜ versionCode๋Š” " + thisCheckVersionCode + " ๋ฐฐํฌ๋œ ์ตœ์‹  ๋ฒ„์ „์€ " + versionCode)

if (thisCheckVersionCode < versionCode) { //๋ฐฐํฌ๋œ ๋ฒ„์ „์ด ํฌ๋ฉด ๊ฐ•์ œ ์—…๋ฐ์ดํŠธ
Timber.d("๊ฐ•์ œ์—…๋ฐ์ดํŠธ")
return true
} else if (thisCheckVersionCode >= versionCode) { //์ด ๋ฒ„์ „์ด ๋” ํฌ๊ฑฐ๋‚˜ ๊ฐ™์œผ๋ฉด ๊ฐ•์ œ ์—…๋ฐ์ดํŠธ ํ•  ํ•„์š” x
Timber.d("์—…๋ฐ์ดํŠธ ํŒจ์Šค~")
return false
}
return false
}

fun checkAppVersion(): String {
return repository.getAppVersion()
}

fun checkVersionCode(): Long {
return repository.getVersionCode()
}

fun checkAndroidMessage(): AndroidMessage {
return repository.getAndroidMessage()
}
Expand Down
39 changes: 23 additions & 16 deletions app/src/main/java/com/eatssu/android/ui/main/menu/MenuFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MenuFragment : Fragment() {
}

@RequiresApi(Build.VERSION_CODES.O)
fun observeViewModel(){
fun observeViewModel() {
menuService = RetrofitImpl.retrofit.create(MenuService::class.java)
mealService = RetrofitImpl.retrofit.create(MealService::class.java)

Expand All @@ -108,7 +108,8 @@ class MenuFragment : Fragment() {
// ViewModel์—์„œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
calendarViewModel.getData().observe(viewLifecycleOwner) { dataReceived ->

val parsedDate = LocalDate.parse(dataReceived.toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd"))
val parsedDate =
LocalDate.parse(dataReceived.toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd"))
menuDate = parsedDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"))

// Assuming menuDate is a String in the format "yyyyMMdd"
Expand All @@ -122,30 +123,37 @@ class MenuFragment : Fragment() {
//ํ‘ธ๋“œ์ฝ”ํŠธ
menuViewModel.loadFixedMenu(Restaurant.FOOD_COURT)
menuViewModel.fixedMenuDataFood.observe(viewLifecycleOwner) { result ->
totalMenuList.add(
Section(
MenuType.FIXED,
Restaurant.FOOD_COURT,
result.mapFixedMenuResponseToMenu()
if (result.mapFixedMenuResponseToMenu().isNotEmpty()) {
Log.d("menu", result.categoryMenuListCollection.toString())
totalMenuList.add(
Section(
MenuType.FIXED,
Restaurant.FOOD_COURT,
result.mapFixedMenuResponseToMenu()
)
)
)
}
foodCourtDataLoaded.value = true
checkDataLoaded()
//
}

//์Šค๋‚ต์ฝ”๋„ˆ
menuViewModel.loadFixedMenu(Restaurant.SNACK_CORNER)
menuViewModel.fixedMenuDataSnack.observe(viewLifecycleOwner) { result ->
totalMenuList.add(
Section(
MenuType.FIXED,
Restaurant.SNACK_CORNER,
result.mapFixedMenuResponseToMenu()
if (result.mapFixedMenuResponseToMenu().isNotEmpty()) {
totalMenuList.add(
Section(
MenuType.FIXED,
Restaurant.SNACK_CORNER,
result.mapFixedMenuResponseToMenu()
)
)
)
}
snackCornerDataLoaded.value = true
checkDataLoaded()
}

Log.d("MenuFragment", "The date $menuDate is not on a weekend.")
}

Expand All @@ -157,14 +165,13 @@ class MenuFragment : Fragment() {
Log.d("MenuFragment", "The date $menuDate is not on a weekend.")
}

if(time!= Time.LUNCH){
if (time != Time.LUNCH) {
foodCourtDataLoaded.value = true //ํ‘ธ๋“œ์ฝ”ํŠธ
snackCornerDataLoaded.value = true //์Šค๋‚ต์ฝ”๋„ˆ
checkDataLoaded()
}



//ํ•™์ƒ์‹๋‹น
menuViewModel.loadTodayMeal(menuDate, Restaurant.HAKSIK, time)
menuViewModel.todayMealDataHaksik.observe(viewLifecycleOwner) { result ->
Expand Down
12 changes: 4 additions & 8 deletions app/src/main/java/com/eatssu/android/ui/mypage/MyPageActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.eatssu.android.ui.mypage
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.ViewModelProvider
Expand All @@ -25,6 +24,7 @@ import com.eatssu.android.util.extension.startActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import timber.log.Timber

@AndroidEntryPoint
class MyPageActivity : BaseActivity<ActivityMyPageBinding>(ActivityMyPageBinding::inflate) {
Expand Down Expand Up @@ -100,13 +100,13 @@ class MyPageActivity : BaseActivity<ActivityMyPageBinding>(ActivityMyPageBinding
}

private fun setData() {
binding.tvAppVersion.text = BuildConfig.VERSION_NAME
binding.tvStoreAppVersion.text = versionViewModel.checkAppVersion()
binding.tvAppVersion.text = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")"
binding.tvStoreAppVersion.text = versionViewModel.checkVersionCode().toString()

myPageViewModel.getMyInfo()

lifecycleScope.launch {
Log.d(TAG, "๊ด€์ฐฐ์‹œ์ž‘")
Timber.d("๊ด€์ฐฐ์‹œ์ž‘")
myPageViewModel.uiState.collectLatest {
if (!it.error && !it.loading) {
binding.tvNickname.text = it.nickname
Expand Down Expand Up @@ -202,8 +202,4 @@ class MyPageActivity : BaseActivity<ActivityMyPageBinding>(ActivityMyPageBinding
)
}
}

companion object {
val TAG = "MyPageActivity"
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/xml/firebase_remote_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<key>force_update_required</key>
<value>false</value>
</entry>
<entry>
<key>android_version_code</key>
<value>1</value>
</entry>
<entry>
<key>latest_app_version</key>
<value>1.0.0</value>
Expand Down

0 comments on commit 2c84abb

Please sign in to comment.