Skip to content

Commit fa5f302

Browse files
authored
Merge pull request #98 from cuappdev/helen/capacity-reminders
Changed UI and ensured functionality of capacity reminders screen
2 parents 4ea3909 + 0e949b6 commit fa5f302

11 files changed

Lines changed: 240 additions & 131 deletions

File tree

app/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ dependencies {
103103
// Serialization
104104
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3"
105105
// Authentication + Firebase
106-
implementation platform('com.google.firebase:firebase-bom:33.13.0')
107-
implementation "androidx.credentials:credentials:<latest version>"
108-
implementation "androidx.credentials:credentials-play-services-auth:<latest version>"
109-
implementation "com.google.android.libraries.identity.googleid:googleid:<latest version>"
106+
implementation(platform("com.google.firebase:firebase-bom:34.3.0"))
107+
implementation "androidx.credentials:credentials:1.5.0"
108+
implementation "androidx.credentials:credentials-play-services-auth:1.5.0"
109+
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
110110
implementation 'com.google.android.gms:play-services-auth:21.3.0'
111-
implementation 'com.google.firebase:firebase-auth-ktx'
111+
implementation 'com.google.firebase:firebase-auth'
112112
implementation 'com.google.firebase:firebase-messaging'
113+
implementation("com.google.firebase:firebase-analytics")
113114

114115
}
115116

app/src/main/graphql/CapacityReminders.graphql

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,23 @@ mutation CreateCapacityReminder(
1010
id
1111
capacityThreshold
1212
daysOfWeek
13-
fcmToken
1413
gyms
1514
isActive
1615
}
1716
}
1817

1918
mutation EditCapacityReminder(
20-
$reminderId: Int!, $capacityPercent: Int!, $daysOfWeek: [String]!, $gyms: [String]!
21-
){
19+
$reminderId: Int!, $newCapacityThreshold: Int!, $daysOfWeek: [String]!, $newGyms: [String]!
20+
) {
2221
editCapacityReminder(
23-
reminderId: $reminderId,
24-
capacityPercent: $capacityPercent,
25-
daysOfWeek: $daysOfWeek,
26-
gyms: $gyms
22+
reminderId: $reminderId
23+
newCapacityThreshold: $newCapacityThreshold
24+
daysOfWeek: $daysOfWeek
25+
newGyms: $newGyms
2726
) {
2827
id
2928
capacityThreshold
3029
daysOfWeek
31-
fcmToken
3230
gyms
3331
isActive
3432
}
@@ -39,7 +37,6 @@ mutation DeleteCapacityReminder($reminderId: Int!) {
3937
id
4038
capacityThreshold
4139
daysOfWeek
42-
fcmToken
4340
gyms
4441
isActive
4542
}

app/src/main/graphql/schema.graphqls

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ type Query {
5555
Get all friends for a user.
5656
"""
5757
getUserFriends(userId: Int!): [User]
58+
59+
"""
60+
Get a specific capacity reminder by its ID.
61+
"""
62+
getCapacityReminderById(id: Int!): CapacityReminder
63+
64+
"""
65+
Get all capacity reminders.
66+
"""
67+
getAllCapacityReminders: [CapacityReminder]
5868
}
5969

6070
type Gym {
@@ -438,6 +448,52 @@ type HourlyAverageCapacity {
438448
history: [Float]!
439449
}
440450

451+
type CapacityReminder {
452+
id: ID!
453+
454+
gyms: [CapacityReminderGym]!
455+
456+
capacityThreshold: Int!
457+
458+
daysOfWeek: [DayOfWeekEnum]!
459+
460+
isActive: Boolean
461+
}
462+
463+
"""
464+
An enumeration.
465+
"""
466+
enum CapacityReminderGym {
467+
TEAGLEUP
468+
469+
TEAGLEDOWN
470+
471+
HELENNEWMAN
472+
473+
TONIMORRISON
474+
475+
NOYES
476+
}
477+
478+
"""
479+
An enumeration.
480+
"""
481+
enum DayOfWeekEnum {
482+
MONDAY
483+
484+
TUESDAY
485+
486+
WEDNESDAY
487+
488+
THURSDAY
489+
490+
FRIDAY
491+
492+
SATURDAY
493+
494+
SUNDAY
495+
}
496+
441497
type Mutation {
442498
"""
443499
Creates a new giveaway.
@@ -502,7 +558,7 @@ type Mutation {
502558
"""
503559
Edit capacity reminder.
504560
"""
505-
editCapacityReminder(capacityPercent: Int!, daysOfWeek: [String]!, gyms: [String]!, reminderId: Int!): CapacityReminder
561+
editCapacityReminder(daysOfWeek: [String]!, newCapacityThreshold: Int!, newGyms: [String]!, reminderId: Int!): CapacityReminder
506562

507563
"""
508564
Delete a capacity reminder
@@ -558,54 +614,6 @@ type CreateReport {
558614
report: Report
559615
}
560616

561-
type CapacityReminder {
562-
id: ID!
563-
564-
fcmToken: String!
565-
566-
gyms: [CapacityReminderGym]!
567-
568-
capacityThreshold: Int!
569-
570-
daysOfWeek: [DayOfWeekEnum]!
571-
572-
isActive: Boolean
573-
}
574-
575-
"""
576-
An enumeration.
577-
"""
578-
enum CapacityReminderGym {
579-
TEAGLEUP
580-
581-
TEAGLEDOWN
582-
583-
HELENNEWMAN
584-
585-
TONIMORRISON
586-
587-
NOYES
588-
}
589-
590-
"""
591-
An enumeration.
592-
"""
593-
enum DayOfWeekEnum {
594-
MONDAY
595-
596-
TUESDAY
597-
598-
WEDNESDAY
599-
600-
THURSDAY
601-
602-
FRIDAY
603-
604-
SATURDAY
605-
606-
SUNDAY
607-
}
608-
609617
type RemoveFriend {
610618
success: Boolean
611619
}

app/src/main/java/com/cornellappdev/uplift/ui/MainNavigationWrapper.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,20 @@ fun MainNavigationWrapper(
216216
composable<UpliftRootRoute.ProfileCreation> {
217217
ProfileCreationScreen()
218218
}
219-
composable<UpliftRootRoute.CapacityReminders>{
219+
composable<UpliftRootRoute.CapacityReminders> {
220220
CapacityReminderScreen()
221-
composable<UpliftRootRoute.Profile> {
222-
ProfileScreen()
223-
}
224-
composable<UpliftRootRoute.Reminders> {
225-
MainReminderScreen()
226-
}
227-
composable<UpliftRootRoute.Settings> {
228-
SettingsScreen()
221+
composable<UpliftRootRoute.Profile> {
222+
ProfileScreen()
223+
}
224+
composable<UpliftRootRoute.Reminders> {
225+
MainReminderScreen()
226+
}
227+
composable<UpliftRootRoute.Settings> {
228+
SettingsScreen()
229+
}
230+
composable<UpliftRootRoute.Sports> {}
231+
composable<UpliftRootRoute.Favorites> {}
229232
}
230-
composable<UpliftRootRoute.Sports> {}
231-
composable<UpliftRootRoute.Favorites> {}
232233
}
233234
}
234235
}

app/src/main/java/com/cornellappdev/uplift/ui/components/general/UpliftButton.kt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
package com.cornellappdev.uplift.ui.components.general
22

3+
import androidx.compose.animation.animateContentSize
34
import androidx.compose.animation.core.animateFloatAsState
5+
import androidx.compose.foundation.layout.Arrangement
6+
import androidx.compose.foundation.layout.Row
7+
import androidx.compose.foundation.layout.defaultMinSize
48
import androidx.compose.foundation.layout.height
5-
import androidx.compose.foundation.layout.width
69
import androidx.compose.foundation.layout.wrapContentSize
710
import androidx.compose.foundation.shape.RoundedCornerShape
811
import androidx.compose.material3.Button
912
import androidx.compose.material3.ButtonDefaults
10-
import androidx.compose.material3.Surface
1113
import androidx.compose.material3.Text
1214
import androidx.compose.runtime.Composable
1315
import androidx.compose.runtime.getValue
16+
import androidx.compose.ui.Alignment
1417
import androidx.compose.ui.Modifier
1518
import androidx.compose.ui.draw.alpha
1619
import androidx.compose.ui.graphics.Color
@@ -46,7 +49,9 @@ fun UpliftButton(
4649
disabledContainerColor: Color = GRAY02,
4750
contentColor: Color = PRIMARY_BLACK,
4851
disabledContentColor: Color = PRIMARY_BLACK,
49-
elevation: Dp = 4.dp
52+
elevation: Dp = 4.dp,
53+
leadingIcon: (@Composable () -> Unit)? = null,
54+
modifier: Modifier = Modifier
5055
) {
5156
val enabledAlpha by animateFloatAsState(
5257
targetValue = if (enabled) 1f else 0.5f,
@@ -60,8 +65,8 @@ fun UpliftButton(
6065
disabledContentColor = disabledContentColor
6166
),
6267
shape = RoundedCornerShape(38.dp),
63-
modifier = Modifier
64-
.width(width)
68+
modifier = modifier
69+
.defaultMinSize(minWidth = width)
6570
.height(height)
6671
.alpha(enabledAlpha),
6772
elevation = ButtonDefaults.buttonElevation(
@@ -70,15 +75,24 @@ fun UpliftButton(
7075
onClick = { onClick() },
7176
enabled = enabled,
7277
) {
73-
Text(
74-
text = text,
75-
color = PRIMARY_BLACK,
76-
fontFamily = montserratFamily,
77-
fontSize = fontSize.sp,
78-
fontWeight = FontWeight.Bold,
79-
textAlign = TextAlign.Center,
80-
modifier = Modifier.wrapContentSize()
81-
)
78+
Row(
79+
verticalAlignment = Alignment.CenterVertically,
80+
horizontalArrangement = Arrangement.Center,
81+
modifier = Modifier.animateContentSize()
82+
) {
83+
leadingIcon?.let {
84+
it()
85+
}
86+
Text(
87+
text = text,
88+
color = contentColor,
89+
fontFamily = montserratFamily,
90+
fontSize = fontSize.sp,
91+
fontWeight = FontWeight.Bold,
92+
textAlign = TextAlign.Center,
93+
modifier = modifier.wrapContentSize()
94+
)
95+
}
8296
}
8397
}
8498

0 commit comments

Comments
 (0)