Skip to content

Commit

Permalink
feat: Refine stop display (#105)
Browse files Browse the repository at this point in the history
* feat: Distinguish between stop and stations icons

Bus/ferry stops are now displayed separately from rail stations, with a
different icon, and different behavior at different zoom levels. This
also includes quite a bit of refactoring around how the sources and
layers are being created, they're each moved out into a class, plus
another class for adding sources, layers, and images to the map.

* test: Add tests for source generators

* test: Add tests for layer generators

* test: Fix android tests

* refactor: Use Mapbox expression for stop icons

* test: Fix test

* fix: Remove irrelevant layer property
  • Loading branch information
EmmaSimon authored Mar 28, 2024
1 parent 562c0a2 commit 058f7ba
Show file tree
Hide file tree
Showing 29 changed files with 1,043 additions and 180 deletions.
68 changes: 66 additions & 2 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@
9A4E8E592B7EC4B90066B936 /* RoutePill.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A4E8E582B7EC4B90066B936 /* RoutePill.swift */; };
9A5830562BA3A2CE0039876E /* ViewportExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5830552BA3A2CE0039876E /* ViewportExtension.swift */; };
9A5830582BA4A1A30039876E /* ViewportProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5830572BA4A1A30039876E /* ViewportProvider.swift */; };
9A5B27522BB1EF45009A6FC6 /* StopSourceGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27512BB1EF45009A6FC6 /* StopSourceGenerator.swift */; };
9A5B27542BB1EF53009A6FC6 /* RouteSourceGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27532BB1EF53009A6FC6 /* RouteSourceGenerator.swift */; };
9A5B27562BB221C1009A6FC6 /* RouteLayerGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27552BB221C1009A6FC6 /* RouteLayerGenerator.swift */; };
9A5B27582BB22BF9009A6FC6 /* MapLayerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27572BB22BF8009A6FC6 /* MapLayerManager.swift */; };
9A5B275A2BB22D91009A6FC6 /* StopLayerGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27592BB22D91009A6FC6 /* StopLayerGenerator.swift */; };
9A5B275C2BB237DE009A6FC6 /* RecenterButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B275B2BB237DE009A6FC6 /* RecenterButton.swift */; };
9A5B27602BB31178009A6FC6 /* StopSourceGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B275F2BB31178009A6FC6 /* StopSourceGeneratorTests.swift */; };
9A5B27622BB32621009A6FC6 /* RouteSourceGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27612BB32621009A6FC6 /* RouteSourceGeneratorTests.swift */; };
9A5B27642BB3621F009A6FC6 /* RouteLayerGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27632BB3621F009A6FC6 /* RouteLayerGeneratorTests.swift */; };
9A5B27662BB3631F009A6FC6 /* MapTestDataHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27652BB3631F009A6FC6 /* MapTestDataHelper.swift */; };
9A5B27682BB36A23009A6FC6 /* StopLayerGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B27672BB36A23009A6FC6 /* StopLayerGeneratorTests.swift */; };
9A60E8E72B8501BD008A8D5C /* RoutePillTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A60E8E62B8501BD008A8D5C /* RoutePillTests.swift */; };
9A635D1F2B99103200A43C51 /* EmptyWhenModifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A635D1E2B99103200A43C51 /* EmptyWhenModifierTests.swift */; };
9A69D4902B99212400235125 /* NearbyFetcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A69D48F2B99212300235125 /* NearbyFetcherTests.swift */; };
Expand All @@ -69,6 +80,7 @@
9AD1D1FE2BA4D5C600182060 /* ViewportProviderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AD1D1FD2BA4D5C600182060 /* ViewportProviderTest.swift */; };
9ADB849D2BAD05BC006581CE /* Inspection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADB849C2BAD05BC006581CE /* Inspection.swift */; };
9ADB84A02BAD1B84006581CE /* DebouncerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADB849F2BAD1B84006581CE /* DebouncerTests.swift */; };
9ADB84A22BAE37C0006581CE /* StopExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADB84A12BAE37C0006581CE /* StopExtension.swift */; };
9AF88E052B48913C00E08C7C /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 9AF88E042B48913C00E08C7C /* Localizable.xcstrings */; };
A430D45FE0676C73075AB85B /* Pods_iosAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED1649D982654BA7A4D2F2DC /* Pods_iosAppTests.framework */; };
A55C5596CDC797ED68F79279 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C6BD892027AC258EE8F408D /* Pods_iosApp.framework */; };
Expand Down Expand Up @@ -156,6 +168,17 @@
9A4E8E582B7EC4B90066B936 /* RoutePill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoutePill.swift; sourceTree = "<group>"; };
9A5830552BA3A2CE0039876E /* ViewportExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewportExtension.swift; sourceTree = "<group>"; };
9A5830572BA4A1A30039876E /* ViewportProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ViewportProvider.swift; path = iosApp/ViewportProvider.swift; sourceTree = SOURCE_ROOT; };
9A5B27512BB1EF45009A6FC6 /* StopSourceGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopSourceGenerator.swift; sourceTree = "<group>"; };
9A5B27532BB1EF53009A6FC6 /* RouteSourceGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteSourceGenerator.swift; sourceTree = "<group>"; };
9A5B27552BB221C1009A6FC6 /* RouteLayerGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteLayerGenerator.swift; sourceTree = "<group>"; };
9A5B27572BB22BF8009A6FC6 /* MapLayerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLayerManager.swift; sourceTree = "<group>"; };
9A5B27592BB22D91009A6FC6 /* StopLayerGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopLayerGenerator.swift; sourceTree = "<group>"; };
9A5B275B2BB237DE009A6FC6 /* RecenterButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecenterButton.swift; sourceTree = "<group>"; };
9A5B275F2BB31178009A6FC6 /* StopSourceGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopSourceGeneratorTests.swift; sourceTree = "<group>"; };
9A5B27612BB32621009A6FC6 /* RouteSourceGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteSourceGeneratorTests.swift; sourceTree = "<group>"; };
9A5B27632BB3621F009A6FC6 /* RouteLayerGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteLayerGeneratorTests.swift; sourceTree = "<group>"; };
9A5B27652BB3631F009A6FC6 /* MapTestDataHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTestDataHelper.swift; sourceTree = "<group>"; };
9A5B27672BB36A23009A6FC6 /* StopLayerGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopLayerGeneratorTests.swift; sourceTree = "<group>"; };
9A60E8E62B8501BD008A8D5C /* RoutePillTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoutePillTests.swift; sourceTree = "<group>"; };
9A635D1E2B99103200A43C51 /* EmptyWhenModifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyWhenModifierTests.swift; sourceTree = "<group>"; };
9A69D48F2B99212300235125 /* NearbyFetcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearbyFetcherTests.swift; sourceTree = "<group>"; };
Expand All @@ -175,6 +198,7 @@
9AD1D1FD2BA4D5C600182060 /* ViewportProviderTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewportProviderTest.swift; sourceTree = "<group>"; };
9ADB849C2BAD05BC006581CE /* Inspection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Inspection.swift; sourceTree = "<group>"; };
9ADB849F2BAD1B84006581CE /* DebouncerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebouncerTests.swift; sourceTree = "<group>"; };
9ADB84A12BAE37C0006581CE /* StopExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StopExtension.swift; sourceTree = "<group>"; };
9AF88E042B48913C00E08C7C /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
ED1649D982654BA7A4D2F2DC /* Pods_iosAppTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosAppTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F71252D2B68FF131F8E6BDE2 /* Pods-iosAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosAppTests.release.xcconfig"; path = "Target Support Files/Pods-iosAppTests/Pods-iosAppTests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -249,6 +273,7 @@
6EED5E8D2B3DC69F0052A1B8 /* iosAppTests */ = {
isa = PBXGroup;
children = (
9A5B275D2BB242EF009A6FC6 /* Pages */,
6EF50F4F2B988BC500833070 /* Fetchers */,
6EE745822B965B8D0052227E /* Phoenix */,
6E4EACFA2B7A829C0011AB8B /* Mocks */,
Expand Down Expand Up @@ -331,11 +356,11 @@
9A9E05F22B6D6D9F0086B437 /* Fetchers */,
058557BA273AAA24004C7B11 /* Assets.xcassets */,
9AF88E042B48913C00E08C7C /* Localizable.xcstrings */,
7555FF82242A565900829871 /* ContentView.swift */,
7555FF8C242A565B00829871 /* Info.plist */,
2152FB032600AC8F00CF470E /* IOSApp.swift */,
058557D7273AAEEB004C7B11 /* Preview Content */,
7555FF82242A565900829871 /* ContentView.swift */,
8CC1BB3F2B59D1F6005386FE /* LocationDataManager.swift */,
058557D7273AAEEB004C7B11 /* Preview Content */,
);
path = iosApp;
sourceTree = "<group>";
Expand Down Expand Up @@ -388,6 +413,12 @@
isa = PBXGroup;
children = (
6E35D4CF2B72C7B700A2BF95 /* HomeMapView.swift */,
9A5B27572BB22BF8009A6FC6 /* MapLayerManager.swift */,
9A5B275B2BB237DE009A6FC6 /* RecenterButton.swift */,
9A5B27552BB221C1009A6FC6 /* RouteLayerGenerator.swift */,
9A5B27532BB1EF53009A6FC6 /* RouteSourceGenerator.swift */,
9A5B27592BB22D91009A6FC6 /* StopLayerGenerator.swift */,
9A5B27512BB1EF45009A6FC6 /* StopSourceGenerator.swift */,
);
path = Map;
sourceTree = "<group>";
Expand All @@ -409,6 +440,26 @@
path = ComponentViews;
sourceTree = "<group>";
};
9A5B275D2BB242EF009A6FC6 /* Pages */ = {
isa = PBXGroup;
children = (
9A5B275E2BB24326009A6FC6 /* Map */,
);
path = Pages;
sourceTree = "<group>";
};
9A5B275E2BB24326009A6FC6 /* Map */ = {
isa = PBXGroup;
children = (
9A5B27612BB32621009A6FC6 /* RouteSourceGeneratorTests.swift */,
9A5B275F2BB31178009A6FC6 /* StopSourceGeneratorTests.swift */,
9A5B27632BB3621F009A6FC6 /* RouteLayerGeneratorTests.swift */,
9A5B27672BB36A23009A6FC6 /* StopLayerGeneratorTests.swift */,
9A5B27652BB3631F009A6FC6 /* MapTestDataHelper.swift */,
);
path = Map;
sourceTree = "<group>";
};
9A9E05F22B6D6D9F0086B437 /* Fetchers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -438,6 +489,7 @@
9A37F3042BACCC40001714FE /* DoubleRoundedExtension.swift */,
9A37F3062BACCCA5001714FE /* CoordinateExtension.swift */,
9ADB849C2BAD05BC006581CE /* Inspection.swift */,
9ADB84A12BAE37C0006581CE /* StopExtension.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -724,16 +776,21 @@
files = (
9AD1D1FE2BA4D5C600182060 /* ViewportProviderTest.swift in Sources */,
9A887D592B698EF1006F5B80 /* SearchResultViewTests.swift in Sources */,
9A5B27602BB31178009A6FC6 /* StopSourceGeneratorTests.swift in Sources */,
6EE745842B965B9C0052227E /* SocketTests.swift in Sources */,
9A5B27682BB36A23009A6FC6 /* StopLayerGeneratorTests.swift in Sources */,
8CEA10272BA4C83D001C6EB9 /* AlertsFetcherTests.swift in Sources */,
6EF50F482B9889D600833070 /* MockSocket.swift in Sources */,
9A5B27662BB3631F009A6FC6 /* MapTestDataHelper.swift in Sources */,
9ADB84A02BAD1B84006581CE /* DebouncerTests.swift in Sources */,
6EF50F512B988BF600833070 /* PredictionsFetcherTests.swift in Sources */,
9A5B27622BB32621009A6FC6 /* RouteSourceGeneratorTests.swift in Sources */,
9A7B7CA92B98E41B0045214F /* NonNilModifierTests.swift in Sources */,
6EED5EAB2B3E1B550052A1B8 /* ContentViewTests.swift in Sources */,
9A60E8E72B8501BD008A8D5C /* RoutePillTests.swift in Sources */,
6E35D4D32B72CD3900A2BF95 /* HomeMapViewTests.swift in Sources */,
9A69D4902B99212400235125 /* NearbyFetcherTests.swift in Sources */,
9A5B27642BB3621F009A6FC6 /* RouteLayerGeneratorTests.swift in Sources */,
9A635D1F2B99103200A43C51 /* EmptyWhenModifierTests.swift in Sources */,
8C7FA86F2B5EEA34009B699D /* LocationDataManagerTests.swift in Sources */,
6EED5E8F2B3DC6A00052A1B8 /* IosAppTests.swift in Sources */,
Expand All @@ -758,10 +815,13 @@
buildActionMask = 2147483647;
files = (
8CEA10232BA0F3C6001C6EB9 /* ScheduleFetcher.swift in Sources */,
9A5B275C2BB237DE009A6FC6 /* RecenterButton.swift in Sources */,
6E99CBB72B9892C80047E78D /* SocketProvider.swift in Sources */,
9A6DDF912B976FDF004D141A /* EmptyWhenModifier.swift in Sources */,
9ADB849D2BAD05BC006581CE /* Inspection.swift in Sources */,
9A5B27542BB1EF53009A6FC6 /* RouteSourceGenerator.swift in Sources */,
6EE7457E2B965ADE0052227E /* Socket.swift in Sources */,
9A5B27582BB22BF9009A6FC6 /* MapLayerManager.swift in Sources */,
9A03F3662BA9E68500DA40DC /* Debouncer.swift in Sources */,
9A8B34AD2B88E5090018412C /* RailRouteShapeFetcher.swift in Sources */,
9A2005CB2B97B68700F562E1 /* UpcomingTripView.swift in Sources */,
Expand All @@ -770,18 +830,21 @@
9A9E05F62B6D6EF70086B437 /* NearbyFetcher.swift in Sources */,
9A2005C92B97B65900F562E1 /* NearbyStopRoutePatternView.swift in Sources */,
9A4E8E592B7EC4B90066B936 /* RoutePill.swift in Sources */,
9A5B27562BB221C1009A6FC6 /* RouteLayerGenerator.swift in Sources */,
9A9E05F42B6D6DEA0086B437 /* SearchResultFetcher.swift in Sources */,
9A3B09362B967CEC00691427 /* NonNilModifier.swift in Sources */,
2152FB042600AC8F00CF470E /* IOSApp.swift in Sources */,
8CD1F8CD2B7164C100F419D4 /* PredictionsFetcher.swift in Sources */,
9A887D572B683103006F5B80 /* SearchResultView.swift in Sources */,
8CEA10252BA4B179001C6EB9 /* AlertsFetcher.swift in Sources */,
9A5B275A2BB22D91009A6FC6 /* StopLayerGenerator.swift in Sources */,
6E35D4D02B72C7B700A2BF95 /* HomeMapView.swift in Sources */,
8CC1BB402B59D1F6005386FE /* LocationDataManager.swift in Sources */,
8C7FA8732B5F36D6009B699D /* Backend.swift in Sources */,
9A2005C72B97B63300F562E1 /* NearbyStopView.swift in Sources */,
9AC4FDF12BACE216004479BF /* NearbyTransitPageView.swift in Sources */,
7555FF83242A565900829871 /* ContentView.swift in Sources */,
9ADB84A22BAE37C0006581CE /* StopExtension.swift in Sources */,
9AB44A112B8FC43E00E8FFB3 /* IconCard.swift in Sources */,
9A1631E62B76CAB400F667F4 /* GlobalFetcher.swift in Sources */,
9A37F3072BACCCA5001714FE /* CoordinateExtension.swift in Sources */,
Expand All @@ -791,6 +854,7 @@
9A2005C52B97B5EA00F562E1 /* NearbyRouteView.swift in Sources */,
9A5830562BA3A2CE0039876E /* ViewportExtension.swift in Sources */,
9A5830582BA4A1A30039876E /* ViewportProvider.swift in Sources */,
9A5B27522BB1EF45009A6FC6 /* StopSourceGenerator.swift in Sources */,
9AC4FDEF2BACE1EC004479BF /* NearbyTransitLocationProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images": [
{
"filename": "bus-stop-small.svg",
"idiom": "universal",
"scale": "1x"
},
{
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images": [
{
"filename": "mbta-logo-t.svg",
"filename": "bus-stop.svg",
"idiom": "universal",
"scale": "1x"
},
Expand Down
12 changes: 12 additions & 0 deletions iosApp/iosApp/Assets.xcassets/bus-stop.imageset/bus-stop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions iosApp/iosApp/Assets.xcassets/t-logo.imageset/mbta-logo-t.svg

This file was deleted.

21 changes: 21 additions & 0 deletions iosApp/iosApp/Assets.xcassets/t-station.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images": [
{
"filename": "t-station.svg",
"idiom": "universal",
"scale": "1x"
},
{
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Loading

0 comments on commit 058f7ba

Please sign in to comment.