Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c90f413
reformat onboarding slides to fit most screen sizes
silkfiy Oct 10, 2026
cea117e
added background circles on app homepage
Oct 11, 2026
bf9fba3
optimize slide element positions
silkfiy Oct 11, 2026
a421369
iterated on the background circles and tried to debug them
Oct 12, 2026
62c77c6
Add caching to class data
silkfiy Oct 13, 2026
13bb367
Fix onboarding login sizing issues
silkfiy Oct 13, 2026
3c33cc8
restored podfile to facilitate the ios build
Oct 13, 2026
4456bb4
"changed pod file"
Oct 13, 2026
10437fe
"more changes to let ios build happen"
Oct 14, 2026
4aa98e5
"made minor change -- one circle needed to be in a different position"
Oct 14, 2026
816a3ad
"changed the position of one circle"
Oct 15, 2026
1a8cb45
"changed circle position again"
Oct 15, 2026
289324b
"moving circle yet again"
Oct 15, 2026
a74ae72
"changed some circle positions to better reflect the figma"
Oct 15, 2026
f5b1362
"changed the position of a couple more circles"
Oct 15, 2026
1f84878
"tweaked one circle"
Oct 15, 2026
88663c3
"tweaked the circle one MORE TIME"
Oct 15, 2026
cb1f31d
"tweaked the circle hopefully for the last time"
Oct 15, 2026
922cbcb
Fix incorrect top margin when header text wraps
silkfiy Oct 17, 2026
f6e1554
Fix overflow on Free Food notif button
silkfiy Oct 17, 2026
bc155af
Align text for empty shuttle card
silkfiy Oct 17, 2026
61e3a15
Fix notice card image not fitting in large screens
silkfiy Oct 17, 2026
ca199a4
Fix sizing for parking card on large screens
silkfiy Oct 19, 2026
02e8836
Apply pre-commit formatting
silkfiy Oct 19, 2026
cdccb22
Split cache load and API call into 2 steps
silkfiy Oct 22, 2026
31c3b51
Add load indicator when manually reloading
silkfiy Oct 23, 2026
86da264
Change class/finals to call API after Student ID
silkfiy Oct 24, 2026
dceb7a4
added live updating to busyness card
jod034 Oct 21, 2026
930f561
availablity card formatting
jod034 Oct 26, 2026
07c7a07
Remove debug print statements
silkfiy Oct 29, 2026
7888637
Apply pre-commit hook
silkfiy Oct 29, 2026
5053197
MA-685: Migrate Transit shuttle data feed to OneBusAway API
a6wu Oct 29, 2026
f18b04a
Fix tied reloading state of class/finals card
silkfiy Oct 30, 2026
9a2dc0f
Dining Locations with null coordinates broke the app. Fixed it so it …
klortiz13 Oct 30, 2026
08f6aed
Merge branch 'dev' of https://github.com/UCSD/campus-mobile into scre…
klortiz13 Oct 31, 2026
c60016c
fixed small ui bug in profile regarding the email
klortiz13 Oct 31, 2026
792b6c2
fixed alignment issue in profile
klortiz13 Oct 31, 2026
6a9c069
fixed map layout
klortiz13 Oct 31, 2026
76326e4
Merge pull request #2383 from UCSD/screen-size-ui-fixes-silkfiy
klortiz13 Oct 31, 2026
c6955e9
removed hardcoded height
klortiz13 Oct 31, 2026
04ef109
shrinked circles from 90MB+ to <15MB
klortiz13 Oct 31, 2026
bafb574
fixed left alignment
klortiz13 Oct 31, 2026
cafe390
optimized circles
klortiz13 Oct 31, 2026
6719ea1
finalized circles
klortiz13 Oct 31, 2026
ff70d51
Merge branch 'dev' of https://github.com/UCSD/campus-mobile into addi…
klortiz13 Oct 31, 2026
ea352ed
small fix
klortiz13 Oct 31, 2026
6866b46
Merge pull request #2379 from UCSD/adding-background-circles-prj002-d…
klortiz13 Oct 31, 2026
c7bbcd0
Merge branch 'dev' of https://github.com/UCSD/campus-mobile into opti…
klortiz13 Oct 31, 2026
a22aab3
added silent recovery
klortiz13 Oct 31, 2026
4733215
fixed overlapping refresh requests
klortiz13 Oct 31, 2026
edf3753
improved update readability
klortiz13 Oct 31, 2026
ff77e50
added fallback message when data couuldn't be updated
klortiz13 Oct 31, 2026
82ef176
stopped polling data when card was hidden
klortiz13 Oct 31, 2026
c7c5087
Merge pull request #2386 from UCSD/optimize-busyness-card-jod034
klortiz13 Oct 31, 2026
4c5afa3
Merge pull request #2388 from UCSD/optimize-student-cards-silkfiy
klortiz13 Oct 31, 2026
3687d3c
Add search function to dining list
silkfiy Oct 31, 2026
2b58aad
Add search helper for dining search
silkfiy Oct 31, 2026
71ac081
Fix bug with search bar losing focus
silkfiy Oct 31, 2026
8ea8b71
Changed search weights
silkfiy Nov 2, 2026
e46a315
Fix search box dark mode coloring
silkfiy Nov 2, 2026
0d0515b
Merge pull request #2391 from UCSD/dining-card-search-silkfiy
klortiz13 Nov 2, 2026
356141d
Merge branch 'dev' of https://github.com/UCSD/campus-mobile into ma-6…
klortiz13 Nov 6, 2026
4ef17a6
fix(shuttle): resolve startup failures and responsive card UI bugs
klortiz13 Nov 6, 2026
2dbc329
normalized selected stops
klortiz13 Nov 7, 2026
07b0377
MA-685: reconcile shuttle data requests
klortiz13 Nov 7, 2026
d0b1cc0
fixed UI bugs
klortiz13 Nov 7, 2026
415003a
manually tested the card and fixed UI bugs
klortiz13 Nov 7, 2026
5c60f3e
implemented a popupmenubutton instead of a dropdownButton for the cards
klortiz13 Nov 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.svn/
*.env
*.bak
DESIGN.md

# IntelliJ related
*.iml
Expand Down
Binary file added assets/images/circles/circle-1-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/circles/circle-2-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/circles/circle-3-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/circles/circle-4-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/circles/circle-5-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/circles/circle-6-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions lib/app_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:campus_mobile_experimental/core/providers/shuttle.dart';
import 'package:campus_mobile_experimental/core/providers/speed_test.dart';
import 'package:campus_mobile_experimental/core/providers/student_id.dart';
import 'package:campus_mobile_experimental/core/providers/user.dart';
import 'package:campus_mobile_experimental/core/services/shuttle_request_trace.dart';
import 'package:campus_mobile_experimental/ui/navigator/top.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -161,11 +162,10 @@ List<SingleChildWidget> dependentServices = [
var classDataProvider = ClassScheduleDataProvider();
return classDataProvider;
},
lazy: false,
update: (_, userDataProvider, classScheduleDataProvider) {
classScheduleDataProvider!.userDataProvider = userDataProvider;
final bool isLoggedIn = userDataProvider.isLoggedIn;
final bool isNotLoading = !classScheduleDataProvider.isLoading;
if (isLoggedIn && isNotLoading) classScheduleDataProvider.fetchData();
classScheduleDataProvider.handleLoginStateChange();
return classScheduleDataProvider;
},
),
Expand All @@ -176,6 +176,7 @@ List<SingleChildWidget> dependentServices = [
},
update: (_, userDataProvider, studentIdDataProvider) {
studentIdDataProvider!.userDataProvider = userDataProvider;
userDataProvider.studentIdDataProvider = studentIdDataProvider;
return studentIdDataProvider;
},
),
Expand Down Expand Up @@ -204,16 +205,15 @@ List<SingleChildWidget> dependentServices = [
return availabilityDataProvider;
},
),
ChangeNotifierProxyProvider2<Coordinates, UserDataProvider, ShuttleDataProvider>(
ChangeNotifierProxyProvider<UserDataProvider, ShuttleDataProvider>(
create: (_) {
var shuttleDataProvider = ShuttleDataProvider();
var shuttleDataProvider = ShuttleDataProvider(requestTraceObserver: debugLogShuttleRequestTrace);
return shuttleDataProvider;
},
update: (_, coordinates, userDataProvider, shuttleDataProvider) {
update: (_, userDataProvider, shuttleDataProvider) {
print("UpdateProvider: shuttleDataProvider");
shuttleDataProvider!.userCoords = coordinates;
shuttleDataProvider.userDataProvider = userDataProvider;
shuttleDataProvider.fetchStops(true);
shuttleDataProvider!.userDataProvider = userDataProvider;
shuttleDataProvider.fetchStops(true, refreshCatalog: false);
return shuttleDataProvider;
},
),
Expand Down
2 changes: 1 addition & 1 deletion lib/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Router {
return MaterialPageRoute(
builder: (context) {
Provider.of<CustomAppBar>(context).changeTitle(settings.name);
return DiningList();
return DiningList(showSearch: true);
},
);
case RoutePaths.DINING_OPTION_DETAIL_VIEW:
Expand Down
166 changes: 160 additions & 6 deletions lib/core/models/shuttle_arrival.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:convert';

import 'package:campus_mobile_experimental/core/models/shuttle_stop.dart';

List<ArrivingShuttle> getArrivingShuttles(String str) {
var shuttles = json.decode(str);
List<ArrivingShuttle> arrivingShuttles = [];
Expand All @@ -9,6 +11,85 @@ List<ArrivingShuttle> getArrivingShuttles(String str) {
return arrivingShuttles;
}

/// Default route color used when a OneBusAway route has no usable color.
/// Mirrors the "no arrivals found" color used by the Transit card UI.
const String oneBusAwayDefaultRouteColor = '#747678';

final RegExp _hexColorPattern = RegExp(r'^([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$');

/// Parses the envelope of a OneBusAway
/// `arrivals-and-departures-for-stop` response
/// (`{"code":200,"currentTime":...,"data":{"entry":{...},"references":{...}}}`)
/// into the existing [ArrivingShuttle] shape used by the Transit UI.
///
/// - [agencyId]: when provided, arrivals for routes outside that agency are
/// dropped. The campus feed serves multiple agencies (MTS, NCTD, UCSD) at
/// the same stops; the Transit feature only tracks the campus shuttle
/// agency, matching the legacy feed's behavior.
/// - [nowMs]: overrides the reference "now" used to compute arrival times
/// (the envelope's `currentTime` by default, device clock as fallback).
///
/// Arrivals without any usable arrival/departure time are skipped rather
/// than crashing (graceful degradation).
List<ArrivingShuttle> arrivingShuttlesFromOneBusAwayEnvelope(
Map<String, dynamic> envelope, {
String? agencyId,
int? nowMs,
}) {
final dynamic data = envelope['data'];
if (data is! Map<String, dynamic>) return const <ArrivingShuttle>[];
final dynamic entry = data['entry'];
if (entry is! Map<String, dynamic>) return const <ArrivingShuttle>[];
final int now = nowMs ?? (envelope['currentTime'] as num?)?.toInt() ?? DateTime.now().millisecondsSinceEpoch;
final Map<String, Map<String, dynamic>> routeReferences = _routeReferences(data);
final List<ArrivingShuttle> shuttles = [];
final dynamic arrivals = entry['arrivalsAndDepartures'];
if (arrivals is! List) return const <ArrivingShuttle>[];
for (final dynamic arrival in arrivals) {
if (arrival is! Map<String, dynamic>) continue;
final ArrivingShuttle? shuttle = ArrivingShuttle.fromOneBusAwayJson(
arrival,
routeReferences,
now,
agencyId: agencyId,
);
if (shuttle != null) shuttles.add(shuttle);
}
return shuttles;
}

Map<String, Map<String, dynamic>> _routeReferences(Map<String, dynamic> data) {
final dynamic references = data['references'];
final dynamic routes = references is Map<String, dynamic> ? references['routes'] : null;
final Map<String, Map<String, dynamic>> routeById = <String, Map<String, dynamic>>{};
if (routes is! List) return routeById;
for (final dynamic route in routes) {
if (route is! Map<String, dynamic>) continue;
final String? id = _asString(route['id']);
if (id != null && id.isNotEmpty) routeById[id] = route;
}
return routeById;
}

String? _asString(dynamic value) => value == null ? null : value.toString();

String? _firstNonEmpty(List<String?> candidates) {
for (final String? candidate in candidates) {
if (candidate != null && candidate.trim().isNotEmpty) return candidate;
}
return null;
}

/// Validates and canonicalizes a OneBusAway route color (e.g. `182b49`)
/// into the `#RRGGBB` hex string the Transit UI expects. Returns null when
/// the value is missing or not a valid hex color.
String? _normalizeHexColor(String? raw) {
if (raw == null) return null;
final String trimmed = raw.trim().replaceFirst('#', '');
if (!_hexColorPattern.hasMatch(trimmed)) return null;
return '#$trimmed';
}

class ArrivingShuttle {
ArrivingShuttle({
required this.routeId,
Expand All @@ -24,16 +105,89 @@ class ArrivingShuttle {
String routeColor;
int secondsToArrival;

factory ArrivingShuttle.fromJson(Map<String, dynamic> json) {
factory ArrivingShuttle.fromJson(Map<String, dynamic> json) => ArrivingShuttle(
routeId: json["routeId"],
routeName: json["routeName"],
routeStopId: json["routeStopId"],
routeColor: json["routeColor"],
secondsToArrival: json["secondsToArrival"],
);

/// Maps a OneBusAway `arrivalsAndDepartures` entry onto the existing model
/// shape. [routeReferences] holds the referenced routes keyed by their
/// OneBusAway route id; [nowMs] is the reference time used to compute the
/// seconds until arrival. Returns null when the entry cannot be mapped
/// (missing route id, no usable time, or outside [agencyId]).
static ArrivingShuttle? fromOneBusAwayJson(
Map<String, dynamic> arrival,
Map<String, Map<String, dynamic>> routeReferences,
int nowMs, {
String? agencyId,
}) {
final String routeId = _asString(arrival['routeId']) ?? '';
if (routeId.isEmpty) return null;
if (agencyId != null && agencyId.isNotEmpty && !routeId.startsWith('${agencyId}_')) return null;
if (arrival['arrivalEnabled'] == false && arrival['departureEnabled'] == false) return null;

final int? etaMs = _etaMilliseconds(arrival, nowMs);
if (etaMs == null) return null;

final Map<String, dynamic>? route = routeReferences[routeId];
final String? stopId = _asString(arrival['stopId']);
return ArrivingShuttle(
routeId: json["routeId"],
routeName: json["routeName"],
routeStopId: json["routeStopId"],
routeColor: json["routeColor"],
secondsToArrival: json["secondsToArrival"],
routeId: oneBusAwayIdToInt(routeId),
routeName: _routeName(arrival, route),
routeStopId: stopId == null || stopId.isEmpty ? null : oneBusAwayIdToInt(stopId),
routeColor: _normalizeHexColor(_asString(route?['color'])) ?? oneBusAwayDefaultRouteColor,
secondsToArrival: etaMs < 0 ? 0 : etaMs ~/ 1000,
);
}

/// The legacy feed exposed a single human-readable route name. OneBusAway
/// splits this across several fields, so prefer the referenced route's
/// long name (e.g. "Outside Loop"), then its short name, then the fields
/// carried on the arrival itself, then the trip headsign.
static String _routeName(Map<String, dynamic> arrival, Map<String, dynamic>? route) =>
_firstNonEmpty([
_asString(route?['longName']),
_asString(route?['shortName']),
_asString(arrival['routeShortName']),
_asString(arrival['routeLongName']),
_asString(arrival['tripHeadsign']),
]) ??
'Route';

/// Resolves the target epoch-milliseconds for the arrival, preferring
/// real-time predictions over scheduled times and arrival times over
/// departure times. Returns null when no usable time exists (the legacy
/// equivalent of an arrival with no ETA).
static int? _etaMilliseconds(Map<String, dynamic> arrival, int nowMs) {
final bool predicted = arrival['predicted'] == true;
final int predictedArrival = _asMillis(arrival['predictedArrivalTime']);
final int scheduledArrival = _asMillis(arrival['scheduledArrivalTime']);
final int predictedDeparture = _asMillis(arrival['predictedDepartureTime']);
final int scheduledDeparture = _asMillis(arrival['scheduledDepartureTime']);

int? targetMs;
if (predicted && predictedArrival > 0) {
targetMs = predictedArrival;
} else if (scheduledArrival > 0) {
targetMs = scheduledArrival;
} else if (predicted && predictedDeparture > 0) {
targetMs = predictedDeparture;
} else if (scheduledDeparture > 0) {
targetMs = scheduledDeparture;
}
if (targetMs == null) return null;
return targetMs - nowMs;
}

static int _asMillis(dynamic value) {
if (value is num) return value.toInt();
if (value is String) return int.tryParse(value) ?? 0;
return 0;
}

Map<String, dynamic> toJson() => {
"routeId": routeId,
"routeName": routeName,
Expand Down
55 changes: 53 additions & 2 deletions lib/core/models/shuttle_stop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,70 @@ List<ShuttleStopModel> shuttleStopModelFromJson(String str) {
String shuttleStopModelToJson(List<ShuttleStopModel> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));

/// Converts a OneBusAway identifier (e.g. `UCSD_1040`) into the integer id
/// used by the Transit UI and the persisted user profile. If the part after
/// the agency prefix is not numeric, falls back to a stable hash so ids stay
/// unique and non-negative.
int oneBusAwayIdToInt(String id) {
final int separatorIndex = id.lastIndexOf('_');
final String numericPart = separatorIndex >= 0 ? id.substring(separatorIndex + 1) : id;
return int.tryParse(numericPart) ?? (id.hashCode & 0x7FFFFFFF);
}

/// Parses the envelope of a OneBusAway `stops-for-agency` response
/// (`{"code":200,...,"data":{"list":[...]}}`) into the existing
/// [ShuttleStopModel] shape used by the Transit UI.
///
/// Malformed entries are skipped so a single bad record cannot break the
/// whole stop list (graceful degradation).
List<ShuttleStopModel> shuttleStopsFromOneBusAwayEnvelope(Map<String, dynamic> envelope) {
final dynamic data = envelope['data'];
if (data is! Map<String, dynamic>) return const <ShuttleStopModel>[];
final dynamic list = data['list'];
if (list is! List) return const <ShuttleStopModel>[];
return list
.whereType<Map<String, dynamic>>()
.map(ShuttleStopModel.fromOneBusAwayJson)
.whereType<ShuttleStopModel>()
.toList();
}

class ShuttleStopModel {
double lat;
double lon;
int id;
String name;

ShuttleStopModel({required this.lat, required this.lon, required this.id, required this.name});
/// Raw OneBusAway stop id (e.g. `UCSD_10378`), kept so the arrivals
/// endpoint can be queried with the exact id OneBusAway expects.
String? oneBusAwayId;

ShuttleStopModel({required this.lat, required this.lon, required this.id, required this.name, this.oneBusAwayId});

ShuttleStopModel.fromJson(Map<String, dynamic> json)
: lat = json["lat"].toDouble(),
lon = json["lon"].toDouble(),
id = json["id"],
name = json["name"];

Map<String, dynamic> toJson() => {"lat": lat, "lon": lon, "id": id, "name": name};
/// Maps a OneBusAway stop object onto the existing model shape. Returns
/// null when required fields are missing or malformed.
static ShuttleStopModel? fromOneBusAwayJson(Map<String, dynamic> json) {
final dynamic lat = json['lat'];
final dynamic lon = json['lon'];
final String? rawId = json['id']?.toString();
final String? name = json['name']?.toString();
if (lat is! num || lon is! num || rawId == null || rawId.isEmpty || name == null) {
return null;
}
return ShuttleStopModel(
lat: lat.toDouble(),
lon: lon.toDouble(),
id: oneBusAwayIdToInt(rawId),
name: name,
oneBusAwayId: rawId,
);
}

Map<String, dynamic> toJson() => {"lat": lat, "lon": lon, "id": id, "name": name, "oneBusAwayId": oneBusAwayId};
}
Loading
Loading