-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature image marker #42
base: master
Are you sure you want to change the base?
Feature image marker #42
Conversation
Fix hide callback in iOS
@EddyVerbruggen can we get this merged? |
@EddyVerbruggen is there a chance for you to review this PR? I think @Anothar did a nice job over here! @Anothar, thanks for your awesome job over here! Just a tip from developer to developer, for further reviews, avoid to indent things even if they aren't indented as it should. It makes the reviewing much harder when the PR is not about it. I even would advice you to set back some indents and give attention to it later, probably after this merge. |
Thx @cusspvz ))
Yuh, you are right. I really tried not no change indenting, but IDE still formatted html files( |
Hi @Anothar! "The Mapbox SDK is now iOS 3.2.0 and also fixes a memory leak which add 30-50mo each time the user show/hide the map" I am having this exact issue! Can you explain how to update the IOS SDK sitting behind your fork to 3.20? Awesome fork! Custom images work great! |
Hi @lbweb !
Thanks! |
We cannot use this plugin without custom marker support. When will this be merged? What is the hold-up? |
@pke Why can't you use the fork that implements it? |
Because using a fork is always more maintenance work to keep it in sync with the origin repo. |
The reason is the same as for anyone else working on anything. And in this particular case it will clash with 2 other PR's, however if you can review it I'd be happy to hit 'merge'. Main concern usually is backward compatibility (folks upgrading should get the same behavior). |
src/android/Mapbox.java
Outdated
@@ -168,7 +183,23 @@ public void run() { | |||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(webViewWidth - left - right, webViewHeight - top - bottom); | |||
params.setMargins(left, top, right, bottom); | |||
mapView.setLayoutParams(params); | |||
|
|||
//@anothar we have to override back button or app will just close | |||
mapView.setOnKeyListener(new View.OnKeyListener() { |
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.
What has that to do with adding marker icons? Did that slip in as an error in 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.
Hi, @pke it is not error. But you are right is doesn't relate to image markers. Is fixes bug issue 26. To be more exact without this fix android plugin closes your app when you press back button on phone. I know it is not good to add this fix to this PR. But I wasn't sure when/if everything gets merged and needed this fix.
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'd go so far and say it doesn't relate to map in any way. This behaviour is top be decided in the app. And pressing the back button on Android should actually close the app. That's the default UX
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.
And pressing the back button on Android should actually close the app.
You are right that your app should decide behaviour. The problem is that you can't define behaviour from your js code without this fix! Without this fix your app always closes and you can't override it. You can't show previous screen to user and you can't override it from js withous this fix. With this fix you can set behaviour to which you want from your js code. This was the real problem for me. Because my app contains many screens and map is not the first one. And when I pressed back button it just closed. i tried to override it but without any success. Later I understood that event is invoked and processed in map view while it should be delegated to webview to decide what to do. If not to do this then js events for back button are not invoked.
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.
Sure u can. There is a Cordova backbutton event for that
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.
So, what if you redirect this "onKey" to the webview event?
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.
- Event is not delegated to parent container of mapview and webview. Thus your app doesn't force close.
- Event is delegated to webview. WebView invokes js events to backbutton. Thus all cordova handling code for backbutton works correctly.
This problem exists because mapview is not part of webview. It's separate control. It won't delegate it events to js code because it knows nothing about js. That is why we have to do it manually or if your user will press hardware backbuttom while map is focused your app will unexpectedly shutdown(unexpectedly only for cordova).
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 google maps plugin https://github.com/mapsplugin/cordova-plugin-googlemaps does seem to handle that differently, doesn't it? I see no key handling in there.
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 can't say about google maps plugin anything. I haven't tested it. Maybe it solves this problem different way.
You are not sure that problem exists?
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.
@Anothar I know those are separate Views and the others rather than webview do not know JS code. What I meant with "redirect" was to implement a cordova exec init callback on the plugin listening for "back" keys and emit the "back button" on the JS.
I see. Why is it better to implement cordova callback? It is specific only for Android with hardware backbutton. In src/android/Mapbox.java:
@Anothar I know those are separate Views and the others rather than webview do not know JS code. What I meant with "redirect" was to implement a cordova exec init callback on the plugin listening for "back" keys and emit the "back button" on the JS. —You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. |
It's better because Cordova stays in control of the back button that way. And by that the developer. |
@Anothar One brief example, imagine that I have an app with Considering your example, it would do nothing. The desired behaviour would be a On this I have the same opinion as @pke , the best would be to inject a KeyPress event on the WebView using a EDIT: @pke talked about If you need any help from me to implement it, I could study a little bit an help you. :) |
Thx @cusspvz :) I'll do it myself on the weekend. And write here when it is done.
It is specific Cordova event for back button press. |
@Anothar any updates on this? I would love to see this landed. |
@Anothar, I'm now a collaborator, and I would like to see this merged for the next minor release. Is there a chance for us to divide the work you did on this branch on different PRs? I'm sorry for asking you to do it, I understand why you've opted out to increase your branch with fixes, but as I'm using it on a project, I would love to merge all of them. 👍 You should see some conflicting as I've already merged some commits of this PR:
Thanks! :) |
@Brandl, I've already merged TS support on #64. Please expect it to be on the next minor release. |
…pbox into features_image_marker
Hi @cusspvz . I've implemented backbutton callback. If you can-please resolve conflicts. I'm a little bit frustrated with github merge interface. Hope this branch can be merged. |
Hi @Anothar ! Awesome!!
Well, I don't use it neither, I'm used to the cli for the rebasing process. Inspite, if you want to learn how to do manual rebases and pick/unpick commits, I can opt out for guiding you instead. 😄 |
Hi @cusspvz
I'll remember and ask for your guiding one day (place for some serious smile). |
I was thinking the same about the smile, too fancy, mine was serious as well. :)
In this case, the best option is a pick/unpick rebase scenario, I've got your branch backed up and I will tear down it entirely per feature/effect. This will make the review and landing easier than having a huge PR discussion with multiple things. I've added another PR (#67), concerning the back button handling (just changed a little bit the design, I've explained why, but I think it should land before the next minor release as well) I'm excited with this getting closer to be merged. Really think it is a "must have"! :) |
Forget the building result, it isn't configured yet. It was activated yesterday but i didn't landing the config yet. It fails because it is applying the default building pipeline which is a ruby build scenario. |
Already forgot)
Great! This really simplifies review) |
Hi @cusspvz , @dagatsoin , @EddyVerbruggen please give me rights to merge this. I want to recheck and test everything and merge. This actually stops me from further collaborating into this project. |
#41
Added advanced marker image support.
Basic usage:
image:"www/your-image.png"
Code supports raster formats (.png, .jpg) and vector (svg only - via 3-d party libraries).
Advanced usage: