Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Soundscape
//
// Copyright (c) Microsoft Corporation.
// Copyright (c) Soundscape Community Contributors.
// Licensed under the MIT License.
//

Expand Down Expand Up @@ -31,8 +32,7 @@ struct AnyViewControllerRepresentable: ViewControllerRepresentable {
sIdentifier = "Help"
vIdentifier = "OfflinePage"
case .routeGuidance:
sIdentifier = "RecreationalActivities"
vIdentifier = "RouteDetailsView"
return RouteDetailsViewHostingController.makeForActiveRoute()
case .manageDevices:
sIdentifier = "Devices"
vIdentifier = "manageDevices"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class HomeViewController: UIViewController {

// Main Menu Segues

static let showRecreationActivities = "ShowRecreationActivities"
static let showManageDevices = "ShowManageDevices"
static let showStatus = "ShowStatus"
static let showHelp = "ShowHelpSegue"
Expand All @@ -38,7 +37,7 @@ class HomeViewController: UIViewController {
/// - Returns: The segue associated with this menu item
static func segue(for menuItem: MenuItem) -> String? {
switch menuItem {
case .recreation: return Segue.showRecreationActivities
case .recreation: return nil
case .devices: return Segue.showManageDevices
case .help: return Segue.showHelp
case .settings: return Segue.showSettings
Expand Down Expand Up @@ -322,27 +321,31 @@ class HomeViewController: UIViewController {
logContext: telemetryContext
)
}

private func showRecreationActivities() {
show(AuthoredActivitiesListHostingController(), sender: self)
}

private func showOrRefreshExperiences() {
if navigationController?.visibleViewController is HomeViewController {

// The HomeViewController is currently the visible VC - segue to the AuthoredActivitiesList
performSegue(withIdentifier: Segue.showRecreationActivities, sender: self)
// The HomeViewController is currently visible - show the AuthoredActivitiesList
showRecreationActivities()

} else if let vc = navigationController?.visibleViewController as? MenuViewController {

// The MenuViewController is currently the visible VC - dismiss it and segue to the AdaptiveSportsEventsList
// The MenuViewController is currently visible - dismiss it and show the AuthoredActivitiesList
vc.dismiss(animated: true) { [weak self] in
self?.performSegue(withIdentifier: Segue.showRecreationActivities, sender: self)
self?.showRecreationActivities()
}

} else {

// Some other view controller is currently the visible VC - return to home and then segue to the AuthoredActivitiesList
// Return to home and then show the AuthoredActivitiesList
CATransaction.begin()
navigationController?.popToViewController(self, animated: true)
CATransaction.setCompletionBlock { [weak self] in
self?.performSegue(withIdentifier: Segue.showRecreationActivities, sender: self)
self?.showRecreationActivities()
}
CATransaction.commit()

Expand Down Expand Up @@ -477,12 +480,16 @@ extension HomeViewController: UIViewControllerTransitioningDelegate {
guard finished else {
return
}

if dismissed.selected == .recreation {
self?.showRecreationActivities()
return
}

guard let segue = Segue.segue(for: dismissed.selected) else {
return
}


self?.performSegue(withIdentifier: segue, sender: self)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
// Soundscape
//
// Copyright (c) Microsoft Corporation.
// Copyright (c) Soundscape Community Contributors.
// Licensed under the MIT License.
//

import SwiftUI

class AuthoredActivitiesListHostingController: UIHostingController<AnyView> {
required init?(coder aDecoder: NSCoder) {
init() {
let navHelper = ViewNavigationHelper()
let storage = AuthoredActivityStorage(AuthoredActivityLoader.shared)
let view = AuthoredActivitiesList().environmentObject(storage).environmentObject(navHelper)

super.init(coder: aDecoder, rootView: AnyView(view))
super.init(rootView: AnyView(view))

navHelper.host = self
}

@available(*, unavailable, message: "Use init()")
required init?(coder aDecoder: NSCoder) {
fatalError("Use init()")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Soundscape
//
// Copyright (c) Microsoft Corporation.
// Copyright (c) Soundscape Community Contributors.
// Licensed under the MIT License.
//

Expand Down Expand Up @@ -82,9 +83,10 @@ struct BeaconToolbarView: View {

// View details
Button(action: {
let storyboard = UIStoryboard(name: "RecreationalActivities", bundle: Bundle.main)
let viewController = storyboard.instantiateViewController(withIdentifier: "RouteDetailsView")

guard let viewController = RouteDetailsViewHostingController.makeForActiveRoute() else {
return
}

navHelper.pushViewController(viewController, animated: true)
}, label: {
Image(systemName: "info.circle.fill")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,34 @@
// Soundscape
//
// Copyright (c) Microsoft Corporation.
// Copyright (c) Soundscape Community Contributors.
// Licensed under the MIT License.
//

import SwiftUI

class RouteDetailsViewHostingController: UIHostingController<AnyView> {
required init?(coder aDecoder: NSCoder) {
guard let routeGuidance = AppContext.shared.eventProcessor.activeBehavior as? RouteGuidance else {
return nil
}

init(routeGuidance: RouteGuidance) {
let navHelper = ViewNavigationHelper()
let view = RouteDetailsView(routeGuidance.content, deleteAction: nil)
.environmentObject(UserLocationStore())
.environmentObject(navHelper)

super.init(coder: aDecoder, rootView: AnyView(view))
super.init(rootView: AnyView(view))

navHelper.host = self
}

@available(*, unavailable, message: "Use init(routeGuidance:)")
required init?(coder aDecoder: NSCoder) {
fatalError("Use init(routeGuidance:)")
}

static func makeForActiveRoute() -> RouteDetailsViewHostingController? {
guard let routeGuidance = AppContext.shared.eventProcessor.activeBehavior as? RouteGuidance else {
return nil
}

return RouteDetailsViewHostingController(routeGuidance: routeGuidance)
}
}
9 changes: 0 additions & 9 deletions apps/ios/GuideDogs/Code/Visual UI/Views/main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@
</objects>
<point key="canvasLocation" x="440" y="-538"/>
</scene>
<!--availableRecreationActivities-->
<scene sceneID="Jp7-ts-HAe">
<objects>
<viewControllerPlaceholder storyboardName="RecreationalActivities" referencedIdentifier="availableRecreationActivities" id="qYh-X2-fJT" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="6D8-aX-H2M" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="374" y="-788"/>
</scene>
<!--Beacon View Hosting Controller-->
<scene sceneID="VbI-NV-Cie">
<objects>
Expand Down Expand Up @@ -352,7 +344,6 @@
<segue destination="KdS-rN-o6n" kind="show" identifier="RequestMotionFitness" id="yUo-Mb-Mju"/>
<segue destination="Grr-Cc-oJv" kind="presentation" identifier="showStandbyScreen" modalPresentationStyle="fullScreen" modalTransitionStyle="crossDissolve" id="qKv-y2-EwR"/>
<segue destination="nmk-Fj-d9J" kind="show" identifier="EnableMotionFitness" id="eBT-M7-MQe"/>
<segue destination="qYh-X2-fJT" kind="show" identifier="ShowRecreationActivities" id="A9K-HT-444"/>
<segue destination="2Rp-FL-DpL" kind="show" identifier="ShowManageDevices" id="ybG-P0-eHe"/>
<segue destination="f3H-T1-Txl" kind="show" identifier="ShowStatus" id="Vd7-cG-0Ca"/>
<segue destination="6K2-3p-ww3" kind="show" identifier="LocationDetailView" id="9hD-GO-Vl6"/>
Expand Down