Skip to content

Commit 3f22658

Browse files
Merge branch 'master' into copilot/fix-profile-linking-issue
2 parents 1b99e61 + 5d4aa35 commit 3f22658

File tree

12 files changed

+258
-231
lines changed

12 files changed

+258
-231
lines changed

.github/workflows/pr-check.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ concurrency:
2020

2121
permissions:
2222
contents: read
23-
pull-requests: write
2423

2524
jobs:
2625
validate-pr:
@@ -65,29 +64,4 @@ jobs:
6564
path: app/build/outputs/apk/github/debug/*.apk
6665
retention-days: 3
6766

68-
- name: 💬 Comment on PR with APK Link
69-
uses: actions/github-script@v7
70-
if: github.event_name == 'pull_request'
71-
with:
72-
script: |
73-
const runId = context.runId;
74-
const repo = context.repo;
75-
const prNumber = context.issue.number;
76-
77-
const comment = `## 📱 APK Build Complete!
78-
79-
Your debug APK has been built successfully and is ready for testing.
80-
81-
### 📥 Download APK
82-
[Download app-debug.apk](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
83-
84-
**Note:** Click the link above, scroll down to the "Artifacts" section, and download the \`app-debug\` artifact.
85-
86-
**Retention:** This artifact will be available for 3 days.`;
8767

88-
github.rest.issues.createComment({
89-
owner: repo.owner,
90-
repo: repo.repo,
91-
issue_number: prNumber,
92-
body: comment
93-
});

.github/workflows/pr-comment.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: PR Comment
2+
3+
on:
4+
workflow_run:
5+
workflows: ["PR Check"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
pull-requests: write
11+
12+
jobs:
13+
comment:
14+
name: 'Comment on PR'
15+
runs-on: ubuntu-latest
16+
if: >
17+
github.event.workflow_run.event == 'pull_request' &&
18+
github.event.workflow_run.conclusion == 'success'
19+
steps:
20+
- name: 💬 Comment on PR with APK Link
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const workflowRun = context.payload.workflow_run;
25+
const runId = workflowRun.id;
26+
const repo = context.repo;
27+
28+
// Get the PR number from the workflow run
29+
const prNumber = workflowRun.pull_requests[0]?.number;
30+
31+
if (!prNumber) {
32+
console.log('No PR number found, skipping comment');
33+
return;
34+
}
35+
36+
// Check if we already commented on this PR for this run
37+
const comments = await github.rest.issues.listComments({
38+
owner: repo.owner,
39+
repo: repo.repo,
40+
issue_number: prNumber
41+
});
42+
43+
const existingComment = comments.data.find(comment =>
44+
comment.body.includes(`actions/runs/${runId}`) &&
45+
comment.body.includes('APK Build Complete')
46+
);
47+
48+
if (existingComment) {
49+
console.log('Comment already exists for this run, skipping');
50+
return;
51+
}
52+
53+
const comment = `## 📱 APK Build Complete!
54+
55+
Your debug APK has been built successfully and is ready for testing.
56+
57+
### 📥 Download APK
58+
[Download app-debug.apk](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
59+
60+
**Note:** Click the link above, scroll down to the "Artifacts" section, and download the \`app-debug\` artifact.
61+
62+
**Retention:** This artifact will be available for 3 days.`;
63+
64+
await github.rest.issues.createComment({
65+
owner: repo.owner,
66+
repo: repo.repo,
67+
issue_number: prNumber,
68+
body: comment
69+
});
70+
71+
console.log(`Comment added to PR #${prNumber}`);

app/src/main/java/com/yogeshpaliyal/deepr/preference/AppPreferenceDataStore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class AppPreferenceDataStore(
112112

113113
val getThemeMode: Flow<String> =
114114
context.appDataStore.data.map { preferences ->
115-
preferences[THEME_MODE] ?: "light" // Default to light theme
115+
preferences[THEME_MODE] ?: "system" // Default to system theme
116116
}
117117

118118
val getShowOpenCounter: Flow<Boolean> =

app/src/main/java/com/yogeshpaliyal/deepr/ui/components/ThemeSelectionDialog.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import androidx.compose.material3.TextButton
1313
import androidx.compose.runtime.Composable
1414
import androidx.compose.ui.Alignment
1515
import androidx.compose.ui.Modifier
16+
import androidx.compose.ui.res.stringResource
1617
import androidx.compose.ui.unit.dp
18+
import com.yogeshpaliyal.deepr.R
1719

1820
@Composable
1921
fun ThemeSelectionDialog(
@@ -23,16 +25,16 @@ fun ThemeSelectionDialog(
2325
) {
2426
val themeOptions =
2527
listOf(
26-
"system" to "System default",
27-
"light" to "Light",
28-
"dark" to "Dark",
28+
"system" to stringResource(R.string.system_default),
29+
"light" to stringResource(R.string.theme_light),
30+
"dark" to stringResource(R.string.theme_dark),
2931
)
3032

3133
AlertDialog(
3234
onDismissRequest = onDismiss,
3335
title = {
3436
Text(
35-
text = "Select Theme",
37+
text = stringResource(R.string.theme_dialog_title),
3638
style = MaterialTheme.typography.headlineSmall,
3739
)
3840
},
@@ -62,8 +64,8 @@ fun ThemeSelectionDialog(
6264
},
6365
confirmButton = {
6466
TextButton(onClick = onDismiss) {
65-
Text("Close")
67+
Text(stringResource(R.string.close))
6668
}
6769
},
6870
)
69-
}
71+
}

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

Lines changed: 0 additions & 55 deletions
This file was deleted.

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ fun SettingsScreen(
193193
},
194194
)
195195

196-
ScanQRCode()
197-
198196
SettingsItem(
199197
TablerIcons.Settings,
200198
title = stringResource(R.string.shortcut_icon),
@@ -235,12 +233,12 @@ fun SettingsScreen(
235233

236234
SettingsItem(
237235
TablerIcons.Moon,
238-
title = "Theme",
236+
title = stringResource(R.string.theme),
239237
description =
240238
when (themeMode) {
241-
"light" -> "Light"
242-
"dark" -> "Dark"
243-
else -> "System default"
239+
"light" -> stringResource(R.string.theme_light)
240+
"dark" -> stringResource(R.string.theme_dark)
241+
else -> stringResource(R.string.system_default)
244242
},
245243
onClick = {
246244
showThemeDialog = true

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

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.yogeshpaliyal.deepr.ui.screens.addlink
22

33
import android.widget.Toast
4+
import androidx.activity.compose.rememberLauncherForActivityResult
45
import androidx.compose.animation.AnimatedVisibility
56
import androidx.compose.animation.expandVertically
67
import androidx.compose.animation.fadeIn
@@ -64,12 +65,14 @@ import androidx.compose.ui.text.font.FontWeight
6465
import androidx.compose.ui.unit.dp
6566
import androidx.lifecycle.compose.collectAsStateWithLifecycle
6667
import coil3.compose.AsyncImage
68+
import com.journeyapps.barcodescanner.ScanOptions
6769
import com.yogeshpaliyal.deepr.DeeprQueries
6870
import com.yogeshpaliyal.deepr.GetLinksAndTags
6971
import com.yogeshpaliyal.deepr.R
7072
import com.yogeshpaliyal.deepr.Tags
7173
import com.yogeshpaliyal.deepr.ui.LocalNavigator
7274
import com.yogeshpaliyal.deepr.ui.components.ClearInputIconButton
75+
import com.yogeshpaliyal.deepr.util.QRScanner
7376
import com.yogeshpaliyal.deepr.util.isValidDeeplink
7477
import com.yogeshpaliyal.deepr.util.normalizeLink
7578
import com.yogeshpaliyal.deepr.util.openDeeplink
@@ -82,6 +85,7 @@ import compose.icons.tablericons.Link
8285
import compose.icons.tablericons.Note
8386
import compose.icons.tablericons.Photo
8487
import compose.icons.tablericons.Plus
88+
import compose.icons.tablericons.Qrcode
8589
import compose.icons.tablericons.Tag
8690
import compose.icons.tablericons.User
8791
import compose.icons.tablericons.X
@@ -108,6 +112,18 @@ fun AddLinkScreen(
108112
var isError by remember { mutableStateOf(false) }
109113
var isNameError by remember { mutableStateOf(false) }
110114
var isFetchingMetadata by remember { mutableStateOf(false) }
115+
116+
val qrScanner =
117+
rememberLauncherForActivityResult(
118+
QRScanner(),
119+
) { result ->
120+
if (result.contents != null) {
121+
val normalizedLink = normalizeLink(result.contents)
122+
deeprInfo = deeprInfo.copy(link = normalizedLink)
123+
isError = false
124+
}
125+
}
126+
111127
// Tags
112128
var newTagName by remember { mutableStateOf("") }
113129
val allTags by viewModel.allTags.collectAsStateWithLifecycle()
@@ -290,19 +306,27 @@ fun AddLinkScreen(
290306
Text(text = stringResource(R.string.invalid_empty_deeplink))
291307
}
292308
},
293-
trailingIcon =
294-
if (deeprInfo.link.isEmpty()) {
295-
null
296-
} else {
297-
{
309+
trailingIcon = {
310+
Row(verticalAlignment = Alignment.CenterVertically) {
311+
if (deeprInfo.link.isNotEmpty()) {
298312
ClearInputIconButton(
299313
onClick = {
300314
deeprInfo = deeprInfo.copy(link = "")
301315
isError = false
302316
},
303317
)
304318
}
305-
},
319+
IconButton(onClick = {
320+
qrScanner.launch(ScanOptions())
321+
}) {
322+
Icon(
323+
imageVector = TablerIcons.Qrcode,
324+
contentDescription = stringResource(R.string.qr_scanner),
325+
tint = MaterialTheme.colorScheme.primary,
326+
)
327+
}
328+
}
329+
},
306330
singleLine = true,
307331
shape = RoundedCornerShape(12.dp),
308332
)

app/src/main/res/values-es/strings.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,19 @@
127127
<string name="sync_status_invalid">⚠ El formato del archivo es inválido</string>
128128
<string name="sync_status_no_file">No se seleccionó archivo de sincronización</string>
129129
<string name="sync_now_description">Sincronizar manualmente enlaces profundos al archivo seleccionado</string>
130+
<string name="all_tags">Todas las etiquetas</string>
131+
<string name="favourites">Favoritos</string>
132+
<string name="add_to_favourites">Añadir a favoritos</string>
133+
<string name="remove_from_favourites">Eliminar de favoritos</string>
134+
<string name="add">Añadir</string>
135+
<string name="clipboard_link_detected">Enlace detectado en el portapapeles</string>
136+
<string name="add_tag">Añadir etiqueta</string>
137+
<string name="no_favourites_found">Sin favoritos todavía</string>
138+
<string name="no_favourites_description">Marca enlaces como favoritos para verlos aquí.</string>
139+
<string name="no_search_results">Sin resutados</string>
140+
<string name="no_search_results_description">Pruebe a buscar diferentes palabras clave.</string>
141+
<string name="no_links_with_tags">No hay enlaces con las etiquetas seleccionadas</string>
142+
<string name="no_links_with_tags_description">Prueba a seleccionar diferentes etiquetas o reestablecer los filtros.</string>
143+
<string name="no_favourites_with_tags">Sin favoritos en las etiquetas seleccionadas</string>
144+
<string name="no_favourites_with_tags_description">Marca enlaces con estas etiquetas como favoritos o pruebe diferentes etiquetas.</string>
130145
</resources>

app/src/main/res/values-et/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,8 @@
244244
<string name="invalid_link_silent_save">Vigane link</string>
245245
<string name="failed_to_save_link">Lingi salvestamine ei õnnestunud</string>
246246
<string name="link_already_exists">Selline link on juba olemas</string>
247+
<string name="clipboard_link_detection">Lingi tuvastus lõikelaualt</string>
248+
<string name="clipboard_link_detection_description">Tuvasta lõikelaual asuvad lingid automaatselt ja kuva teade nende lisamiseks</string>
249+
<string name="silent_save_profile">Profiili vaikne salvestamine</string>
250+
<string name="silent_save_profile_description">„Salvesta vaikselt“ valiku puhul salvestuvad lingid siia profiili</string>
247251
</resources>

0 commit comments

Comments
 (0)