Skip to content

Commit 00b0374

Browse files
committed
Make modId property private and initialize in onCreate
Changed modId from a val to a private set var and moved its initialization to onCreate. This ensures modId is only set once the intent is available, improving encapsulation and lifecycle correctness.
1 parent 475c46b commit 00b0374

File tree

1 file changed

+6
-3
lines changed
  • webui/src/main/kotlin/com/dergoogler/mmrl/webui/activity

1 file changed

+6
-3
lines changed

webui/src/main/kotlin/com/dergoogler/mmrl/webui/activity/WXActivity.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ open class WXActivity : ComponentActivity() {
8686
*
8787
* @return The [ModId] if found, otherwise `null`.
8888
*/
89-
val modId: ModId? = intent.getModId()
89+
var modId: ModId? = null
90+
private set
9091

9192
/**
9293
* Executes a block of code with the ModId if it exists in the intent.
@@ -135,6 +136,8 @@ open class WXActivity : ComponentActivity() {
135136
super.onCreate(savedInstanceState)
136137
enableEdgeToEdge()
137138

139+
modId = intent.getModId()
140+
138141
onRender(savedInstanceState)
139142
registerBackEvents()
140143

@@ -229,10 +232,10 @@ open class WXActivity : ComponentActivity() {
229232
finish()
230233
}
231234

232-
override fun onActivityResult(
235+
override fun onActivityResult(
233236
requestCode: Int,
234237
resultCode: Int,
235-
data: Intent?
238+
data: Intent?,
236239
) {
237240
super.onActivityResult(requestCode, resultCode, data)
238241
view.wx.onActivityResult(requestCode, resultCode, data)

0 commit comments

Comments
 (0)