Skip to content

Commit

Permalink
Merge pull request #95 from snuhcs-course/dev
Browse files Browse the repository at this point in the history
Final merge Dev into Main
  • Loading branch information
SeongjunJo authored Dec 10, 2023
2 parents 076fcc6 + 91cfd82 commit 89abfad
Show file tree
Hide file tree
Showing 39 changed files with 904 additions and 864 deletions.
4 changes: 4 additions & 0 deletions frontend/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ android {

buildTypes {
release {
isDebuggable = false
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
debug {
isDebuggable = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class HomeScreenUITest {
personalUser_loginToHomeScreen()
composeTestRule.onNodeWithContentDescription("calendar icon")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.assertIsNotDisplayed()
}

Expand All @@ -114,7 +114,7 @@ class HomeScreenUITest {
.performClick()
composeTestRule.onNodeWithText("Sunday, December 10, 2023")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.onNodeWithText("행사 불러오는 중...")
.isDisplayed()
Expand All @@ -127,7 +127,7 @@ class HomeScreenUITest {
.performClick()
composeTestRule.onNodeWithText("Sunday, December 10, 2023")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.waitUntil(5000) {
composeTestRule.onNodeWithText("SNUPO SNUp\nSNUPO & SNUpia 하계 앙상블")
Expand All @@ -144,7 +144,7 @@ class HomeScreenUITest {
.performClick()
composeTestRule.onNodeWithText("Sunday, December 10, 2023")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.waitUntil(5000) {
composeTestRule.onNodeWithText("행사 추천 받기")
Expand All @@ -167,7 +167,7 @@ class HomeScreenUITest {
.performClick()
composeTestRule.onNodeWithText("Friday, December 1, 2023")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.waitUntil(5000) {
composeTestRule.onNodeWithText("오늘은 예정된 축제가 없어요!")
Expand All @@ -184,7 +184,7 @@ class HomeScreenUITest {
.performClick()
composeTestRule.onNodeWithText("Friday, December 1, 2023")
.performClick()
composeTestRule.onNodeWithText("OK")
composeTestRule.onNodeWithText("확인")
.performClick()
composeTestRule.waitUntil(5000) {
composeTestRule.onNodeWithText("행사 불러오는 중...")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.haengsha.model.dataSource

import java.time.LocalDate

data class EventCardData(
val id: Int,
val organizer: String,
val eventTitle: String,
val startDate: LocalDate,
val endDate: LocalDate,
val likes: Int,
val favorites: Int,
val eventType: String,
val place: String = "",
val time: String = "",
val image: String = ""
)

data class TabItem(
val title: String,
val eventCards: List<EventCardData>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.haengsha.model.dataSource

import com.example.haengsha.R

enum class SampleImage(val id: Int) {
ImageFestival1(R.drawable.f_alchole),
ImageFestival2(R.drawable.f_animu),
ImageFestival3(R.drawable.f_cinema),
ImageFestival4(R.drawable.f_cushion),
ImageFestival5(R.drawable.f_dongsojae),
ImageFestival6(R.drawable.f_goahead),
ImageFestival7(R.drawable.f_meeting),
ImageFestival8(R.drawable.f_pub),
ImageFestival9(R.drawable.f_recruite),
ImageFestival10(R.drawable.f_taco),
ImageAcademic1(R.drawable.a_aiseminar),
ImageAcademic2(R.drawable.a_artspace),
ImageAcademic3(R.drawable.a_bookconcert),
ImageAcademic4(R.drawable.a_law),
ImageAcademic5(R.drawable.a_math),
ImageAcademic6(R.drawable.a_music),
ImageAcademic7(R.drawable.a_piano),
ImageAcademic8(R.drawable.a_social),
ImageAcademic9(R.drawable.a_writing),
ImageAcademic10(R.drawable.a_network),
ImageAcademicDefault(R.drawable.a_snu_enterance)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.haengsha.model.route

sealed class HomeRoute(val route: String) {
data object Home : HomeRoute("Home")
data object HomeDetail : HomeRoute("Details")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.update
class BoardViewModel : ViewModel() {
private val _boardUiState = MutableStateFlow(BoardUiState())
val boardUiState = _boardUiState.asStateFlow()
private val _tempBoardUiState = MutableStateFlow(BoardUiState())

private val _boardPostUiState = MutableStateFlow(BoardPostUiState())
val boardPostUiState = _boardPostUiState.asStateFlow()
Expand Down Expand Up @@ -79,13 +80,24 @@ class BoardViewModel : ViewModel() {
updateSearchParameter(newEndDate, "endDate", "filter")
}

fun updateFilterInitialState() {
updateSearchParameter("foo", "bar", "filter")
fun savePreviousFilter() {
_tempBoardUiState.value = _boardUiState.value
}

fun resetFilterInitialState() {
fun cancelFilter() {
_boardUiState.value = _tempBoardUiState.value
}

fun resetFilter() {
_boardUiState.update { currentState ->
currentState.copy(initialState = true)
currentState.copy(
token = currentState.token,
keyword = currentState.keyword,
isFestival = 2,
startDate = "",
endDate = "",
initialState = currentState.initialState
)
}
}

Expand Down Expand Up @@ -120,7 +132,7 @@ class BoardViewModel : ViewModel() {
isFestival = if (type == "isFestival") newParameter.toInt() else currentState.isFestival,
startDate = if (type == "startDate") newParameter else currentState.startDate,
endDate = if (type == "endDate") newParameter else currentState.endDate,
initialState = false
initialState = if (type == "keyword") false else currentState.initialState
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@ package com.example.haengsha.model.viewModel.home

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.haengsha.ui.screens.home.EventCardData
import com.example.haengsha.model.dataSource.EventCardData
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import java.time.LocalDate

class HomeViewModel : ViewModel() {
private val selectedDate = MutableLiveData(LocalDate.now())
private val _selectedDate = MutableStateFlow(LocalDate.now())
val selectedDate = _selectedDate.asStateFlow()
var initialEnter = true
var selectionChanged = false
var initialRecommendationState = true
val festivalItems = MutableLiveData<List<EventCardData>?>()
val academicItems = MutableLiveData<List<EventCardData>?>()

fun updateSelectedDate(newDate: LocalDate) {
selectedDate.value = newDate // Update functions to set LiveData properties
if (_selectedDate.value != newDate) {
_selectedDate.value = newDate
selectionChanged = true
}
}

fun updateEventItems(
Expand Down
12 changes: 12 additions & 0 deletions frontend/app/src/main/java/com/example/haengsha/ui/HaengshaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ fun HaengshaApp(mainNavController: NavHostController = rememberNavController())
}
}
}
} else if (currentScreenType == "Home") {
mainNavController.navigate(MainRoute.Home.route) {
if (backStackEntry.value?.destination?.route == "Home") {
mainNavController.popBackStack()
}
}
} else {
mainNavController.navigate(MainRoute.Favorite.route) {
if (backStackEntry.value?.destination?.route == "Favorite") {
Expand Down Expand Up @@ -192,6 +198,9 @@ fun HaengshaApp(mainNavController: NavHostController = rememberNavController())
Home(
homeViewModel = homeViewModel,
homeApiViewModel = homeApiViewModel,
boardApiViewModel = boardApiViewModel,
boardViewModel = boardViewModel,
navigationViewModel = navigationViewModel,
innerPadding = innerPadding,
userUiState = userUiState,
)
Expand Down Expand Up @@ -364,6 +373,9 @@ fun HaengshaApp(mainNavController: NavHostController = rememberNavController())
is LoginApiUiState.Success -> {
userViewModel.resetUserData()
loginApiViewModel.resetLoginApiUiState()
homeViewModel.initialEnter = true
homeViewModel.selectionChanged = false
homeViewModel.initialRecommendationState = true
boardViewModel.resetBoardUiState()
boardApiViewModel.resetBoardListUiStateToLoading()
mainNavController.navigate(MainRoute.Login.route) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ import com.example.haengsha.ui.theme.ButtonBlue
import com.example.haengsha.ui.theme.HaengshaBlue
import com.example.haengsha.ui.theme.PlaceholderGrey
import com.example.haengsha.ui.theme.poppins
import com.example.haengsha.ui.uiComponents.BoardDatePickerDialog
import com.example.haengsha.ui.uiComponents.CheckBox
import com.example.haengsha.ui.uiComponents.ConfirmDialog
import com.example.haengsha.ui.uiComponents.CustomCircularProgressIndicator
import com.example.haengsha.ui.uiComponents.CustomDatePickerDialog
import com.example.haengsha.ui.uiComponents.CustomHorizontalDivider
import com.example.haengsha.ui.uiComponents.CustomVerticalDivider
import com.example.haengsha.ui.uiComponents.customLargeTextField
Expand Down Expand Up @@ -575,7 +575,7 @@ fun BoardPostScreen(
}

if (startDatePick) {
CustomDatePickerDialog(
BoardDatePickerDialog(
onDismissRequest = { startDatePick = false },
boardViewModel = boardViewModel,
type = "startDate",
Expand All @@ -584,7 +584,7 @@ fun BoardPostScreen(
}

if (endDatePick) {
CustomDatePickerDialog(
BoardDatePickerDialog(
onDismissRequest = { endDatePick = false },
boardViewModel = boardViewModel,
type = "endDate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ import com.example.haengsha.ui.theme.ButtonBlue
import com.example.haengsha.ui.theme.HaengshaBlue
import com.example.haengsha.ui.theme.PlaceholderGrey
import com.example.haengsha.ui.theme.poppins
import com.example.haengsha.ui.uiComponents.BoardDatePickerDialog
import com.example.haengsha.ui.uiComponents.CustomCircularProgressIndicator
import com.example.haengsha.ui.uiComponents.CustomDatePickerDialog
import com.example.haengsha.ui.uiComponents.CustomHorizontalDivider
import com.example.haengsha.ui.uiComponents.FilterDialog
import com.example.haengsha.ui.uiComponents.SearchBar
import com.example.haengsha.ui.uiComponents.listItem
import com.example.haengsha.ui.uiComponents.boardListItem
import es.dmoral.toasty.Toasty

@Composable
Expand Down Expand Up @@ -141,6 +141,7 @@ fun BoardScreen(
val filterText =
if (filterDateText.isEmpty()) filterCategoryText else "$filterDateText, $filterCategoryText"
Text(
modifier = Modifier.padding(top = 2.dp),
text = "필터 : $filterText",
fontFamily = poppins,
fontSize = 12.sp,
Expand Down Expand Up @@ -268,7 +269,7 @@ fun BoardScreen(
boardViewModel.updateEventId(event.id)
boardNavController.navigate(BoardRoute.BoardDetail.route)
}) {
listItem(
boardListItem(
isFavorite = false,
event = event
)
Expand Down Expand Up @@ -314,7 +315,7 @@ fun BoardScreen(
}

if (startDatePick) {
CustomDatePickerDialog(
BoardDatePickerDialog(
onDismissRequest = { startDatePick = false },
boardViewModel = boardViewModel,
type = "startDate",
Expand All @@ -323,7 +324,7 @@ fun BoardScreen(
}

if (endDatePick) {
CustomDatePickerDialog(
BoardDatePickerDialog(
onDismissRequest = { endDatePick = false },
boardViewModel = boardViewModel,
type = "endDate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import com.example.haengsha.ui.theme.PlaceholderGrey
import com.example.haengsha.ui.theme.poppins
import com.example.haengsha.ui.uiComponents.CustomCircularProgressIndicator
import com.example.haengsha.ui.uiComponents.CustomHorizontalDivider
import com.example.haengsha.ui.uiComponents.listItem
import com.example.haengsha.ui.uiComponents.boardListItem
import es.dmoral.toasty.Toasty

@Composable
Expand Down Expand Up @@ -184,7 +184,7 @@ fun FavoriteScreen(
boardViewModel.updateEventId(event.id)
favoriteNavController.navigate(FavoriteRoute.FavoriteDetail.route)
}) {
listItem(
boardListItem(
isFavorite = true,
event = event
)
Expand Down
Loading

0 comments on commit 89abfad

Please sign in to comment.