Skip to content

Commit de47237

Browse files
committed
Align with ST BLE Sensor V5.3.2
Signed-off-by: Luca Pezzoni <luca.pezzoni@st.com>
1 parent f35e849 commit de47237

File tree

129 files changed

+3950
-3577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3950
-3577
lines changed

License.html

Lines changed: 381 additions & 107 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Application ST BLE Sensors
55

66
## Compilation
77

8-
Code compiled using gradle 9.3.1
8+
Code compiled using gradle 9.4.1
99

1010
set on Gradle properties the Github Login name and SSO authentication
1111
Example:

app/build.gradle.kts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ plugins {
2121
alias(libs.plugins.jaredsburrowsLicense)
2222
}
2323

24-
apply {
25-
from("st_dependencies.gradle")
26-
}
24+
apply(from = "st_dependencies.gradle")
2725

2826
android {
2927
namespace = "com.st.bluems"
28+
compileSdk {
29+
version = release(stCompileSdk) {
30+
minorApiLevel = 1
31+
}
32+
}
3033
compileSdk = stCompileSdk
3134

3235
defaultConfig {
3336
applicationId = "com.st.bluems"
3437
minSdk = stMinSdk
3538
targetSdk = stTargetSdk
36-
versionCode = 356
37-
versionName = "5.3.0"
39+
versionCode = 365
40+
versionName = "5.3.2"
3841

3942
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
4043
vectorDrawables { useSupportLibrary = true }
@@ -48,10 +51,6 @@ android {
4851
)
4952
}
5053

51-
hilt {
52-
enableAggregatingTask = true
53-
}
54-
5554
buildTypes {
5655
release {
5756
isMinifyEnabled = false
@@ -75,14 +74,18 @@ android {
7574
viewBinding = true
7675
}
7776

78-
ksp {
79-
arg("room.schemaLocation", "$projectDir/schemas")
80-
arg("room.generateKotlin", "true")
81-
}
82-
8377
packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } }
8478
}
8579

80+
hilt {
81+
enableAggregatingTask = true
82+
}
83+
84+
ksp {
85+
arg("room.schemaLocation", "$projectDir/schemas")
86+
arg("room.generateKotlin", "true")
87+
}
88+
8689
licenseReport {
8790
// Generate reports
8891
generateCsvReport = false

app/src/main/assets/open_source_licenses.html

Lines changed: 381 additions & 107 deletions
Large diffs are not rendered by default.

app/src/main/java/com/st/bluems/MainActivity.kt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -110,55 +110,6 @@ class MainActivity : AppCompatActivity() {
110110
val packageName = pInfo.packageName.split('.').last()
111111

112112
val keySearched = "${packageName}_${versionName}"
113-
Log.i("Firebase Remote Config", "keySearched : $keySearched")
114-
115-
// //Singleton
116-
// val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig
117-
// val configSettings = remoteConfigSettings {
118-
// minimumFetchIntervalInSeconds = 3600
119-
// }
120-
// remoteConfig.setConfigSettingsAsync(configSettings)
121-
//
122-
// //Set the Default Values
123-
// remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)
124-
//
125-
// //Read the Default Value
126-
// var boardCatalogStatus = remoteConfig.getString(keySearched)
127-
// Log.d("boardCatalogStatus", "Default number=${boardCatalogStatus}")
128-
//
129-
// remoteConfig.fetchAndActivate()
130-
// .addOnCompleteListener(this) { task ->
131-
// if (task.isSuccessful) {
132-
// val updated = task.result
133-
// Log.d("boardCatalogStatus", "Config params updated: $updated")
134-
// boardCatalogStatus = remoteConfig.getString(keySearched)
135-
// if (boardCatalogStatus.isNotEmpty()) {
136-
// viewModel.updateBoardCatalogStatus(boardCatalogStatus)
137-
// }
138-
// } else {
139-
// Log.d("boardCatalogStatus", "Fetch failed")
140-
// }
141-
// }
142-
//
143-
// remoteConfig.addOnConfigUpdateListener(object : ConfigUpdateListener {
144-
// override fun onUpdate(configUpdate: ConfigUpdate) {
145-
// Log.d(boardCatalogStatus, "Updated keys: " + configUpdate.updatedKeys)
146-
//
147-
// if (configUpdate.updatedKeys.contains(keySearched)) {
148-
// remoteConfig.activate().addOnCompleteListener {
149-
// boardCatalogStatus = remoteConfig.getString(keySearched)
150-
// Log.d(boardCatalogStatus, "New number=$boardCatalogStatus")
151-
// if (boardCatalogStatus.isNotEmpty()) {
152-
// viewModel.updateBoardCatalogStatus(boardCatalogStatus)
153-
// }
154-
// }
155-
// }
156-
// }
157-
//
158-
// override fun onError(error: FirebaseRemoteConfigException) {
159-
// Log.w("boardCatalogStatus", "Config update error with code: " + error.code, error)
160-
// }
161-
// })
162113

163114
//for using NFC deep Link node auto-connect
164115
val nfcIntent = intent
@@ -232,7 +183,6 @@ class MainActivity : AppCompatActivity() {
232183
}
233184

234185
entry<BlueMSApplicationNavKey> {
235-
// AndroidFragment<HomeFragment>()
236186
val homeViewModel: HomeViewModel = hiltViewModel()
237187
HomeScreen(homeViewModel = homeViewModel, nfcViewModel = nfcViewModel)
238188
}

app/src/main/java/com/st/bluems/MainViewModel.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ class MainViewModel @Inject constructor(
3232
val shouldShowProfile = preferences.hasSelectedProfile().not()
3333
val shouldShowTerms = preferences.hasAcceptedTerms().not()
3434

35-
fun initApplicationAnalytics(etnaApplication: ApplicationAnalyticsService.ApplicationNameEtna, application: Application, activity: Activity) {
35+
fun initApplicationAnalytics(
36+
etnaApplication: ApplicationAnalyticsService.ApplicationNameEtna,
37+
application: Application,
38+
activity: Activity
39+
) {
3640
appAnalyticsService.forEach {
37-
it.createAnalytics(etnaApplication,application,activity)
41+
it.createAnalytics(etnaApplication, application, activity)
3842
}
3943
}
4044

@@ -48,10 +52,6 @@ class MainViewModel @Inject constructor(
4852
preferences.setTermsFlag(accepted = accepted)
4953
}
5054

51-
fun updateBoardCatalogStatus(boardCatalogStatus: String) {
52-
preferences.setBoardCatalogStatus(boardCatalogStatus)
53-
}
54-
5555
fun welcomeShow() {
5656
preferences.setWelcomeFlag(completed = true)
5757
}

app/src/main/java/com/st/bluems/ui/composable/DeviceList.kt

Lines changed: 6 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import androidx.compose.material.icons.filled.Sync
2626
import androidx.compose.material3.*
2727
import androidx.compose.runtime.*
2828
import androidx.compose.runtime.saveable.rememberSaveable
29-
import androidx.compose.ui.Modifier
3029
import androidx.compose.ui.draw.rotate
3130
import androidx.compose.ui.platform.LocalContext
3231
import androidx.compose.ui.res.stringResource
@@ -48,16 +47,13 @@ import com.st.ui.theme.Grey6
4847
import androidx.compose.material3.FloatingActionButton
4948
import androidx.compose.material3.Scaffold
5049
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
51-
import androidx.compose.ui.tooling.preview.Preview
50+
import androidx.compose.ui.Modifier
5251
import androidx.compose.ui.unit.IntOffset
5352
import androidx.lifecycle.Lifecycle
5453
import androidx.navigation3.runtime.NavBackStack
5554
import androidx.navigation3.runtime.NavKey
56-
import com.st.blue_sdk.board_catalog.models.isDeprecated
57-
import com.st.blue_sdk.board_catalog.models.isDismissed
5855
import com.st.ui.composables.BlueMSPullToRefreshBox
5956
import com.st.ui.composables.ComposableLifecycle
60-
import com.st.ui.theme.PreviewBlueMSTheme
6157
import com.st.ui.theme.PrimaryBlue
6258
import com.st.ui.theme.SecondaryBlue
6359
import 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.\nThis 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.\nThis 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

755674
private const val DEGREES = 360f

app/src/main/java/com/st/bluems/ui/composable/HomeScreenNavigation.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ fun HomeScreenNavigation(
4040
rememberNavBackStack(HomeScreenNavKey)
4141

4242
GlobalConfig.removeBackState = {
43-
backState.removeLastOrNull()
43+
if(backState.size>1) {
44+
backState.removeLastOrNull()
45+
}
4446
}
4547

4648
BlueMSTheme {
@@ -51,7 +53,9 @@ fun HomeScreenNavigation(
5153
),
5254
backStack = backState,
5355
onBack = {
54-
backState.removeLastOrNull()
56+
if (backState.size > 1) {
57+
backState.removeLastOrNull()
58+
}
5559
},
5660
entryDecorators = listOf(
5761
rememberSaveableStateHolderNavEntryDecorator(),

0 commit comments

Comments
 (0)