This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos]Remove iOS/macOS codes from native codes #16031
Merged
Merged
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
3d91301
add source/header
m-stephen 32b55c1
add ios files
m-stephen 99f0738
add configs
m-stephen bc3fb0b
modify name
m-stephen ca72384
http_file_source
m-stephen c09c622
add interface delegate when map init
m-stephen 810cefd
fix name
m-stephen 37d88fe
fix delegate name
m-stephen f9dfa38
support mac os
m-stephen 65e7c29
add mac os support
m-stephen dfa567e
make optional delegate when mac os
m-stephen c1301ec
mac/ios difference
m-stephen ecf76fe
add ios change log
m-stephen 5cd5aff
cancel iOS/mac OS judgement
m-stephen f0df7ba
cancel iOS/mac OS judgement
m-stephen 357c8f7
cancel judgement in .m
m-stephen 1c4c436
update
m-stephen 29397ff
update
m-stephen a72e651
update http_file_source
m-stephen f72d5f5
update ios
m-stephen 0f07dd3
update mac os
m-stephen 82cf430
add mac os file
m-stephen 0a5e2d1
add mac os file to `.cmake`
m-stephen 6aeb46c
change names
m-stephen 17d3e53
add log & fix format
m-stephen 2b79561
reset changelog commit
m-stephen d5c9171
update changelog
m-stephen 2c5415d
rename iOS network manager
m-stephen 3afd98b
Add a test configuration(same as default configuration) when mac os r…
m-stephen 84af097
re-add account type into `http_file_source`
m-stephen aabc7e9
refactor
m-stephen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
platform/darwin/include/mbgl/interface/native_apple_interface.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@protocol MGLNativeAppleInterfaceDelegate <NSObject> | ||
m-stephen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@optional | ||
|
||
- (NSString *)skuToken; | ||
- (NSString *)accountTypeKey; | ||
|
||
@required | ||
|
||
- (NSURLSessionConfiguration *)sessionConfiguration; | ||
|
||
- (void)startDownloadEvent:(NSString *)event type:(NSString *)type; | ||
|
||
- (void)cancelDownloadEventForResponse:(NSURLResponse *)response; | ||
|
||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response; | ||
|
||
@end | ||
|
||
#define MGL_APPLE_EXPORT __attribute__((visibility ("default"))) | ||
|
||
@interface MGLNativeNetworkDelegate: NSObject | ||
m-stephen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
+ (MGLNativeNetworkDelegate *)shared; | ||
m-stephen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@property (nonatomic, weak) id<MGLNativeAppleInterfaceDelegate> delegate; | ||
|
||
@property (nonatomic, readonly) NSString *accountTypeKey; | ||
@property (nonatomic, readonly) NSString *skuToken; | ||
|
||
@property (nonatomic, readonly) NSURLSessionConfiguration *sessionConfiguration; | ||
|
||
- (void)startDownloadEvent:(NSString *)event type:(NSString *)type; | ||
|
||
- (void)cancelDownloadEventForResponse:(NSURLResponse *)response; | ||
|
||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response; | ||
|
||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import <Foundation/Foundation.h> | ||
#include <mbgl/interface/native_apple_interface.h> | ||
|
||
@interface MGLNetworkIntegrationManager : NSObject <MGLNativeAppleInterfaceDelegate> | ||
|
||
+ (MGLNetworkIntegrationManager *)shared; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#import "MGLNetworkIntegrationManager.h" | ||
|
||
#import "MGLLoggingConfiguration_Private.h" | ||
#import "MGLNetworkConfiguration_Private.h" | ||
|
||
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR | ||
#import "MGLAccountManager_Private.h" | ||
#endif | ||
|
||
@implementation MGLNetworkIntegrationManager | ||
|
||
static MGLNetworkIntegrationManager *instance = nil; | ||
|
||
+ (MGLNetworkIntegrationManager *)shared { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
instance = [[MGLNetworkIntegrationManager alloc] init]; | ||
}); | ||
return instance; | ||
} | ||
|
||
#pragma mark - MGLNativeAppleInterfaceManager delegate - | ||
|
||
- (NSURLSessionConfiguration *)sessionConfiguration { | ||
return [MGLNetworkConfiguration sharedManager].sessionConfiguration; | ||
} | ||
|
||
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR | ||
- (NSString *)accountTypeKey { | ||
m-stephen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return MGLMapboxAccountTypeKey; | ||
} | ||
|
||
- (NSString *)skuToken { | ||
return MGLAccountManager.skuToken; | ||
} | ||
#endif | ||
|
||
- (void)startDownloadEvent:(NSString *)event type:(NSString *)type { | ||
[[MGLNetworkConfiguration sharedManager] startDownloadEvent:event type:@"tile"]; | ||
} | ||
|
||
- (void)cancelDownloadEventForResponse:(NSURLResponse *)response { | ||
[[MGLNetworkConfiguration sharedManager] cancelDownloadEventForResponse:response]; | ||
} | ||
|
||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response { | ||
[[MGLNetworkConfiguration sharedManager] stopDownloadEventForResponse:response]; | ||
} | ||
|
||
@end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this files to next/platform/ios/ios.cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are using two building systems on iOS & mac OS, it shouldn't be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm..it looks like this was needed after all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, looks like that. We need add all *.m files into
ios.cmake
, should we make another PR for this?