Skip to content

Commit

Permalink
Merge pull request #10 from Team-Linky/develop
Browse files Browse the repository at this point in the history
v1.0.04
  • Loading branch information
sun5066 authored Jul 28, 2024
2 parents 1c3ab9a + 4e6a64d commit bbe5f7d
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object VersionConstants {
const val MIN_SDK = 24
const val TARGET_SDK = 34

const val VERSION_CODE = 3
const val VERSION_NAME = "1.0.03"
const val VERSION_CODE = 4
const val VERSION_NAME = "1.0.04"

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface LinkDao {
suspend fun deleteRemovedAll()

@Transaction
@Query("SELECT * FROM link WHERE isRemove == 0")
@Query("SELECT * FROM link WHERE isRemove == 0 ORDER BY link.createAt DESC")
fun selectPage(): PagingSource<Int, LinkWithTags>

@Query("SELECT * FROM link WHERE pk == :id")
Expand All @@ -51,6 +51,7 @@ interface LinkDao {
)
)
AND isRemove == 0
ORDER BY link.createAt DESC
"""
)
fun selectLinksByTagName(tagName: String): PagingSource<Int, LinkWithTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.linky.timeline

import androidx.activity.ComponentActivity
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -179,16 +180,22 @@ private fun TimeLineScreen(
derivedStateOf { linksPager.loadState.append is LoadState.Loading && linksPager.itemCount > 0 }
}

val showHeader by remember(listState) {
derivedStateOf { listState.firstVisibleItemIndex < 1 }
}

Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.background),
horizontalAlignment = Alignment.CenterHorizontally
) {
TimeLineHeader(
sortType = sortType,
onChangeSort = onChangeSort,
)
AnimatedVisibility(visible = showHeader) {
TimeLineHeader(
sortType = sortType,
onChangeSort = onChangeSort,
)
}
Box(
modifier = Modifier.weight(1f),
contentAlignment = Alignment.TopCenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TimeLineViewModel @Inject constructor(
}
}

init {
private fun getLinks() {
intent {
val links = savedStateHandle.get<String>(INTENT_KEY_TAG_NAME)
?.let { selectLinkByTagNameUseCase.invoke(it) }
Expand All @@ -58,6 +58,10 @@ class TimeLineViewModel @Inject constructor(
reduce { state.copy(links = links.cachedIn(viewModelScope)) }
}
}

init {
getLinks()
}
}

sealed interface TimeLineAction {
Expand Down
Loading

0 comments on commit bbe5f7d

Please sign in to comment.