Skip to content

Commit

Permalink
[Fix/#141] remote config ENUM값 있는걸로 교체 (#193)
Browse files Browse the repository at this point in the history
* fix: as Restaurant 타입 캐스팅 안되는 중

* fix: conflict

* ds

* chore: add gitignore ".DS_Store"
  • Loading branch information
HI-JIN2 authored Aug 19, 2024
1 parent c99b420 commit 5220ea8
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 22 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

.DS_Store
Binary file modified app/.DS_Store
Binary file not shown.
133 changes: 133 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())


android {
namespace 'com.eatssu.android'
compileSdk 34

defaultConfig {
applicationId "com.eatssu.android"
minSdk 23
targetSdk 34
versionCode 16
versionName "1.1.14"


buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"${properties.get('KAKAO_NATIVE_APP_KEY')}\"")
manifestPlaceholders = [KAKAO_NATIVE_APP_KEY: properties.get('KAKAO_NATIVE_APP_KEY')]

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
buildConfig = true
viewBinding = true
dataBinding = true
}

buildTypes {
debug {
buildConfigField("String", "BASE_URL", properties["DEV_BASE_URL"])
}
release {
buildConfigField("String", "BASE_URL", properties["PROD_BASE_URL"])

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
splits {
abi {
enable true
reset()
universalApk true
}
}
lint{
abortOnError = false
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.jakewharton.threetenabp:threetenabp:1.4.4'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.google.android.datatransport:transport-runtime:3.1.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
annotationProcessor 'com.android.databinding:compiler:3.1.4'

//retrofit2 - 서버통신
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1' // Gson

//OkHttp: 통신 로그 확인하기 위함
implementation 'com.squareup.okhttp3:okhttp:4.12.0' //포스팅 당시 4.9.0 버전 기준
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'

//glide - 사진 업로드
implementation 'com.github.bumptech.glide:glide:4.15.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

//이미지 압축
implementation 'id.zelory:compressor:3.0.1'

//coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'

// 카카오 로그인 모듈
implementation "com.kakao.sdk:v2-user:2.8.6" // 카카오 로그인

//hilt
implementation 'com.google.dagger:hilt-android:2.50'
kapt "com.google.dagger:hilt-android-compiler:2.50"
annotationProcessor 'com.google.dagger:hilt-compiler:2.50'

// viewmodel과 livedata
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.7.0"

//firebase
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.firebase:firebase-config-ktx:21.4.1'
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 {
correctErrorTypes true
}
Binary file added app/src/.DS_Store
Binary file not shown.
Binary file added app/src/main/.DS_Store
Binary file not shown.
Binary file added app/src/main/java/.DS_Store
Binary file not shown.
Binary file added app/src/main/java/com/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.eatssu.android.data.model

import com.eatssu.android.data.enums.Restaurant

data class RestaurantInfo(
val enum: Restaurant,
val name: String,
val location: String,
val time: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eatssu.android.data.repository

import com.eatssu.android.R
import com.eatssu.android.data.enums.Restaurant
import com.eatssu.android.data.model.AndroidMessage
import com.eatssu.android.data.model.RestaurantInfo
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
Expand Down Expand Up @@ -65,7 +66,7 @@ class FirebaseRemoteConfigRepository {
}

fun getCafeteriaInfo(): ArrayList<RestaurantInfo> {
return parsingJson(instance.getString("cafeteria_info"))
return parsingJson(instance.getString("restraunt_info"))
}

private fun parsingJson(json: String): ArrayList<RestaurantInfo> {
Expand All @@ -75,12 +76,14 @@ class FirebaseRemoteConfigRepository {
for (index in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(index)

val enumString = jsonObject.optString("enum", "")
val enumValue = enumValues<Restaurant>().find { it.name == enumString } ?: Restaurant.HAKSIK
val name = jsonObject.optString("name", "")
val location = jsonObject.optString("location", "")
val time = jsonObject.optString("time", "")
val etc = jsonObject.optString("etc", "")

val restaurantInfo = RestaurantInfo(name, location, time, etc)
val restaurantInfo = RestaurantInfo(enumValue, name, location, time, etc)
Timber.d(restaurantInfo.toString())
list.add(restaurantInfo)
}
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/java/com/eatssu/android/ui/info/InfoViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.eatssu.android.ui.info
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.eatssu.android.data.enums.Restaurant
import com.eatssu.android.data.model.RestaurantInfo
import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository

Expand Down Expand Up @@ -34,28 +35,28 @@ class InfoViewModel(firebaseRemoteConfigRepository: FirebaseRemoteConfigReposito
infoList.value = firebaseRemoteConfigRepository.getCafeteriaInfo()
Log.d("InfoViewModel",infoList.value.toString())

val dodam = infoList.value!!.find { it.name == "숭실도담" }
val dodam = infoList.value!!.find { it.enum == Restaurant.DODAM }
dodamTime.value = dodam?.time ?: ""
dodamLocation.value = dodam?.location ?: ""
dodamEtc.value = dodam?.etc ?: ""

val food = infoList.value!!.find { it.name == "FOOD COURT" }
val food = infoList.value!!.find { it.enum == Restaurant.FOOD_COURT }
foodTime.value = food?.time ?: ""
foodLocation.value = food?.location ?: ""
foodEtc.value = food?.etc ?: ""

val dormitory = infoList.value!!.find { it.name == "기숙사 식당" }
val dormitory = infoList.value!!.find { it.enum == Restaurant.DORMITORY }
dormitoryTime.value = dormitory?.time ?: ""
dormitoryLocation.value = dormitory?.location ?: ""
dormitoryEtc.value = dormitory?.etc ?: ""

val snack = infoList.value!!.find { it.name == "스낵코너" }
val snack = infoList.value!!.find { it.enum == Restaurant.SNACK_CORNER }
snackTime.value = snack?.time ?: ""
snackLocation.value = snack?.location ?: ""
snackEtc.value = snack?.etc ?: ""

val haksik = infoList.value!!.find { it.name == "학생식당" }
haksikTime.value = haksik?.time ?: "tlqof"
val haksik = infoList.value!!.find { it.enum == Restaurant.HAKSIK }
haksikTime.value = haksik?.time ?: ""
haksikLocation.value = haksik?.location ?: ""
haksikEtc.value = haksik?.etc ?: ""
}
Expand Down
41 changes: 27 additions & 14 deletions app/src/main/res/xml/firebase_remote_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,65 @@
<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>
</entry>

<entry>
<key>cafeteria_info</key>
<value>{
"name": "숭실도담",
<key>restraunt_info</key>
<value>
{
"enum": "DODAM",
"name": "도담 식당",
"location": "신양관 2층",
"time": "11:20~14:00\n17:00~18:30",
"etc": "대면 배식+웰빙코너\n토요일 11:30~13:30"
"time": "11:20~14:00(점심)\n17:00~18:30(저녁)",
"etc": "2개 코너 운영\n대면 배식,웰빙코너\n토요일 11:30~13:30"
},
{
"name": "학생식당",
"enum": "HAKSIK",
"name": "학생 식당",
"location": "학생회관 3층",
"time": "11:20~16:00\n(식사 14:00 마감)",
"time": "08:10~09:20(천원의 아침밥, 100개 한정,
24.03.11~06.14)\n11:20~14:00\n(점심)\n14:00~17:00(공간 개방)",
"etc": "3개 코너 운영\n뚝배기찌개, 덮밥, 양식"
},
{
"name": "스낵코너",
"enum": "SNACK_CORNER",
"name": "스낵 코너",
"location": "학생회관 3층",
"time": "11:00~16:00",
"etc": "분식류, 옛날도시락, 컵밥 등"
"etc": "분식류, 옛날도시락, 컵밥 등. 주말 휴무"
},
{
"name": "FOOD COURT",
"enum": "FOOD_COURT",
"name": "푸드 코트",
"location": "학생회관 2층",
"time": "11:30~16:00",
"etc": "아시안푸드, 돈까스, 샐러드, 국밥 등 + 카페"
"time": "휴무",
"etc": "준비 중"
},
{
"enum": "DORMITORY",
"name": "기숙사 식당",
"location": "레지던스홀 지하 1층",
"time": "08:00~09:30\n11:00~14:00\n17:00~18:30",
"etc": "주말 조식은 운영되지 않습니다."
}
]
</value>
</entry>

<entry>
<key>android_message</key>
<value>{"dialog":false,"message":"지금은 서버 점검 중입니다. "}
<value>{
"dialog":false,
"message":"지금은 서버 점검 중입니다. "
}
</value>
</entry>
</defaultsMap>

0 comments on commit 5220ea8

Please sign in to comment.