#define ABSTRACT_ITEM_MAIN_TYPE_KEY "__ABSTRACT_ITEM_MAIN_TYPE_KEY__"
#define ABSTRACT_ITEM_MULTI_LANG_ARR_KEY "__ABSTRACT_ITEM_MULTI_LANG_ARR_KEY__"
#define ABSTRACT_ITEM_MULTI_LANG_KEY "__ABSTRACT_ITEM_MULTI_LANG_KEY__"
+#define ABSTRACT_ITEM_EXTENSION_DATA_KEY "__ABSTRACT_ITEM_EXTENSION_DATA_KEY__"
using namespace std;
using namespace tizen_base;
b.Add(ABSTRACT_ITEM_HIDE_VIEWER_KEY, arr);
}
+ b.Add(ABSTRACT_ITEM_EXTENSION_DATA_KEY,
+ reinterpret_cast<char*>(impl_->extension_data_.ToRaw().first.get()));
+
return b;
}
impl_->hide_viewer_list_.push_back(str);
}
}
+
+ impl_->extension_data_ = Bundle(b.GetString(ABSTRACT_ITEM_EXTENSION_DATA_KEY));
}
void AbstractItem::SetId(std::string id) {
delete(shared_file);
}
+tizen_base::Bundle AbstractItem::GetExtensionData(std::string key) {
+ if (impl_->extension_data_.GetString(key) == "")
+ return Bundle();
+ else
+ return Bundle(impl_->extension_data_.GetString(key));
+}
+
+void AbstractItem::SetExtensionData(std::string key, Bundle value) {
+ if (impl_->extension_data_.GetString(key) != "")
+ impl_->extension_data_.Delete(key);
+
+ impl_->extension_data_.Add(key,
+ reinterpret_cast<char*>(value.ToRaw().first.get()));
+}
+
} // namespace item
} // namespace notification
*/
MainType GetMainType() const;
+ /**
+ * @brief Gets the extension data.
+ * @since_tizen 5.5
+ * @param[in] key
+ * @return Bundle
+ */
+ tizen_base::Bundle GetExtensionData(std::string key);
+
+ /**
+ * @brief Sets the extension data.
+ * @since_tizen 5.5
+ * @param[in] key key string
+ * @param[in] value Bundle
+ */
+ void SetExtensionData(std::string key, tizen_base::Bundle value);
+
private:
class Impl;
std::unique_ptr<Impl> impl_;
std::string background_;
bool ongoing_ = false;
MainType main_type_ = MainNone;
+ tizen_base::Bundle extension_data_;
};
} // namespace item
int noti_ex_led_info_set_color(
noti_ex_led_info_h handle, noti_ex_color_h color);
+int noti_ex_item_get_extension_data(noti_ex_item_h handle, const char *key,
+ bundle **value);
+int noti_ex_item_set_extension_data(noti_ex_item_h handle, const char *key,
+ bundle *value);
#ifdef __cplusplus
}
#endif
-#endif /* __TIZEN_APPFW_NOTIFICATION_EX_INTERNAL_H__ */
\ No newline at end of file
+#endif /* __TIZEN_APPFW_NOTIFICATION_EX_INTERNAL_H__ */
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_item_get_extension_data(noti_ex_item_h handle,
+ const char *key, bundle **value) {
+ if (handle == nullptr || key == nullptr || value == nullptr) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+
+ Bundle b = p->Get()->GetExtensionData(key);
+ if (b.GetCount() == 0)
+ *value = nullptr;
+ else
+ *value = b.GetHandle();
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_set_extension_data(noti_ex_item_h handle,
+ const char *key, bundle *value) {
+ if (handle == nullptr || key == nullptr || value == nullptr) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Bundle b = Bundle(value);
+
+ Handle* p = static_cast<Handle*>(handle);
+ p->Get()->SetExtensionData(key, b);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_manager_create(noti_ex_manager_h *handle,
const char *receiver_group, noti_ex_manager_events_s event_callbacks,
void *data) {
app_control_h app_control, app_control_1;
char* app_id = NULL;
time_t current_time;
+ Bundle extension_b;
app_control_create(&app_control);
app_control_set_app_id(app_control, "new_appid");
item.SetLEDInfo(led);
item.SetOnGoingState(true);
+ extension_b.Add("test_key", "test_value");
+ item.SetExtensionData("extension_key", extension_b);
+
/* Deserialize */
Bundle b = item.Serialize();
ASSERT_STREQ(app_id, "new_appid_1");
ASSERT_EQ(gen_test->GetOnGoingState(), true);
+
+ Bundle extension_b2 = gen_test->GetExtensionData("extension_key");
+ ASSERT_EQ(extension_b2.GetString("test_key"), "test_value");
}
TEST_F(AbstractItemTest, SerializeDeserialize2) {