Skip to content

Commit 4611daf

Browse files
author
Bitrise Buildbot
committed
Bitrise build 14323
1 parent 2f2d7e8 commit 4611daf

18 files changed

Lines changed: 162 additions & 285 deletions

geotabdrivesdk/build.gradle.kts

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import java.util.Properties
22

3-
val versionName = "6.8.0_75308"
3+
val versionName = "6.8.1_75323"
44

55
plugins {
66
id("com.android.library")
@@ -16,34 +16,24 @@ apply {
1616
from("./../kotlin-lint.gradle.kts")
1717
}
1818

19-
ksp {
20-
arg("room.schemaLocation", "$projectDir/schemas")
21-
}
2219
android {
2320
compileSdk = 34
2421
namespace = "com.geotab.mobile.sdk"
2522

2623
defaultConfig {
2724
minSdk = 24
28-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2925

26+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3027

28+
ksp {
29+
arg("room.schemaLocation", "$projectDir/schemas")
30+
}
3131

3232
buildConfigField("String", "KEYSTORE_ALIAS", "\"" + System.getenv("KEYSTORE_ALIAS") + "\"")
3333
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
3434

3535
manifestPlaceholders["appLinkHost"] = ""
3636
manifestPlaceholders["appAuthRedirectPathPrefix"] = ""
37-
manifestPlaceholders["authScheme"] = ""
38-
manifestPlaceholders["authHost"] = ""
39-
}
40-
41-
testOptions {
42-
unitTests.all { test ->
43-
test.testLogging {
44-
events("passed", "skipped", "failed")
45-
}
46-
}
4737
}
4838

4939
buildTypes {
@@ -135,30 +125,25 @@ dependencies {
135125
dokkaPlugin("org.jetbrains.dokka:android-documentation-plugin:1.8.10")
136126
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
137127
implementation("androidx.core:core-ktx:1.12.0")
138-
// This implementation is needed for consumers of the SDK have the option to not include the
139-
// RedirectUriReceiverActivity in their app if they don't use SSO login.
140-
api("net.openid:appauth:0.11.1")
128+
implementation("net.openid:appauth:0.11.1")
141129
implementation("androidx.constraintlayout:constraintlayout:2.0.3")
142130
implementation("androidx.appcompat:appcompat:1.1.0")
143131
implementation("androidx.exifinterface:exifinterface:1.3.1")
144132
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2-native-mt")
145133
implementation("com.github.spullara.mustache.java:compiler:0.8.18")
146134
implementation("androidx.fragment:fragment-ktx:1.4.0-alpha07")
147-
implementation("androidx.work:work-runtime-ktx:2.9.0")
148-
testImplementation("androidx.work:work-testing:2.9.0")
149135
implementation("androidx.lifecycle:lifecycle-common:2.5.1")
150136
implementation("com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava")
137+
debugImplementation("androidx.fragment:fragment-testing:1.6.0-alpha04")
151138
implementation("com.google.code.gson:gson:2.11.0")
152-
api ("androidx.room:room-runtime:2.6.1")
153-
api("androidx.room:room-ktx:2.6.1")
154-
annotationProcessor("androidx.room:room-compiler:2.6.1")
139+
implementation ("androidx.room:room-runtime:2.5.2")
140+
implementation("androidx.room:room-ktx:2.5.2")
141+
annotationProcessor("androidx.room:room-compiler:2.5.2")
155142
ksp("androidx.room:room-compiler:2.6.1")
156143
testImplementation("junit:junit:4.13.2")
157144
testImplementation("org.jetbrains.kotlin:kotlin-test:2.0.20")
158145
testImplementation("io.mockk:mockk:1.12.3")
159146
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
160-
testImplementation("org.robolectric:robolectric:4.10.3")
161-
testImplementation ("org.json:json:20231013")
162147
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2-native-mt")
163148
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.31")
164149
androidTestImplementation("androidx.test:core:1.5.0")

geotabdrivesdk/native-sdk.d.ts

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -503,43 +503,23 @@ declare namespace geotabModules {
503503
}
504504

505505
namespace login {
506+
enum GeotabAppId {
507+
GEOTAB_DRIVE = 0,
508+
MYGEOTAB
509+
}
510+
506511
/*******
507512
* Start the login function integrated with Chrome Custom Tabs.
508-
* @param argument: { clientId: string, discoveryUri: string, loginHint: string }
513+
* @param argument: { clientId: string, discoveryUri: string, geotabAppId: GeotabAppId, loginHint: string? }
509514
* @param callback:
510515
* - result: string. A GeotabAuthState object.
511-
* The loginHint parameter is mandatory as we use it to store it as username in the SecureStorage.
512-
* It is also used to pre-fill the username field in the login page.
516+
* The loginHint parameter is optional. It is used to pre-fill the username field in the login page.
513517
* On a successful call a GeotabAuthState object turned into JSON will be given as result
514518
* If there's an error while logging in, err will be given.
515519
* GeotabAuthState object contains the following properties:
516-
* { accessToken: string }
520+
* { accessToken: string, idToken: string, refreshToken: string }
517521
*/
518-
function start(argument: { clientId: string, discoveryUri: string, loginHint: string }, callback: (err?: Error, result?: string) => void);
519-
520-
/*******
521-
* Start the getAuthToken function.
522-
* @param argument: { username: string }
523-
* @param callback:
524-
* - result: string. A GeotabAuthState object.
525-
* On a successful call a GeotabAuthState object turned into JSON will be given as result
526-
* If there's an error while retrieving the access token, err will be given.
527-
* GeotabAuthState object contains the following properties:
528-
* { accessToken: string }
529-
*/
530-
function getAuthToken(argument: { username: string }, callback: (err?: Error, result?: string) => void);
531-
}
532-
533-
namespace auth {
534-
/*******
535-
* Start the logout function integrated with Chrome Custom Tabs.
536-
* @param argument: { username: string }
537-
* @param callback:
538-
* - result: string.
539-
* On a successful call a string will be given as result with a success message.
540-
* If there's an error while retrieving the access token, err will be given.
541-
*/
542-
function logout(argument: { username: string }, callback: (err?: Error, result?: string) => void);
522+
function start(argument: { clientId: string, discoveryUri: string, geotabAppId: GeotabAppId, loginHint: string? }, callback: (err?: Error, result?: string) => void);
543523
}
544524

545525
namespace appearance {

geotabdrivesdk/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
5151
android:resource="@xml/accessory_filter" />
5252
</activity>
53-
<!-- This implementation is needed for consumers of the SDK have the option to not include the
54-
RedirectUriReceiverActivity in their app if they don't use SSO login.-->
53+
5554
<activity
5655
android:name="net.openid.appauth.RedirectUriReceiverActivity"
5756
android:exported="true"
57+
android:taskAffinity=""
5858
tools:node="replace">
5959
</activity>
6060
<service

geotabdrivesdk/src/main/java/com/geotab/mobile/sdk/DriveFragment.kt

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,10 @@ import com.geotab.mobile.sdk.module.ModuleFunction
3131
import com.geotab.mobile.sdk.module.NetworkErrorDelegate
3232
import com.geotab.mobile.sdk.module.Result
3333
import com.geotab.mobile.sdk.module.Success
34-
import com.geotab.mobile.sdk.logging.AppLogEventSource
35-
import com.geotab.mobile.sdk.models.database.AppDatabase
36-
import com.geotab.mobile.sdk.models.database.secureStorage.SecureStorageRepository
34+
import com.geotab.mobile.sdk.module.app.AppLogEventSource
3735
import com.geotab.mobile.sdk.module.app.AppModule
3836
import com.geotab.mobile.sdk.module.app.LastServerUpdatedCallbackType
3937
import com.geotab.mobile.sdk.module.appearance.AppearanceModule
40-
import com.geotab.mobile.sdk.module.auth.AuthModule
4138
import com.geotab.mobile.sdk.module.battery.BatteryModule
4239
import com.geotab.mobile.sdk.module.browser.BrowserModule
4340
import com.geotab.mobile.sdk.module.camera.CameraDelegate
@@ -65,8 +62,6 @@ import com.geotab.mobile.sdk.module.state.StateModule
6562
import com.geotab.mobile.sdk.module.user.DriverActionNecessaryCallbackType
6663
import com.geotab.mobile.sdk.module.dutyStatusLog.GetDutyStatusLogFunction
6764
import com.geotab.mobile.sdk.module.dutyStatusLog.GetCurrentDrivingLogFunction
68-
import com.geotab.mobile.sdk.module.login.AuthUtil
69-
import com.geotab.mobile.sdk.module.login.LoginModule
7065
import com.geotab.mobile.sdk.module.user.GetAllUsersFunction
7166
import com.geotab.mobile.sdk.module.user.GetAvailabilityFunction
7267
import com.geotab.mobile.sdk.module.user.GetHosRuleSetFunction
@@ -93,6 +88,7 @@ import kotlinx.coroutines.Dispatchers
9388
import kotlinx.coroutines.delay
9489
import kotlinx.coroutines.launch
9590
import kotlinx.coroutines.withContext
91+
import net.openid.appauth.BuildConfig
9692
import org.json.JSONObject
9793

9894
// fragment initialization parameters
@@ -245,24 +241,10 @@ class DriveFragment :
245241
appPreferences
246242
)
247243
}
248-
private val authUtil: AuthUtil by lazy {
249-
AuthUtil.init(secureStorageRepository)
250-
}
251-
252-
private var loginModule: LoginModule? = null
253-
private var authModule: AuthModule? = null
254-
255-
private val secureStorageRepository: SecureStorageRepository by lazy {
256-
SecureStorageRepository(
257-
requireContext().packageName,
258-
AppDatabase.getDatabase(requireContext()).secureStorageDao()
259-
)
260-
}
261244

262245
private val secureStorageModule: SecureStorageModule by lazy {
263-
SecureStorageModule(secureStorageRepository)
246+
SecureStorageModule(requireContext())
264247
}
265-
266248
private val modulesInternal: ArrayList<Module?> by lazy {
267249
arrayListOf(
268250
deviceModule,
@@ -365,24 +347,6 @@ class DriveFragment :
365347
startForegroundService()
366348
driveReadyCallback()
367349
}
368-
if (DriveSdkConfig.includeAppAuthModules) {
369-
loginModule?.let { module ->
370-
with(module) {
371-
initValues(requireActivity())
372-
lifecycleScope.launch {
373-
withContext(Dispatchers.IO) {
374-
startTokenRefresh()
375-
}
376-
}
377-
}
378-
}
379-
authModule?.let { module ->
380-
with(module) {
381-
initValues(requireActivity())
382-
}
383-
}
384-
}
385-
386350
ioxUsbModule.start()
387351
}
388352

@@ -412,9 +376,6 @@ class DriveFragment :
412376

413377
ioxUsbModule.stop()
414378

415-
loginModule?.dispose()
416-
authModule?.dispose()
417-
418379
appModule.stopForegroundService()
419380
}
420381

@@ -465,12 +426,6 @@ class DriveFragment :
465426
this.modules = ArrayList(modules)
466427
}
467428
this.modules.addAll(modulesInternal.filterNotNull())
468-
if (DriveSdkConfig.includeAppAuthModules) {
469-
loginModule = LoginModule(authUtil)
470-
authModule = AuthModule(authUtil)
471-
loginModule?.let { this.modules.add(it) }
472-
authModule?.let { this.modules.add(it) }
473-
}
474429
logger.info(TAG, "modules initialized")
475430
}
476431

geotabdrivesdk/src/main/java/com/geotab/mobile/sdk/DriveSdkConfig.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ class DriveSdkConfig {
99
const val apiCallTimeoutMilli = 9 * 1000L
1010
var serverAddress = "my.geotab.com"
1111
var allowThirdPartyCookies = false
12-
var includeAppAuthModules = false
1312
}
1413
}

geotabdrivesdk/src/main/java/com/geotab/mobile/sdk/MyGeotabFragment.kt

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,17 @@ import android.webkit.WebView
1616
import androidx.activity.OnBackPressedCallback
1717
import androidx.annotation.Keep
1818
import androidx.fragment.app.Fragment
19-
import androidx.lifecycle.lifecycleScope
2019
import com.geotab.mobile.sdk.databinding.FragmentGeotabDriveSdkBinding
2120
import com.geotab.mobile.sdk.fileChooser.FileChooserHelper
22-
import com.geotab.mobile.sdk.logging.AppLogEventSource
23-
import com.geotab.mobile.sdk.logging.InternalAppLogging
2421
import com.geotab.mobile.sdk.models.ModuleEvent
25-
import com.geotab.mobile.sdk.models.database.AppDatabase
26-
import com.geotab.mobile.sdk.models.database.secureStorage.SecureStorageRepository
2722
import com.geotab.mobile.sdk.module.Failure
2823
import com.geotab.mobile.sdk.module.Module
2924
import com.geotab.mobile.sdk.module.ModuleFunction
3025
import com.geotab.mobile.sdk.module.NetworkErrorDelegate
3126
import com.geotab.mobile.sdk.module.Result
3227
import com.geotab.mobile.sdk.module.Success
33-
import com.geotab.mobile.sdk.module.auth.AuthModule
3428
import com.geotab.mobile.sdk.module.browser.BrowserModule
3529
import com.geotab.mobile.sdk.module.device.DeviceModule
36-
import com.geotab.mobile.sdk.module.login.AuthUtil
37-
import com.geotab.mobile.sdk.module.login.LoginModule
3830
import com.geotab.mobile.sdk.module.sso.SSOModule
3931
import com.geotab.mobile.sdk.module.webview.WebViewModule
4032
import com.geotab.mobile.sdk.permission.Permission
@@ -47,9 +39,7 @@ import com.geotab.mobile.sdk.util.PushScriptUtil
4739
import com.geotab.mobile.sdk.util.UserAgentUtil
4840
import com.geotab.mobile.sdk.util.serializable
4941
import com.github.mustachejava.DefaultMustacheFactory
50-
import kotlinx.coroutines.Dispatchers
51-
import kotlinx.coroutines.launch
52-
import kotlinx.coroutines.withContext
42+
import net.openid.appauth.BuildConfig
5343
import org.json.JSONObject
5444

5545
// fragment initialization parameters
@@ -128,19 +118,6 @@ class MyGeotabFragment :
128118
activity?.let { WebViewModule(it, goBack) }
129119
}
130120

131-
private val authUtil: AuthUtil by lazy {
132-
AuthUtil.init(secureStorageRepository)
133-
}
134-
private var loginModule: LoginModule? = null
135-
private var authModule: AuthModule? = null
136-
137-
private val secureStorageRepository: SecureStorageRepository by lazy {
138-
SecureStorageRepository(
139-
requireContext().packageName,
140-
AppDatabase.getDatabase(requireContext()).secureStorageDao()
141-
)
142-
}
143-
144121
private val modulesInternal: ArrayList<Module?> by lazy {
145122
arrayListOf(
146123
deviceModule,
@@ -263,27 +240,9 @@ class MyGeotabFragment :
263240
webView.visibility = View.VISIBLE
264241
errorView.visibility = View.GONE
265242
}
266-
if (DriveSdkConfig.includeAppAuthModules) {
267-
loginModule?.let { module ->
268-
with(module) {
269-
initValues(requireActivity())
270-
lifecycleScope.launch {
271-
withContext(Dispatchers.IO) {
272-
startTokenRefresh()
273-
}
274-
}
275-
}
276-
}
277-
authModule?.let { module ->
278-
with(module) {
279-
initValues(requireActivity())
280-
}
281-
}
282-
}
283243

284244
configureWebView()
285245
configureWebViewScript(contentController)
286-
InternalAppLogging.setListener(AppLogEventSource(push))
287246
}
288247

289248
override fun findModule(module: String): Module? {
@@ -376,13 +335,6 @@ class MyGeotabFragment :
376335
this.modules = ArrayList(modules)
377336
}
378337
this.modules.addAll(modulesInternal.filterNotNull())
379-
380-
if (DriveSdkConfig.includeAppAuthModules) {
381-
loginModule = LoginModule(authUtil)
382-
authModule = AuthModule(authUtil)
383-
loginModule?.let { this.modules.add(it) }
384-
authModule?.let { this.modules.add(it) }
385-
}
386338
}
387339

388340
@SuppressLint("SetJavaScriptEnabled")
@@ -465,8 +417,6 @@ class MyGeotabFragment :
465417
override fun onDestroyView() {
466418
super.onDestroyView()
467419
_binding = null
468-
loginModule?.dispose()
469-
authModule?.dispose()
470420
}
471421

472422
private fun moveAppToBackground() {

geotabdrivesdk/src/main/java/com/geotab/mobile/sdk/logging/InternalAppLogging.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.geotab.mobile.sdk.logging
22

33
import android.util.Log
44
import androidx.annotation.Keep
5+
import com.geotab.mobile.sdk.module.app.AppLogEventListener
56

67
@Keep
78
enum class LogLevel(val type: Int) {

0 commit comments

Comments
 (0)