Skip to content

Commit c45cd18

Browse files
committed
pr fixes
1 parent 593d0b7 commit c45cd18

5 files changed

Lines changed: 17 additions & 21 deletions

File tree

app/src/main/java/com/cornellappdev/transit/ui/NavigationController.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,19 @@ fun NavigationController(
4747
}
4848

4949
composable("settings") {
50-
SettingsScreen { route ->
51-
navController.navigate(route)
52-
}
50+
SettingsScreen (
51+
onAboutClick = {navController.navigate("about")},
52+
onSupportClick = {navController.navigate("support")},
53+
onNotificationsAndPrivacyClick = {navController.navigate("notifs_privacy")})
5354
}
5455

5556
composable("about") {
5657
AboutScreen()
5758
}
5859

5960
composable("notifs_privacy") {
60-
NotifsAndPrivacyScreen { route ->
61-
navController.navigate(route)
61+
NotifsAndPrivacyScreen {
62+
navController.navigate("privacy_settings")
6263
}
6364
}
6465

app/src/main/java/com/cornellappdev/transit/ui/components/PrivacyOptionItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fun PrivacyOptionItem(text: String, subtext: String = "", onClick: () -> Unit =
6767

6868
@Preview(showBackground = true)
6969
@Composable
70-
fun PrivacyOptionItemPreview() {
70+
private fun PrivacyOptionItemPreview() {
7171
PrivacyOptionItem(
7272
text = "Privacy Policy",
7373
subtext = "Learn more about how we handle your data",

app/src/main/java/com/cornellappdev/transit/ui/components/SwitchItem.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ fun SwitchItem(
3838
isChecked: Boolean,
3939
onCheckedChange: (Boolean) -> Unit
4040
) {
41-
//var isChecked by remember { mutableStateOf(true) }
4241
Row(
4342
modifier = Modifier
4443
.fillMaxWidth(),

app/src/main/java/com/cornellappdev/transit/ui/screens/SettingsScreen.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ import com.cornellappdev.transit.ui.theme.robotoFamily
2929
* Composable for Settings Screen, which displays a list of settings options and app information.
3030
* **/
3131
@Composable
32-
fun SettingsScreen(onNavigate: (String) -> Unit) {
32+
fun SettingsScreen(onSupportClick: () -> Unit,
33+
onAboutClick: () -> Unit,
34+
onNotificationsAndPrivacyClick: () -> Unit ){
3335
Column(
3436
modifier = Modifier
3537
.fillMaxSize()
@@ -50,14 +52,14 @@ fun SettingsScreen(onNavigate: (String) -> Unit) {
5052
name = "About Transit",
5153
description = "Learn more about the team behind the app",
5254
icon = R.drawable.appdev_gray,
53-
onClick = { onNavigate("about") })
55+
onClick = { onAboutClick() })
5456
HorizontalDivider(thickness = 0.5.dp)
5557

5658
SettingsPageItem(
5759
name = "Notifications and Privacy",
5860
description = "Manage permissions and analytics",
5961
icon = R.drawable.lock,
60-
onClick = { onNavigate("notifs_privacy") }
62+
onClick = { onNotificationsAndPrivacyClick() }
6163
)
6264

6365
HorizontalDivider(thickness = 0.5.dp)
@@ -66,7 +68,7 @@ fun SettingsScreen(onNavigate: (String) -> Unit) {
6668
name = "Support",
6769
description = "Report issues and contact us",
6870
icon = R.drawable.help_outline,
69-
onClick = { onNavigate("support") },
71+
onClick = { onSupportClick() },
7072
)
7173
}
7274
Box(modifier = Modifier.fillMaxSize()) {
@@ -87,8 +89,5 @@ fun SettingsScreen(onNavigate: (String) -> Unit) {
8789
@Preview(showBackground = true)
8890
@Composable
8991
private fun SettingsScreenPreview() {
90-
val navController = NavController(LocalContext.current)
91-
SettingsScreen { route ->
92-
navController.navigate(route)
93-
}
92+
SettingsScreen({}, {}, {})
9493
}

app/src/main/java/com/cornellappdev/transit/ui/screens/settings/NotifsAndPrivacyScreen.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import com.cornellappdev.transit.ui.theme.robotoFamily
2929
* notification settings and links to privacy settings
3030
* **/
3131
@Composable
32-
fun NotifsAndPrivacyScreen(onNavigate: (String) -> Unit) {
32+
fun NotifsAndPrivacyScreen(onPrivacyCLick: () -> Unit) {
3333

3434
var pauseAllNotifs by remember { mutableStateOf(false) }
3535
var busNotifs by remember { mutableStateOf(false) }
@@ -92,7 +92,7 @@ fun NotifsAndPrivacyScreen(onNavigate: (String) -> Unit) {
9292
PrivacyOptionItem(
9393
text = "Privacy Settings",
9494
subtext = "",
95-
onClick = { onNavigate("privacy_settings") },
95+
onClick = { onPrivacyCLick() },
9696
icon = Icons.Outlined.KeyboardArrowRight
9797
)
9898

@@ -104,8 +104,5 @@ fun NotifsAndPrivacyScreen(onNavigate: (String) -> Unit) {
104104
@Preview(showBackground = true)
105105
@Composable
106106
private fun NotifsAndPrivacyScreenPreview() {
107-
val navController = NavController(LocalContext.current)
108-
NotifsAndPrivacyScreen { route ->
109-
navController.navigate(route)
110-
}
107+
NotifsAndPrivacyScreen {}
111108
}

0 commit comments

Comments
 (0)