From 5aa57b563dea52f08e93a787f66baedd1f02b04e Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 20 Aug 2024 15:44:05 -0700 Subject: [PATCH] Cleanup: remove private header This header was copied in from MapLibre Native to expose a private method. Previously this got out of sync and caused a bug: https://github.com/maplibre/maplibre-navigation-ios/pull/53 Instead we can use the already public delegate method. Note: The deleted header was importing Maplibre/Mapbox.h, but we are using that elsewhere, so I moved that import up a level. --- MapboxNavigation/NavigationMapView.swift | 4 +--- MapboxNavigation/RouteMapViewController.swift | 4 ++++ MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h | 9 --------- MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.m | 8 -------- MapboxNavigationObjc/include/MapboxNavigation.h | 2 +- 5 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h delete mode 100644 MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.m diff --git a/MapboxNavigation/NavigationMapView.swift b/MapboxNavigation/NavigationMapView.swift index ec05641d..2f7dea7d 100644 --- a/MapboxNavigation/NavigationMapView.swift +++ b/MapboxNavigation/NavigationMapView.swift @@ -258,9 +258,7 @@ open class NavigationMapView: MLNMapView, UIGestureRecognizerDelegate { } } - override open func mapViewDidFinishRenderingFrameFullyRendered(_ fullyRendered: Bool, frameEncodingTime: Double, frameRenderingTime: Double) { - super.mapViewDidFinishRenderingFrameFullyRendered(fullyRendered, frameEncodingTime: frameEncodingTime, frameRenderingTime: frameRenderingTime) - + func updateCourseTrackingAfterDidFinishRenderingFrame() { guard self.shouldPositionCourseViewFrameByFrame else { return } guard let location = userLocationForCourseTracking else { return } diff --git a/MapboxNavigation/RouteMapViewController.swift b/MapboxNavigation/RouteMapViewController.swift index 5f1382e3..f11fc939 100644 --- a/MapboxNavigation/RouteMapViewController.swift +++ b/MapboxNavigation/RouteMapViewController.swift @@ -582,6 +582,10 @@ extension RouteMapViewController: NavigationViewDelegate { self.delegate?.mapViewDidFinishLoadingMap?(mapView) } + func mapViewDidFinishRenderingFrame(_ mapView: MLNMapView, fullyRendered: Bool) { + self.mapView.updateCourseTrackingAfterDidFinishRenderingFrame() + } + // MARK: - VisualInstructionDelegate func label(_ label: InstructionLabel, willPresent instruction: VisualInstruction, as presented: NSAttributedString) -> NSAttributedString? { diff --git a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h b/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h deleted file mode 100644 index 8ea47be9..00000000 --- a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -@interface MLNMapView (MLNNavigationAdditions) - -- (void)mapViewDidFinishRenderingFrameFullyRendered:(BOOL)fullyRendered - frameEncodingTime:(double)frameEncodingTime - frameRenderingTime:(double)frameRenderingTime; - -@end diff --git a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.m b/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.m deleted file mode 100644 index 240426b1..00000000 --- a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.m +++ /dev/null @@ -1,8 +0,0 @@ -#import "MLNMapView+MLNNavigationAdditions.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wincomplete-implementation" -@implementation MLNMapView (MLNNavigationAdditions) -#pragma clang diagnostic pop - -@end diff --git a/MapboxNavigationObjc/include/MapboxNavigation.h b/MapboxNavigationObjc/include/MapboxNavigation.h index 46ebd62a..23299115 100644 --- a/MapboxNavigationObjc/include/MapboxNavigation.h +++ b/MapboxNavigationObjc/include/MapboxNavigation.h @@ -7,4 +7,4 @@ FOUNDATION_EXPORT double MapboxNavigationVersionNumber; FOUNDATION_EXPORT const unsigned char MapboxNavigationVersionString[]; #import "../MBRouteVoiceController.h" -#import "../MLNMapView+MLNNavigationAdditions.h" +#import