-
Notifications
You must be signed in to change notification settings - Fork 164
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
Nativescript 7.x compatibility #420
Conversation
- tns-core-modules is not required anymore, use @nativescript/core instead - removed tns-core-modules typings (deprecated) - momentarily added skipLibCheck: true - version bump (beta) - plugin build OK
- references.d.ts should use the new module - fixed tsc compile errors without using @nativescript/core types
Some updates: unfortunately I'm not in touch yet with NS team, new commits are including the fix for the problem reported in the last message. |
- WeakRef import not needed anymore with @nativescript/types global def
Problem fixed! Successfully loaded the map in a nativescript v6 application! (tested on android only) |
I had an issue with markers not showing on the map. Apparently this is happening because the nativeView is cleared after initialization (disposeNativeView() method is called in the wrong moment?). By looking at nativescript/core view management, seems that some changes have been introduced in the view lifecycle, so this needs to fixed before closing the PR! In fact I started this migration due to this problem, people using the last released version will not see markers if they update to {N}6 |
- parseMultipleTemplates,parse are deprecated
- installed eslint with typescript-eslint - basic configuration - ignored files & folders - new lint scripts
uses git hooks to avoid committing code with linting errors
Sadly I can't show the markers even with this PR. |
@flocca this PR is not fixing the marker problem actually, it was more a generic update of dependencies and so on. I thought that they were not showing due to the plugin dependencies not being up to date. In fact the source of the problem is in the code (nativescript is handling the view life-cycle differently, so the plugin is getting null instead of the map-view reference: it cannot load the markers). Cheers, |
- avoiding to call GC on map elements (read in-code comment) - imports condensed where possible - fixed file with tslint recommendations
- optimized imports - fixed files with tslint recommendations - code formatting
- imports optimized - ImageSource.fromResourceSync in place of imageSource.fromResource(deprecated) - code formatting
follow the ns@7 update guidlines: - update npm packages - update ns plaforms to v7 (android & ios) - add ts-node patcher and plugin config in tsconfig.json - update tsconfig module config - add ns global-types.d.ts support - add @nativeclass() decorator where needed - update prepare.js script version check Ref #422
@flocca I've just pushed the fix, it includes nativescript@7 support, plus other stuff, now I'm closing so I didn't have time to test it in a project, btw the fix is well documented in Tomorrow I'll do a full test to check if everything is working properly. Cheers ;) |
- generate a new project with `ns create...` - merge the existing project with the new one
The stable version of this plugin is loading up or it's giving you the same exception? |
@funder7 I've just created a new ns-vue blank project here: https://github.com/liamcharmer/nativescript-vue-plain-google-map-test NPM Version 6.14.7 |
Ok mate, I will try to check it this weekend! Thanks for the project |
Another user reported that the MapView is not loading at all in this comment. |
Don't feel rushed or anything, you're honestly doing such amazing stuff and saving so many people. But keep good health! |
Hi guys, I am also seeing the
After a couple of hours of poking around I've finally got the app to build and the map to load without any warnings or crashes. These changes may have broken other things - I haven't had chance to test much of map functionality yet. Hopefully this might help somebody get up and running...
I modified the
Change this line: To this:
I just removed this import from
Added an export of
To build the plugin:
To install the plugin:
|
Working for me too, thanks! |
Just create a tgz (just download the file and remove .zip ;) ) for easier usage: |
Hey @hypery2k nice work! Regarding the pack.sh script....it creates a copy of the "src" directory, which if I don't remember bad is the "TO_SRC_DIR", then it does some operations on that folder, and finally it gets packed. You can see what happens by commenting out the lines where the new directories are removed! Cheers ;-) |
Hello guys, I agree with you @MrSnoozles, before merging demo projects must be updated & tested, in order to provide to new users a good starting point. Unfortunately I'm really busy in these days and it's hard to find a moment to finish the upgrade. |
I've been working on this (along with others of course) and will do everything I can. At the moment apart from the demos, there seems to be issues with all events on IOS apart from mapReady. Ive seen at least one other commenting similar. I can run extensive tests on IOS both physical and via simulators and Im not seeing anything other than mapReady firing. I'm thinking the new @nativeclass requirement is the issue. |
@funder7 I have can do the job .. can you do a briefing about the status of jobs ? |
Hi guys, thanks for your interest. @NativeClass()
class IndoorDisplayDelegateImpl extends NSObject implements GMSIndoorDisplayDelegate { Would that be sufficient? I don't know, but I hope so. I just looked at some code that I've commited in the past months and it seems that decorators are already in place. But speaking with another plugin user, he told me about a memory leak problem that he noticed. When unloading the view which contains the map, memory is not freed. So if you continue to do back and forth from the map view, a new instance is created every time, but not deleted once you leave. You can try to do a debug session and check that in the iOS part, all references are populated correctly, it's very likely that something is not initialized and is @kefahB demo projects are carried with the plugin to provide a minimal working configuration for each NS flavour (Angular, Vue.js, Vanilla JS, etc.. ). So there are some changes to be done:
Generally speaking that's what's missing, solving iOS issues and checking the mapView lifecycle on both platforms is a top priority task though, maybe let's focus on that before completing the rest. We can organize a day where we "meet" and try to fix all this problem, to close this update. Let me know what do you think about it, generally I'm free on saturday or sunday (doh) Cheers guys |
Thanks for the comprehensive post @funder7
I think/hope so too. I've seen the decorator in some places but not others I might have expected them to be. I have to push an App Store update this evening with partial fixes in a client app, but once that is out I can turn back to this. |
@funder7 It will be great if you push your changes to your fork, then I will continue from there |
@rljdavies no problem, we can also arrange this for the next weekend @kefahB Ok I'll push the changes in a separate branch, as more than a month passed and now I don't remember if what I was doing was kind of a test, or definitive code. They're more than 200 files :( I'll post the branch name once everything is pushed |
Ok... so I pushed my changes to If you want, we can meet next saturday afternoon and try to finish this update. Let me know if you're available. Cheers |
@funder7 I've forked the original project .. and successful running on IOS, there is only one issue, infoWindowTemplates dose not work! I’ll keep this for the moment try with android then we will see |
Nice! So #422 happens on android only, or recent ns updates have solved the problem. The current version has a typo in the class where map styling json is parsed, in case you need that function give it a check. If you can, keep an eye on memory usage, in particular I'd like to know if memory is freed once the map view is unloaded. It's kinda weird though that it works with the old configuration, but not after linking new nativescript libraries. I will try to compare the transpiled output of both version just to understand what differs. Thanks for reporting! |
I run the project on both platforms successfully without problem .. I'll try to debug the memory for android... Also I have implemented |
I found a reply from TSC to a question you asked a little while back @funder7 - confirming NativeClass decorator is not needed in the typings files. So here's what I did...
After I did the above I was able to run my project including with map events (eg MapMarkerSelected) firing on IOS. So, I copied the typings files in the plugin's platforms/ios folder to the @nativescript/types-ios/lib/ios/objc-x86_64 folder and added references to them in @nativescript/types-ios/lib/ios/ios.d.ts and everything I'm using plugin wise now appears to be working (although one issue with preparing a release build remains) Therefore, there does seem to be an issue with references but this point I'm unsure if this is specific to this plugin or something more general with NS7. Its worth pointing out not all of the plugins in the project are NS7 but in those cases they are minor plugins with limited function. Hopefully this info moves us on a little. |
Hi @funder7 , I've pushed a new PR .. I tested on multiples device and it work "properly" but the |
Nice work guys! I'm sorry about not being able to contribute, but I'm very busy. I think that creating a native app on the respective platform, including Google Maps (the same version used by this plugin) would highlight any kind of problem related to component initialization & configuration. Also I don't know if it's possible to debug the full application, from the Java/Objective-C layer to the Javascript code. That probably must be done by doing one layer at time. But probably this is the last resort. @rljdavies Thanks for the info about decorators and typings. Btw the map is visible and can be panned, so in order to troubleshoot the problem related to camera changed event, I would split the investigation like this (always if anybody has the time to do it!):
There's another point regarding the infoWindowTemplate mentioned by @kefahB thay may benefit from a check-up on the view rendering & link between the layers. Debugging here can be really helpful, by placing a breakpoint where the infoWindowTemplate is fired it would be possible to see if everything that it needs to show up is in place. At least this is how I've fixed the markers problem. Markers were not showing because with NS7, some plugin code was running in the wrong moment. It was code used to avoid memory leaks I think, and it was called originally on view destroy. With NS7 that was called during the view initialization, and if my memory works, it was called twice during the navigation from a view to another one. Long speech here :-) ... btw to sum up, a full debugging in every step of the plugin's view lifecycle, would help to understand what happening. If we only could know what changed into the "magic black box"....... :-D |
Hi,
this PR updates the plugin by following the guidelines reported in this blog post, fixes the #422 issue (markers not showing), plus some other minor code improvements.
Cheers