Skip to content

Commit 6560a72

Browse files
author
Nick Hubbers
authored
Merge pull request #3 from jedlix/version-1.2.0
Version 1.2.0
2 parents 4423d0e + aee9b82 commit 6560a72

28 files changed

+353
-653
lines changed

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Add the following to your `build.gradle`:
1414

1515
```groovy
1616
dependencies {
17-
implementation("com.jedlix:sdk:1.1.0")
17+
implementation("com.jedlix:sdk:1.2.0")
1818
}
1919
```
2020

@@ -60,20 +60,23 @@ class SomeActivity : AppCompatActivity() {
6060
}
6161
```
6262

63-
A convenience method `startVehicleConnectSession(userIdentifier)` can also be called
64-
65-
6663
To start a charger connect session, you need to specify a charging location identifier:
6764

6865
```swift
6966
connectSessionManager.startConnectSession(
7067
"<USER ID>",
71-
ConnectSessionType.Charger("CHARGING LOCATION ID")
68+
ConnectSessionType.Charger("<CHARGING LOCATION ID>")
7269
)
7370
```
7471

75-
A convenience method `startChargerConnectSession(userIdentifier, "CHARGING LOCATION ID")` can also be called
72+
A user might leave the app at any moment. If the connect session hasn't been finished, you should resume by providing a session identifier you obtain from the Smart Charging API:
7673

74+
```kotlin
75+
connectSessionManager.resumeConnectSession(
76+
"<USER ID>",
77+
"<CONNECT SESSION ID>"
78+
)
79+
```
7780

7881
### Logging
7982

azure-pipelines-qa.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- main
6+
pr: none
7+
pool:
8+
vmImage: 'ubuntu-latest'
9+
demands:
10+
- allowFrontend
11+
resources:
12+
- repo: self
13+
14+
variables:
15+
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
16+
branchName: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]
17+
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
18+
branchName: $[replace(variables['System.PullRequest.SourceBranch'], 'refs/heads/', '')]
19+
gradleProperties: -PkeystorePath=$(keystoreFile.secureFilePath) -PkeystorePassword=$(keystorePassword) -PserviceAccountLocation=$(serviceAccount.secureFilePath) -PbuildCode=$(Build.BuildId)
20+
21+
stages:
22+
- stage: Setup
23+
jobs:
24+
- job: Setup
25+
steps:
26+
- checkout: self
27+
persistCredentials: true
28+
submodules: recursive
29+
- task: CmdLine@2
30+
displayName: 'Git checkout'
31+
inputs:
32+
script: |
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "Azure Pipeline"
35+
git checkout $(branchName)
36+
- task: CmdLine@2
37+
displayName: 'Set parameters'
38+
inputs:
39+
script: |
40+
export file=android/example/src/main/java/com/jedlix/sdk/example/ExampleApplication.kt
41+
sed -i '\|//|s|^//||' $file
42+
sed -i 's|<AUTH0 CLIENT ID>|$(auth0ClientId)|' $file
43+
sed -i 's|<AUTH0 DOMAIN>|$(auth0Domain)|' $file
44+
sed -i 's|<AUTH0 AUDIENCE>|$(auth0Audience)|' $file
45+
sed -i 's|<USER IDENTIFIER KEY>|$(userIdentifierKey)|' $file
46+
sed -i 's|<YOUR BASE URL>|$(baseUrl)|' $file
47+
48+
- stage: Build
49+
jobs:
50+
- job: 'JedlixSDK'
51+
steps:
52+
- task: DownloadSecureFile@1
53+
name: keystoreFile
54+
displayName: 'Download Keystore File'
55+
inputs:
56+
secureFile: upload-keystore.jks
57+
- task: DownloadSecureFile@1
58+
name: serviceAccount
59+
displayName: 'Download Secure Service Account JSON'
60+
inputs:
61+
secureFile: jedlix-service-account.json
62+
- task: Gradle@2
63+
displayName: 'Build'
64+
continueOnError: true
65+
inputs:
66+
workingDirectory: 'android'
67+
gradleWrapperFile: 'android/gradlew'
68+
gradleOptions: '-Xmx3072m'
69+
tasks: ":example:publishReleaseBundle $(gradleProperties)"
70+
71+
- stage: GitTag
72+
jobs:
73+
- job: GitTag
74+
steps:
75+
- checkout: self
76+
persistCredentials: true
77+
- bash: |
78+
git config --global user.email "[email protected]"
79+
git config --global user.name "Azure Pipeline"
80+
VERSION=$(cat android/example/build.gradle.kts | grep -m1 'versionName' | cut -d'=' -f2 | tr -d ' ' | tr -d ';' | tr -d '"')
81+
TAG=v$VERSION-$BUILD_NUMBER
82+
git tag $TAG
83+
git push origin $TAG
84+
displayName: 'Git tag'
85+
env:
86+
BUILD_NUMBER: $(Build.BuildId)

example/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<category android:name="android.intent.category.LAUNCHER" />
2121
</intent-filter>
2222
</activity>
23-
<activity android:name=".activity.ConnectActivity"/>
23+
<activity android:name=".activity.ConnectionsActivity"/>
2424
</application>
2525

2626
</manifest>

example/src/main/java/com/jedlix/sdk/example/ExampleApplication.kt

+9-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import kotlinx.coroutines.cancel
2828
import java.net.URL
2929

3030
class ExampleApplication : Application() {
31-
3231
companion object {
3332
lateinit var baseURL: URL
3433
lateinit var authentication: Authentication
@@ -40,15 +39,15 @@ class ExampleApplication : Application() {
4039
super.onCreate()
4140

4241
baseURL = URL("<YOUR BASE URL>")
43-
// authentication = DefaultAuthentication(this)
44-
authentication = Auth0Authentication(
45-
"<AUTH0 CLIENT ID>",
46-
"<AUTH0 DOMAIN>",
47-
"<AUTH0 AUDIENCE>",
48-
"<USER IDENTIFIER KEY>",
49-
coroutineScope,
50-
this
51-
)
42+
authentication = DefaultAuthentication(this)
43+
// authentication = Auth0Authentication(
44+
// "<AUTH0 CLIENT ID>",
45+
// "<AUTH0 DOMAIN>",
46+
// "<AUTH0 AUDIENCE>",
47+
// "<USER IDENTIFIER KEY>",
48+
// coroutineScope,
49+
// this
50+
// )
5251
JedlixSDK.configure(
5352
baseURL,
5453
authentication

example/src/main/java/com/jedlix/sdk/example/activity/AuthenticationActivity.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class AuthenticationActivity : AppCompatActivity() {
4343
startActivity(
4444
Intent(
4545
this@AuthenticationActivity,
46-
ConnectActivity::class.java
46+
ConnectionsActivity::class.java
4747
).apply {
4848
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
49-
putExtra(ConnectActivity.USER_IDENTIFIER, userIdentifier)
49+
putExtra(ConnectionsActivity.USER_IDENTIFIER, userIdentifier)
5050
}
5151
)
5252
}

example/src/main/java/com/jedlix/sdk/example/activity/ConnectActivity.kt example/src/main/java/com/jedlix/sdk/example/activity/ConnectionsActivity.kt

+13-7
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ import androidx.activity.viewModels
2323
import androidx.appcompat.app.AppCompatActivity
2424
import androidx.lifecycle.lifecycleScope
2525
import com.jedlix.sdk.connectSession.registerConnectSessionManager
26-
import com.jedlix.sdk.example.databinding.ActivityConnectBinding
27-
import com.jedlix.sdk.example.viewModel.ConnectViewModel
26+
import com.jedlix.sdk.example.databinding.ActivityConnectionsBinding
27+
import com.jedlix.sdk.example.viewModel.ConnectionsViewModel
2828
import kotlinx.coroutines.flow.collect
2929
import kotlinx.coroutines.launch
3030

31-
class ConnectActivity : AppCompatActivity() {
31+
class ConnectionsActivity : AppCompatActivity() {
3232

3333
companion object {
3434
const val USER_IDENTIFIER = "userIdentifier"
3535
}
3636

37-
private val viewModel: ConnectViewModel by viewModels {
38-
ConnectViewModel.Factory(
37+
private val viewModel: ConnectionsViewModel by viewModels {
38+
ConnectionsViewModel.Factory(
3939
intent.extras!!.getString(USER_IDENTIFIER)!!
4040
)
4141
}
4242

4343
override fun onCreate(savedInstanceState: Bundle?) {
4444
super.onCreate(savedInstanceState)
45-
val binding = ActivityConnectBinding.inflate(LayoutInflater.from(this), null, false)
45+
val binding = ActivityConnectionsBinding.inflate(LayoutInflater.from(this), null, false)
4646
setContentView(binding.root)
4747
binding.viewModel = viewModel
4848
binding.lifecycleOwner = this
@@ -55,7 +55,7 @@ class ConnectActivity : AppCompatActivity() {
5555
viewModel.didDeauthenticate.collect {
5656
startActivity(
5757
Intent(
58-
this@ConnectActivity,
58+
this@ConnectionsActivity,
5959
AuthenticationActivity::class.java
6060
).apply {
6161
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
@@ -69,5 +69,11 @@ class ConnectActivity : AppCompatActivity() {
6969
connectSessionManager.startConnectSession(userIdentifier, type)
7070
}
7171
}
72+
73+
lifecycleScope.launch {
74+
viewModel.didResumeConnectSession.collect { (userIdentifier, sessionIdentifier) ->
75+
connectSessionManager.resumeConnectSession(userIdentifier, sessionIdentifier)
76+
}
77+
}
7278
}
7379
}

example/src/main/java/com/jedlix/sdk/example/activity/VehicleActivity.kt

-78
This file was deleted.

example/src/main/java/com/jedlix/sdk/example/connectSessionObserver/ConnectSessionObserver.kt

-69
This file was deleted.

0 commit comments

Comments
 (0)