Skip to content

Commit e36b367

Browse files
Merge branch 'master' into fix-issue-255
2 parents 05188c8 + 5d4aa35 commit e36b367

File tree

7 files changed

+95
-37
lines changed

7 files changed

+95
-37
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/Settings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ fun SettingsScreen(
233233

234234
SettingsItem(
235235
TablerIcons.Moon,
236-
title = "Theme",
236+
title = stringResource(R.string.theme),
237237
description =
238238
when (themeMode) {
239-
"light" -> "Light"
240-
"dark" -> "Dark"
241-
else -> "System default"
239+
"light" -> stringResource(R.string.theme_light)
240+
"dark" -> stringResource(R.string.theme_dark)
241+
else -> stringResource(R.string.system_default)
242242
},
243243
onClick = {
244244
showThemeDialog = true

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@
111111
<string name="shortcut_icon">Icona Scorciatoia</string>
112112
<string name="use_link_app_icon">Usa l\'icona dell\'app di supporto del link</string>
113113
<string name="use_deepr_app_icon">Usa l\'icona dell\'app Deepr</string>
114+
115+
<string name="theme">Tema</string>
116+
<string name="theme_dialog_title">Seleziona Tema</string>
117+
<string name="theme_light">Chiaro</string>
118+
<string name="theme_dark">Scuro</string>
119+
<string name="close">Chiudi</string>
114120
<string name="shortcut_icon_setting">Impostazione Icona Scorciatoia</string>
115121
<string name="language">Lingua</string>
116122
<string name="language_description">Cambia la lingua dell\'app</string>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,9 @@
281281
<!-- Clipboard Link Detection Setting -->
282282
<string name="clipboard_link_detection">Clipboard link detection</string>
283283
<string name="clipboard_link_detection_description">Automatically detect links in clipboard and show a banner to add them</string>
284+
<string name="theme">Theme</string>
285+
<string name="theme_dialog_title">Select Theme</string>
286+
<string name="theme_light">Light</string>
287+
<string name="theme_dark">Dark</string>
288+
<string name="close">Close</string>
284289
</resources>

0 commit comments

Comments
 (0)