@@ -63,7 +63,7 @@ fun ExpertModeDialog(
6363 onProceed : () -> Unit ,
6464 allowIncompatible : Boolean = false
6565) {
66- var selectedPatchForOptions by remember { mutableStateOf<Pair <Int , PatchInfo >? > (null ) }
66+ var selectedPatchForOptions by remember { mutableStateOf<Triple <Int , PatchInfo , Boolean >? > (null ) }
6767 var searchQuery by remember { mutableStateOf(" " ) }
6868 var searchVisible by remember { mutableStateOf(false ) }
6969 var showMultipleSourcesWarning by remember { mutableStateOf(false ) }
@@ -294,7 +294,7 @@ fun ExpertModeDialog(
294294 isEnabled = isEnabled,
295295 onToggle = { togglePatch(bundle.uid, patch.name) },
296296 onConfigureOptions = {
297- if (! patch.options.isNullOrEmpty()) selectedPatchForOptions = bundle.uid to patch
297+ if (! patch.options.isNullOrEmpty()) selectedPatchForOptions = Triple ( bundle.uid, patch, bundle.uid == 0 )
298298 },
299299 hasOptions = ! patch.options.isNullOrEmpty()
300300 )
@@ -415,7 +415,7 @@ fun ExpertModeDialog(
415415 isEnabled = isEnabled,
416416 onToggle = { togglePatch(bundle.uid, patch.name) },
417417 onConfigureOptions = {
418- if (! patch.options.isNullOrEmpty()) selectedPatchForOptions = bundle.uid to patch
418+ if (! patch.options.isNullOrEmpty()) selectedPatchForOptions = Triple ( bundle.uid, patch, bundle.uid == 0 )
419419 },
420420 hasOptions = ! patch.options.isNullOrEmpty()
421421 )
@@ -456,9 +456,10 @@ fun ExpertModeDialog(
456456 }
457457
458458 // Options dialog
459- selectedPatchForOptions?.let { (bundleUid, patch) ->
459+ selectedPatchForOptions?.let { (bundleUid, patch, isDefaultBundle ) ->
460460 PatchOptionsDialog (
461461 patch = patch,
462+ isDefaultBundle = isDefaultBundle,
462463 values = options[bundleUid]?.get(patch.name),
463464 onValueChange = { key, value ->
464465 onOptionChange(bundleUid, patch.name, key, value)
@@ -676,11 +677,15 @@ private fun EmptyStateContent(
676677@Composable
677678private fun PatchOptionsDialog (
678679 patch : PatchInfo ,
680+ isDefaultBundle : Boolean ,
679681 values : Map <String , Any ?>? ,
680682 onValueChange : (String , Any? ) -> Unit ,
681683 onReset : () -> Unit ,
682684 onDismiss : () -> Unit
683685) {
686+ // Derive the target package from the patch's compatible packages list
687+ val packageName = patch.compatiblePackages?.firstOrNull()?.packageName.orEmpty()
688+
684689 var showColorPicker by remember { mutableStateOf<Pair <String , String >? > (null ) }
685690
686691 MorpheDialog (
@@ -756,6 +761,8 @@ private fun PatchOptionsDialog(
756761 description = option.description,
757762 value = value?.toString() ? : " " ,
758763 presets = option.presets,
764+ packageName = packageName,
765+ isDefaultBundle = isDefaultBundle,
759766 onValueChange = { onValueChange(key, it) }
760767 )
761768 }
@@ -788,6 +795,8 @@ private fun PatchOptionsDialog(
788795 title = option.title,
789796 description = option.description,
790797 value = value?.toString() ? : " " ,
798+ packageName = packageName,
799+ isDefaultBundle = isDefaultBundle,
791800// required = option.required,
792801 onValueChange = { onValueChange(key, it) }
793802 )
@@ -1017,6 +1026,8 @@ private fun PathInputOption(
10171026 title : String ,
10181027 description : String ,
10191028 value : String ,
1029+ packageName : String ,
1030+ isDefaultBundle : Boolean ,
10201031// required: Boolean,
10211032 onValueChange : (String ) -> Unit
10221033) {
@@ -1063,8 +1074,8 @@ private fun PathInputOption(
10631074 onFolderPickerClick = { folderPicker() }
10641075 )
10651076
1066- // Create Icon button
1067- if (isIconField) {
1077+ // Create Icon button (only for the default Morphe bundle)
1078+ if (isIconField && isDefaultBundle ) {
10681079 MorpheDialogOutlinedButton (
10691080 text = stringResource(R .string.adaptive_icon_create),
10701081 onClick = { showIconCreator = true },
@@ -1073,8 +1084,8 @@ private fun PathInputOption(
10731084 )
10741085 }
10751086
1076- // Create Header button
1077- if (isHeaderField) {
1087+ // Create Header button (only for the default Morphe bundle)
1088+ if (isHeaderField && isDefaultBundle ) {
10781089 MorpheDialogOutlinedButton (
10791090 text = stringResource(R .string.header_creator_create),
10801091 onClick = { showHeaderCreator = true },
@@ -1100,6 +1111,7 @@ private fun PathInputOption(
11001111 // Icon creator dialog
11011112 if (showIconCreator) {
11021113 AdaptiveIconCreatorDialog (
1114+ packageName = packageName,
11031115 onDismiss = { showIconCreator = false },
11041116 onIconCreated = { path ->
11051117 onValueChange(path)
@@ -1111,6 +1123,7 @@ private fun PathInputOption(
11111123 // Header creator dialog
11121124 if (showHeaderCreator) {
11131125 HeaderCreatorDialog (
1126+ packageName = packageName,
11141127 onDismiss = { showHeaderCreator = false },
11151128 onHeaderCreated = { path ->
11161129 onValueChange(path)
@@ -1130,6 +1143,8 @@ private fun PathWithPresetsOption(
11301143 description : String ,
11311144 value : String ,
11321145 presets : Map <String , * >,
1146+ packageName : String ,
1147+ isDefaultBundle : Boolean ,
11331148 onValueChange : (String ) -> Unit
11341149) {
11351150 var showIconCreator by remember { mutableStateOf(false ) }
@@ -1185,8 +1200,8 @@ private fun PathWithPresetsOption(
11851200 onFolderPickerClick = { folderPicker() }
11861201 )
11871202
1188- // Create Icon button
1189- if (isIconField) {
1203+ // Create Icon button (only for the default Morphe bundle)
1204+ if (isIconField && isDefaultBundle ) {
11901205 MorpheDialogOutlinedButton (
11911206 text = stringResource(R .string.adaptive_icon_create),
11921207 onClick = { showIconCreator = true },
@@ -1195,8 +1210,8 @@ private fun PathWithPresetsOption(
11951210 )
11961211 }
11971212
1198- // Create Header button
1199- if (isHeaderField) {
1213+ // Create Header button (only for the default Morphe bundle)
1214+ if (isHeaderField && isDefaultBundle ) {
12001215 MorpheDialogOutlinedButton (
12011216 text = stringResource(R .string.header_creator_create),
12021217 onClick = { showHeaderCreator = true },
@@ -1224,6 +1239,7 @@ private fun PathWithPresetsOption(
12241239 // Icon creator dialog
12251240 if (showIconCreator) {
12261241 AdaptiveIconCreatorDialog (
1242+ packageName = packageName,
12271243 onDismiss = { showIconCreator = false },
12281244 onIconCreated = { path ->
12291245 onValueChange(path)
@@ -1235,6 +1251,7 @@ private fun PathWithPresetsOption(
12351251 // Header creator dialog
12361252 if (showHeaderCreator) {
12371253 HeaderCreatorDialog (
1254+ packageName = packageName,
12381255 onDismiss = { showHeaderCreator = false },
12391256 onHeaderCreated = { path ->
12401257 onValueChange(path)
0 commit comments