Skip to content

Commit 684d9be

Browse files
committed
Merge PR 390 from original repo: Pre-set profile to active profile
2 parents a8e76b5 + 73dab1b commit 684d9be

File tree

11 files changed

+306
-167
lines changed

11 files changed

+306
-167
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/assets/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ <h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
119119

120120
<div class="flex-1">
121121
<label for="linkName" class="block text-sm font-medium text-gray-700 mb-2">
122-
Link Name
122+
Link Name (Optional)
123123
</label>
124124
<input
125125
type="text"
126126
id="linkName"
127-
placeholder="My Awesome Link"
128-
required
127+
placeholder="My Awesome Link (Optional)"
128+
129129
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all duration-200 text-gray-800"
130130
>
131131
</div>

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/addlink/AddLinkScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ fun AddLinkScreen(
165165

166166
// Profile selection
167167
val allProfiles by viewModel.allProfiles.collectAsStateWithLifecycle()
168-
val currentProfile by viewModel.currentProfile.collectAsStateWithLifecycle()
169168
var selectedProfileId by remember(selectedLink) {
170-
mutableStateOf(selectedLink.profileId.takeIf { !isCreate } ?: currentProfile?.id ?: 1L)
169+
mutableStateOf(selectedLink.profileId)
171170
}
172171
var showCreateProfileDialog by remember { mutableStateOf(false) }
173172
var pendingProfileNameToSelect by remember { mutableStateOf<String?>(null) }

0 commit comments

Comments
 (0)