-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos]Remove iOS/macOS codes from native codes #16031
Conversation
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.
I'm going to summarize our hangout conversation into the following changes:
- @tmpsantos could you please advice how can we use the new build system to build this library?
- Move
MGLNativeInterfaceReceiver.h/m
from ios/macos to platform/darwin and import this file into each project. - Rename
MGLNativeInterfaceReceiver
to:MGLNetworkIntegrationManager
- Rename
MGLNativeAppleInterfaceTransmitter
to:MGLNativeNetworkDelegate
- Once this PR lands CP the changes related to the platform code to
gl-native-ios
Just update the list of files here: next/platform/macos/macos.cmake |
@@ -88,29 +83,29 @@ void cancel() { | |||
public: | |||
Impl() { | |||
@autoreleasepool { | |||
NSURLSessionConfiguration *sessionConfig = [MGLNetworkConfiguration sharedManager].sessionConfiguration; | |||
NSURLSessionConfiguration *sessionConfig = MGLNativeAppleInterfaceTransmitter.shared.sessionConfiguration; |
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.
Longer-term, I would prefer to avoid having & going via a singleton here. @tmpsantos is there an existing core object that we could set a property on?
Perhaps using a notification (& object) to request the client sets a weak delegate here?
This comment is general, and shouldn't block the PR.
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.
Not at the moment. But if we move at some point this abstraction to not be at the "request" level and rather at the "network manager" level it will probably solve the problem, because session becomes a property of the "network manager".
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
@tmpsantos Could help to show how can I use this new build system to avoid generating |
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.
This is looking good. Please address the comments I left. The test is not passing because the test target is not setting the delegate and returns a nil NSURLSessionConfiguration
.
@@ -88,6 +88,8 @@ target_sources( | |||
${MBGL_ROOT}/platform/darwin/src/run_loop.cpp | |||
${MBGL_ROOT}/platform/darwin/src/string_nsstring.mm | |||
${MBGL_ROOT}/platform/darwin/src/timer.cpp | |||
${MBGL_ROOT}/platform/darwin/src/native_apple_interface.m |
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?
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
platform/darwin/include/mbgl/interface/native_apple_interface.h
Outdated
Show resolved
Hide resolved
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.
Thank you for making these changes. The next step is bring the darwing changes into gl-native-ios
.
/cc @julianrex
* add source/header * add ios files * add configs * modify name * http_file_source * add interface delegate when map init * fix name * fix delegate name * support mac os * add mac os support * make optional delegate when mac os * mac/ios difference * add ios change log * cancel iOS/mac OS judgement * cancel iOS/mac OS judgement * cancel judgement in .m * update * update * update http_file_source * update ios * update mac os * add mac os file * add mac os file to `.cmake` * change names * add log & fix format * reset changelog commit * update changelog * rename iOS network manager * Add a test configuration(same as default configuration) when mac os run tests * re-add account type into `http_file_source` * refactor
Refactor of
http_file_source.mm
, using a delegate & interface to separate platform codes(macOS, iOS) from native codes, to reach our goal of modular SDK.