#define EXPORT_API __attribute__((visibility("default")))
+#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
+#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
+#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
+#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
+#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
+#define ICON_KEY "__ICON_KEY__"
+#define TITLE_KEY "__TITLE_KEY__"
+#define TIME_KEY "__TIME_KEY__"
+#define RANGE_CUR_KEY "__CUR_KEY__"
+#define RANGE_MAX_KEY "__MAX_KEY__"
+#define RANGE_MIN_KEY "__MIN_KEY__"
+#define IMAGE_KEY "__IMAGE_KEY__"
+#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
+#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
+#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
+#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
+#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
+#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
+#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
+#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
+
#ifdef __cplusplus
extern "C" {
#endif
#include "watchface-common/watchface-util.h"
#include "watchface-common/include/watchface-common.h"
+#include "watchface-common/watchface-common-internal.h"
#ifdef LOG_TAG
#undef LOG_TAG
return appid;
}
+ std::string GetAppPath(const char* appid, char* path) {
+ char* root_path;
+ aul_get_app_shared_resource_path_by_appid(appid, &root_path);
+ std::string app_path =
+ "" + std::string(root_path) + "../../" + std::string(path);
+ free(root_path);
+ LOGI("%s", app_path.c_str());
+ return app_path;
+ }
+
+ int ConvertPathToAppPath(const char* appid, bundle* data) {
+ char* path;
+ char* dup_path;
+ int ret = bundle_get_str(data, ICON_KEY, &path);
+ if (ret == BUNDLE_ERROR_NONE) {
+ dup_path = strdup(path);
+ bundle_del(data, ICON_KEY);
+ ret = bundle_add_str(
+ data, ICON_KEY,
+ util::GetAppPath(appid, dup_path).c_str());
+ free(dup_path);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("fail to add app path");
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+ }
+
+ ret = bundle_get_str(data, IMAGE_KEY, &path);
+ if (ret == BUNDLE_ERROR_NONE) {
+ dup_path = strdup(path);
+ bundle_del(data, IMAGE_KEY);
+ ret = bundle_add_str(
+ data, IMAGE_KEY,
+ util::GetAppPath(appid, path).c_str());
+ free(dup_path);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("fail to add app path");
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+ }
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ }
+
} // namespace util
} // namespace watchface_complication
#define WATCHFACE_COMMON_WATCHFACE_UTIL_H_
#include <gio/gio.h>
+#include <bundle.h>
+
#include <string>
#include "watchface-common/include/watchface-common.h"
EXPORT_API std::string GetAppId();
EXPORT_API std::string GetCmdStr(CmdType type);
EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
+ EXPORT_API std::string GetAppPath(const char* appid, char* path);
+ EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
} // namespace util
} // namespace watchface_complication
#include <list>
#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-common-internal.h"
#include "watchface-complication-provider/complication-provider.h"
#include "watchface-complication-provider/complication-provider-implementation.h"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
delete shared_data;
return;
}
-
+ util::ConvertPathToAppPath(util::GetAppId().c_str(), shared_data->GetRaw());
ret = gdbus_.get()->EmitSignal(
IGDBus::Complication,
std::string(sender_app_id),
* @brief Sets image path data for shared data.
* @since_tizen 5.0
* @remarks @a image_path can be added only for #WATCHFACE_COMPLICATION_TYPE_IMAGE type shared data.
+ * @remarks @a image_path should be relative path like shared/res/image.png.
* @param[in] shared_data The data which will be shared with watch application
* @param[in] image_path The image path data
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* @since_tizen 5.0
* @remarks @a icon_path can be added only for #WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
* #WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, #WATCHFACE_COMPLICATION_TYPE_TIME, #WATCHFACE_COMPLICATION_TYPE_ICON type shared data.
+ * @remarks @a icon_path should be relative path like shared/res/icon.png.
* @param[in] shared_data The data which will be shared with watch application
* @param[in] icon_path The icon path data
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
#include <list>
#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-common-internal.h"
#include "watchface-complication-provider/complication-provider.h"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
#include "watchface-complication/db-manager.h"
#include "watchface-complication/complication.h"
#include "watchface-complication/complication-implementation.h"
#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-common-internal.h"
#include "watchface-complication/include/watchface-complication-internal.h"
#ifdef LOG_TAG
#include <pkgmgr_installer_info.h>
#include <vconf.h>
+#include "watchface-complication/include/watchface-complication-internal.h"
#include "watchface-complication/db-manager.h"
#include "watchface-common/watchface-util.h"
goto out;
}
default_data = std::unique_ptr<Bundle>(new Bundle(std::string(raw_data)));
+ util::ConvertPathToAppPath(provider_app_id.c_str(), default_data->GetRaw());
}
out:
-
sqlite3_finalize(stmt);
CloseDB(db);
#include <watchface-common.h>
-#define SETUP_EDITOR_APPID_KEY "__SETUP_EDITOR_APPID_KEY__"
-#define SETUP_EDITABLE_ID_KEY "__SETUP_EDITABLE_ID_KEY__"
-#define SETUP_CONTEXT_DATA_KEY "__SETUP_CONTEXT_DATA_KEY__"
-#define SHORT_TEXT_KEY "__SHORT_TEXT_KEY__"
-#define LONG_TEXT_KEY "__LONG_TEXT_KEY__"
-#define ICON_KEY "__ICON_KEY__"
-#define TITLE_KEY "__TITLE_KEY__"
-#define TIME_KEY "__TIME_KEY__"
-#define RANGE_CUR_KEY "__CUR_KEY__"
-#define RANGE_MAX_KEY "__MAX_KEY__"
-#define RANGE_MIN_KEY "__MIN_KEY__"
-#define IMAGE_KEY "__IMAGE_KEY__"
-#define DATA_TYPE_KEY "__DATA_TYPE_KEY__"
-#define EXTRA_DATA_KEY "__EXTRA_DATA_KEY__"
-#define SCREEN_READER_TEXT_KEY "__SCREEN_READER_TEXT_KEY__"
-#define TOUCH_LAUNCH_CONTEXT_KEY "__TOUCH_LAUNCH_CONTEXT_KEY__"
-#define TOUCH_LAUNCH_PROVIDER_ID_KEY "__TOUCH_LAUNCH_PROVIDER_ID_KEY__"
-#define TOUCH_LAUNCH_TYPE_KEY "__TOUCH_LAUNCH_TYPE_KEY__"
-#define TOUCH_LAUNCH_EVENT_KEY "__TOUCH_LAUNCH_EVENT_KEY__"
-#define TOUCH_LAUNCH_DATA_KEY "__TOUCH_LAUNCH_DATA_KEY__"
-
namespace watchface_complication {
typedef enum {
#include "watchface-complication/complication.h"
#include "watchface-complication/shared-handle.h"
#include "watchface-common/watchface-util.h"
+#include "watchface-common/watchface-common-internal.h"
#ifdef LOG_TAG
#undef LOG_TAG