hansemannn / titanium-googlemaps

๐Ÿ—บ Use the Google Maps SDK in Titanium
Other
87 stars 26 forks source link

Support Renderer-API, support Indoor-Navigation API #99

Closed hansemannn closed 7 years ago

hansemannn commented 7 years ago
hansemannn commented 7 years ago

@yozef wanna review? ๐Ÿ‘€ ๐Ÿ˜ƒ

yozef commented 7 years ago

Sure :)

yozef commented 7 years ago

Having crashes when I use:

// Testing 3.8.0
$.mapview.indoorPicker = true;
$.mapview.indoorEnabled = true;

$.mapview.indoorDisplay.addEventListener('didChangeActiveBuilding', function(e) {
    Ti.API.info('didChangeActiveBuilding ' + JSON.stringify(e));
});
$.mapview.indoorDisplay.addEventListener('didChangeActiveLevel', function(e) {
    Ti.API.info('didChangeActiveLevel ' + JSON.stringify(e));
});

When I zoom into an area where I know has indoor location, zooming in enough just when the events are about to fire, I get this uncaught exception:

[ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  -[TiGooglemapsIndoorLevelProxy copyWithZone:]: unrecognized selector sent to instance 0x7fb34c755a80
[ERROR] :  Stack trace: ...
yozef commented 7 years ago

Testing out the KML renderer:

// Render KML
var renderer = $.mapview.createRenderer({
    file: 'KML_Samples.kml',  // added this .kml into assets/
    mapView: $.mapview
});
renderer.render();

I get this error: [ERROR] : message = "undefined is not a function (evaluating '$.mapview.createRenderer({\n file: \"KML_Samples.kml\",\n mapView: $.mapview\n })')";

It seems that this might be on my end? maybe wrong API implementation (I used the same code syntax from the readme).

Using this KML: https://developers.google.com/kml/documentation/KML_Samples.kml

hansemannn commented 7 years ago

Re indoor-picker: The floor name / floor short-name can be null, I added the guards now. Re renderer: The renderer is created from the module-instance, not the map-view instance. It shouldn't crash then.

yozef commented 7 years ago

Re-tested indoor events with the new committed code (got the same result as before): Crashes when I use:

// Testing 3.8.0
$.mapview.indoorPicker = true;
$.mapview.indoorEnabled = true;

$.mapview.indoorDisplay.addEventListener('didChangeActiveBuilding', function(e) {
    Ti.API.info('didChangeActiveBuilding ' + JSON.stringify(e));
});
$.mapview.indoorDisplay.addEventListener('didChangeActiveLevel', function(e) {
    Ti.API.info('didChangeActiveLevel ' + JSON.stringify(e));
});

When I zoom into an area where I know has indoor location, zooming in enough just when the events are about to fire, I get this uncaught exception:

[ERROR] :  The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] :  Reason:
[ERROR] :  -[TiGooglemapsIndoorLevelProxy copyWithZone:]: unrecognized selector sent to instance 0x7faf3c4ca540
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x000000010b450af3 __exceptionPreprocess + 147
[ERROR] :  1   libobjc.A.dylib                     0x0000000105f0e141 objc_exception_throw + 48
[ERROR] :  2   CoreFoundation                      0x000000010b4c0134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
[ERROR] :  3   CoreFoundation                      0x000000010b3d7840 ___forwarding___ + 1024
[ERROR] :  4   CoreFoundation                      0x000000010b3d73b8 _CF_forwarding_prep_0 + 120
[ERROR] :  5   MyApp                              0x00000001034801f0 TiBindingEventCreateWithNSObjects + 144
[ERROR] :  6   MyApp                              0x00000001032f9358 -[TiProxy fireEvent:withObject:propagate:reportSuccess:errorCode:message:] + 120
[ERROR] :  7   MyApp                              0x00000001032f8fdb -[TiProxy fireEvent:withObject:] + 139
[ERROR] :  8   MyApp                              0x0000000103ae760e -[TiGooglemapsIndoorDisplayProxy didChangeActiveLevel:] + 152
[ERROR] :  9   CoreFoundation                      0x000000010b3d8c6c __invoking___ + 140
[ERROR] :  10  CoreFoundation                      0x000000010b3d8b40 -[NSInvocation invoke] + 320
[ERROR] :  11  CoreFoundation                      0x000000010b3f0956 -[NSInvocation invokeWithTarget:] + 54
[ERROR] :  12  MyApp                              0x000000010354b6ce -[GMSDelegateForward forwardInvocation:] + 102
[ERROR] :  13  CoreFoundation                      0x000000010b3d7656 ___forwarding___ + 534
[ERROR] :  14  CoreFoundation                      0x000000010b3d73b8 _CF_forwarding_prep_0 + 120
[ERROR] :  15  MyApp                              0x000000010354bd6c -[GMSIndoorDisplay updateFocusedBuilding:activeLevel:indoorState:] + 259
[ERROR] :  16  MyApp                              0x00000001034bd0fc -[GMSMapView vectorMapView:didUpdateFocusedBuilding:fromBuilding:activeLevel:] + 127
[ERROR] :  17  MyApp                              0x000000010362fa7e -[GMSVectorMapView didUpdateFocusedBuilding:fromBuilding:activeLevel:] + 124
[ERROR] :  18  MyApp                              0x000000010369bed1 __44-[GMSIndoorFocusManager setFocusedBuilding:]_block_invoke + 57
[ERROR] :  19  libdispatch.dylib                   0x000000010cffb585 _dispatch_call_block_and_release + 12
[ERROR] :  20  libdispatch.dylib                   0x000000010d01c792 _dispatch_client_callout + 8
[ERROR] :  21  libdispatch.dylib                   0x000000010d004247 _dispatch_main_queue_callback_4CF + 1041
[ERROR] :  22  CoreFoundation                      0x000000010b415909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
[ERROR] :  23  CoreFoundation                      0x000000010b3dbae4 __CFRunLoopRun + 2164
[ERROR] :  24  CoreFoundation                      0x000000010b3db016 CFRunLoopRunSpecific + 406
[ERROR] :  25  GraphicsServices                    0x000000010e4baa24 GSEventRunModal + 62
[ERROR] :  26  UIKit                               0x0000000107f1b134 UIApplicationMain + 159
[ERROR] :  27  MyApp                              0x0000000103213fc4 main + 100
[ERROR] :  28  libdyld.dylib                       0x000000010d06565d start + 1
[ERROR] :  29  ???                                 0x0000000000000001 0x0 + 1
-- End simulator log ---------------------------------------------------------

You can check at SFO airport Terminal 2: 37.617174, -122.383633 zoom in enough I got the results above.

yozef commented 7 years ago

KML renderer worked :) I figured my code was the culprit before.

2017-07-16 at 10 09 39 am 2017-07-16 at 10 20 10 am
mcongrove commented 7 years ago

KML renderer definitely works; quite well, too! Thanks Hans.

mcongrove commented 7 years ago

The mapStyle no longer functions as it did before (tried passing JSON string, as well as new file location option). Get the following error: Could not apply map style: The data couldn't be read because it isn't in the correct format. Worked prior to this PR.

Sample styling JSON attached, generated from Google's style generator.

map_style.json.txt

yozef commented 7 years ago

@mcongrove hmmm style json is working for me. Not sure it's visible, but the KML snapshots posted have a json style rendered.

mcongrove commented 7 years ago

@yozef Strange. I went back to before 06e3d4d and my style JSON works. Any newer commit and it breaks for me. Sanity check me by trying my JSON file?

yozef commented 7 years ago

@mcongrove this requires a different issue to be opened, as the indoor events are still buggy.

For the mapStyle:

var mapJSONStyle = [ { "elementType": "geometry", "stylers": [ { "color": "#ebe3cd" } ] } ..... ]; // Array Obj
$.mapview.mapStyle = JSON.stringify(mapJSONStyle);
hansemannn commented 7 years ago

@mcongrove I changed the mapStyle to detect both JSON-strings and file-references. If it's a JSON-file, it needs to end with ".json", if it's any other string, it will be passed to the module.

mcongrove commented 7 years ago

@hansemannn It does end in ".json"; GitHub just doesn't allow that file extension for uploads, so I used ".txt". Sorry, should've clarified that.

hansemannn commented 7 years ago

Can you try the latest commit? I forgot commiting yesterday :-)

mcongrove commented 7 years ago

I'm confused. Looks like the only changes since the last version I tested is to the README. What are you wanting me to re-test?

hansemannn commented 7 years ago

@mcongrove Dump issue, fixed it.

hansemannn commented 7 years ago

@yozef Working on the indoor-level issue, it's related to the GoogleMaps SDK not being thread-safe again :(

hansemannn commented 7 years ago

I've created a ticket at Google for this, since I'm kind of running out of ideas here, what the SDK could do wrong. Maybe we exclude that event for now and mark it as a future support? Would be bad to block all the other features here because of that one.

hansemannn commented 7 years ago

Fixed it.....Let's get this in @yozef ๐Ÿ˜…

yozef commented 7 years ago

Hey Hans,

I'm actually on vacation. No computer around :-/ On Wed, Jul 26, 2017 at 17:30 Hans Knรถchel notifications@github.com wrote:

Fixed it.....Let's get this in @yozef https://github.com/yozef ๐Ÿ˜…

โ€” You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/hansemannn/titanium-google-maps/pull/99#issuecomment-318070709, or mute the thread https://github.com/notifications/unsubscribe-auth/AARiGA49_fqV5mPgQiZ57m6NG7kQrPVeks5sR015gaJpZM4OXWfW .