TEST_F(EC, RequestEdit)
{
- EXPECT_EQ(EC::container->RequestEdit("Editor"), 0);
+ EXPECT_EQ(EC::container->RequestEdit(), 0);
}
void _on_edit_ready_cb(watchface_editable_container_h handle, const char *editor_appid, void *user_data) {
private:
EditablesContainer* parent_;
int subscribe_id_;
+ std::string editor_id_;
int watcher_id_ = -1;
std::list<std::shared_ptr<IEditable>> ed_list_;
};
ed_list_.clear();
g_variant_get(parameters, "(&s)", &editor_id);
LOGI("editor_id: %s", editor_id);
- parent_->OnEditReady(std::string(editor_id));
+ editor_id_ = std::string(editor_id);
+ parent_->OnEditReady(editor_id_);
+
} else if (signal_name.compare(
ComplicationConnector::GetInst().GetCmdStr(
ComplicationConnector::EditableEditPreview)) == 0) {
const std::string& name_owner) {
}
-int EditablesContainer::RequestEdit(const std::string& editor_id) {
+int EditablesContainer::RequestEdit() {
int list_idx = 0;
int str_len = 0;
bundle_raw *str_raw = NULL;
std::unique_ptr<const char*[]> list_arr(new const char*[impl_->ed_list_.size()]);
- if (editor_id.empty())
+ if (impl_->editor_id_.empty())
return -1;
for (auto& i : impl_->ed_list_) {
ComplicationConnector::GetInst().EmitSignal(
ComplicationConnector::Editable,
- editor_id,
- editor_id,
+ impl_->editor_id_,
+ impl_->editor_id_,
-1,
ComplicationConnector::GetInst().GetCmdStr(
ComplicationConnector::EditableEditRequest),
str_raw)
);
- impl_->watcher_id_ = ComplicationConnector::GetInst().Watch(editor_id,
+ impl_->watcher_id_ = ComplicationConnector::GetInst().Watch(impl_->editor_id_,
this->impl_.get());
return WATCHFACE_COMPLICATION_ERROR_NONE;
virtual ~EditablesContainer();
int Add(std::shared_ptr<IEditable> ed, int editable_id);
int Remove(std::shared_ptr<IEditable> ed);
- int RequestEdit(const std::string& editor_id);
+ int RequestEdit();
virtual void OnUpdate(const IEditable& ed, int selected_idx,
IEditable::EditableState state);
void OnEditReady(const std::string& editor_id) override;
list_handle, geo, "Color");
watchface_editable_candidates_list_destroy(list_handle);
- watchface_editable_request_edit(handle, editor_appid, _on_editable_update, user_data);
+ watchface_editable_request_edit(handle, _on_editable_update, user_data);
}
* @endcode
*/
watchface_editable_geo_s geo);
int watchface_editable_request_edit(watchface_editable_container_h handle,
- const char *editor_appid,
watchface_editable_update_requested_cb cb,
void *user_data);
int watchface_editable_add_edit_ready_cb(watchface_editable_edit_ready_cb cb,
}
extern "C" EXPORT_API int watchface_editable_request_edit(
- watchface_editable_container_h handle, const char *editor_appid,
+ watchface_editable_container_h handle,
watchface_editable_update_requested_cb cb, void *user_data) {
- if (handle == NULL || editor_appid == NULL || cb == NULL)
+ if (handle == NULL || cb == NULL)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
EditablesContainerStub* ec = static_cast<EditablesContainerStub*>(handle);
auto ci = new UpdateCallbackInfo(cb, user_data);
ec->ClearUpdateCallbackInfo();
ec->AddUpdateCallbackInfo(ci);
- ec->RequestEdit(std::string(editor_appid));
-
- LOGI("Request edit to %s", editor_appid);
+ ec->RequestEdit();
return WATCHFACE_COMPLICATION_ERROR_NONE;
}