[TIMOB-23492] Windows: Parity issue with Ti.Geolocation.reverseGeocoder callback response
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-06-30T01:08:59.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.0.0 |
| Components | Windows |
| Labels | parity |
| Reporter | Christopher Williams |
| Assignee | Gary Mathews |
| Created | 2016-06-10T17:30:03.000+0000 |
| Updated | 2016-08-29T18:18:15.000+0000 |
Description
Ti.Geolocation.reverseGeocoder callback function should get a ReverseGeocoderResponse style object back: http://docs.appcelerator.com/platform/latest/#!/api/ReverseGeocodeResponse
On Windows, it appears we effectively return the equivalent of
response.places[0] as the object.
Test case:
// FIXME Windows doesn't honor the API properly! We have zipcode on the data object itself!
it('reverseGeocoder', function (finish) {
should(Ti.Geolocation.reverseGeocoder).be.a.Function;
Ti.Geolocation.reverseGeocoder(37.3883645, -122.0512682, function (data) {
try {
should(data).have.property('success').which.is.a.Boolean;
should(data).have.property('code').which.is.a.Number;
// FIXME error property is missing altogether on success for iOS...
//should(data).have.property('error'); // undefined on success, holds error message as String otherwise.
should(data).have.property('places').which.is.an.Array;
should(data.places[0].zipcode).be.eql('94043');
should(data.places[0].country).be.eql('United States of America');
should(data.places[0].state).be.eql('California');
should(data.places[0].country_code).be.eql('US');
should(data.places[0]).have.property('city').which.is.a.String;
should(data.places[0]).have.property('address').which.is.a.String;
should(data.places[0]).have.property('latitude').which.is.a.Number; // docs say String!
should(data.places[0]).have.property('longitude').which.is.a.Number; // docs say String!
finish();
} catch (err) {
finish(err);
}
});
});
*TEST*
*RESPONSE*Ti.Geolocation.reverseGeocoder(37.3883645, -122.0512682, function (response) { Ti.API.info(JSON.stringify(response, null, ' ')); });That seems correct? Although the docs say string for{ "success": true, "places": [ { "country": "United States of America", "country_code": "US", "zipcode": "94043", "city": "Mountain View", "street": "North Bernardo Avenue", "state": "California", "address": "377 North Bernardo Avenue, Mountain View, CA 94043, United States of America", "longitude": -122.051191, "latitude": 37.3882739 } ] }longitudeandlatitudeI think that is an error, since the server returns numeric values andreverseGeocoderaccepts numeric values for its parameters.master: https://github.com/appcelerator/titanium_mobile_windows/pull/751
Verified using: Windows 10 Pro Appc core: 6.0.0-31 Appc NPM: 4.2.8-5 Ti SDK: 6.0.0.v20160829005859 Lumia 520 8.1 Lumia 930 10.0 Response returned from Ti.Geolocation.reverseGeocoder is now as expected Closing ticket