@@ -4,31 +4,41 @@ import androidx.compose.runtime.Composable
44import com.redmadrobot.debug.core.internal.CommonContainer
55import com.redmadrobot.debug.core.internal.PluginDependencyContainer
66import com.redmadrobot.debug.core.plugin.Plugin
7+ import com.redmadrobot.debug.plugin.aboutapp.model.AboutAppAction
78import com.redmadrobot.debug.plugin.aboutapp.model.AboutAppInfo
89import com.redmadrobot.debug.plugin.aboutapp.ui.AboutAppScreen
910
1011/* *
1112 * Plugin that displays information about the application in the debug panel.
1213 *
13- * Accepts an arbitrary list of "title -- value" pairs
14- * which will be shown as a list .
14+ * Accepts an arbitrary list of "title -- value" pairs which will be shown as a list,
15+ * plus an optional list of custom action buttons rendered below the info section .
1516 *
1617 * @param appInfoList list of information entries to display.
17- * Must contain at least one element .
18- * @throws IllegalStateException if [appInfoList] is empty
18+ * @param actions list of custom action buttons rendered below the info section .
19+ * @throws IllegalStateException if both [appInfoList] and [actions] are empty
1920 *
2021 * @see AboutAppInfo
22+ * @see AboutAppAction
2123 */
2224public class AboutAppPlugin (
23- private val appInfoList : List <AboutAppInfo >
25+ private val appInfoList : List <AboutAppInfo >,
26+ private val actions : List <AboutAppAction > = emptyList(),
2427) : Plugin() {
2528 init {
26- appInfoList.firstOrNull()
27- ? : error(" AboutAppPlugin can't be initialized. At least one information block must be set." )
29+ check(appInfoList.isNotEmpty() || actions.isNotEmpty()) {
30+ " AboutAppPlugin can't be initialized. " +
31+ " At least one information block or one action must be set."
32+ }
2833 }
2934
3035 override fun getPluginContainer (commonContainer : CommonContainer ): PluginDependencyContainer {
31- return AboutAppPluginContainer (appInfoList = appInfoList, commonContainer = commonContainer)
36+ return AboutAppPluginContainer (
37+ appInfoList = appInfoList,
38+ actions = actions,
39+ commonContainer = commonContainer,
40+ pushEvent = ::pushEvent,
41+ )
3242 }
3343
3444 override fun getName (): String = NAME
0 commit comments