Files
AFFiNE-Mirror/packages/frontend/apps/android/App/app/build.gradle
aki-chang-dev a02eed382d feat(android): chat base feature (#12684)
- **feat(android): chat send & receive**
- **[WIP] feat(android): markdown style for chat**
- **fix(android): fix auto scroll & ai message id replacement**
- **feat(android): replace icons**
- **refactor(android): design system**
- **feat(android): markdown style for chat**

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a comprehensive custom theme system with new color palettes, typography, and theme modes (Light, Dark, System).
  - Added support for rendering Markdown-formatted text in chat messages with custom styling.
  - Integrated new vector icons for UI elements such as lists, camera, image, send, close, and more.
  - Added composable icon and icon button components for consistent icon usage across the app.

- **Enhancements**
  - Updated chat UI to use the new theme, icons, and Markdown rendering for AI messages.
  - Improved chat message management and send button state handling with enhanced session retrieval and SSE stream processing.
  - Refined app bar and dropdown menu components with updated icons and theme integration.
  - Enhanced floating action button appearance with tinted vector drawable.
  - Unified UI components and styling under the AFFiNE design system in chat input and app bars.

- **Bug Fixes**
  - Corrected application and theme class naming for consistency.

- **Chores**
  - Added new dependencies for rich text and Markdown support.
  - Updated color and icon resources for a unified visual style.
  - Removed deprecated headers from authentication requests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-03 07:35:48 +00:00

188 lines
6.3 KiB
Groovy

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
alias libs.plugins.kotlin.parcelize
alias libs.plugins.kotlin.serialization
alias libs.plugins.ksp
alias libs.plugins.rust.android
alias libs.plugins.compose
alias libs.plugins.google.service
alias libs.plugins.firebase.crashlytics
alias libs.plugins.hilt
}
apply from: 'capacitor.build.gradle'
android {
namespace "app.affine.pro"
compileSdk rootProject.ext.compileSdkVersion
ndkVersion = new File(sdkDirectory, "ndk").listFiles().sort().last().name
defaultConfig {
applicationId "app.affine.pro"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName System.getenv('VERSION_NAME') ?: 'v1.0.0-local'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
ndk {
abiFilters 'arm64-v8a'
}
}
buildFeatures {
compose true
buildConfig true
viewBinding true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
debuggable true
}
}
flavorDimensions = ['chanel']
productFlavors {
stable
beta
internal
canary
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}
repositories {
flatDir {
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':capacitor-android')
implementation project(':capacitor-cordova-android-plugins')
implementation project(':service')
implementation libs.androidx.appcompat
implementation libs.androidx.browser
implementation libs.timber
implementation libs.hilt.android.core
ksp libs.hilt.compiler
def composeBom = platform(libs.androidx.compose.bom)
implementation composeBom
implementation libs.androidx.activity.compose
implementation libs.androidx.compose.foundation.layout
implementation libs.androidx.compose.material3
implementation libs.androidx.compose.material.icons.extended
implementation libs.androidx.compose.runtime.livedata
implementation libs.androidx.compose.ui.tooling.preview
implementation libs.androidx.compose.ui.util
implementation libs.androidx.compose.ui.viewbinding
implementation libs.androidx.compose.ui.googlefonts
implementation libs.androidx.lifecycle.viewModelCompose
implementation libs.androidx.lifecycle.runtime.compose
implementation libs.androidx.navigation.compose
debugImplementation composeBom
debugImplementation libs.androidx.compose.ui.test.manifest
debugImplementation libs.androidx.compose.ui.tooling
implementation libs.androidx.coordinatorlayout
implementation libs.androidx.core.ktx
implementation libs.androidx.core.splashscreen
implementation libs.androidx.datastore.preferences
implementation libs.androidx.navigation.fragment
implementation libs.androidx.navigation.ui.ktx
implementation libs.apollo.runtime
implementation (libs.jna) {
artifact {
type = 'aar'
}
}
implementation libs.kotlinx.coroutines.android
implementation libs.kotlinx.serialization.json
implementation platform(libs.firebase.bom)
implementation libs.firebase.analytics
implementation libs.firebase.crashlytics
implementation libs.firebase.storage
implementation platform(libs.okhttp.bom)
implementation libs.okhttp
implementation libs.okhttp.coroutines
implementation libs.okhttp.logging
implementation libs.okhttp.sse
implementation libs.richtext.commonmark
implementation libs.richtext.ui
testImplementation libs.junit
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.core
}
cargo {
module = "../../../../mobile-native"
libname = "affine_mobile_native"
features {
defaultAnd("use-as-lib")
}
targets = ["arm64"]
pythonCommand = "python3"
targetDirectory = "../../../../../../target"
apiLevel = 28
targetIncludes = ["libaffine_mobile_native.so"]
profile = "release"
}
kotlin {
compilerOptions {
apiVersion = KotlinVersion.KOTLIN_2_1
languageVersion = KotlinVersion.KOTLIN_2_1
jvmTarget = JvmTarget.JVM_21
}
}
afterEvaluate {
// The `cargoBuild` task isn't available until after evaluation.
android.applicationVariants.configureEach { variant ->
def productFlavor = ""
variant.productFlavors.each {
productFlavor += "${it.name.capitalize()}"
}
def buildType = "${variant.buildType.name.capitalize()}"
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(tasks["cargoBuild"])
}
}
android.applicationVariants.configureEach { variant ->
def t = tasks.register("generate${variant.name.capitalize()}UniFFIBindings", Exec) {
workingDir "${project.projectDir}"
// Runs the bindings generation, note that you must have uniffi-bindgen installed and in your PATH environment variable
commandLine 'cargo', 'run', '--bin', 'uniffi-bindgen', 'generate', '--library', "${buildDir}/rustJniLibs/android/arm64-v8a/libaffine_mobile_native.so", '--language', 'kotlin', '--out-dir', "${project.projectDir}/src/main/java"
dependsOn("cargoBuild")
}
variant.javaCompileProvider.get().dependsOn(t)
}
tasks.whenTaskAdded { task ->
if ((task.name == 'javaPreCompileDebug' || task.name == 'javaPreCompileRelease')) {
task.dependsOn 'cargoBuild'
}
}