Merge lp:~abreu-alexandre/unity-js-scopes/search-reply-activation-response into lp:unity-js-scopes

Proposed by Alexandre Abreu
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 134
Merged at revision: 134
Proposed branch: lp:~abreu-alexandre/unity-js-scopes/search-reply-activation-response
Merge into: lp:unity-js-scopes
Diff against target: 97 lines (+31/-14)
4 files modified
examples/soundcloud/soundcloud.js (+5/-5)
src/bindings/index.js (+3/-1)
src/bindings/src/activation-response.cc (+18/-7)
src/bindings/src/activation-response.h (+5/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-js-scopes/search-reply-activation-response
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alberto Mardegan (community) Approve
Review via email: mp+286334@code.launchpad.net

Commit message

Handle SearchReply as an activation response creation parameter

Description of the change

Handle SearchReply as an activation response creation parameter

To post a comment you must log in.
Revision history for this message
Alberto Mardegan (mardy) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/soundcloud/soundcloud.js'
2--- examples/soundcloud/soundcloud.js 2016-02-15 20:34:33 +0000
3+++ examples/soundcloud/soundcloud.js 2016-02-17 14:43:26 +0000
4@@ -268,20 +268,20 @@
5 action_id,
6 // activate
7 function() {
8- console.log('activate called');
9+ console.log('Activate called');
10
11- var result;
12+ var activation_response;
13 switch (action_id) {
14 case 'updateId':
15- result = activateUpdatePreview();
16+ activation_response = activateUpdatePreview();
17 break;
18 default:
19- result = new scopes.lib.ActivationResponse(
20+ activation_response = new scopes.lib.ActivationResponse(
21 scopes.defs.ActivationResponseStatus.NotHandled);
22 break;
23 }
24
25- return result;
26+ return activation_response;
27 },
28 // cancelled
29 function() {
30
31=== modified file 'src/bindings/index.js'
32--- src/bindings/index.js 2016-02-13 16:01:06 +0000
33+++ src/bindings/index.js 2016-02-17 14:43:26 +0000
34@@ -221,7 +221,9 @@
35 ShowDash: 1,
36 HideDash: 2,
37 ShowPreview: 3,
38- PerformQuery: 4
39+ PerformQuery: 4,
40+ UpdateResult: 5,
41+ UpdatePreview: 6
42 };
43
44 module.exports = {
45
46=== modified file 'src/bindings/src/activation-response.cc'
47--- src/bindings/src/activation-response.cc 2016-02-15 20:34:33 +0000
48+++ src/bindings/src/activation-response.cc 2016-02-17 14:43:26 +0000
49@@ -51,13 +51,24 @@
50 activation_response_.reset(
51 new unity::scopes::ActivationResponse(widgets_list));
52 } else {
53- auto query =
54- v8cpp::from_v8<std::shared_ptr<CannedQuery>>(
55- v8::Isolate::GetCurrent(),
56- arg);
57- activation_response_.reset(
58- new unity::scopes::ActivationResponse(
59- query->canned_query()));
60+ // TODO fix at the v8cpp level
61+ try {
62+ auto query =
63+ v8cpp::from_v8<std::shared_ptr<CannedQuery>>(
64+ v8::Isolate::GetCurrent(),
65+ arg);
66+ activation_response_.reset(
67+ new unity::scopes::ActivationResponse(
68+ query->canned_query()));
69+ } catch (std::invalid_argument& e) {
70+ auto result =
71+ v8cpp::from_v8<std::shared_ptr<Result>>(
72+ v8::Isolate::GetCurrent(),
73+ arg);
74+ activation_response_.reset(
75+ new unity::scopes::ActivationResponse(
76+ *result));
77+ }
78 }
79 }
80
81
82=== modified file 'src/bindings/src/activation-response.h'
83--- src/bindings/src/activation-response.h 2016-02-15 20:34:33 +0000
84+++ src/bindings/src/activation-response.h 2016-02-17 14:43:26 +0000
85@@ -41,7 +41,11 @@
86 --doc:constructor
87 *
88 * @constructor
89- * @param status|query|{Array of PreviewWidget} ActivationResponseStatus to create a response with given status OR CannedQuery to create an ActivationResponse with status defs.ActivationResponseStatus.PerformQuery and a search query to be executed OR an array of PreviewWidgets to create an ActivationResponse with status defs.ActivationResponseStatus.UpdatePreview to update the given widgets
90+ * @param status|query|result|{Array of PreviewWidget} The parameter can be of different types depending on the intended ActivationResponse:
91+ - ActivationResponseStatus to create a response with given status
92+ - CannedQuery to create an ActivationResponse with status defs.ActivationResponseStatus.PerformQuery and a search query to be executed
93+ - SearchResult to create an ActivationResponse with status defs.ActivationResponseStatus.UpdateResult
94+ - an array of PreviewWidgets to create an ActivationResponse with status defs.ActivationResponseStatus.UpdatePreview to update the given widgets
95 --/doc:constructor
96
97 --doc:prototype ActivationResponse

Subscribers

People subscribed via source and target branches

to all changes: