File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
app/src/main/java/com/capyreader/app/ui/articles
capy/src/main/java/com/jocmp/capy/logging Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -5,23 +5,20 @@ import androidx.compose.runtime.LaunchedEffect
55import com.capyreader.app.preferences.AppPreferences
66import com.jocmp.capy.Article
77import org.koin.compose.koinInject
8+ import com.jocmp.capy.logging.CapyLog
89
910@Composable
1011fun ArticleHandler (
1112 article : Article ? ,
1213 appPreferences : AppPreferences = koinInject(),
1314 onRequestArticle : (articleID: String ) -> Unit ,
1415) {
15- LaunchedEffect (article?.id) {
16- if (article != null ) {
17- return @LaunchedEffect
18- }
19-
20- val articleID = appPreferences.articleID.get()
21-
22- if (articleID.isNotBlank()) {
23- appPreferences.articleID.delete()
24- onRequestArticle(articleID)
16+ LaunchedEffect (article?.id, state) {
17+ if (article != null && state?.pane != ThreePaneScaffoldRole .Primary ) {
18+ CapyLog .info(" launch" , mapOf (" id" to article.id))
19+ onNavigateToArticle(article)
20+ } else {
21+ CapyLog .info(" skip" , mapOf (" id" to article?.id, " state" to state?.pane))
2522 }
2623 }
2724}
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ object CapyLog : Logging {
77 Log .d(TAG , serializeData(event, data))
88 }
99
10+ override fun info (tag : String , data : Map <String , Any ?>) {
11+ Log .i(appTag(tag), serializeData(data))
12+ }
13+
1014 override fun info (event : String , data : Map <String , Any ?>) {
1115 Log .i(TAG , serializeData(event, data))
1216 }
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package com.jocmp.capy.logging
33interface Logging {
44 fun debug (event : String , data : Map <String , Any ?> = emptyMap())
55
6+ fun info (tag : String , data : Map <String , Any ?> = emptyMap())
7+
68 fun info (event : String , data : Map <String , Any ?> = emptyMap())
79
810 fun warn (event : String , data : Map <String , String ?> = emptyMap())
You can’t perform that action at this time.
0 commit comments