Skip to content

Commit b067d26

Browse files
committed
fix merge conflict
2 parents 336f7d3 + 9554d81 commit b067d26

51 files changed

Lines changed: 1506 additions & 696 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
root = true
2+
3+
[*.{kt,kts}]
4+
ktlint_function_naming_ignore_when_annotated_with = Composable

.github/workflows/android-workflow.yaml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
142142
# Run JaCoCo, generate Test Report
143143
- name: Check Code Coverage
144-
run: ./gradlew jacocoTestReport --stacktrace
144+
run: ./gradlew testDebugUnitTest jacocoTestReport --stacktrace
145145

146146
# Upload reports to GitHub Actions
147147
- name: Upload Reports
@@ -163,20 +163,11 @@ jobs:
163163
java-version: '17'
164164
distribution: 'temurin'
165165

166-
- name: Install ktlint
167-
run: |
168-
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.3.1/ktlint
169-
chmod a+x ktlint
170-
sudo mv ktlint /usr/local/bin/
166+
- name: Grant execute permission for gradlew
167+
run: chmod +x ./gradlew
171168

172169
- name: Run ktlint
173-
run: |
174-
set -o pipefail
175-
ktlint --reporter=plain > ktlint_errors.txt
176-
177-
- name: Check for ktlint errors
178-
if: ${{ failure() || steps.run_ktlint.exitCode == 1 }}
179-
run: cat ktlint_errors.txt
170+
run: ./gradlew ktlintCheck
180171

181172
# Publish to Firebase App Distribution
182173
# https://github.com/wzieba/Firebase-Distribution-Github-Action

PennMobile/build.gradle

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
alias(libs.plugins.kotlin.android)
44
alias(libs.plugins.google.services)
55
alias(libs.plugins.firebase.crashlytics)
6+
alias(libs.plugins.ktlint)
67
// Removed problematic compose compiler alias for Kotlin 1.9.x compatibility
78
id 'jacoco'
89
id 'kotlin-parcelize'
@@ -11,24 +12,24 @@ plugins {
1112
}
1213

1314
android {
14-
namespace 'com.pennapps.labs.pennmobile'
15+
namespace = 'com.pennapps.labs.pennmobile'
1516

1617
buildFeatures {
1718
buildConfig = true
18-
viewBinding true
19-
compose true
19+
viewBinding = true
20+
compose = true
2021
}
2122

2223
buildTypes {
2324
debug {
2425
matchingFallbacks = ['qa', 'release']
25-
enableUnitTestCoverage true
26-
enableAndroidTestCoverage true
26+
enableUnitTestCoverage = true
27+
enableAndroidTestCoverage = true
2728
}
2829
release {}
2930
}
3031

31-
compileSdk 35
32+
compileSdk = 35
3233

3334
composeOptions {
3435
// Matches Kotlin 1.9.24 defined in your libs.versions.toml
@@ -43,7 +44,7 @@ android {
4344
minSdkVersion 26
4445
targetSdkVersion 35
4546
vectorDrawables.useSupportLibrary = true
46-
multiDexEnabled true
47+
multiDexEnabled = true
4748
buildConfigField ("String", "PLATFORM_REDIRECT_URI", getPlatformRedirectUri())
4849
buildConfigField ("String", "PLATFORM_CLIENT_ID", getPlatformClientID())
4950
}
@@ -56,6 +57,20 @@ android {
5657
}
5758
}
5859

60+
ktlint {
61+
version.set("1.8.0")
62+
android.set(true)
63+
ignoreFailures.set(false)
64+
verbose.set(true)
65+
outputToConsole.set(true)
66+
coloredOutput.set(true)
67+
68+
filter {
69+
exclude("**/build/**")
70+
exclude("**/generated/**")
71+
}
72+
}
73+
5974
dependencies {
6075
implementation fileTree(include: ['*.jar'], dir: 'libs')
6176
// If you want the foundation layout, use the bundle or the specific activity compose you have defined
@@ -64,6 +79,8 @@ dependencies {
6479
implementation libs.places
6580
// implementation libs.androidx.foundation.layout
6681

82+
ktlintRuleset libs.ktlint
83+
6784
androidTestImplementation libs.androidx.espresso.core
6885
androidTestImplementation libs.androidx.junit
6986
androidTestImplementation libs.kaspresso

PennMobile/src/main/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
android:versionCode="81"
5-
android:versionName="3.3.1">
4+
android:versionCode="83"
5+
android:versionName="3.4.1">
66

77
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
88
<uses-permission android:name="android.permission.WAKE_LOCK" />
@@ -93,4 +93,4 @@
9393
android:required="false" />
9494
</application>
9595

96-
</manifest>
96+
</manifest>

PennMobile/src/main/java/com/pennapps/labs/pennmobile/NotificationsSettingsView.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@file:Suppress("ktlint:standard:no-wildcard-imports")
22

3+
package com.pennapps.labs.pennmobile
4+
35
import androidx.compose.foundation.background
46
import androidx.compose.foundation.layout.*
57
import androidx.compose.foundation.lazy.LazyColumn
@@ -20,11 +22,14 @@ import androidx.compose.ui.unit.dp
2022
@Suppress("ktlint:standard:function-naming")
2123
@OptIn(ExperimentalMaterial3Api::class)
2224
@Composable
23-
fun NotificationSettingsList(settingsList: List<Pair<String, Boolean>>) {
25+
fun NotificationSettingsList(
26+
settingsList: List<Pair<String, Boolean>>,
27+
modifier: Modifier = Modifier,
28+
) {
2429
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
2530

2631
Scaffold(
27-
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
32+
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
2833
topBar = {
2934
Column {
3035
CenterAlignedTopAppBar(
@@ -102,12 +107,13 @@ fun NotificationSettingsList(settingsList: List<Pair<String, Boolean>>) {
102107
fun NotificationSettingRow(
103108
label: String,
104109
isEnabledInitial: Boolean,
110+
modifier: Modifier = Modifier,
105111
) {
106112
var isEnabled by remember { mutableStateOf(isEnabledInitial) }
107113

108114
Row(
109115
modifier =
110-
Modifier
116+
modifier
111117
.fillMaxWidth()
112118
.padding(horizontal = 32.dp, vertical = 4.dp),
113119
verticalAlignment = Alignment.CenterVertically,
@@ -141,11 +147,10 @@ fun NotificationSettingRow(
141147
fun saveNotificationSettings() {
142148
}
143149

144-
@Suppress("ktlint:standard:function-naming")
145150
@Preview(showBackground = true)
146151
@Composable
147-
fun AppWithListPreview() {
148-
var settingsList =
152+
private fun AppWithListPreview() {
153+
val settingsList =
149154
listOf(
150155
"Penn Course Alert" to false,
151156
"Laundry" to true,

PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/Serializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public List<GSRLocation> deserialize(JsonElement je, Type type, JsonDeserializat
153153
location.gid = jsonLocation.get("gid").getAsInt();
154154
location.name = jsonLocation.get("name").getAsString();
155155
location.kind = jsonLocation.get("kind").getAsString();
156+
location.bookableDays = jsonLocation.get("bookable_days").getAsInt();
156157
locations.add(location);
157158
}
158159
return locations;

PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/StudentLife.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ interface StudentLife {
187187
): Observable<DiningHall?>
188188

189189
@GET("gsr/locations")
190-
fun location(): Observable<List<GSRLocation?>?>
190+
fun locationUnfiltered(): Observable<List<GSRLocation?>?>
191+
192+
@GET("gsr/user-locations")
193+
fun location(
194+
@Header("Authorization") bearerToken: String?,
195+
): Observable<List<GSRLocation?>?>
191196

192197
@GET("events/fling")
193198
fun getFlingEvents(): Observable<List<FlingEvent?>?>

PennMobile/src/main/java/com/pennapps/labs/pennmobile/components/floatingbottombar/behavior/ExpandableBottomBarBehavior.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.pennapps.labs.pennmobile.components.floatingbottombar.behavior
22

3+
import android.annotation.SuppressLint
34
import android.content.Context
45
import android.util.AttributeSet
56
import android.view.Gravity
@@ -12,6 +13,7 @@ open class ExpandableBottomBarBehavior<V : View> : CoordinatorLayout.Behavior<V>
1213

1314
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
1415

16+
@SuppressLint("RestrictedApi")
1517
override fun layoutDependsOn(
1618
parent: CoordinatorLayout,
1719
child: V,
@@ -23,6 +25,7 @@ open class ExpandableBottomBarBehavior<V : View> : CoordinatorLayout.Behavior<V>
2325
return super.layoutDependsOn(parent, child, dependency)
2426
}
2527

28+
@SuppressLint("RestrictedApi")
2629
private fun updateSnackBar(
2730
child: View,
2831
snackBarLayout: Snackbar.SnackbarLayout,
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.pennapps.labs.pennmobile.compose.presentation.components.error
2+
3+
import SFProDisplayMedium
4+
import android.content.res.Configuration
5+
import androidx.compose.foundation.layout.Column
6+
import androidx.compose.foundation.layout.fillMaxWidth
7+
import androidx.compose.foundation.layout.padding
8+
import androidx.compose.material3.Card
9+
import androidx.compose.material3.CardDefaults
10+
import androidx.compose.material3.MaterialTheme
11+
import androidx.compose.material3.Text
12+
import androidx.compose.runtime.Composable
13+
import androidx.compose.ui.Alignment
14+
import androidx.compose.ui.Modifier
15+
import androidx.compose.ui.text.style.TextAlign
16+
import androidx.compose.ui.tooling.preview.Preview
17+
import androidx.compose.ui.unit.dp
18+
import com.pennapps.labs.pennmobile.compose.presentation.theme.AppTheme
19+
20+
@Composable
21+
fun ErrorCard(
22+
errorMessage: String,
23+
modifier: Modifier = Modifier,
24+
) {
25+
Card(
26+
modifier = modifier,
27+
shape = MaterialTheme.shapes.small,
28+
colors =
29+
CardDefaults.cardColors(
30+
containerColor = MaterialTheme.colorScheme.surface,
31+
contentColor = MaterialTheme.colorScheme.onBackground,
32+
),
33+
) {
34+
Text(
35+
text = errorMessage,
36+
color = MaterialTheme.colorScheme.onBackground,
37+
fontFamily = SFProDisplayMedium,
38+
modifier =
39+
Modifier
40+
.fillMaxWidth()
41+
.align(Alignment.CenterHorizontally)
42+
.padding(vertical = 24.dp, horizontal = 12.dp),
43+
textAlign = TextAlign.Center,
44+
)
45+
}
46+
}
47+
48+
@Preview(
49+
name = "Light Mode",
50+
showBackground = true,
51+
uiMode = Configuration.UI_MODE_NIGHT_NO,
52+
)
53+
@Preview(
54+
name = "Dark Mode",
55+
showBackground = true,
56+
uiMode = Configuration.UI_MODE_NIGHT_YES,
57+
)
58+
@Composable
59+
private fun PreviewErrorCard() {
60+
AppTheme {
61+
Column(modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
62+
ErrorCard(
63+
UserDisplayErrors.PAST_BALANCES_NOT_AVAILABLE,
64+
Modifier
65+
.padding(vertical = 12.dp)
66+
.fillMaxWidth(0.95f),
67+
)
68+
}
69+
}
70+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.pennapps.labs.pennmobile.compose.presentation.components.error
2+
3+
object UserDisplayErrors {
4+
const val CAMPUS_EXPRESS_DOWN =
5+
"Dining prediction graphs are down due to an error with Campus Express. " +
6+
"We are working on a fix and will release it ASAP."
7+
8+
const val PAST_BALANCES_NOT_AVAILABLE =
9+
"Dining prediction graphs are unavailable since you are either not on a dining plan " +
10+
"or an RA on a special plan that we can't track."
11+
}

0 commit comments

Comments
 (0)