Skip to content

Commit a9af28b

Browse files
committed
Add Compose Compiler Gradle Plugin
1 parent ee6f56c commit a9af28b

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

app/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import java.util.regex.Matcher
22
import java.util.regex.Pattern
33

4-
apply plugin: 'com.android.application'
5-
apply plugin: 'org.jetbrains.kotlin.android'
6-
apply plugin: 'dagger.hilt.android.plugin'
7-
apply plugin: 'kotlin-kapt'
8-
apply plugin: 'maven-publish'
4+
plugins {
5+
id 'com.android.application'
6+
id 'org.jetbrains.kotlin.android'
7+
id 'dagger.hilt.android.plugin'
8+
id 'kotlin-kapt'
9+
id 'maven-publish'
10+
id "org.jetbrains.kotlin.plugin.compose" version "2.1.21"
11+
}
912

1013
android {
1114
compileSdk 35

app/src/main/java/ai/elimu/vitabu/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ fun VitabuTheme(content: @Composable () -> Unit) {
5454

5555
@Composable
5656
fun MainScreen(onPackageCheck: (Boolean) -> Unit) {
57-
val context = LocalContext.current
57+
val context = LocalContext.current.applicationContext
5858

5959
// Empty Box as container - the UI is minimal since this is just a launcher activity
6060
Box(modifier = Modifier.fillMaxSize()) {
6161
// Check for required package when the composable is first launched
6262
LaunchedEffect(key1 = Unit) {
63-
val hasPackage = ensurePackageInstalledOrPrompt(
63+
val hasPackage = context.ensurePackageInstalledOrPrompt(
6464
packageName = BuildConfig.CONTENT_PROVIDER_APPLICATION_ID,
6565
launchPackage = BuildConfig.APPSTORE_APPLICATION_ID,
6666
launchClass = "ai.elimu.appstore.MainActivity",

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ buildscript {
1616
}
1717
}
1818

19+
plugins {
20+
// Existing plugins
21+
alias(libs.plugins.compose.compiler)
22+
}
23+
1924
allprojects {
2025
repositories {
2126
google()

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ androidXEspresso = "3.6.1"
1212
kotlinGradlePlugin = "2.1.21"
1313
kotlinCoroutines = "1.10.2"
1414
agp = "8.8.2"
15+
kotlinx-metadata-jvm = "0.6.0"
1516

1617
# Jetpack Compose
1718
composeUi = "1.5.4"
@@ -32,6 +33,7 @@ kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutine
3233
androidx-constraint-layout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" }
3334
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidXJunit" }
3435
androidx-espresso = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidXEspresso" }
36+
kotlinx-metadata-jvm = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version.ref = "kotlinx-metadata-jvm" }
3537

3638
# Jetpack Compose
3739
compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "composeUi" }
@@ -47,3 +49,4 @@ android-gradle-plugin = { group = "com.android.tools.build", name = "gradle", ve
4749
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin"}
4850

4951
[plugins]
52+
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinGradlePlugin" }

0 commit comments

Comments
 (0)