Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
minSdk = 24
targetSdk = 35
versionCode = 16
versionName = "3.3"
versionName = "3.5"
multiDexEnabled = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -69,6 +69,7 @@ android {
dependencies {

implementation("org.eclipse.ecsp:vehicleconnectsdk:1.1.5")
// implementation(files("libs/androidVehicleConnectSDK.aar"))
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.compose.ui:ui:1.5.0")
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/eclipse/ecsp/helper/AppConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ object AppConstants {
const val UNLOCKED = "Unlocked"
const val STARTED = "Started"
const val STOPPED = "Stopped"
const val IGNITION_ENABLED = "IGNITION_ENABLED"
const val IGNITION_DISABLED = "IGNITION_DISABLED"

const val WINDOWS = "Windows"
const val LIGHT = "Lights"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,16 @@ class RemoteOperationVM(activity: Activity) : AndroidViewModel(activity.applicat
dashboardRepository.getRemoteOperationHistory(userId, vehicleId)
.observe(lifecycleOwner) { roEventHistoryResponse ->
isProgressBarLoading?.value = false
updateListOnRoHistory(
activity,
roEventHistoryResponse,
lazyStaggeredGridList,
notifyRoUpdate,
)
if(roEventHistoryResponse.status.requestStatus) {
updateListOnRoHistory(
activity,
roEventHistoryResponse,
lazyStaggeredGridList,
notifyRoUpdate,
)
} else{
toastError(activity, "RO History: ${roEventHistoryResponse.error?.message ?: "Error occurred"}")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,15 @@ class DashboardRepository {
deviceCall.await()?.forEach {
if (it.mDeviceId != null) {
vehicleServiceInterface.getVehicleProfile(it.mDeviceId!!) { vehicleProfileData ->
list[it.mDeviceId!!] =
VehicleProfileModel(
it,
vehicleProfileData.response?.data?.get(0)
)
if (vehicleProfileData.response != null
&& vehicleProfileData.response?.data != null
&& vehicleProfileData.response!!.data!!.isNotEmpty()) {
list[it.mDeviceId!!] =
VehicleProfileModel(
it,
vehicleProfileData.response?.data?.get(0)
)
}
}
success = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class RemoteOperationService {
AppConstants.STARTED.lowercase() -> AppConstants.STOPPED
AppConstants.STOPPED.lowercase() -> AppConstants.STARTED
AppConstants.PARTIAL_OPENED.lowercase() -> AppConstants.getWindowCurrentState(activity)
AppConstants.IGNITION_ENABLED.lowercase() -> AppConstants.STOPPED
AppConstants.IGNITION_DISABLED.lowercase() -> AppConstants.STARTED
else -> ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import org.eclipse.ecsp.ui.view.composes.TopBar
import org.eclipse.ecsp.ui.view.composes.dashboardcompose.BottomNavigationBar
import org.eclipse.ecsp.ui.view.composes.dashboardcompose.ShowChangePasswordConfirmationDialogBox
import org.eclipse.ecsp.ui.view.composes.dashboardcompose.ShowConfirmationDialogBox
import org.eclipse.ecsp.ui.view.composes.dashboardcompose.mainCompose
import org.eclipse.ecsp.ui.view.composes.dashboardcompose.MainCompose
import org.eclipse.ecsp.userservice.service.UserServiceInterface

/**
Expand Down Expand Up @@ -138,7 +138,8 @@ class DashboardActivity : BaseAppActivity() {
setContent {
remoteOperationVM.getRoHistoryData().observeAsState().value.let {
if (isInternetAvailable(this)) {
if (it != null) getRoHistory(it)
if (it != null)
getRoHistory(it)
} else {
toastError(this, "No internet connectivity")
}
Expand All @@ -157,11 +158,11 @@ class DashboardActivity : BaseAppActivity() {
mutableStateOf(-1)
}
processVehicleList(
Gson().fromJson(
HashMap(Gson().fromJson<Map<String, VehicleProfileModel?>>(
AppConstants.getVehicleList(
this@DashboardActivity,
),
),
)
))
)
LaunchedEffect(Unit) {
dashboardVM.fetchAssociateDeviceList()
Expand Down Expand Up @@ -192,7 +193,7 @@ class DashboardActivity : BaseAppActivity() {
BottomNavigationBar(navController = navController)
},
content = { padding ->
mainCompose(
MainCompose(
this,
padding = padding,
navController,
Expand Down Expand Up @@ -281,7 +282,7 @@ class DashboardActivity : BaseAppActivity() {
// dashboardVM.subscribeNotificationConfig(emailId?:"", it)
isProgressBarLoading.value = false
it.let {
AppConstants.setVehicleList(this@DashboardActivity, Gson().toJson(it))
AppConstants.setVehicleList(this@DashboardActivity, Gson().toJson(it.second))
processVehicleList(it.second)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.eclipse.ecsp.ui.view.composes

/********************************************************************************
* Copyright (c) 2023-24 Harman International
*
Expand Down Expand Up @@ -54,26 +55,29 @@ fun TopBar(
Text(topBarTextString, color = Black, fontWeight = FontWeight.Bold)
},
navigationIcon = {
IconButton(onClick = onClicked) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_back_arrow),
contentDescription = "Back",
modifier = Modifier.testTag("top_bar_back_arrow_icon_tag"),
)
}
if (topBarTextString != "Remote Control")
IconButton(onClick = onClicked) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_back_arrow),
contentDescription = "Back",
modifier = Modifier.testTag("top_bar_back_arrow_icon_tag"),
)
}
},
colors = TopAppBarDefaults.mediumTopAppBarColors(containerColor = White),
modifier =
Modifier.drawWithContent {
drawContent()
val strokeWidth = 2.dp.value * density
val y = size.height - strokeWidth / 2
drawLine(
DarkGray,
Offset((textFieldPadding).toPx(), y),
Offset(size.width - textFieldPadding.toPx(), y),
)
}.testTag("topBar_tag"),
Modifier
.drawWithContent {
drawContent()
val strokeWidth = 2.dp.value * density
val y = size.height - strokeWidth / 2
drawLine(
DarkGray,
Offset((textFieldPadding).toPx(), y),
Offset(size.width - textFieldPadding.toPx(), y),
)
}
.testTag("topBar_tag"),
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.eclipse.ecsp.ui.view.composes.dashboardcompose

/********************************************************************************
* Copyright (c) 2023-24 Harman International
*
Expand Down Expand Up @@ -28,6 +29,7 @@ import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -55,6 +57,7 @@ import org.eclipse.ecsp.ui.theme.DarkGray
import org.eclipse.ecsp.ui.theme.LightBlue
import org.eclipse.ecsp.ui.theme.White
import org.eclipse.ecsp.ui.view.composes.deviceinstallationcompose.ProgressBar
import org.eclipse.ecsp.ui.view.composes.notificationcompose.NotificationMainCompose
import org.eclipse.ecsp.ui.view.composes.remoteoperationcompose.BottomSheetOptionsRoCompose
import org.eclipse.ecsp.ui.view.composes.remoteoperationcompose.RemoteOperationScreen

Expand All @@ -67,9 +70,8 @@ fun BottomNavigationBar(navController: NavController) {
NavigationBar {
val navBackStackEntry = navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry.value?.destination?.route
BottomNavItem::class.sealedSubclasses.map {
it.objectInstance as BottomNavItem
}.forEach { navItem ->
val bottomItemList = listOf(BottomNavItem.RemoteOperation, BottomNavItem.Settings)
bottomItemList.forEach { navItem ->
val selected = currentRoute == navItem.route
NavigationBarItem(
selected = selected,
Expand Down Expand Up @@ -117,6 +119,7 @@ fun Activity.NavHostContainer(
openConfirmationDialog: MutableState<Boolean>?,
notifyRoUpdate: MutableState<Int>,
lifecycleOwner: LifecycleOwner,
alertList: MutableState<ArrayList<AlertData>>,
passwordChangeDialog: MutableState<Boolean>?
) {
NavHost(
Expand Down Expand Up @@ -148,7 +151,6 @@ fun Activity.NavHostContainer(
passwordChangeDialog
)
}
// disabled for current iteration
/*composable(BottomNavItem.Notification.route) {
NotificationMainCompose(
dashboardVM,
Expand All @@ -164,7 +166,7 @@ fun Activity.NavHostContainer(
}

@Composable
fun mainCompose(
fun MainCompose(
activity: Activity,
padding: PaddingValues,
navController: NavHostController,
Expand Down Expand Up @@ -195,35 +197,50 @@ fun mainCompose(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Top,
) {
LaunchedEffect(showVehicleList.value.second) {

}
// if (showVehicleList.value.first) {
VehicleSelectionListView(
vehicleList = showVehicleList.value.second,
selectedVehicleId?.value!!.first,
selectedVehicleId.value.second,
onVehicleSelection = { vehicleProfileModel, index ->
selectedVehicleId.value =
Triple(
vehicleProfileModel?.associatedDevice?.mDeviceId.toString(),
vehicleProfileModel?.vehicleDetailData?.vehicleAttributes?.name
?: "No Name",
vehicleProfileModel?.vehicleDetailData?.vehicleId.toString(),
)
selectedVehicleIndex?.value = index
if (navController.currentBackStackEntry?.destination?.route == BottomNavItem.RemoteOperation.route) {
notifyRoUpdate.value = notifyRoUpdate.value + 1
remoteOperationVM.clickOnRoHistory(selectedVehicleId.value.first)
}
},
) {
launchActivity()
}
VehicleSelectionListView(
vehicleList = showVehicleList.value.second,
selectedVehicleId?.value!!.first,
selectedVehicleId.value.second,
onVehicleSelection = { vehicleProfileModel, index ->
selectedVehicleId.value =
Triple(
vehicleProfileModel?.associatedDevice?.mDeviceId.toString(),
vehicleProfileModel?.vehicleDetailData?.vehicleAttributes?.name
?: "No Name",
vehicleProfileModel?.vehicleDetailData?.vehicleId.toString(),
)
selectedVehicleIndex?.value = index
if (navController.currentBackStackEntry?.destination?.route == BottomNavItem.RemoteOperation.route) {
notifyRoUpdate.value = notifyRoUpdate.value + 1
remoteOperationVM.clickOnRoHistory(selectedVehicleId.value.first)
}
},
) {
launchActivity()
}
// }
activity.NavHostContainer(
activity,
navController = navController, dashboardVM, remoteOperationVM, notificationVM,
vehicleProfileList = vehicleProfileList, isProgressBarLoading, showBottomSheet,
openDialog, selectedVehicleId, lazyStaggeredGridList,
showVehicleList, openConfirmationDialog, notifyRoUpdate, lifecycleOwner,passwordChangeDialog
navController = navController,
dashboardVM,
remoteOperationVM,
notificationVM,
vehicleProfileList = vehicleProfileList,
isProgressBarLoading,
showBottomSheet,
openDialog,
selectedVehicleId,
lazyStaggeredGridList,
showVehicleList,
openConfirmationDialog,
notifyRoUpdate,
lifecycleOwner,
alertList,
passwordChangeDialog
)

isProgressBarLoading?.value?.let {
Expand Down Expand Up @@ -285,7 +302,8 @@ fun mainCompose(
AJAR
} else {
showBottomSheet.value.third
}}",
}
}",
Toast.LENGTH_LONG,
).show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun Activity.NotificationMainCompose(
alertList: MutableState<ArrayList<AlertData>>,
isProgressBarLoading: MutableState<Boolean>?,
vehicleProfileDataList: MutableState<HashMap<String, VehicleProfileModel?>>?,
selectedVehicleId: MutableState<Pair<String, String>>?,
selectedVehicleId: MutableState<Triple<String, String, String>>?,
lifecycleOwner: LifecycleOwner,
) {
LaunchedEffect(Unit) {
Expand Down Expand Up @@ -225,7 +225,7 @@ private fun getAlertHistoryData(
notificationVM: NotificationVM,
isProgressBarLoading: MutableState<Boolean>?,
vehicleProfileDataList: MutableState<HashMap<String, VehicleProfileModel?>>?,
selectedVehicleId: MutableState<Pair<String, String>>?,
selectedVehicleId: MutableState<Triple<String,String, String>>?,
alertList: MutableState<ArrayList<AlertData>>,
lifecycleOwner: LifecycleOwner,
) {
Expand Down
Loading