38 lines
1.3 KiB
Kotlin
38 lines
1.3 KiB
Kotlin
package pl.firmatpp.kierowca
|
|
|
|
import android.os.Bundle
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.setValue
|
|
import androidx.activity.ComponentActivity
|
|
import androidx.activity.compose.setContent
|
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
import pl.firmatpp.kierowca.ui.DriverApp
|
|
import pl.firmatpp.kierowca.ui.DriverViewModel
|
|
import pl.firmatpp.kierowca.ui.theme.TppKierowcaTheme
|
|
|
|
class MainActivity : ComponentActivity() {
|
|
private var notificationRouteId by mutableStateOf<String?>(null)
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
notificationRouteId = intent.getStringExtra(EXTRA_ROUTE_ID)
|
|
setContent {
|
|
TppKierowcaTheme {
|
|
val viewModel: DriverViewModel = viewModel()
|
|
DriverApp(viewModel = viewModel, initialRouteId = notificationRouteId)
|
|
}
|
|
}
|
|
}
|
|
|
|
override fun onNewIntent(intent: android.content.Intent) {
|
|
super.onNewIntent(intent)
|
|
setIntent(intent)
|
|
notificationRouteId = intent.getStringExtra(EXTRA_ROUTE_ID)
|
|
}
|
|
|
|
companion object {
|
|
const val EXTRA_ROUTE_ID = "pl.firmatpp.kierowca.EXTRA_ROUTE_ID"
|
|
}
|
|
}
|