Skip to content

Commit ca61302

Browse files
committed
updated for Android versions, Kotlin version, and typo fixes in readme
1 parent f3dea60 commit ca61302

File tree

6 files changed

+53
-41
lines changed

6 files changed

+53
-41
lines changed

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Full documentation can be found on the [Couchbase Developer Portal](https://deve
77
## Prerequisites
88
To run this prebuilt project, you will need:
99
- Familiarity with building Android Apps with <a target="_blank" rel="noopener noreferrer" href="https://developer.android.com/kotlin">Kotlin</a>, <a target="_blank" rel="noopener noreferrer" href="https://developer.android.com/jetpack/compose/mental-model">JetPack Compose</a>, and Android Studio
10-
- [Android Studio Chimpmuck or above](https://developer.android.com/studio)
11-
- Android SDK installed and setup (> v.33.0.0)
12-
- Android Build Tools (> v.33.0.0)
13-
- Android device or emulator running API level 24 or above
10+
- [Android Studio Chipmuck or above](https://developer.android.com/studio)
11+
- Android SDK installed and setup (> v.34.0.0)
12+
- Android Build Tools (> v.34.0.0)
13+
- Android device or emulator running API level 26 or above
1414
- JDK 11 (now embedded into Android Studio 4+)
1515

1616
### Installing Couchbase Lite Framework
@@ -35,7 +35,7 @@ Then add the following to the <a target="_blank" rel="noopener noreferrer" href=
3535
dependencies {
3636
...
3737

38-
implementation "com.couchbase.lite:couchbase-lite-android-ktx:3.0.2"
38+
implementation "com.couchbase.lite:couchbase-lite-android-ktx:3.1.8"
3939
}
4040
```
4141

src/app/build.gradle.kts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ android {
1818
// The following argument makes the Android Test Orchestrator run its
1919
// "pm clear" command after each test invocation. This command ensures
2020
// that the app's state is completely cleared between tests.
21-
testInstrumentationRunnerArguments(mapOf("clearPackageData" to "true"))
21+
testInstrumentationRunnerArguments["clearPackageData"] = "true"
2222

2323
vectorDrawables {
2424
useSupportLibrary = true
@@ -48,7 +48,12 @@ android {
4848
}
4949

5050
kotlinOptions {
51-
jvmTarget = "1.8"
51+
jvmTarget = "11"
52+
}
53+
54+
compileOptions {
55+
sourceCompatibility = JavaVersion.VERSION_11
56+
targetCompatibility = JavaVersion.VERSION_11
5257
}
5358

5459
buildFeatures {
@@ -138,19 +143,19 @@ dependencies {
138143
implementation("io.insert-koin:koin-androidx-compose:$koinVersion")
139144

140145
//couchbase lite for kotlin
141-
implementation("com.couchbase.lite:couchbase-lite-android-ktx:3.1.6")
146+
implementation("com.couchbase.lite:couchbase-lite-android-ktx:$couchbaseLiteVersion")
142147

143148
//required because some flow APIs are still experimental (Card's onclick and cblite flow)
144149
implementation("androidx.annotation:annotation-experimental:$annotationExperimentalVersion")
145150

146151
testImplementation("junit:junit:4.13.2")
147-
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
148-
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
149-
androidTestImplementation("androidx.test.ext:junit:1.1.5")
150-
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
152+
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
153+
androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
154+
androidTestImplementation("androidx.test.ext:junit:1.2.0")
155+
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.0")
151156
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeUiVersion")
152-
androidTestImplementation("androidx.test:runner:1.5.2")
153-
androidTestUtil("androidx.test:orchestrator:1.4.2")
157+
androidTestImplementation("androidx.test:runner:1.6.0")
158+
androidTestUtil("androidx.test:orchestrator:1.5.0")
154159
debugImplementation("androidx.compose.ui:ui-tooling:$composeUiVersion")
155160
debugImplementation("androidx.compose.ui:ui-test-manifest:$composeUiVersion")
156161
}

src/app/src/androidTest/java/com/couchbase/learningpath/DatabaseIntegrationTests.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ import com.couchbase.learningpath.data.warehouse.WarehouseRepositoryDb
1313
import com.couchbase.learningpath.models.*
1414
import com.couchbase.learningpath.services.MockAuthenticationService
1515
import com.couchbase.lite.CouchbaseLiteException
16+
import kotlinx.coroutines.ExperimentalCoroutinesApi
1617
import kotlinx.coroutines.flow.*
1718
import kotlinx.coroutines.test.runTest
19+
import kotlinx.serialization.ExperimentalSerializationApi
1820
import org.junit.*
1921
import org.junit.Assert.*
2022
import org.junit.runner.RunWith
2123

24+
@ExperimentalSerializationApi
25+
@ExperimentalCoroutinesApi
2226
@RunWith(AndroidJUnit4::class)
2327
class DatabaseIntegrationTests {
2428

@@ -30,6 +34,7 @@ class DatabaseIntegrationTests {
3034
private lateinit var authenticationService: MockAuthenticationService
3135

3236
//setup repositories
37+
@OptIn(ExperimentalCoroutinesApi::class)
3338
private lateinit var projectRepository: ProjectRepositoryDb
3439
private lateinit var warehouseRepository: WarehouseRepositoryDb
3540
private lateinit var auditRepository: AuditRepositoryDb
@@ -82,6 +87,7 @@ class DatabaseIntegrationTests {
8287

8388
authenticationService = MockAuthenticationService()
8489
val isAuth = authenticationService.authenticatedUser(user1.username, user1.password)
90+
assertTrue(isAuth)
8591

8692
//arrange repositories
8793
auditRepository = AuditRepositoryDb(authenticationService, databaseManager)

src/app/src/main/java/com/couchbase/learningpath/InventoryNavGraph.kt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.couchbase.learningpath.ui.login.LoginViewModel
2222
import com.couchbase.learningpath.ui.profile.UserProfileView
2323
import com.couchbase.learningpath.ui.profile.UserProfileViewModel
2424
import com.couchbase.learningpath.ui.project.*
25+
import org.koin.androidx.compose.koinViewModel
2526

2627
/*
2728
Destinations used in routing
@@ -75,7 +76,7 @@ fun InventoryNavGraph(
7576
LoginView(onSuccessLogin = {
7677
actions.navigateToProjectsListView()
7778
},
78-
viewModel = getViewModel<LoginViewModel>())
79+
viewModel = koinViewModel<LoginViewModel>())
7980
}
8081

8182
composable(MainDestinations.PROJECT_LIST_ROUTE) {
@@ -85,13 +86,13 @@ fun InventoryNavGraph(
8586
scope = scope,
8687
navigateToProjectEditor = actions.navigateToProjectEditor,
8788
navigateToAuditListByProject = actions.navigateToAuditListByProject,
88-
viewModel = getViewModel<ProjectListViewModel>())
89+
viewModel = koinViewModel<ProjectListViewModel>())
8990
}
9091

9192
composable(MainDestinations.AUDIT_LIST_ROUTE_PATH){ backstackEntry ->
9293
val projectJson = backstackEntry.arguments?.getString(MainDestinations.AUDIT_LIST_KEY_ID)
9394
projectJson?.let {
94-
val viewModel = getViewModel<AuditListViewModel>()
95+
val viewModel = koinViewModel<AuditListViewModel>()
9596
viewModel.projectJson = it
9697
viewModel.getAudits()
9798
AuditListView(
@@ -106,7 +107,7 @@ fun InventoryNavGraph(
106107

107108
composable(MainDestinations.PROJECT_EDITOR_ROUTE_PATH ) { backstackEntry ->
108109
val projectId = backstackEntry.arguments?.getString(MainDestinations.PROJECT_KEY_ID)
109-
val viewModel = getViewModel<ProjectEditorViewModel>()
110+
val viewModel = koinViewModel<ProjectEditorViewModel>()
110111
if (projectId == null){
111112
viewModel.projectId(UUID.randomUUID().toString())
112113
}
@@ -133,7 +134,7 @@ fun InventoryNavGraph(
133134
argAuditId?.let {
134135
auditId = it
135136
}
136-
val viewModel = getViewModel<AuditEditorViewModel>()
137+
val viewModel = koinViewModel<AuditEditorViewModel>()
137138
viewModel.getAudit(projectId = projectId, auditId = auditId)
138139
viewModel.navigateToListSelection = actions.navigateToStockItemListSelector
139140

@@ -146,7 +147,7 @@ fun InventoryNavGraph(
146147
composable(MainDestinations.LOCATION_ROUTE_PATH) { backstackEntry ->
147148
val projectId = backstackEntry.arguments?.getString(MainDestinations.LOCATION_LIST_KEY_ID)
148149
projectId?.let {
149-
val viewModel = getViewModel<WarehouseSelectionViewModel>()
150+
val viewModel = koinViewModel<WarehouseSelectionViewModel>()
150151
viewModel.projectId(it)
151152
WarehouseSelectionView(
152153
viewModel = viewModel,
@@ -169,8 +170,8 @@ fun InventoryNavGraph(
169170
auditId = it
170171
}
171172

172-
val viewModel = getViewModel<StockItemSelectionViewModel>()
173-
val auditEditorViewModel = getViewModel<AuditEditorViewModel>()
173+
val viewModel = koinViewModel<StockItemSelectionViewModel>()
174+
val auditEditorViewModel = koinViewModel<AuditEditorViewModel>()
174175

175176
viewModel.projectId(projectId)
176177
viewModel.auditId(auditId)
@@ -192,13 +193,13 @@ fun InventoryNavGraph(
192193
UserProfileView(
193194
openDrawer = openDrawer,
194195
scaffoldState = scaffoldState,
195-
viewModel = getViewModel<UserProfileViewModel>())
196+
viewModel = koinViewModel<UserProfileViewModel>())
196197
}
197198

198199
composable(MainDestinations.DEVELOPER_ROUTE){
199200
DeveloperView(
200201
scaffoldState = scaffoldState,
201-
viewModel = getViewModel<DeveloperViewModel>(),
202+
viewModel = koinViewModel<DeveloperViewModel>(),
202203
openDrawer = openDrawer,
203204
navigateToDatabaseInfoView = actions.navigateToDeveloperDatabaseInfo)
204205
}
@@ -207,12 +208,12 @@ fun InventoryNavGraph(
207208
DevDatabaseInfoView(
208209
scaffoldState = scaffoldState,
209210
navigateUp = actions.upPress,
210-
viewModel = getViewModel<DevDatabaseInfoViewModel>())
211+
viewModel = koinViewModel<DevDatabaseInfoViewModel>())
211212
}
212213

213214
composable(MainDestinations.REPLICATOR_ROUTE){
214215
ReplicatorView(
215-
viewModel = getViewModel<ReplicatorViewModel>(),
216+
viewModel = koinViewModel<ReplicatorViewModel>(),
216217
openDrawer = openDrawer,
217218
replicatorConfigNav = actions.navigateToReplicatorConfig,
218219
scaffoldState = scaffoldState
@@ -221,7 +222,7 @@ fun InventoryNavGraph(
221222

222223
composable(MainDestinations.REPLICATOR_SETTINGS_ROUTE){
223224
ReplicatorConfigView(
224-
viewModel = getViewModel<ReplicatorConfigViewModel>(),
225+
viewModel = koinViewModel<ReplicatorConfigViewModel>(),
225226
navigateUp = actions.upPress,
226227
scaffoldState = scaffoldState
227228
)

src/build.gradle.kts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@ buildscript {
22
//Gradle docs on Extra properties
33
//https://docs.gradle.org/current/userguide/kotlin_dsl.html#extra_properties
44
val kotlinVersion by extra("1.9.22")
5-
val coreKtx by extra("1.12.0")
5+
val coreKtx by extra("1.13.1")
66
val composeVersion by extra("1.3.1")
7-
val composeUiVersion by extra("1.6.1")
8-
val activityComposeVersion by extra("1.8.2")
9-
val lifestyleRuntimeKtVersion by extra("2.7.0")
10-
val koinVersion by extra("3.5.3")
11-
val androidMaterialDesignVersion by extra("1.11.0")
12-
val androidxNavigationComposeVersion by extra("2.5.0")
7+
val composeUiVersion by extra("1.6.8")
8+
val activityComposeVersion by extra("1.9.0")
9+
val lifestyleRuntimeKtVersion by extra("2.8.2")
10+
val koinVersion by extra("3.5.6")
11+
val androidMaterialDesignVersion by extra("1.12.0")
12+
val androidxNavigationComposeVersion by extra("2.7.7")
1313
val googleAccompanistVersion by extra("0.23.1")
14-
val kotlinxSerializationJson by extra("1.6.2")
14+
val kotlinxSerializationJson by extra("1.6.3")
1515
val constraintsComposeVersion by extra("1.0.1")
16-
val annotationExperimentalVersion by extra("1.4.0")
16+
val annotationExperimentalVersion by extra("1.4.1")
1717
val coroutinesTestsVersion by extra("1.6.3")
1818

1919
//couchbase
20-
val couchbaseLiteVersion by extra("3.1.3")
20+
val couchbaseLiteVersion by extra("3.1.8")
2121

2222

2323
repositories {
24-
maven(url = "https://mobile.maven.couchbase.com/maven2/dev/")
2524
google()
2625
mavenCentral()
26+
maven(url = "https://mobile.maven.couchbase.com/maven2/dev/")
2727
}
2828
dependencies {
2929
classpath("org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}")
3030
}
3131
} // Top-level build file where you can add configuration options common to all sub-projects/modules.
3232

3333
plugins {
34-
id("com.android.application") version "8.3.0" apply false
35-
id("com.android.library") version "8.3.0" apply false
34+
id("com.android.application") version "8.4.2" apply false
35+
id("com.android.library") version "8.4.2" apply false
3636
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
3737
id("org.jetbrains.kotlin.jvm") version "1.9.22" apply false
3838
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Fri Apr 15 09:52:37 EDT 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)