summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM.Stephen <truestyle2005@163.com>2019-12-09 23:53:09 +0800
committerM.Stephen <truestyle2005@163.com>2019-12-09 23:53:09 +0800
commit32b55c155390749c98beb922bf36a70ab2eb5c4a (patch)
treeadad176f3d33a3ca94b1cb3671e87673276a4c9f
parent3d9130150f2b8d5ae77d5fb95420bc1e78016f53 (diff)
downloadqtlocation-mapboxgl-32b55c155390749c98beb922bf36a70ab2eb5c4a.tar.gz
add ios files
-rw-r--r--platform/ios/src/MGLNativeInterfaceReceiver.h8
-rw-r--r--platform/ios/src/MGLNativeInterfaceReceiver.m48
2 files changed, 56 insertions, 0 deletions
diff --git a/platform/ios/src/MGLNativeInterfaceReceiver.h b/platform/ios/src/MGLNativeInterfaceReceiver.h
new file mode 100644
index 0000000000..367adf9f3f
--- /dev/null
+++ b/platform/ios/src/MGLNativeInterfaceReceiver.h
@@ -0,0 +1,8 @@
+#import <Foundation/Foundation.h>
+#include <mbgl/interface/native_apple_interface.h>
+
+@interface MGLNativeInterfaceReceiver : NSObject <MGLNativeAppleInterfaceDelegate>
+
++ (MGLNativeInterfaceReceiver *)shared;
+
+@end
diff --git a/platform/ios/src/MGLNativeInterfaceReceiver.m b/platform/ios/src/MGLNativeInterfaceReceiver.m
new file mode 100644
index 0000000000..e1a676d507
--- /dev/null
+++ b/platform/ios/src/MGLNativeInterfaceReceiver.m
@@ -0,0 +1,48 @@
+#import "MGLNativeInterfaceReceiver.h"
+
+#import "MGLLoggingConfiguration_Private.h"
+#import "MGLNetworkConfiguration_Private.h"
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#import "MGLAccountManager_Private.h"
+#endif
+
+@implementation MGLNativeInterfaceReceiver
+
+static MGLNativeInterfaceReceiver *instance = nil;
+
++ (MGLNativeInterfaceReceiver *)shared {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ instance = [[MGLNativeInterfaceReceiver alloc] init];
+ });
+ return instance;
+}
+
+#pragma mark - MGLNativeAppleInterfaceManager delegate -
+
+- (NSString *)nai_skuToken {
+ return MGLAccountManager.skuToken;
+}
+
+- (NSURLSessionConfiguration *)nai_sessionConfiguration {
+ return [MGLNetworkConfiguration sharedManager].sessionConfiguration;
+}
+
+- (NSString *)nai_accountType {
+ return MGLMapboxAccountTypeKey;
+}
+
+- (void)nai_startDownloadEvent:(NSString *)event type:(NSString *)type {
+ [[MGLNetworkConfiguration sharedManager] startDownloadEvent:event type:@"tile"];
+}
+
+- (void)nai_cancelDownloadEventForResponse:(NSURLResponse *)response {
+ [[MGLNetworkConfiguration sharedManager] cancelDownloadEventForResponse:response];
+}
+
+- (void)nai_stopDownloadEventForResponse:(NSURLResponse *)response {
+ [[MGLNetworkConfiguration sharedManager] stopDownloadEventForResponse:response];
+}
+
+@end