diff --git a/Daydream.xcodeproj/project.pbxproj b/Daydream.xcodeproj/project.pbxproj index 7225d51..048726a 100644 --- a/Daydream.xcodeproj/project.pbxproj +++ b/Daydream.xcodeproj/project.pbxproj @@ -687,7 +687,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -749,7 +749,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -785,7 +785,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.rckim.Daydream; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "daydream-provisioning-profile-distribution"; + PROVISIONING_PROFILE_SPECIFIER = "daydream-prov-profile-distribution-new-mac"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -804,7 +804,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.rckim.Daydream; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "daydream-provisioning-profile-distribution"; + PROVISIONING_PROFILE_SPECIFIER = "daydream-prov-profile-distribution-new-mac"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/Daydream/Base.lproj/Main.storyboard b/Daydream/Base.lproj/Main.storyboard index 95a5eb8..91814da 100644 --- a/Daydream/Base.lproj/Main.storyboard +++ b/Daydream/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -160,29 +160,12 @@ - - - - - - - - - - - - - - - - - diff --git a/Daydream/Info.plist b/Daydream/Info.plist index b6e3d4e..1d13911 100644 --- a/Daydream/Info.plist +++ b/Daydream/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.21.0 + 2.22.0 CFBundleVersion - 7 + 8 LSApplicationQueriesSchemes googlechromes diff --git a/Daydream/MapViewController.swift b/Daydream/MapViewController.swift index b777edb..370ea2f 100644 --- a/Daydream/MapViewController.swift +++ b/Daydream/MapViewController.swift @@ -15,11 +15,11 @@ import Combine // swiftlint:disable type_body_length final class MapViewController: UIViewController { - var place: Place? - var dynamicMapView: GMSMapView? - var dynamicMarker: GMSMarker? - var currentReviews: [Review]? - var currentReviewIndex = 0 + private var place: Place + private var dynamicMapView: GMSMapView? + private var dynamicMarker: GMSMarker? + private var currentReviews: [Review]? + private var currentReviewIndex = 0 // Will automatically sync with system user interface style settings but can be overridden // when the user taps the dark mode button. Note this must be called once dynamicMapView is set. @@ -83,10 +83,14 @@ final class MapViewController: UIViewController { card.addGestureRecognizer(tapGesture) return card }() - - override func viewDidLoad() { - super.viewDidLoad() - + + init?(place: Place?) { + guard let place = place else { + return nil + } + self.place = place + super.init(nibName: nil, bundle: nil) + NotificationCenter.default.addObserver(self, selector: #selector(stopDisplayingReviews), name: UIApplication.didEnterBackgroundNotification, @@ -95,8 +99,16 @@ final class MapViewController: UIViewController { selector: #selector(restartDisplayingCurrentReviews), name: UIApplication.willEnterForegroundNotification, object: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidLoad() { + super.viewDidLoad() - addOrUpdateMapView(for: place?.placeId, name: place?.name, location: place?.coordinate) + addOrUpdateMapView(for: place.placeId, name: place.name, location: place.coordinate) addProgrammaticViews() } @@ -153,11 +165,7 @@ final class MapViewController: UIViewController { reviewCard.isHidden = true } - private func addOrUpdateMapView(for placeId: String?, name: String?, location: CLLocationCoordinate2D?) { - guard let placeId = placeId, let name = name, let location = location else { - return - } - + private func addOrUpdateMapView(for placeId: String, name: String, location: CLLocationCoordinate2D) { let camera = GMSCameraPosition.camera(withLatitude: location.latitude, longitude: location.longitude, zoom: 16.0) @@ -349,7 +357,7 @@ extension MapViewController: GMSMapViewDelegate { func mapView(_ mapView: GMSMapView, didTapInfoWindowOf marker: GMSMarker) { logEvent(contentType: "info window on marker tapped", title) - if let mapUrl = place?.mapUrl, let url = URL(string: mapUrl) { + if let mapUrl = place.mapUrl, let url = URL(string: mapUrl) { UIApplication.shared.open(url, options: [:]) } } diff --git a/Daydream/SearchDetailViewController.swift b/Daydream/SearchDetailViewController.swift index 5848763..83376a4 100644 --- a/Daydream/SearchDetailViewController.swift +++ b/Daydream/SearchDetailViewController.swift @@ -225,17 +225,6 @@ final class SearchDetailViewController: UIViewController { floatingTitleView.alpha = 0 } - // MARK: - Segue - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - if let destinationVC = segue.destination as? MapViewController, let sender = sender as? Place { - // segue from Top Sights cell - if segue.identifier == "genericMapSegue" { - destinationVC.place = sender - } - } - } - // MARK: - Button selector methods @objc @@ -394,7 +383,10 @@ extension SearchDetailViewController: GMSAutocompleteResultsViewControllerDelega extension SearchDetailViewController: SightsCardCellDelegate { func sightsCardCell(_ cell: SightsCardCell, didSelectPlace place: Place) { logEvent(contentType: "select point of interest", title) - performSegue(withIdentifier: "genericMapSegue", sender: place) + guard let mapVC = MapViewController(place: place) else { + return + } + present(mapVC, animated: true) } func sightsCardCellDidTapBusinessStatusButton(_ businessStatus: PlaceBusinessStatus) { @@ -418,7 +410,10 @@ extension SearchDetailViewController: EateriesCardCellDelegate { openUrl(url) } case .google: - performSegue(withIdentifier: "genericMapSegue", sender: eatery) + guard let mapVC = MapViewController(place: eatery as? Place) else { + return + } + present(mapVC, animated: true) } } diff --git a/DaydreamUITests/Info.plist b/DaydreamUITests/Info.plist index 5442b0f..46d81d8 100644 --- a/DaydreamUITests/Info.plist +++ b/DaydreamUITests/Info.plist @@ -15,8 +15,8 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 2.21.0 + 2.22.0 CFBundleVersion - 7 + 8