From: taekeun.kang Date: Thu, 9 Jul 2015 04:43:17 +0000 (+0900) Subject: [Content] Remove the codes checking if latitude and longitude are zero and Add the... X-Git-Tag: submit/tizen_tv/20150720.124123^2^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66af6033a4faca105b235d506508f01161d9732d;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Content] Remove the codes checking if latitude and longitude are zero and Add the code checking if geolocation is null when it is updated Change-Id: If31ed04db65d5b30714514afa23adb5d6ebf6660 Signed-off-by: taekeun.kang --- diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc index 594fe5d7..072d0488 100755 --- a/src/content/content_manager.cc +++ b/src/content/content_manager.cc @@ -408,15 +408,20 @@ static int setContent(media_info_h media, const picojson::value& content) { if (type == MEDIA_CONTENT_TYPE_IMAGE || type == MEDIA_CONTENT_TYPE_VIDEO) { picojson::value geo = content.get("geolocation"); - double latitude = atof(geo.get("latitude").to_str().c_str()); - double longitude = atof(geo.get("longitude").to_str().c_str()); - ret = media_info_set_latitude(media, latitude); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - LoggerE("Updating geolocation is failed."); - } - ret = media_info_set_longitude(media, longitude); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - LoggerD("Updating geolocation is failed."); + if (geo.evaluate_as_boolean()) { + LoggerD("geolocation is not null"); + double latitude = atof(geo.get("latitude").to_str().c_str()); + double longitude = atof(geo.get("longitude").to_str().c_str()); + ret = media_info_set_latitude(media, latitude); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + LoggerE("Updating geolocation is failed."); + } + ret = media_info_set_longitude(media, longitude); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + LoggerD("Updating geolocation is failed."); + } + } else { + LoggerD("geolocation is null"); } } diff --git a/src/content/js/datatypes.js b/src/content/js/datatypes.js index e04df4d2..a4e52655 100755 --- a/src/content/js/datatypes.js +++ b/src/content/js/datatypes.js @@ -322,7 +322,7 @@ function VideoContent(data) { return geolocation; }, set: function(v) { - if (!type_.isNull(v) && v.latitude && v.longitude) { + if (!type_.isNull(v)) { var latitude = converter_.toDouble(v.latitude, false); var longitude = converter_.toDouble(v.longitude, false); geolocation = new tizen.SimpleCoordinates(latitude, longitude); @@ -629,7 +629,7 @@ function ImageContent(data) { return geolocation; }, set: function(v) { - if (!type_.isNull(v) && v.latitude && v.longitude) { + if (!type_.isNull(v)) { var latitude = converter_.toDouble(v.latitude, false); var longitude = converter_.toDouble(v.longitude, false); geolocation = new tizen.SimpleCoordinates(latitude, longitude);