Skip to content

Commit 99f2272

Browse files
feat(android): add Report Issue settings screen with secure GitHub pre-fill submission
1 parent 8111538 commit 99f2272

3 files changed

Lines changed: 139 additions & 0 deletions

File tree

mobile/app/src/main/java/com/bytecats/metanoia/MainActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class MainActivity : ComponentActivity() {
9898
composable("settings_changelog") {
9999
com.bytecats.metanoia.ui.screens.settings.ChangelogScreen { navController.popBackStack() }
100100
}
101+
composable("settings_issues") {
102+
com.bytecats.metanoia.ui.screens.settings.ReportIssueScreen { navController.popBackStack() }
103+
}
101104
}
102105
}
103106
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
package com.bytecats.metanoia.ui.screens.settings
2+
3+
import android.content.Intent
4+
import android.net.Uri
5+
import androidx.compose.foundation.BorderStroke
6+
import androidx.compose.foundation.layout.*
7+
import androidx.compose.foundation.rememberScrollState
8+
import androidx.compose.foundation.verticalScroll
9+
import androidx.compose.material.icons.Icons
10+
import androidx.compose.material.icons.automirrored.filled.ArrowBack
11+
import androidx.compose.material.icons.automirrored.filled.OpenInNew
12+
import androidx.compose.material.icons.filled.BugReport
13+
import androidx.compose.material.icons.filled.Shield
14+
import androidx.compose.material3.*
15+
import androidx.compose.runtime.*
16+
import androidx.compose.ui.Alignment
17+
import androidx.compose.ui.Modifier
18+
import androidx.compose.ui.graphics.Color
19+
import androidx.compose.ui.platform.LocalContext
20+
import androidx.compose.ui.text.font.FontWeight
21+
import androidx.compose.ui.unit.dp
22+
23+
@OptIn(ExperimentalMaterial3Api::class)
24+
@Composable
25+
fun ReportIssueScreen(onBack: () -> Unit) {
26+
val context = LocalContext.current
27+
var issueTitle by remember { mutableStateOf("") }
28+
var issueDescription by remember { mutableStateOf("") }
29+
var issueType by remember { mutableStateOf("bug") }
30+
var issueModule by remember { mutableStateOf("mobile") }
31+
32+
Scaffold(
33+
topBar = {
34+
TopAppBar(
35+
title = { Text("REPORT AN ISSUE") },
36+
navigationIcon = {
37+
IconButton(onClick = onBack) {
38+
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
39+
}
40+
}
41+
)
42+
}
43+
) { innerPadding ->
44+
Column(
45+
modifier = Modifier
46+
.padding(innerPadding)
47+
.fillMaxSize()
48+
.padding(16.dp)
49+
.verticalScroll(rememberScrollState()),
50+
verticalArrangement = Arrangement.spacedBy(16.dp)
51+
) {
52+
Card(
53+
modifier = Modifier.fillMaxWidth(),
54+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.4f)),
55+
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.4f))
56+
) {
57+
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
58+
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
59+
Icon(Icons.Default.BugReport, contentDescription = null, tint = MaterialTheme.colorScheme.error)
60+
Text("Submit Issue or Feature Request", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
61+
}
62+
Text(
63+
"Submit bug reports, feature requests, or translation corrections directly to the public GitHub repository safely without token exposure.",
64+
style = MaterialTheme.typography.bodyMedium,
65+
color = MaterialTheme.colorScheme.outline
66+
)
67+
}
68+
}
69+
70+
OutlinedTextField(
71+
value = issueTitle,
72+
onValueChange = { issueTitle = it },
73+
label = { Text("Issue Title") },
74+
placeholder = { Text("e.g. Interlinear alignment bug on Hebrew verses") },
75+
modifier = Modifier.fillMaxWidth(),
76+
singleLine = true
77+
)
78+
79+
OutlinedTextField(
80+
value = issueDescription,
81+
onValueChange = { issueDescription = it },
82+
label = { Text("Description & Steps to Reproduce") },
83+
placeholder = { Text("1. Open chapter...\n2. Tap verse...\n3. Observed behavior...") },
84+
modifier = Modifier
85+
.fillMaxWidth()
86+
.height(140.dp),
87+
maxLines = 6
88+
)
89+
90+
Card(
91+
modifier = Modifier.fillMaxWidth(),
92+
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.3f))
93+
) {
94+
Row(modifier = Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
95+
Icon(Icons.Default.Shield, contentDescription = null, tint = MaterialTheme.colorScheme.primary)
96+
Text(
97+
"Secure Submission: Opens pre-filled GitHub issue page in your browser.",
98+
style = MaterialTheme.typography.labelMedium,
99+
color = MaterialTheme.colorScheme.onSecondaryContainer
100+
)
101+
}
102+
}
103+
104+
Button(
105+
onClick = {
106+
val fullTitle = "[${issueModule.uppercase()}] ${issueTitle.ifEmpty { "User Feedback" }}"
107+
val fullBody = "### Component\n$issueModule\n\n### Description\n$issueDescription\n\n---\n*Submitted securely via Metanoia Android App*"
108+
val issueUrl = "https://github.com/4cecoder/metanoia/issues/new?title=${Uri.encode(fullTitle)}&body=${Uri.encode(fullBody)}&labels=${Uri.encode(issueType)}"
109+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(issueUrl))
110+
context.startActivity(intent)
111+
},
112+
modifier = Modifier
113+
.fillMaxWidth()
114+
.height(50.dp)
115+
) {
116+
Icon(Icons.AutoMirrored.Filled.OpenInNew, contentDescription = null, modifier = Modifier.size(18.dp))
117+
Spacer(modifier = Modifier.width(8.dp))
118+
Text("Open Issue Pre-Fill on GitHub")
119+
}
120+
121+
OutlinedButton(
122+
onClick = {
123+
val portalUrl = "https://4cecoder.github.io/metanoia/#issues"
124+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(portalUrl))
125+
context.startActivity(intent)
126+
},
127+
modifier = Modifier.fillMaxWidth()
128+
) {
129+
Text("Open GitHub Pages Issue Web Form")
130+
}
131+
}
132+
}
133+
}

mobile/app/src/main/java/com/bytecats/metanoia/ui/screens/settings/SettingsComponents.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ fun SettingsDashboard(navController: NavController) {
3838
SettingsLink("Changelog", "Recent commits and version history", Icons.Default.History) {
3939
navController.navigate("settings_changelog")
4040
}
41+
SettingsLink("Report Issue", "Submit feedback or report bugs securely", Icons.Default.BugReport) {
42+
navController.navigate("settings_issues")
43+
}
4144
}
4245
}
4346
}

0 commit comments

Comments
 (0)