Skip to content

Commit ccd59f0

Browse files
Search in notes and Show API info always (#230)
* Refactor metadata fetching logic to use a dedicated function and trigger on link selection * Enhance search functionality by including notes in query conditions and refactor API documentation layout
1 parent c1b1465 commit ccd59f0

File tree

4 files changed

+70
-74
lines changed

4 files changed

+70
-74
lines changed

app/src/main/java/com/yogeshpaliyal/deepr/server/LocalServerRepositoryImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class LocalServerRepositoryImpl(
9999
val links =
100100
deeprQueries
101101
.getLinksAndTags(
102+
"",
102103
"",
103104
"",
104105
-1L,
@@ -158,6 +159,7 @@ class LocalServerRepositoryImpl(
158159
val linkCount =
159160
deeprQueries
160161
.getLinksAndTags(
162+
"",
161163
"",
162164
"",
163165
-1L,

app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/LocalNetworkServer.kt

Lines changed: 66 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -254,82 +254,75 @@ fun LocalNetworkServerScreen(
254254
}
255255
}
256256

257-
// Server Details Section
258-
AnimatedVisibility(
259-
visible = isRunning && serverUrl != null,
257+
// API Documentation Card
258+
OutlinedCard(
259+
modifier = Modifier.fillMaxWidth(),
260+
colors =
261+
CardDefaults.outlinedCardColors(
262+
containerColor = MaterialTheme.colorScheme.surface,
263+
),
260264
) {
261-
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
262-
// API Documentation Card
263-
OutlinedCard(
264-
modifier = Modifier.fillMaxWidth(),
265-
colors =
266-
CardDefaults.outlinedCardColors(
267-
containerColor = MaterialTheme.colorScheme.surface,
268-
),
265+
Column(
266+
modifier = Modifier.padding(20.dp),
267+
verticalArrangement = Arrangement.spacedBy(16.dp),
268+
) {
269+
Row(
270+
verticalAlignment = Alignment.CenterVertically,
271+
horizontalArrangement = Arrangement.spacedBy(8.dp),
269272
) {
270-
Column(
271-
modifier = Modifier.padding(20.dp),
272-
verticalArrangement = Arrangement.spacedBy(16.dp),
273-
) {
274-
Row(
275-
verticalAlignment = Alignment.CenterVertically,
276-
horizontalArrangement = Arrangement.spacedBy(8.dp),
277-
) {
278-
Icon(
279-
TablerIcons.InfoCircle,
280-
contentDescription = null,
281-
tint = MaterialTheme.colorScheme.secondary,
282-
modifier = Modifier.size(20.dp),
283-
)
284-
Text(
285-
text = stringResource(R.string.api_endpoints),
286-
style = MaterialTheme.typography.titleMedium,
287-
fontWeight = FontWeight.SemiBold,
288-
)
289-
}
290-
Text(
291-
text = stringResource(R.string.api_endpoints_description),
292-
style = MaterialTheme.typography.bodySmall,
293-
color = MaterialTheme.colorScheme.onSurfaceVariant,
294-
)
273+
Icon(
274+
TablerIcons.InfoCircle,
275+
contentDescription = null,
276+
tint = MaterialTheme.colorScheme.secondary,
277+
modifier = Modifier.size(20.dp),
278+
)
279+
Text(
280+
text = stringResource(R.string.api_endpoints),
281+
style = MaterialTheme.typography.titleMedium,
282+
fontWeight = FontWeight.SemiBold,
283+
)
284+
}
285+
Text(
286+
text = stringResource(R.string.api_endpoints_description),
287+
style = MaterialTheme.typography.bodySmall,
288+
color = MaterialTheme.colorScheme.onSurfaceVariant,
289+
)
295290

296-
Column(
297-
modifier =
298-
Modifier
299-
.fillMaxWidth()
300-
.background(
301-
MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.5f),
302-
RoundedCornerShape(12.dp),
303-
).padding(16.dp),
304-
verticalArrangement = Arrangement.spacedBy(12.dp),
305-
) {
306-
ApiEndpointItem(
307-
"GET",
308-
"/api/links",
309-
stringResource(R.string.api_get_links),
310-
)
311-
ApiEndpointItem(
312-
"POST",
313-
"/api/links",
314-
stringResource(R.string.api_add_link),
315-
)
316-
ApiEndpointItem(
317-
"GET",
318-
"/api/tags",
319-
stringResource(R.string.api_get_tags),
320-
)
321-
ApiEndpointItem(
322-
"GET",
323-
"/api/link-info",
324-
stringResource(R.string.api_get_link_info),
325-
)
326-
ApiEndpointItem(
327-
"GET",
328-
"/api/server-info",
329-
stringResource(R.string.api_get_server_info),
330-
)
331-
}
332-
}
291+
Column(
292+
modifier =
293+
Modifier
294+
.fillMaxWidth()
295+
.background(
296+
MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.5f),
297+
RoundedCornerShape(12.dp),
298+
).padding(16.dp),
299+
verticalArrangement = Arrangement.spacedBy(12.dp),
300+
) {
301+
ApiEndpointItem(
302+
"GET",
303+
"/api/links",
304+
stringResource(R.string.api_get_links),
305+
)
306+
ApiEndpointItem(
307+
"POST",
308+
"/api/links",
309+
stringResource(R.string.api_add_link),
310+
)
311+
ApiEndpointItem(
312+
"GET",
313+
"/api/tags",
314+
stringResource(R.string.api_get_tags),
315+
)
316+
ApiEndpointItem(
317+
"GET",
318+
"/api/link-info",
319+
stringResource(R.string.api_get_link_info),
320+
)
321+
ApiEndpointItem(
322+
"GET",
323+
"/api/server-info",
324+
stringResource(R.string.api_get_server_info),
325+
)
333326
}
334327
}
335328
}

app/src/main/java/com/yogeshpaliyal/deepr/viewmodel/AccountViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ class AccountViewModel(
254254

255255
deeprQueries
256256
.getLinksAndTags(
257+
query,
257258
query,
258259
query,
259260
favourite.toLong(),

app/src/main/sqldelight/com/yogeshpaliyal/deepr/Deepr.sq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ FROM
6161
LEFT JOIN LinkTags ON Deepr.id = LinkTags.linkId
6262
LEFT JOIN Tags ON LinkTags.tagId = Tags.id
6363
WHERE
64-
(Deepr.link LIKE '%' || ? || '%' OR Deepr.name LIKE '%' || ? || '%')
64+
(Deepr.link LIKE '%' || ? || '%' OR Deepr.name LIKE '%' || ? || '%' OR Deepr.notes LIKE '%' || ? || '%')
6565
AND (
6666
? = -1 OR Deepr.isFavourite = ?
6767
)

0 commit comments

Comments
 (0)