Skip to content

Commit 8385e13

Browse files
authored
Implement getMatchedAppIds (#185)
1 parent 5b19d3d commit 8385e13

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

shell/platform/tizen/channels/app_control.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ EncodableValue AppControl::SerializeToMap() {
300300
return EncodableValue(map);
301301
}
302302

303+
AppControlResult AppControl::GetMatchedAppIds(EncodableList& list) {
304+
EncodableList app_ids;
305+
AppControlResult ret = app_control_foreach_app_matched(
306+
handle_,
307+
[](app_control_h app_control, const char* app_id,
308+
void* user_data) -> bool {
309+
auto app_ids = static_cast<EncodableList*>(user_data);
310+
app_ids->push_back(EncodableValue(app_id));
311+
return true;
312+
},
313+
&app_ids);
314+
if (ret) {
315+
list = std::move(app_ids);
316+
}
317+
return ret;
318+
}
319+
303320
AppControlResult AppControl::SendLaunchRequest() {
304321
return app_control_send_launch_request(handle_, nullptr, nullptr);
305322
}

shell/platform/tizen/channels/app_control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class AppControl {
8989

9090
EncodableValue SerializeToMap();
9191

92+
AppControlResult GetMatchedAppIds(EncodableList& list);
9293
AppControlResult SendLaunchRequest();
9394
AppControlResult SendLaunchRequestWithReply(ReplyCallback on_reply);
9495
AppControlResult SendTerminateRequest();

shell/platform/tizen/channels/app_control_channel.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ void AppControlChannel::HandleMethodCall(
9999
if (method_name == "dispose") {
100100
AppControlManager::GetInstance().Remove(app_control->id());
101101
result->Success();
102+
} else if (method_name == "getMatchedAppIds") {
103+
EncodableList app_ids;
104+
AppControlResult ret = app_control->GetMatchedAppIds(app_ids);
105+
if (ret) {
106+
result->Success(EncodableValue(app_ids));
107+
} else {
108+
result->Error(ret.code(), ret.message());
109+
}
102110
} else if (method_name == "reply") {
103111
Reply(app_control, arguments, std::move(result));
104112
} else if (method_name == "sendLaunchRequest") {

0 commit comments

Comments
 (0)