From: Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics
Date: Tue, 27 Feb 2024 10:35:28 +0000 (+0100)
Subject: [Content] Add deprecation to some not frequently used members
X-Git-Tag: accepted/tizen/unified/20240308.174302^0
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ed80ebece2175f5717cab64957ce94efad6060f;hp=fa387ce65e9bae28190480f740610f0d1656737d;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Content] Add deprecation to some not frequently used members
[ACR] https://jira.sec.samsung.net/browse/TWDAPI-294
[Verification] Code compiles without errors.
Change-Id: I91ebbeb53a70d27fb46e7cd19ce60f36ee2d352d
---
diff --git a/src/content/content_filter.cc b/src/content/content_filter.cc
index 4d3bfb9..e17ce5b 100644
--- a/src/content/content_filter.cc
+++ b/src/content/content_filter.cc
@@ -46,9 +46,12 @@ std::map const attributeNameMap = {
{"createdDate", "MEDIA_ADDED_TIME"},
{"releaseDate", "MEDIA_DATETAKEN"},
{"modifiedDate", "MEDIA_MODIFIED_TIME"},
- {"geolocation.latitude", "MEDIA_LATITUDE"},
- {"geolocation.longitude", "MEDIA_LONGITUDE"},
- {"duration", "MEDIA_DURATION"},
+ {"geolocation.latitude",
+ "MEDIA_LATITUDE"}, // Deprecated since 9.0 //TODO remove after 2 versions
+ {"geolocation.longitude",
+ "MEDIA_LONGITUDE"}, // Deprecated since 9.0 //TODO remove after 2 versions
+ {"duration",
+ "MEDIA_DURATION"}, // Deprecated since 9.0 //TODO remove after 2 versions
{"album", "MEDIA_ALBUM"},
{"artists", "MEDIA_ARTIST"},
{"width", "MEDIA_WIDTH"},
@@ -85,7 +88,9 @@ PlatformResult ContentFilter::MapField(const std::string& name, std::string* res
ScopeLogger();
auto it = attributeNameMap.find(name);
if (it != attributeNameMap.end()) {
- if (name == "rating" || name == "description") {
+ if (name == "rating" || name == "description" ||
+ name == "geolocation.latitude" || name == "geolocation.longitude" ||
+ name == "duration") {
std::string warning = "Filtering by attribute '" + name + "'";
common::tools::PrintDeprecationWarningFor(warning.c_str());
}
diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc
index ae956a8..7e92ad2 100644
--- a/src/content/content_manager.cc
+++ b/src/content/content_manager.cc
@@ -107,9 +107,11 @@ void ContentToJson(media_info_h info, picojson::object& o) {
o["height"] = picojson::value(static_cast(tmpInt));
}
picojson::object geo;
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_latitude(info, &tmpDouble)) {
geo["latitude"] = picojson::value(tmpDouble);
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_longitude(info, &tmpDouble)) {
geo["longitude"] = picojson::value(tmpDouble);
}
@@ -149,17 +151,22 @@ void ContentToJson(media_info_h info, picojson::object& o) {
}
} else if (type == MEDIA_CONTENT_TYPE_VIDEO) {
o["type"] = picojson::value(std::string("VIDEO"));
+ // Deprecated since 9.0 //TODO remove after 2 versions
video_meta_h video;
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_video(info, &video)) {
+ // Deprecated since 9.0 //TODO remove after 2 versions
std::unique_ptr::type, int (*)(video_meta_h)> video_ptr(
video, &video_meta_destroy); // automatically release the memory
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_width(video, &tmpInt)) {
o["width"] = picojson::value(static_cast(tmpInt));
}
-
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_height(video, &tmpInt)) {
o["height"] = picojson::value(static_cast(tmpInt));
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_artist(video, &tmpStr)) {
picojson::array artists;
if (tmpStr) {
@@ -169,6 +176,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
}
o["artists"] = picojson::value(artists);
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_album(video, &tmpStr)) {
if (tmpStr) {
o["album"] = picojson::value(tmpStr);
@@ -176,9 +184,11 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_duration(video, &tmpInt)) {
o["duration"] = picojson::value(static_cast(tmpInt));
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_recorded_date(video, &tmpStr)) {
if (tmpStr) {
o["releaseDate"] = picojson::value(get_date(tmpStr));
@@ -188,9 +198,11 @@ void ContentToJson(media_info_h info, picojson::object& o) {
}
}
picojson::object geo;
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_latitude(info, &tmpDouble)) {
geo["latitude"] = picojson::value(tmpDouble);
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_longitude(info, &tmpDouble)) {
geo["longitude"] = picojson::value(tmpDouble);
}
@@ -201,6 +213,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_audio(info, &audio)) {
std::unique_ptr::type, int (*)(audio_meta_h)> audio_ptr(
audio, &audio_meta_destroy); // automatically release the memory
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_recorded_date(audio, &tmpStr)) {
if (tmpStr) {
o["releaseDate"] = picojson::value(get_date(tmpStr));
@@ -233,6 +246,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_composer(audio, &tmpStr)) {
if (tmpStr) {
picojson::array composers;
@@ -242,6 +256,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_copyright(audio, &tmpStr)) {
if (tmpStr) {
o["copyright"] = picojson::value(std::string(tmpStr));
@@ -249,6 +264,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_bit_rate(audio, &tmpInt)) {
o["bitrate"] = picojson::value(static_cast(tmpInt));
}
@@ -261,6 +277,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
o["trackNumber"] = picojson::value();
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_duration(audio, &tmpInt)) {
o["duration"] = picojson::value(static_cast(tmpInt));
}
@@ -320,6 +337,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
ret = media_info_get_description(info, &tmpStr);
if (ret == MEDIA_CONTENT_ERROR_NONE) {
if (tmpStr) {
@@ -328,6 +346,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
tmpStr = NULL;
}
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
ret = media_info_get_rating(info, &tmpInt);
if (ret == MEDIA_CONTENT_ERROR_NONE) {
o["rating"] = picojson::value(static_cast(tmpInt));
@@ -336,6 +355,7 @@ void ContentToJson(media_info_h info, picojson::object& o) {
if (ret == MEDIA_CONTENT_ERROR_NONE) {
o["size"] = picojson::value(static_cast(tmpLong));
}
+ // Deprecated since 9.0 //TODO remove after 2 versions
ret = media_info_get_favorite(info, &tmpBool);
if (ret == MEDIA_CONTENT_ERROR_NONE) {
o["isFavorite"] = picojson::value(tmpBool);
@@ -403,13 +423,7 @@ static int setContent(media_info_h media, const picojson::value& content) {
return MEDIA_CONTENT_ERROR_DB_FAILED;
}
- media_content_type_e type;
- ret = media_info_get_media_type(media, &type);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- LoggerE("Failed: media_info_get_media_type()");
- return ret;
- }
-
+ // Deprecated since 9.0 //TODO remove after 2 versions
ret = media_info_set_favorite(media, is_fav);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
LoggerE("Updating isFavorite failed.");
diff --git a/src/content/js/datatypes.js b/src/content/js/datatypes.js
index 7898250..b903415 100755
--- a/src/content/js/datatypes.js
+++ b/src/content/js/datatypes.js
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+var privUtils_ = xwalk.utils;
+
var ContentType = {
IMAGE: 'IMAGE',
VIDEO: 'VIDEO',
@@ -129,8 +131,14 @@ function Content(data) {
Object.defineProperties(this, {
editableAttributes: {
- value: editableAttributes,
- writable: false,
+ get: function () {
+ privUtils_.deprecationWarn(
+ 'editableAttributes is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
+ return editableAttributes;
+ },
+ set: function () { },
enumerable: true
},
id: {
@@ -220,6 +228,10 @@ function Content(data) {
},
releaseDate: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'releaseDate is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return releaseDate;
},
set: function(v) {
@@ -253,6 +265,10 @@ function Content(data) {
},
description: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'description is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return description;
},
set: function(v) {
@@ -270,6 +286,10 @@ function Content(data) {
},
rating: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'rating is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return rating;
},
set: function(v) {
@@ -289,9 +309,17 @@ function Content(data) {
},
isFavorite: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'isFavorite is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return isFavorite;
},
set: function(v) {
+ privUtils_.deprecationWarn(
+ 'isFavorite is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
if (!type_.isNull(v)) {
isFavorite = converter_.toBoolean(v, false);
}
@@ -325,12 +353,22 @@ function VideoContent(data) {
Object.defineProperties(this, {
editableAttributes: {
- value: editableAttributes,
- writable: false,
+ get: function () {
+ privUtils_.deprecationWarn(
+ 'editableAttributes is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
+ return editableAttributes;
+ },
+ set: function () { },
enumerable: true
},
geolocation: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'geolocation is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
// for keep geolocation's latitude and longitude readonly
// we need to return copy of this object
return new tizen.SimpleCoordinates(
@@ -357,6 +395,10 @@ function VideoContent(data) {
},
album: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'album is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return album;
},
set: function(v) {
@@ -367,7 +409,11 @@ function VideoContent(data) {
enumerable: true
},
artists: {
- get: function() {
+ get: function () {
+ privUtils_.deprecationWarn(
+ 'artists is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return artists;
},
set: function(v) {
@@ -379,6 +425,10 @@ function VideoContent(data) {
},
duration: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'duration is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return duration;
},
set: function(v) {
@@ -390,6 +440,10 @@ function VideoContent(data) {
},
width: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'width is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return width;
},
set: function(v) {
@@ -401,6 +455,10 @@ function VideoContent(data) {
},
height: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'height is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return height;
},
set: function(v) {
@@ -552,6 +610,10 @@ function AudioContent(data) {
},
composers: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'composers is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return composers;
},
set: function(v) {
@@ -577,6 +639,10 @@ function AudioContent(data) {
},
copyright: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'copyright is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return copyright;
},
set: function(v) {
@@ -588,6 +654,10 @@ function AudioContent(data) {
},
bitrate: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'bitrate is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return bitrate;
},
set: function(v) {
@@ -610,6 +680,10 @@ function AudioContent(data) {
},
duration: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'duration is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
return duration;
},
set: function(v) {
@@ -647,12 +721,22 @@ function ImageContent(data) {
Object.defineProperties(this, {
editableAttributes: {
- value: editableAttributes,
- writable: false,
+ get: function () {
+ privUtils_.deprecationWarn(
+ 'editableAttributes is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
+ return editableAttributes;
+ },
+ set: function () { },
enumerable: true
},
geolocation: {
get: function() {
+ privUtils_.deprecationWarn(
+ 'geolocation is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
// for keep geolocation's latitude and longitude readonly
// we need to return copy of this object
return new tizen.SimpleCoordinates(
diff --git a/src/content/js/manager.js b/src/content/js/manager.js
index 9381846..e3c0755 100755
--- a/src/content/js/manager.js
+++ b/src/content/js/manager.js
@@ -130,6 +130,10 @@ var ContentManagerUpdate = function(content) {
};
ContentManager.prototype.update = function() {
+ privUtils_.deprecationWarn(
+ 'ContentManager.update() is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
ContentManagerUpdate.apply(this, arguments);
};
@@ -138,6 +142,10 @@ ContentManager.prototype.updateBatch = function(
successCallback,
errorCallback
) {
+ privUtils_.deprecationWarn(
+ 'ContentManager.updateBatch() is deprecated since Tizen 9.0 with no replacement.',
+ '9.0'
+ );
var args = validator_.validateArgs(arguments, [
{ name: 'contents', type: types_.ARRAY, values: Content },
{