Skip to content

Commit b774bd3

Browse files
committed
build: optimise dependencies
1 parent cb5674d commit b774bd3

6 files changed

Lines changed: 57 additions & 25 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- '**'
7+
pull_request:
78
workflow_dispatch:
89

910
jobs:

.github/workflows/dependency.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: 'Dependency Review'
2-
on: [ pull_request ]
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
pull_request:
7+
workflow_dispatch:
38

49
permissions:
510
contents: read
@@ -10,7 +15,27 @@ jobs:
1015
steps:
1116
- name: 'Checkout Repository'
1217
uses: actions/checkout@v4
13-
- name: 'Dependency Review'
18+
19+
- name: 'Dependency Review (Pull Request)'
20+
if: github.event_name == 'pull_request'
21+
uses: actions/dependency-review-action@v4
22+
with:
23+
fail-on-severity: 'high' # This is your custom setting
24+
25+
- name: 'Dependency Review (Manual)'
26+
if: github.event_name == 'workflow_dispatch'
1427
uses: actions/dependency-review-action@v4
1528
with:
16-
fail-on-severity: 'high'
29+
head-ref: ${{ github.ref }}
30+
base-ref: ${{ github.event.repository.default_branch }}
31+
fail-on-severity: 'high'
32+
33+
- name: Set up Java
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: 'zulu'
37+
java-version: 21
38+
- name: Setup Gradle
39+
uses: gradle/actions/setup-gradle@v4
40+
- name: analyze dependencies
41+
run: ./gradlew clean analyzeReleaseDependencies

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
.externalNativeBuild
1111
.cxx
1212
local.properties
13-
app/jni/
14-
app/jni/api-keys.c
1513
# Built application files
1614
*.apk
1715
*.aar

app/build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
applicationId = "me.nanova.summaryexpressive"
1717
minSdk = 33
1818
targetSdk = 36
19-
versionCode = 2
20-
versionName = "0.0.2"
19+
versionCode = 3
20+
versionName = "0.0.3"
2121

2222
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2323

@@ -84,8 +84,10 @@ dependencies {
8484
implementation("androidx.datastore:datastore-preferences:1.1.7")
8585

8686
// ml & llm
87-
implementation("com.google.mlkit:text-recognition:16.0.1")
88-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services")
87+
// this will bundle model to apk which is huge, use play service one first
88+
// implementation("com.google.mlkit:text-recognition:16.0.1")
89+
implementation("com.google.android.gms:play-services-mlkit-text-recognition:19.0.1")
90+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.10.2")
8991
implementation("io.ktor:ktor-client-android:3.2.2")
9092
implementation("ai.koog:koog-agents:0.3.0") {
9193
exclude(group = "io.ktor", module = "ktor-client-cio")

app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@
77
<!-- TODO: android:roundIcon="@mipmap/summary_you_round" -->
88
<application
99
android:name=".SummaryExpressiveApplication"
10+
android:enableOnBackInvokedCallback="true"
1011
android:icon="@mipmap/summary_you"
1112
android:label="@string/app_name"
1213
android:supportsRtl="true"
1314
android:theme="@style/Theme.SummaryExpressive"
14-
tools:ignore="MissingApplicationIcon">
15+
android:usesCleartextTraffic="true"
16+
android:windowSoftInputMode="adjustResize"
17+
tools:ignore="MissingApplicationIcon"
18+
tools:targetApi="36">
19+
20+
<meta-data
21+
android:name="com.google.mlkit.vision.DEPENDENCIES"
22+
android:value="ocr" />
23+
1524
<activity
1625
android:name=".MainActivity"
17-
android:enableOnBackInvokedCallback="true"
18-
android:exported="true"
19-
android:windowSoftInputMode="adjustResize">
26+
android:exported="true">
2027
<intent-filter>
2128
<action android:name="android.intent.action.MAIN" />
2229
<category android:name="android.intent.category.LAUNCHER" />

app/src/main/kotlin/me/nanova/summaryexpressive/ui/page/HomeScreen.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import androidx.compose.foundation.layout.Spacer
1515
import androidx.compose.foundation.layout.fillMaxSize
1616
import androidx.compose.foundation.layout.fillMaxWidth
1717
import androidx.compose.foundation.layout.height
18-
import androidx.compose.foundation.layout.imeNestedScroll
19-
import androidx.compose.foundation.layout.imePadding
2018
import androidx.compose.foundation.layout.padding
2119
import androidx.compose.foundation.layout.size
2220
import androidx.compose.foundation.layout.width
@@ -116,7 +114,7 @@ fun HomeScreen(
116114
modifier: Modifier = Modifier,
117115
navController: NavHostController,
118116
initialUrl: String? = null,
119-
viewModel: SummaryViewModel = hiltViewModel()
117+
viewModel: SummaryViewModel = hiltViewModel(),
120118
) {
121119
var isExtracting by remember { mutableStateOf(false) } // For Loading-Animation
122120
var url by remember { mutableStateOf(initialUrl ?: "") }
@@ -270,7 +268,7 @@ fun HomeScreen(
270268
@Composable
271269
private fun HomeTopAppBar(
272270
navController: NavHostController,
273-
scrollBehavior: TopAppBarScrollBehavior
271+
scrollBehavior: TopAppBarScrollBehavior,
274272
) {
275273
MediumFlexibleTopAppBar(
276274
modifier = Modifier.height(100.dp),
@@ -313,7 +311,7 @@ private fun UrlInputSection(
313311
isExtracting: Boolean,
314312
multiLine: Boolean,
315313
singleLine: Boolean,
316-
onSingleLineChange: (Boolean) -> Unit
314+
onSingleLineChange: (Boolean) -> Unit,
317315
) {
318316
val showCancelIcon = remember(url) { url.isNotBlank() }
319317

@@ -370,12 +368,13 @@ private fun UrlInputSection(
370368
.size(55.dp)
371369
.align(Alignment.Center)
372370
)
371+
} else {
372+
Icon(
373+
if (isDocument) Icons.Filled.CheckCircle else Icons.Filled.AddCircle,
374+
contentDescription = "Floating action button",
375+
modifier = Modifier.align(Alignment.Center)
376+
)
373377
}
374-
Icon(
375-
if (isDocument && !isExtracting) Icons.Filled.CheckCircle else Icons.Filled.AddCircle,
376-
contentDescription = "Floating action button",
377-
modifier = Modifier.align(Alignment.Center)
378-
)
379378
}
380379
}
381380
if (multiLine) {
@@ -436,7 +435,7 @@ private fun SummaryLengthSelector(
436435
private fun SummaryResultSection(
437436
summaryResult: SummaryResult,
438437
url: String,
439-
onRegenerate: () -> Unit
438+
onRegenerate: () -> Unit,
440439
) {
441440
val scope = rememberCoroutineScope()
442441
val clipboard = LocalClipboard.current
@@ -490,7 +489,7 @@ private fun SummaryResultSection(
490489
private fun HomeFloatingActionButtons(
491490
onPaste: () -> Unit,
492491
onSummarize: () -> Unit,
493-
isExtracting: Boolean
492+
isExtracting: Boolean,
494493
) {
495494
val context = LocalContext.current
496495
val stillLoading = stringResource(id = R.string.stillLoading)

0 commit comments

Comments
 (0)