-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trip planner tab view and notification
- Loading branch information
1 parent
7a22390
commit 935900d
Showing
10 changed files
with
195 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// TripPlanner+Extension.swift | ||
// OBAKit | ||
// | ||
// Created by Hilmy Veradin on 14/09/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Notification.Name { | ||
static let tripPlannerServiceDidChange = Notification.Name("tripPlannerServiceDidChange") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// TripPlannerHostingView.swift | ||
// OBAKit | ||
// | ||
// Created by Hilmy Veradin on 14/09/24. | ||
// | ||
|
||
import UIKit | ||
import SwiftUI | ||
import OBAKitCore | ||
import OTPKit | ||
|
||
class TripPlannerHostingController: UIHostingController<AnyView> { | ||
|
||
init(tripPlannerService: TripPlannerService) { | ||
let rootView = AnyView( | ||
TripPlannerView() | ||
.environment(tripPlannerService) | ||
.environment(OriginDestinationSheetEnvironment()) | ||
) | ||
|
||
super.init(rootView: rootView) | ||
|
||
title = Strings.tripPlanner | ||
tabBarItem.image = Icons.tripPlannerTabIcon | ||
tabBarItem.selectedImage = Icons.tripPlannerSelectedTabIcon | ||
|
||
let appearance = UITabBarAppearance() | ||
appearance.configureWithDefaultBackground() | ||
tabBarItem.scrollEdgeAppearance = appearance | ||
} | ||
|
||
@MainActor required dynamic init?(coder aDecoder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// TripPlannerView.swift | ||
// OBAKit | ||
// | ||
// Created by Hilmy Veradin on 14/09/24. | ||
// | ||
|
||
import MapKit | ||
import OTPKit | ||
import SwiftUI | ||
|
||
struct TripPlannerView: View { | ||
@Environment(TripPlannerService.self) private var tripPlanner | ||
|
||
var body: some View { | ||
ZStack { | ||
TripPlannerExtensionView { | ||
Map(position: tripPlanner.currentCameraPositionBinding, interactionModes: .all) { | ||
tripPlanner.generateMarkers() | ||
tripPlanner.generateMapPolyline() | ||
.stroke(.blue, lineWidth: 5) | ||
} | ||
.mapControls { | ||
if !tripPlanner.isMapMarkingMode { | ||
MapUserLocationButton() | ||
MapPitchToggle() | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
#Preview { | ||
TripPlannerView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters