Skip to content

Commit 10eb1a6

Browse files
committed
Align with ST BLE Sensor V5.2.1
Signed-off-by: Luca Pezzoni <luca.pezzoni@st.com>
1 parent b76b16e commit 10eb1a6

File tree

245 files changed

+8991
-1178
lines changed

Some content is hidden

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

245 files changed

+8991
-1178
lines changed

README.md

Lines changed: 2 additions & 2 deletions
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 8.2.1 and JDK jbr-17
8+
Code compiled using gradle 8.2.1 and JDK 17.0.7
99

1010
set on Gradle properties the Github Login name and SSO authentication
1111
Example:
@@ -16,7 +16,7 @@ GPR_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX
1616
For using this application is necessary to downlaod the Android BlueST-SDK from:
1717
https://github.com/STMicroelectronics/BlueSTSDK_Android
1818

19-
tag BlueST-SDK_V1.1.0
19+
tag BlueST-SDK_V1.1.3
2020

2121
and follow the instruction for compiling and publish on local maven repository the 2 libraries necessary for this application:
2222
* st-blue-sdk

app/build.gradle

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,26 @@ android {
2525
applicationId "com.st.bluems"
2626
minSdk rootProject.minSdk
2727
targetSdk rootProject.targetSdk
28-
versionCode 180
29-
versionName "5.2.0"
28+
versionCode 191
29+
versionName "5.2.1"
3030

3131
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3232
vectorDrawables {
3333
useSupportLibrary true
3434
}
3535

36+
3637
manifestPlaceholders = [
3738
'appAuthRedirectScheme': 'stblesensor'
3839
]
40+
41+
buildConfigField(
42+
"String",
43+
"VESPUCCI_ENVIRONMENT",
44+
// "\"DEV\""
45+
// "\"PRE_PROD\""
46+
"\"PROD\""
47+
)
3948
}
4049

4150
buildTypes {
@@ -45,6 +54,7 @@ android {
4554
}
4655
}
4756
compileOptions {
57+
coreLibraryDesugaringEnabled true
4858
sourceCompatibility JavaVersion.VERSION_17
4959
targetCompatibility JavaVersion.VERSION_17
5060
}
@@ -108,6 +118,8 @@ dependencies {
108118
// Blue ST SDK
109119
implementation "com.st.blue.sdk:st-blue-sdk:$st_version"
110120

121+
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugaring_version"
122+
111123
// Hilt
112124
implementation "androidx.hilt:hilt-navigation-fragment:$hilt_navigation_fragment_version"
113125
implementation "com.google.dagger:hilt-android:$hilt_version"

app/src/.DS_Store

-6 KB
Binary file not shown.
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package com.st.bluems.di
22

33
import android.net.Uri
4+
import com.st.bluems.BuildConfig
5+
import com.st.bluems.util.ENVIRONMENT
6+
import com.st.login.STLoginConfig
47
import dagger.Module
58
import dagger.Provides
69
import dagger.hilt.InstallIn
710
import dagger.hilt.components.SingletonComponent
8-
import dagger.multibindings.IntKey
911
import dagger.multibindings.IntoMap
12+
import dagger.multibindings.StringKey
1013

1114
@InstallIn(SingletonComponent::class)
1215
@Module(includes = [BlueMsModule.WithProvides::class])
@@ -18,9 +21,22 @@ abstract class BlueMsModule {
1821

1922
@Provides
2023
@IntoMap
21-
@IntKey(0)
22-
fun provideRedirectUri(): Uri {
23-
return Uri.parse("stblesensor://callback")
24+
@StringKey("stLoginConfig")
25+
fun provideSTLoginConfig(): STLoginConfig {
26+
return STLoginConfig(
27+
Uri.parse("stblesensor://callback"),
28+
if (BuildConfig.VESPUCCI_ENVIRONMENT != ENVIRONMENT.DEV.name) {
29+
com.st.login.R.raw.prod_auth_config_vespucci
30+
} else {
31+
com.st.login.R.raw.dev_auth_config_vespucci
32+
},
33+
if (BuildConfig.VESPUCCI_ENVIRONMENT != ENVIRONMENT.DEV.name) {
34+
Uri.parse("https://www.st.com/cas/logout?service=https%3A%2F%2Fvespucci.st.com%2Fsvc%2Fwebtomobile%2Fstblesensor")
35+
} else {
36+
Uri.parse("")
37+
},
38+
BuildConfig.VESPUCCI_ENVIRONMENT == ENVIRONMENT.PROD.name
39+
)
2440
}
2541
}
2642
}

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

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ import androidx.compose.ui.window.Dialog
2121
import com.st.blue_sdk.models.ConnectionStatus
2222
import com.st.blue_sdk.models.NodeState
2323
import com.st.bluems.R
24+
import com.st.ui.theme.BlueMSTheme
2425
import com.st.ui.theme.LocalDimensions
2526
import com.st.ui.theme.PreviewBlueMSTheme
2627
import com.st.ui.theme.Grey6
28+
import com.st.ui.theme.WarningText
2729

2830
@Composable
2931
fun ConnectionStatusDialog(
32+
isPairingRequest: Boolean = false,
3033
connectionStatus: ConnectionStatus,
3134
boardName: String
3235
) {
3336
when (connectionStatus.current) {
34-
NodeState.Connecting -> NodeConnectingDialog(boardName)
37+
NodeState.Connecting -> NodeConnectingDialog(boardName, isPairingRequest)
3538
NodeState.Connected -> NodeConnectedDialog(boardName)
3639
NodeState.Disconnecting -> NodeDisconnectingDialog(boardName)
3740
NodeState.ServicesDiscovered -> Unit
@@ -41,7 +44,7 @@ fun ConnectionStatusDialog(
4144
}
4245

4346
@Composable
44-
fun NodeConnectingDialog(boardName: String) {
47+
fun NodeConnectingDialog(boardName: String, isPairingRequest: Boolean = false) {
4548
Dialog(onDismissRequest = { /** NOOP **/ }) {
4649
Surface(modifier = Modifier.fillMaxWidth()) {
4750
Column(
@@ -57,6 +60,18 @@ fun NodeConnectingDialog(boardName: String) {
5760

5861
Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingLarge))
5962

63+
if (isPairingRequest) {
64+
Text(
65+
modifier = Modifier
66+
.padding(bottom = LocalDimensions.current.paddingMedium)
67+
.fillMaxWidth(),
68+
textAlign = TextAlign.Center,
69+
style = MaterialTheme.typography.titleMedium,
70+
color = WarningText,
71+
text = "Default PIN 123456"
72+
)
73+
}
74+
6075
LinearProgressIndicator(modifier = Modifier.fillMaxWidth(1f))
6176

6277
Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingLarge))
@@ -65,7 +80,10 @@ fun NodeConnectingDialog(boardName: String) {
6580
textAlign = TextAlign.Center,
6681
style = MaterialTheme.typography.bodyMedium,
6782
color = Grey6,
68-
text = stringResource(id = R.string.st_home_connectionStatus_connectingDescription,boardName)
83+
text = stringResource(
84+
id = R.string.st_home_connectionStatus_connectingDescription,
85+
boardName
86+
)
6987
)
7088
}
7189
}
@@ -97,7 +115,10 @@ fun NodeConnectedDialog(boardName: String) {
97115
textAlign = TextAlign.Center,
98116
style = MaterialTheme.typography.bodyMedium,
99117
color = Grey6,
100-
text = stringResource(id = R.string.st_home_connectionStatus_connectedDescription,boardName)
118+
text = stringResource(
119+
id = R.string.st_home_connectionStatus_connectedDescription,
120+
boardName
121+
)
101122
)
102123
}
103124
}
@@ -129,7 +150,10 @@ fun NodeDisconnectingDialog(boardName: String) {
129150
textAlign = TextAlign.Center,
130151
style = MaterialTheme.typography.bodyMedium,
131152
color = Grey6,
132-
text = stringResource(id = R.string.st_home_connectionStatus_disconnectingDescription,boardName)
153+
text = stringResource(
154+
id = R.string.st_home_connectionStatus_disconnectingDescription,
155+
boardName
156+
)
133157
)
134158
}
135159
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ fun DeviceListScreen(
7070
val isServerForced by viewModel.isServerForced.collectAsStateWithLifecycle()
7171
val pinnedDevices by viewModel.pinnedDevices.collectAsStateWithLifecycle(emptyList())
7272
val boardsDescription by viewModel.boardsDescription.collectAsStateWithLifecycle()
73+
val disableHiddenDemos by viewModel.disableHiddenDemos.collectAsStateWithLifecycle()
7374

7475

7576
val nfcNodeId by nfcViewModel.nfcNodeId.collectAsStateWithLifecycle()
@@ -95,6 +96,10 @@ fun DeviceListScreen(
9596
isExpert = isExpert,
9697
isServerForced = isServerForced,
9798
isBetaRelease = isBetaRelease,
99+
disableHiddenDemos = disableHiddenDemos,
100+
enableDisableHiddenDemos = {
101+
viewModel.enableDisableHiddenDemos()
102+
},
98103
login = {
99104
viewModel.login()
100105
},
@@ -206,6 +211,8 @@ fun DeviceListWithPermissionsCheck(
206211
isExpert: Boolean = false,
207212
isServerForced: Boolean = false,
208213
isBetaRelease: Boolean = false,
214+
disableHiddenDemos: Boolean = false,
215+
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
209216
devices: List<Node>,
210217
pinnedDevices: List<String>,
211218
onPinChange: (String, Boolean) -> Unit,
@@ -270,6 +277,8 @@ fun DeviceListWithPermissionsCheck(
270277
isExpert = isExpert,
271278
isServerForced = isServerForced,
272279
isBetaRelease = isBetaRelease,
280+
disableHiddenDemos = disableHiddenDemos,
281+
enableDisableHiddenDemos = enableDisableHiddenDemos,
273282
login = login,
274283
logout = logout,
275284
goToProfile = goToProfile,
@@ -439,6 +448,8 @@ fun DeviceList(
439448
isExpert: Boolean = false,
440449
isServerForced: Boolean = false,
441450
isBetaRelease: Boolean = false,
451+
disableHiddenDemos: Boolean = false,
452+
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
442453
isLoading: Boolean = false,
443454
pinnedDevices: List<String>,
444455
onPinChange: (String, Boolean) -> Unit,
@@ -504,6 +515,8 @@ fun DeviceList(
504515
isExpert = isExpert,
505516
isServerForced = isServerForced,
506517
isBetaRelease = isBetaRelease,
518+
disableHiddenDemos = disableHiddenDemos,
519+
enableDisableHiddenDemos = enableDisableHiddenDemos,
507520
login = login,
508521
logout = logout,
509522
goToProfile = goToProfile,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ fun DeviceListItem(
158158
text = stringResource(id = com.st.bluems.R.string.st_home_deviceListItem_fwCustomLabel)
159159
)
160160
} else {
161-
catalogInfo?.maturity?.let { maturity ->
162-
if(maturity!=FirmwareMaturity.RELEASE) {
161+
if (catalogInfo != null) {
162+
if(catalogInfo.maturity!=FirmwareMaturity.RELEASE) {
163163
Text(
164164
modifier = Modifier.padding(all = LocalDimensions.current.paddingNormal),
165165
color = ErrorText,
166-
text = "$maturity FW"
166+
text = "${catalogInfo.maturity} FW"
167167
)
168168
}
169169
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ fun MainTopBar(
4646
isExpert: Boolean = false,
4747
isServerForced: Boolean = false,
4848
isBetaRelease: Boolean = false,
49+
disableHiddenDemos: Boolean = false,
50+
enableDisableHiddenDemos: () -> Unit = { /** NOOP **/ },
4951
login: () -> Unit = { /** NOOP **/ },
5052
logout: () -> Unit = { /** NOOP **/ },
5153
onAddCatalogEntryFromFile: () -> Unit = { /** NOOP **/ }
@@ -104,6 +106,18 @@ fun MainTopBar(
104106
Text(text = "Read Release Catalog", modifier = Modifier.clickable {
105107
readReleaseCatalog()
106108
})
109+
110+
Spacer(modifier = Modifier.height(height = LocalDimensions.current.paddingNormal))
111+
112+
if (disableHiddenDemos) {
113+
Text(text = "Hide Removed Demos", modifier = Modifier.clickable {
114+
enableDisableHiddenDemos()
115+
})
116+
} else {
117+
Text(text = "Show Removed Demos", modifier = Modifier.clickable {
118+
enableDisableHiddenDemos()
119+
})
120+
}
107121
} else {
108122
Text(
109123
text = "v${BuildConfig.VERSION_NAME} [Stable]",

0 commit comments

Comments
 (0)