-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/#94 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/#94 #95
Changes from all commits
cf2ce0c
7ab8fb7
90c37b3
acdd8ff
cfc2fcc
1d66cff
8f75a42
aaec583
4fceb18
2568964
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package com.metasearch.android.core.common.utils | ||
|
|
||
| import android.content.Context | ||
| import androidx.annotation.StringRes | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.res.stringResource | ||
|
|
||
| @Suppress("SpreadOperator") | ||
| sealed interface UiText { | ||
| data class DynamicString(val value: String) : UiText | ||
|
|
||
| class StringResource( | ||
| @StringRes val resId: Int, | ||
| vararg val args: Any, | ||
| ) : UiText | ||
|
|
||
| @Composable | ||
| fun asString(): String { | ||
| return when (this) { | ||
| is DynamicString -> value | ||
| is StringResource -> stringResource(resId, *args) | ||
| } | ||
| } | ||
|
|
||
| fun asString(context: Context): String { | ||
| return when (this) { | ||
| is DynamicString -> value | ||
| is StringResource -> context.getString(resId, *args) | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||
| package com.metasearch.android.feature.detail.graph | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import androidx.compose.runtime.Composable | ||||||||||||||||||||||||||||
| import androidx.compose.runtime.LaunchedEffect | ||||||||||||||||||||||||||||
| import androidx.compose.ui.platform.LocalContext | ||||||||||||||||||||||||||||
| import com.metasearch.android.core.common.utils.MetaSearchEvent | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| @Composable | ||||||||||||||||||||||||||||
| fun GraphDetailSideEffect( | ||||||||||||||||||||||||||||
| state: GraphDetailUiState, | ||||||||||||||||||||||||||||
| eventSink: (GraphDetailUiEvent) -> Unit, | ||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||
| val context = LocalContext.current | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| LaunchedEffect(state.sideEffect) { | ||||||||||||||||||||||||||||
| when (state.sideEffect) { | ||||||||||||||||||||||||||||
| is GraphDetailSideEffect.ShowToast -> { | ||||||||||||||||||||||||||||
| MetaSearchEvent.ShowToast(message = state.sideEffect.message.asString(context)) | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find all SideEffect-related files and locate the files mentioned in the review
find . -name "*SideEffect*" -type f | head -20Repository: komodgn/meta-android Length of output: 818 🏁 Script executed: # Check the current state of GraphDetailSideEffect.kt, specifically around lines 17-19
find . -name "GraphDetailSideEffect.kt" -type fRepository: komodgn/meta-android Length of output: 163 🏁 Script executed: # Also search for NLSearchSideEffect.kt
find . -name "NLSearchSideEffect.kt" -type fRepository: komodgn/meta-android Length of output: 158 🏁 Script executed: cat -n ./feature/detail/src/main/java/com/metasearch/android/feature/detail/graph/GraphDetailSideEffect.ktRepository: komodgn/meta-android Length of output: 1087 🏁 Script executed: cat -n ./feature/search/src/main/java/com/metasearch/android/feature/search/nls/NLSearchSideEffect.ktRepository: komodgn/meta-android Length of output: 1281 🏁 Script executed: # Search for EventHandler usage pattern to understand the correct dispatch method
rg "EventHandler\.sendEvent" --type kotlin -B 2 -A 2 | head -50Repository: komodgn/meta-android Length of output: 4050 🏁 Script executed: # Check if there are any other ShowToast or EventHandler references in GraphDetailSideEffect.kt
rg "ShowToast|EventHandler" ./feature/detail/src/main/java/com/metasearch/android/feature/detail/graph/GraphDetailSideEffect.ktRepository: komodgn/meta-android Length of output: 212 🏁 Script executed: # Verify the line count of GraphDetailSideEffect.kt to ensure we're seeing the full file
wc -l ./feature/detail/src/main/java/com/metasearch/android/feature/detail/graph/GraphDetailSideEffect.ktRepository: komodgn/meta-android Length of output: 166 Add missing
Fix+import com.metasearch.android.core.common.utils.EventHandler
import com.metasearch.android.core.common.utils.MetaSearchEvent is GraphDetailSideEffect.ShowToast -> {
- MetaSearchEvent.ShowToast(message = state.sideEffect.message.asString(context))
+ EventHandler.sendEvent(
+ MetaSearchEvent.ShowToast(message = state.sideEffect.message.asString(context))
+ )
}📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| else -> {} | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if (state.sideEffect != null) { | ||||||||||||||||||||||||||||
| eventSink(GraphDetailUiEvent.InitSideEffect) | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 1066
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 1523
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 1392
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 112
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 1701
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 413
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 4754
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 1540
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 704
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 424
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 120
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 828
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 505
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 2134
🏁 Script executed:
Repository: komodgn/meta-android
Length of output: 523
Use
apiscope forkotlinx-collections-immutableto ensure transitive availability for State types.FocusingSearchUiStateexposesImmutableList<CircleModel>as a public field—a type that becomes part of the public API. Withimplementationscope, the dependency is not transitive; modules depending on feature modules won't haveImmutableListon their compile classpath. While most State types are consumed through the Circuit runtime and may not require direct type references, any code that imports these State classes (for testing, navigation setup, or composition) will fail to compile without the dependency.Changing to
apiscope ensures the type is available to all consumers of feature modules and eliminates a potential compilation surprise.Suggested change
📝 Committable suggestion
🤖 Prompt for AI Agents