@@ -26,7 +26,6 @@ import androidx.compose.material.icons.filled.Sync
2626import androidx.compose.material3.*
2727import androidx.compose.runtime.*
2828import androidx.compose.runtime.saveable.rememberSaveable
29- import androidx.compose.ui.Modifier
3029import androidx.compose.ui.draw.rotate
3130import androidx.compose.ui.platform.LocalContext
3231import androidx.compose.ui.res.stringResource
@@ -48,16 +47,13 @@ import com.st.ui.theme.Grey6
4847import androidx.compose.material3.FloatingActionButton
4948import androidx.compose.material3.Scaffold
5049import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
51- import androidx.compose.ui.tooling.preview.Preview
50+ import androidx.compose.ui.Modifier
5251import androidx.compose.ui.unit.IntOffset
5352import androidx.lifecycle.Lifecycle
5453import androidx.navigation3.runtime.NavBackStack
5554import androidx.navigation3.runtime.NavKey
56- import com.st.blue_sdk.board_catalog.models.isDeprecated
57- import com.st.blue_sdk.board_catalog.models.isDismissed
5855import com.st.ui.composables.BlueMSPullToRefreshBox
5956import com.st.ui.composables.ComposableLifecycle
60- import com.st.ui.theme.PreviewBlueMSTheme
6157import com.st.ui.theme.PrimaryBlue
6258import com.st.ui.theme.SecondaryBlue
6359import java.text.SimpleDateFormat
@@ -96,20 +92,8 @@ fun DeviceListScreenNavigation(
9692 mutableStateOf(false )
9793 }
9894
99- var isBoardCatalogDeprecated by remember { mutableStateOf(false ) }
100- var isBoardCatalogDismissed by remember { mutableStateOf(false ) }
101-
102- LaunchedEffect (key1 = Unit ) {
103- val boardCatalogStatus = viewModel.boardCatalogStatus
104- if (boardCatalogStatus != null ) {
105-
106- isBoardCatalogDismissed = boardCatalogStatus.isDismissed()
107-
108- if (isBoardCatalogDismissed.not ()) {
109- isBoardCatalogDeprecated = boardCatalogStatus.isDeprecated()
110- }
111- }
112- }
95+ var isApplicationDeprecated by remember { mutableStateOf(false ) }
96+ var isApplicationDismissed by remember { mutableStateOf(false ) }
11397
11498 ComposableLifecycle { _, event ->
11599 when (event) {
@@ -194,7 +178,7 @@ fun DeviceListScreenNavigation(
194178 val enableServer = if (isServerForced) {
195179 true
196180 } else {
197- ! ( (node.boardType == Boards .Model .SENSOR_TILE_BOX ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PRO ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PROB ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PROC ))
181+ ! ((node.boardType == Boards .Model .SENSOR_TILE_BOX ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PRO ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PROB ) || (node.boardType == Boards .Model .SENSOR_TILE_BOX_PROC ))
198182 }
199183
200184 nfcViewModel.setNFCNodeId(null )
@@ -221,22 +205,6 @@ fun DeviceListScreenNavigation(
221205 }
222206 }
223207 )
224-
225- if (isBoardCatalogDeprecated) {
226- CatalogStatusDeprecatedDismissedDialog (
227- title = " Deprecated Application Version" ,
228- body = " Please update your application.\n This application version will be dismissed on " ,
229- date = viewModel.boardCatalogStatus?.dismissionDate ? : Date (),
230- onDismissRequest = { isBoardCatalogDeprecated = false })
231- }
232-
233- if (isBoardCatalogDismissed) {
234- CatalogStatusDeprecatedDismissedDialog (title = " Dismissed Application Version" ,
235- body = " Please update your application!.\n " +
236- " This application version is dismissed from " ,
237- date = viewModel.boardCatalogStatus?.dismissionDate ? : Date (),
238- onDismissRequest = { isBoardCatalogDismissed = false })
239- }
240208}
241209
242210@OptIn(
@@ -698,58 +666,9 @@ fun DeviceList(
698666 }
699667}
700668
701- @Composable
702- fun CatalogStatusDeprecatedDismissedDialog (
703- modifier : Modifier = Modifier ,
704- title : String ,
705- body : String ,
706- date : Date ,
707- onDismissRequest : () -> Unit = { /* * NOOP **/ }
708- ) {
709- AlertDialog (
710- modifier = modifier,
711- onDismissRequest = onDismissRequest,
712- title = {
713- Text (text = title)
714- },
715- text = {
716- val string = body + SimpleDateFormat (" dd/MM/yyyy" , Locale .getDefault()).format(date)
717- Text (
718- text = string
719- )
720- },
721- confirmButton = {
722- BlueMsButton (
723- text = stringResource(id = android.R .string.ok),
724- onClick = onDismissRequest
725- )
726- }
727- )
728- }
729-
730- @Preview
731- @Composable
732- private fun CatalogStatusDeprecatedDismissedDialogDeprecatedPreview () {
733- PreviewBlueMSTheme {
734- CatalogStatusDeprecatedDismissedDialog (
735- title = " Deprecated Application Version" ,
736- body = " Please update your application.\n This application version will be dismissed on " ,
737- date = Date (),
738- onDismissRequest = { })
739- }
740- }
741669
742- @Preview
743- @Composable
744- private fun CatalogStatusDeprecatedDismissedDialogDismissedPreview () {
745- PreviewBlueMSTheme {
746- CatalogStatusDeprecatedDismissedDialog (
747- title = " Dismissed Application Version" ,
748- body = " Please update your application!.\n " +
749- " This application version is dismissed from " ,
750- date = Date (),
751- onDismissRequest = { })
752- }
670+ fun Date.toDayMonthYearString (): String {
671+ return SimpleDateFormat (" dd/MM/yyyy" , Locale .getDefault()).format(this )
753672}
754673
755674private const val DEGREES = 360f
0 commit comments