-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
507daef
commit 3416e5f
Showing
12 changed files
with
314 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
core/model/src/main/java/store/newsbriefing/app/core/model/BriefingArticle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
package store.newsbriefing.app.core.model | ||
|
||
import java.time.ZonedDateTime | ||
|
||
data class BriefingArticle( | ||
val id: Long, | ||
val ranks: Int, | ||
val title: String, | ||
val subtitle: String, | ||
val content: String, | ||
val date: ZonedDateTime, | ||
val date: String, | ||
val articles: List<BriefingArticleRelated>, | ||
val isScrap: Boolean, | ||
val isBriefingOpen: Boolean, | ||
val isWarning: Boolean, | ||
val scrapCount: Int, | ||
val gptModel: String, | ||
val timeOfDay: String, | ||
val type: String | ||
val timeOfDay: TimeOfDay, | ||
val category: BriefingArticleCategory | ||
) |
1 change: 1 addition & 0 deletions
1
core/model/src/main/java/store/newsbriefing/app/core/model/BriefingArticleCategory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 32 additions & 5 deletions
37
...ewsdetail/src/main/java/store/newsbriefing/app/feature/newsdetail/NewsDetailNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,50 @@ | ||
package store.newsbriefing.app.feature.newsdetail | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptionsBuilder | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import java.net.URLDecoder | ||
import java.net.URLEncoder | ||
import kotlin.text.Charsets.UTF_8 | ||
|
||
private val URL_CHARACTER_ENCODING = UTF_8.name() | ||
|
||
internal const val NEWS_ID_ARG = "newsId" | ||
const val NewsDetailRoute = "news_detail_route" | ||
|
||
fun NavController.navigateToNewsDetail() { | ||
navigate(NewsDetailRoute) | ||
internal class NewsDetailArgs(val newsId: String) { | ||
constructor(savedStateHandle: SavedStateHandle) : | ||
this(URLDecoder.decode(checkNotNull(savedStateHandle[NEWS_ID_ARG]), URL_CHARACTER_ENCODING)) | ||
} | ||
|
||
fun NavController.navigateToNewsDetail(newsId: String, navOptions: NavOptionsBuilder.() -> Unit = {}) { | ||
navigate(createNewsDetailRoute(newsId)) { | ||
navOptions() | ||
} | ||
} | ||
|
||
fun createNewsDetailRoute(newsId: String): String { | ||
val encodedId = URLEncoder.encode(newsId, URL_CHARACTER_ENCODING) | ||
return "$NewsDetailRoute/$encodedId" | ||
} | ||
|
||
fun NavGraphBuilder.newsDetailScreen( | ||
showSnackbar: (String) -> Unit | ||
showSnackbar: (String) -> Unit, | ||
navigateUp: () -> Unit | ||
) { | ||
composable( | ||
route = NewsDetailRoute | ||
route = "${NewsDetailRoute}/{$NEWS_ID_ARG}", | ||
arguments = listOf( | ||
navArgument(NEWS_ID_ARG) { type = NavType.StringType }, | ||
), | ||
) { | ||
NewsDetailRoute( | ||
showSnackbar = showSnackbar | ||
showSnackbar = showSnackbar, | ||
navigateUp = navigateUp | ||
) | ||
} | ||
} |
Oops, something went wrong.