@@ -120,9 +120,15 @@ internal fun ListManagerScreen(
120
120
tagData = config.speechRule.tagData.toString(),
121
121
onDismissRequest = { showTagClearDialog = null },
122
122
onConfirm = {
123
- config.speechRule.target = SpeechTarget .ALL
124
- config.speechRule.resetTag()
125
- dbm.systemTtsV2.update(systts)
123
+ dbm.systemTtsV2.update(
124
+ systts.copy(
125
+ config = config.copy(
126
+ speechRule = config.speechRule.copy(
127
+ target = SpeechTarget .ALL ,
128
+ ).apply { resetTag() },
129
+ )
130
+ )
131
+ )
126
132
if (systts.isEnabled) SystemTtsService .notifyUpdateConfig()
127
133
showTagClearDialog = null
128
134
}
@@ -135,9 +141,9 @@ internal fun ListManagerScreen(
135
141
context.longToast(R .string.systts_drag_tip_msg)
136
142
}
137
143
138
- val model = systts.copy()
139
- val config = model.config as TtsConfigurationDTO
144
+ val config = systts.config as TtsConfigurationDTO
140
145
if (config.speechRule.target == SpeechTarget .BGM ) return
146
+ val ruleData = config.speechRule.copy()
141
147
142
148
if (config.speechRule.target == SpeechTarget .TAG ) dbm.speechRuleDao.getByRuleId(
143
149
config.speechRule.tagRuleId
@@ -148,34 +154,34 @@ internal fun ListManagerScreen(
148
154
val nextIndex = (idx + 1 )
149
155
val newTag = keys.getOrNull(nextIndex)
150
156
if (newTag == null ) {
151
- if (config.speechRule .isTagDataEmpty()) {
152
- config.speechRule .target = SpeechTarget .ALL
153
- config.speechRule .resetTag()
157
+ if (ruleData .isTagDataEmpty()) {
158
+ ruleData .target = SpeechTarget .ALL
159
+ ruleData .resetTag()
154
160
} else {
155
- showTagClearDialog = model
161
+ showTagClearDialog = systts
156
162
return
157
163
}
158
164
} else {
159
- config.speechRule .tag = newTag
165
+ ruleData .tag = newTag
160
166
runCatching {
161
- config.speechRule .tagName =
162
- SpeechRuleEngine .getTagName(context, speechRule, info = config.speechRule )
167
+ ruleData .tagName =
168
+ SpeechRuleEngine .getTagName(context, speechRule, info = ruleData )
163
169
}.onFailure {
164
- config.speechRule .tagName = " "
170
+ ruleData .tagName = " "
165
171
context.displayErrorDialog(it)
166
172
}
167
173
168
174
}
169
175
}
170
176
else {
171
- dbm.speechRuleDao.getByRuleId(config.speechRule .tagRuleId)?.let {
172
- config.speechRule .target = SpeechTarget .TAG
173
- config.speechRule .tag = it.tags.keys.first()
177
+ dbm.speechRuleDao.getByRuleId(ruleData .tagRuleId)?.let {
178
+ ruleData .target = SpeechTarget .TAG
179
+ ruleData .tag = it.tags.keys.first()
174
180
}
175
181
}
176
182
177
- dbm.systemTtsV2.update(model )
178
- if (model .isEnabled) SystemTtsService .notifyUpdateConfig()
183
+ dbm.systemTtsV2.update(systts.copy(config = systts.ttsConfig.copy(speechRule = ruleData)) )
184
+ if (systts .isEnabled) SystemTtsService .notifyUpdateConfig()
179
185
}
180
186
181
187
var deleteTts by remember { mutableStateOf<SystemTtsV2 ?>(null ) }
0 commit comments