Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23492] Windows: Parity issue with Ti.Geolocation.reverseGeocoder callback response

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-06-30T01:08:59.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsparity
ReporterChristopher Williams
AssigneeGary Mathews
Created2016-06-10T17:30:03.000+0000
Updated2016-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);
			}
		});
	});

Comments

  1. Gary Mathews 2016-06-25

    *TEST*
       Ti.Geolocation.reverseGeocoder(37.3883645, -122.0512682, function (response) {
           Ti.API.info(JSON.stringify(response, null, ' '));
       });
       
    *RESPONSE*
       {
        "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
         }
        ]
       }
       
    That seems correct? Although the docs say string for longitude and latitude I think that is an error, since the server returns numeric values and reverseGeocoder accepts numeric values for its parameters.
  2. Gary Mathews 2016-06-26

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/751
  3. Ewan Harris 2016-08-29

    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

JSON Source