Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ dependencies {
implementation(projects.feature.login)
implementation(projects.feature.subscription)
implementation(projects.feature.tab)
implementation(projects.feature.agent)
implementation(projects.composeUi)
implementation(libs.androidx.splash)
implementation(libs.materialKolor)
Expand Down
2 changes: 2 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@
-keep interface rust.nostr.sdk.** { *; }
-keepclassmembers class rust.nostr.sdk.** { *; }
-keepclassmembers interface rust.nostr.sdk.** { *; }
-dontwarn java.lang.management.**
-dontwarn javax.management.**
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="ai.koog.agents.core,ai.koog.agents.features.event.handler,ai.koog.agents.features.memory,ai.koog.agents.features.opentelemetry,ai.koog.agents.features.snapshot,ai.koog.agents.features.tokenizer,ai.koog.agents.features.trace,ai.koog.agents.mcp.metadata,ai.koog.agents.tools,ai.koog.agents.utils,ai.koog.embeddings.base,ai.koog.embeddings.llm,ai.koog.http.client.core,ai.koog.http.client.ktor,ai.koog.koog.agents,ai.koog.prompt.cache.files,ai.koog.prompt.cache.model,ai.koog.prompt.executor.anthropic.client,ai.koog.prompt.executor.bedrock.client,ai.koog.prompt.executor.cached,ai.koog.prompt.executor.clients,ai.koog.prompt.executor.model,ai.koog.prompt.executor.ollama.client,ai.koog.prompt.executor.openai.client,ai.koog.prompt.executor.openai.client.base,ai.koog.prompt.llm,ai.koog.prompt.markdown,ai.koog.prompt.model,ai.koog.prompt.processor,ai.koog.prompt.structure,ai.koog.prompt.tokenizer,ai.koog.prompt.xml,ai.koog.rag.base,ai.koog.serialization.core,ai.koog.utils" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/dev/dimension/flare/ui/AppContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ fun FlareApp(content: @Composable () -> Unit) {
}

val appSettings = state.appSettings.takeSuccessOr(AppSettings(""))
val openAIConfig = appSettings.aiConfig.type as? AppSettings.AiConfig.Type.OpenAI
CompositionLocalProvider(
LocalUriHandler provides uriHandler,
LocalGlobalAppearance provides globalAppearance,
LocalTimelineAppearance provides
remember(globalAppearance, timelineAppearance, appSettings.translateConfig, appSettings.aiConfig.tldr) {
remember(globalAppearance, timelineAppearance, appSettings.translateConfig, appSettings.aiConfig) {
timelineAppearance.copy(
aiConfig =
TimelineAppearance.AiConfig(
translation = true,
tldr = appSettings.aiConfig.tldr,
agent = appSettings.aiConfig.agent && !openAIConfig?.model.isNullOrBlank(),
),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.ModalBottomSheetProperties
import androidx.compose.material3.SheetState
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.material3.SheetValue
import androidx.compose.material3.rememberBottomSheetState
import androidx.compose.runtime.Composable
import androidx.navigation3.runtime.NavEntry
import androidx.navigation3.scene.OverlayScene
Expand All @@ -25,7 +26,17 @@ private class BottomSheetScene<T : Any>(
lateinit var sheetState: SheetState

override val content: @Composable (() -> Unit) = {
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = properties.expandFully)
sheetState =
rememberBottomSheetState(
initialValue =
if (properties.expandFully) SheetValue.Expanded else SheetValue.PartiallyExpanded,
enabledValues =
if (properties.expandFully) {
setOf(SheetValue.Expanded, SheetValue.Hidden)
} else {
setOf(SheetValue.PartiallyExpanded, SheetValue.Expanded, SheetValue.Hidden)
},
)
ModalBottomSheet(
onDismissRequest = { onBack() },
properties = properties.properties,
Expand Down
79 changes: 53 additions & 26 deletions app/src/main/java/dev/dimension/flare/ui/component/SearchBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
Expand Down Expand Up @@ -64,6 +67,7 @@ internal fun SearchBar(
onSearch: (String) -> Unit,
modifier: Modifier = Modifier,
trailingIcon: @Composable (() -> Unit)? = null,
historyFloatingActionButton: @Composable (() -> Unit)? = null,
) {
val keyboardController = LocalSoftwareKeyboardController.current
SearchContent(
Expand All @@ -85,6 +89,7 @@ internal fun SearchBar(
},
queryTextState = state.queryTextState,
trailingIcon = trailingIcon,
historyFloatingActionButton = historyFloatingActionButton,
)
}

Expand All @@ -102,6 +107,7 @@ private fun SearchContent(
onBack: () -> Unit,
modifier: Modifier = Modifier,
trailingIcon: @Composable (() -> Unit)? = null,
historyFloatingActionButton: @Composable (() -> Unit)? = null,
) {
androidx.compose.material3.SearchBar(
inputField = {
Expand Down Expand Up @@ -137,33 +143,54 @@ private fun SearchContent(
expanded = expanded,
onExpandedChange = onExpandedChange,
) {
LazyColumn(
modifier = Modifier.imePadding(),
Box(
modifier =
Modifier
.fillMaxSize()
.imePadding(),
) {
historyState.onSuccess { history ->
items(history.size) { index ->
val item = history[index]
ListItem(
headlineContent = {
Text(text = item.keyword)
},
modifier =
Modifier
.clickable {
onSearch(item.keyword)
},
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
trailingContent = {
IconButton(onClick = {
onDelete.invoke(item)
}) {
FAIcon(
imageVector = FontAwesomeIcons.Solid.Xmark,
contentDescription = stringResource(R.string.delete),
)
}
},
)
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding =
PaddingValues(
bottom = if (historyFloatingActionButton != null) 88.dp else 0.dp,
),
) {
historyState.onSuccess { history ->
items(history.size) { index ->
val item = history[index]
ListItem(
headlineContent = {
Text(text = item.keyword)
},
modifier =
Modifier
.clickable {
onSearch(item.keyword)
},
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
trailingContent = {
IconButton(onClick = {
onDelete.invoke(item)
}) {
FAIcon(
imageVector = FontAwesomeIcons.Solid.Xmark,
contentDescription = stringResource(R.string.delete),
)
}
},
)
}
}
}
historyFloatingActionButton?.let { fab ->
Box(
modifier =
Modifier
.align(androidx.compose.ui.Alignment.BottomCenter)
.padding(bottom = 16.dp),
) {
fab()
}
}
}
Expand Down
Loading
Loading