Skip to content

Commit

Permalink
chore: Rename site to department
Browse files Browse the repository at this point in the history
  • Loading branch information
kongwoojin committed Mar 29, 2024
1 parent e4e8081 commit aed05e0
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ArticleActivity : ComponentActivity() {
super.onCreate(savedInstanceState)

val uuid = UUID.fromString(intent.getStringExtra("uuid"))
val department = intent.getStringExtra("site")!!
val department = intent.getStringExtra("department")!!

setContent {
ArticleMain(department = department, uuid = uuid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fun BoardContent(
onClick = {
val intent =
Intent(context, ArticleActivity::class.java)
intent.putExtra("site", department.name)
intent.putExtra("department", department.name)
intent.putExtra("uuid", it.uuid.toString())
context.startActivity(intent)
}
Expand Down Expand Up @@ -438,7 +438,7 @@ fun SearchFAB(department: Department, index: Int) {
showDialog = false
val intent = Intent(context, SearchActivity::class.java)
intent.putExtra(
"site",
"department",
department.name
)
intent.putExtra(
Expand All @@ -463,7 +463,7 @@ fun SearchFAB(department: Department, index: Int) {
showDialog = false
val intent = Intent(context, SearchActivity::class.java)
intent.putExtra(
"site",
"department",
department.name
)
intent.putExtra(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fun BoardInHome(
modifier = Modifier
.clickable {
val intent = Intent(context, ArticleActivity::class.java)
intent.putExtra("site", department.name)
intent.putExtra("department", department.name)
intent.putExtra("uuid", data.uuid.toString())
context.startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import javax.inject.Inject
class HomeBoardViewModel @Inject constructor(private val getBoardMinimumUseCase: GetBoardMinimumUseCase) :
BaseViewModel<HomeBoardState, HomeBoardEvent>(HomeBoardState()) {

fun getApi(site: String, board: String) {
sendEvent(HomeBoardEvent.FetchData(site, board))
fun getApi(department: String, board: String) {
sendEvent(HomeBoardEvent.FetchData(department, board))
}

override fun reduce(oldState: HomeBoardState, event: HomeBoardEvent) {
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/kongjak/koreatechboard/ui/search/Search.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import com.kongjak.koreatechboard.util.findActivity

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SearchScreen(site: String, board: String, title: String) {
fun SearchScreen(department: String, board: String, title: String) {
val context = LocalContext.current

Scaffold(
Expand All @@ -66,7 +66,7 @@ fun SearchScreen(site: String, board: String, title: String) {
content = { contentPadding ->
SearchContent(
contentPadding = contentPadding,
site = site,
department = department,
board = board,
title = title
)
Expand All @@ -78,7 +78,7 @@ fun SearchScreen(site: String, board: String, title: String) {
fun SearchContent(
searchViewModel: SearchViewModel = hiltViewModel(),
contentPadding: PaddingValues,
site: String,
department: String,
board: String,
title: String
) {
Expand All @@ -87,7 +87,7 @@ fun SearchContent(
val uiState by searchViewModel.uiState.collectAsState()

LaunchedEffect(key1 = Unit) {
searchViewModel.getAPI(site, board, title)
searchViewModel.getAPI(department, board, title)
}

val lazyPostList = uiState.boardData.collectAsLazyPagingItems()
Expand All @@ -112,7 +112,7 @@ fun SearchContent(
selected = false,
onClick = {
val intent = Intent(context, ArticleActivity::class.java)
intent.putExtra("site", site)
intent.putExtra("department", department)
intent.putExtra("uuid", it.uuid.toString())
context.startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SearchActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val site = intent.getStringExtra("site")!!
val department = intent.getStringExtra("department")!!
val board = intent.getStringExtra("board")!!
val title = intent.getStringExtra("title")!!

Expand All @@ -45,7 +45,7 @@ class SearchActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
SearchScreen(site, board, title)
SearchScreen(department, board, title)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import retrofit2.Response
import javax.inject.Inject

class BoardRemoteDataSource @Inject constructor(private val api: API) {
suspend fun getBoardMinimum(site: String, board: String): Response<BoardResponse> {
return api.getBoardMinimum(site, board)
suspend fun getBoardMinimum(department: String, board: String): Response<BoardResponse> {
return api.getBoardMinimum(department, board)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ import javax.inject.Inject

class BoardRepositoryImpl @Inject constructor(private val boardRemoteDataSource: BoardRemoteDataSource, private val api: API) :
BoardRepository {
override fun getBoard(site: String, board: String): Flow<PagingData<BoardData>> {
override fun getBoard(department: String, board: String): Flow<PagingData<BoardData>> {
return Pager(
config = PagingConfig(
pageSize = 20,
enablePlaceholders = false
),
pagingSourceFactory = { BoardPagingSource(api, site, board) }
pagingSourceFactory = { BoardPagingSource(api, department, board) }
).flow
}

override suspend fun getBoardMinimum(site: String, board: String): ResponseResult<Board> {
val response = boardRemoteDataSource.getBoardMinimum(site, board)
override suspend fun getBoardMinimum(department: String, board: String): ResponseResult<Board> {
val response = boardRemoteDataSource.getBoardMinimum(department, board)
return BoardMapper.mapToBoard(response.body(), response.code())
}

override fun searchTitle(
site: String,
department: String,
board: String,
title: String
): Flow<PagingData<BoardData>> {
Expand All @@ -42,7 +42,7 @@ class BoardRepositoryImpl @Inject constructor(private val boardRemoteDataSource:
pageSize = 20,
enablePlaceholders = false
),
pagingSourceFactory = { SearchTitlePagingSource(api, site, board, title) }
pagingSourceFactory = { SearchTitlePagingSource(api, department, board, title) }
).flow
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.kongjak.koreatechboard.domain.model.BoardData
import kotlinx.coroutines.flow.Flow

interface BoardRepository {
fun getBoard(site: String, board: String): Flow<PagingData<BoardData>>
suspend fun getBoardMinimum(site: String, board: String): ResponseResult<Board>
fun searchTitle(site: String, board: String, title: String): Flow<PagingData<BoardData>>
fun getBoard(department: String, board: String): Flow<PagingData<BoardData>>
suspend fun getBoardMinimum(department: String, board: String): ResponseResult<Board>
fun searchTitle(department: String, board: String, title: String): Flow<PagingData<BoardData>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.kongjak.koreatechboard.domain.repository.BoardRepository
import javax.inject.Inject

class GetBoardMinimumUseCase @Inject constructor(private val boardRepository: BoardRepository) {
suspend operator fun invoke(site: String, board: String): ResponseResult<Board> {
return boardRepository.getBoardMinimum(site, board)
suspend operator fun invoke(department: String, board: String): ResponseResult<Board> {
return boardRepository.getBoardMinimum(department, board)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class GetBoardUseCase @Inject constructor(private val boardRepository: BoardRepository) {
operator fun invoke(site: String, board: String): Flow<PagingData<BoardData>> {
return boardRepository.getBoard(site, board)
operator fun invoke(department: String, board: String): Flow<PagingData<BoardData>> {
return boardRepository.getBoard(department, board)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class SearchBoardWithTitleUseCase @Inject constructor(private val boardRepository: BoardRepository) {
operator fun invoke(site: String, board: String, title: String): Flow<PagingData<BoardData>> {
return boardRepository.searchTitle(site, board, title)
operator fun invoke(department: String, board: String, title: String): Flow<PagingData<BoardData>> {
return boardRepository.searchTitle(department, board, title)
}
}

0 comments on commit aed05e0

Please sign in to comment.