diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-05-17 00:10:14 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-05-18 11:55:54 -0700 |
commit | 2c7d0567fa7a2b342b16a5ecea5290aee32aaa77 (patch) | |
tree | a23f39a5212bfe4dc04a01a13d840c25294ac09b /platform | |
parent | b3546ccc48081bd2215288d14741c9ef794a8654 (diff) | |
download | qtlocation-mapboxgl-2c7d0567fa7a2b342b16a5ecea5290aee32aaa77.tar.gz |
Privatized MGLMapboxEvents
`-pauseMetricsCollection` and `-resumeMetricsCollection` were originally introduced to mitigate concerns around battery usage, but `MGLMapboxEvents` has since evolved to tread much lighter on the battery. There’s no longer any need for the client to call these methods directly. The iOS test project now includes MGLMapboxEvents.h explicitly to avoid having to package a header that will go unused.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLAccountManager.m | 2 | ||||
-rw-r--r-- | platform/ios/MGLMapView.mm | 9 | ||||
-rw-r--r-- | platform/ios/MGLMapboxEvents.h | 62 | ||||
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 2 | ||||
-rw-r--r-- | platform/ios/MGLMapboxEvents_Private.h | 7 |
5 files changed, 67 insertions, 15 deletions
diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index 2e3c0a38e4..a49433777d 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -1,7 +1,7 @@ #import <Foundation/Foundation.h> #import "MGLAccountManager.h" -#import "MGLMapboxEvents_Private.h" +#import "MGLMapboxEvents.h" #import "NSProcessInfo+MGLAdditions.h" @interface MGLAccountManager() diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index dfbb034398..72a2ed0d62 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -15,22 +15,19 @@ #include <mbgl/util/geo.hpp> #include <mbgl/util/constants.hpp> -#import "MGLTypes.h" +#import "MapboxGL.h" + #import "NSBundle+MGLAdditions.h" #import "NSString+MGLAdditions.h" #import "NSProcessInfo+MGLAdditions.h" #import "NSException+MGLAdditions.h" -#import "MGLAccountManager.h" -#import "MGLAnnotation.h" #import "MGLUserLocationAnnotationView.h" #import "MGLUserLocation_Private.h" #import "MGLFileCache.h" +#import "MGLMapboxEvents.h" #import "SMCalloutView.h" -#import "MGLMapboxEvents.h" -#import "MapboxGL.h" - #import <algorithm> class MBGLView; diff --git a/platform/ios/MGLMapboxEvents.h b/platform/ios/MGLMapboxEvents.h new file mode 100644 index 0000000000..94aa8be783 --- /dev/null +++ b/platform/ios/MGLMapboxEvents.h @@ -0,0 +1,62 @@ +#import <Foundation/Foundation.h> + +extern NSString *const MGLEventTypeMapLoad; +extern NSString *const MGLEventTypeMapTap; +extern NSString *const MGLEventTypeMapDragEnd; +extern NSString *const MGLEventTypeLocation; +extern NSString *const MGLEventTypeVisit; + +extern NSString *const MGLEventKeyLatitude; +extern NSString *const MGLEventKeyLongitude; +extern NSString *const MGLEventKeyZoomLevel; +extern NSString *const MGLEventKeySpeed; +extern NSString *const MGLEventKeyCourse; +extern NSString *const MGLEventKeyAltitude; +extern NSString *const MGLEventKeyHorizontalAccuracy; +extern NSString *const MGLEventKeyVerticalAccuracy; +extern NSString *const MGLEventKeyPushEnabled; +extern NSString *const MGLEventKeyEmailEnabled; +extern NSString *const MGLEventKeyGestureID; +extern NSString *const MGLEventKeyArrivalDate; +extern NSString *const MGLEventKeyDepartureDate; + +extern NSString *const MGLEventGestureSingleTap; +extern NSString *const MGLEventGestureDoubleTap; +extern NSString *const MGLEventGestureTwoFingerSingleTap; +extern NSString *const MGLEventGestureQuickZoom; +extern NSString *const MGLEventGesturePanStart; +extern NSString *const MGLEventGesturePinchStart; +extern NSString *const MGLEventGestureRotateStart; + +@interface MGLMapboxEvents : NSObject <NSURLSessionDelegate> + ++ (instancetype)sharedManager; + +// You must call these methods from the main thread. +// ++ (void) pauseMetricsCollection; ++ (void) resumeMetricsCollection; + +// You can call this method from any thread. Significant work will +// be dispatched to a low-priority background queue and all +// resulting calls are guaranteed threadsafe. +// +// Events or attributes passed could be accessed on non-main threads, +// so you must not reference UI elements from within any arguments. +// Copy any values needed first or create dedicated methods in this +// class for threadsafe access to UIKit classes. +// ++ (void) pushEvent:(NSString *)event withAttributes:(NSDictionary *)attributeDictionary; + +// You can call these methods from any thread. +// ++ (BOOL) checkPushEnabled; + +// You can call this method from any thread. +// ++ (void) flush; + +// Main thread only ++ (void)validate; + +@end diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 2b9d887777..5663e3f1c0 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -1,4 +1,4 @@ -#import "MGLMapboxEvents_Private.h" +#import "MGLMapboxEvents.h" #import <UIKit/UIKit.h> #import <SystemConfiguration/CaptiveNetwork.h> diff --git a/platform/ios/MGLMapboxEvents_Private.h b/platform/ios/MGLMapboxEvents_Private.h deleted file mode 100644 index 6a48b31f04..0000000000 --- a/platform/ios/MGLMapboxEvents_Private.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "MGLMapboxEvents.h" - -@interface MGLMapboxEvents (Private) - -+ (instancetype)sharedManager; - -@end |