Merge lp:~mardy/unity-webapps-qml/app-access into lp:unity-webapps-qml

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 108
Merged at revision: 145
Proposed branch: lp:~mardy/unity-webapps-qml/app-access
Merge into: lp:unity-webapps-qml
Prerequisite: lp:~abreu-alexandre/unity-webapps-qml/fix-1288801
Diff against target: 237 lines (+152/-4)
7 files modified
debian/control (+2/-1)
examples/api-bindings/online-accounts/www/js/app.js (+11/-1)
src/Ubuntu/UnityWebApps/UnityWebApps.pro (+3/-1)
src/Ubuntu/UnityWebApps/UnityWebApps.qml (+1/-0)
src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js (+87/-0)
src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js (+2/-0)
src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js (+46/-1)
To merge this branch: bzr merge lp:~mardy/unity-webapps-qml/app-access
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandre Abreu (community) Needs Fixing
Justin McPherson Approve
Review via email: mp+219321@code.launchpad.net

This proposal supersedes a proposal from 2014-05-13.

Commit message

Bindings for the OnlineAccounts.Client module

Description of the change

Bindings for the OnlineAccounts.Client module

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

- You should at least add a Suggests w/ qtdeclarative5-online-accounts-client0.1

I have an error when trying to instanciate the Setup object:

Cannot assign to non-existent property \"applicationId\"

I am pretty sure I already saw that ...

Revision history for this message
Justin McPherson (justinmcp) :
review: Approve
105. By Alberto Mardegan

Add Suggests for qtdeclarative5-online-accounts-client0.1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve
106. By Alberto Mardegan

Merge trunk

[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Bindings for the download manager (LP: #1295842)
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Cleanup the structure of the QML bindings to make it clearer. No
  Changes in functionality all features are still working & same, This
  is an updated version of: https://code.launchpad.net/~abreu-
  alexandre/unity-webapps-qml/restructure-cleanup-bindings-qml-
  structure/+merge/208148 with the latest changes that got in in
  between (LP: #1288801)
* Simplifies the manifest.json handling in some instances. More
  precisely when one is using a custom model search path for the
  webapp lookup, some restrictions are being put on what is expected
  to be found in the folder among which: a common/ subfolder (even if
  the webapp doesnt require one),. one or more unity-webapps-* folders
  with manifest.json & *.user.js files in it,. More over the manifest
  files do require user scripts to be defined. This imposes a set of
  constraints over a given webapp that simply wants to use the
  container (w/o js injection). This simplifies it an allows one to
  define a manifest.json file (still with some required elements, but
  a smaller set), directly in the model search path. E.g. something
  like: {     "name": "MyWebApp",     "homepage":
  "http://www.bbc.co.uk/news/",     "domain": "bbc.co.uk",
      "includes": [] } will do, or to avoid any confusion w/ the click
  manifest.json file, one also searches for a webapp-properties.json
  w/ the same content as above.

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

You need to update the install files ...

review: Needs Fixing
107. By Alberto Mardegan

Install missing file

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

I am all +1 for this, but this doesnt solve the bug linked at all, it adds an API; could you please remove the attached bug #

108. By Alberto Mardegan

From trunk

[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* When using a webapp-properties file for an unamed webapp the user
  script does not get injected. (LP: #1409051)
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Make sure that the content hub bindings are fail safe since the
  content hub package is a suggests (which is fine since it is not
  there by default on desktop). (LP: #1395524)
* The content hub has been updated with some changes that caused the
  getPeers() fonction to break on the HTML5 API side.
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Improve testability for the desktop webapp search path
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Port qml bindings to oxide (LP: #1374100)
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Add small guard before url navigation (LP: #1378437)
* debian/control:
  - update libqt5webkit5-qmlwebkitplugin -> qml-module-qtwebkit
    (fixes a multiarch install failure)
[ Ken VanDine ]
* handle qtdeclarative5-ubuntu-content1 package rename
[ Ubuntu daily release ]
* New rebuild forced
[ Alexandre Abreu ]
* Simplify the click webapp definition for things like overrides etc.
[ Alexandre Abreu ]
* Add bidirectional callback support between js <-> qml,
[ Alexandre Abreu ]
* Fix issue with qmlplugindump using 100% cpu Fix and expanded AP
  tests to properly test the installed webapps case (LP: #1300957)
[ Ken VanDine ]
* add content share
[ Alexandre Abreu ]
* add content share
[ Ubuntu daily release ]
* New rebuild forced
[ Olivier Tilloy ]
* Do not override existing message handlers. Oxide has this nice
  feature that it automatically attaches the instantiated message
  handler to the webview anyway, so this line was useless. (LP:
  #1323735)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-01-08 19:36:38 +0000
3+++ debian/control 2015-03-04 17:01:07 +0000
4@@ -35,7 +35,8 @@
5 qtdeclarative5-accounts-plugin,
6 ${misc:Depends},
7 ${shlibs:Depends},
8-Suggests: qtdeclarative5-ubuntu-content1,
9+Suggests: qtdeclarative5-online-accounts-client0.1 (>= 0.3+14.10.20140530),
10+ qtdeclarative5-ubuntu-content1,
11 qtdeclarative5-ubuntu-download-manager0.1
12 Description: Unity Webapps QML component
13 Unity Webapps QML is a QML component that binds to a QML WebView and allows
14
15=== modified file 'examples/api-bindings/online-accounts/www/js/app.js'
16--- examples/api-bindings/online-accounts/www/js/app.js 2014-05-09 13:17:09 +0000
17+++ examples/api-bindings/online-accounts/www/js/app.js 2015-03-04 17:01:07 +0000
18@@ -4,13 +4,23 @@
19 var api = external.getUnityObject('1.0');
20 var oa = api.OnlineAccounts;
21
22- oa.api.getProviders({"applicationId": "webbrowser-app"}, function(providers) {
23+ var appId = "shotwell";
24+
25+ oa.api.getProviders({"applicationId": appId}, function(providers) {
26 var ul = document.querySelector('#providers ul');
27
28 for (var i = 0; i < providers.length; ++i) {
29 var li = document.createElement('li');
30+ var button = document.createElement('input');
31+ button.type = 'button';
32+ button.providerId = providers[i].providerId;
33+ button.value = 'Request account';
34+ button.addEventListener('click', function() {
35+ oa.api.requestAccount(appId, this.providerId, function() {});
36+ });
37 li.innerHTML = 'displayName: ' + providers[i].displayName
38 + ', providerId: ' + providers[i].providerId;
39+ li.appendChild(button);
40 ul.appendChild(li);
41 }
42 });
43
44=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.pro'
45--- src/Ubuntu/UnityWebApps/UnityWebApps.pro 2014-07-11 17:13:18 +0000
46+++ src/Ubuntu/UnityWebApps/UnityWebApps.pro 2015-03-04 17:01:07 +0000
47@@ -60,7 +60,9 @@
48 alarm_binding_backend_js_files.files = ./bindings/alarm-api/backend/alarm-api.js
49
50 online_accounts_binding_backend_js_files.path = $$installPath/bindings/online-accounts/backend/
51-online_accounts_binding_backend_js_files.files = ./bindings/online-accounts/backend/online-accounts.js
52+online_accounts_binding_backend_js_files.files = \
53+ ./bindings/online-accounts/backend/online-accounts.js \
54+ ./bindings/online-accounts/backend/online-accounts-client.js
55
56 runtime_api_binding_backend_js_files.path = $$installPath/bindings/runtime-api/backend/
57 runtime_api_binding_backend_js_files.files = ./bindings/runtime-api/backend/runtime-api.js
58
59=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
60--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2015-01-08 19:36:38 +0000
61+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2015-03-04 17:01:07 +0000
62@@ -26,6 +26,7 @@
63 import "./bindings/alarm-api/backend/alarm-api.js" as AlarmApiBackend
64 import "./bindings/content-hub/backend/content-hub.js" as ContentHubApiBackend
65 import "./bindings/online-accounts/backend/online-accounts.js" as OnlineAccountsApiBackend
66+import "./bindings/online-accounts/backend/online-accounts-client.js" as OnlineAccountsClientApiBackend
67 import "./bindings/download-manager/backend/download-api.js" as DownloadApiBackend
68
69 /*!
70
71=== added file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js'
72--- src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js 1970-01-01 00:00:00 +0000
73+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js 2015-03-04 17:01:07 +0000
74@@ -0,0 +1,87 @@
75+/*
76+ * Copyright 2014 Canonical Ltd.
77+ *
78+ * This file is part of unity-webapps-qml.
79+ *
80+ * unity-webapps-qml is free software; you can redistribute it and/or modify
81+ * it under the terms of the GNU General Public License as published by
82+ * the Free Software Foundation; version 3.
83+ *
84+ * unity-webapps-qml is distributed in the hope that it will be useful,
85+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
86+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87+ * GNU General Public License for more details.
88+ *
89+ * You should have received a copy of the GNU General Public License
90+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
91+ */
92+
93+/**
94+ *
95+ * Online Accounts client API backend binding
96+ *
97+ */
98+function createOnlineAccountsClientApi(backendDelegate) {
99+ var PLUGIN_URI = 'Ubuntu.OnlineAccounts.Client';
100+ var VERSION = 0.1;
101+
102+ function Setup(params) {
103+ var result = backendDelegate.createQmlObject(
104+ PLUGIN_URI, VERSION, 'Setup', params);
105+ this._id = result.id;
106+ this._object = result.object;
107+ };
108+ Setup.prototype = {
109+ _validate: function() {
110+ if (! this._object)
111+ throw new TypeError("Invalid object null");
112+ },
113+
114+ destroy: function() {
115+ if (! this._object)
116+ return;
117+ this._object.destroy();
118+ backendDelegate.deleteId(this._id);
119+ },
120+
121+ // object methods
122+ serialize: function() {
123+ this._validate();
124+ return {
125+ type: 'object-proxy',
126+ apiid: 'OnlineAccounts.Client',
127+ objecttype: 'Setup',
128+ objectid: this._id,
129+ }
130+ },
131+
132+ // methods
133+ exec: function(callback) {
134+ this._validate();
135+
136+ var self = this;
137+
138+ var onFinished = function() {
139+ self._object.onFinished.disconnect(onFinished);
140+ callback();
141+ }
142+
143+ this._object.onFinished.connect(onFinished);
144+ this._object.exec();
145+ }
146+ };
147+
148+ return {
149+ requestAccount: function(applicationId, providerId, callback) {
150+ var setup = new Setup({
151+ 'applicationId': applicationId,
152+ 'providerId': providerId,
153+ });
154+ var onFinished = function() {
155+ setup.destroy();
156+ callback();
157+ };
158+ setup.exec(onFinished);
159+ },
160+ };
161+}
162
163=== modified file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js'
164--- src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js 2014-05-22 08:54:56 +0000
165+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js 2015-03-04 17:01:07 +0000
166@@ -673,6 +673,8 @@
167 }
168 },
169
170+ Client: OnlineAccountsClientApiBackend.createOnlineAccountsClientApi(backendDelegate),
171+
172 // Internal
173
174 dispatchToObject: function(infos) {
175
176=== modified file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js'
177--- src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js 2014-05-09 13:17:09 +0000
178+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js 2015-03-04 17:01:07 +0000
179@@ -161,7 +161,7 @@
180 *
181 * @method api.getAccounts
182 * @param filters {Object} A dictionary of parameters to filter the result. The filtering keys are:
183- * - application: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)
184+ * - applicationId: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)
185 * - provider: the ID of a provider (see /usr/share/accounts/providers/ or ~/.local/share/accounts/providers/ for a list of the available providers)
186 * - service: the ID of a service (see /usr/share/accounts/services/ or ~/.local/share/accounts/services/ for a list of the available services)
187 *
188@@ -215,6 +215,51 @@
189 , [filters]
190 , callback);
191 },
192+ /**
193+ * Requests access to an account.
194+ *
195+ * Applications must invoke this method in order to obtain access
196+ * to an account. The user will be prompted to grant access to
197+ * either an existing account, to create a new one or to decline
198+ * the request.
199+ *
200+ * @method api.requestAccount
201+ * @param applicationId {String} The ID of the application
202+ * requesting the account (see /usr/share/accounts/applications/ or
203+ * ~/.local/share/accounts/applications/ for a list of the
204+ * available applications)
205+ * @param providerId {String} The ID of the provider of the desired
206+ * account (see /usr/share/accounts/providers/ or
207+ * ~/.local/share/accounts/providers/ for a list of the available
208+ * providers)
209+ * @param callback {Function()} Callback which will be invoked
210+ * after the access request has been decided (either with the
211+ * access to an account being granted, or with a refusal).
212+ *
213+ * @example
214+ var api = external.getUnityObject(1.0);
215+ var oa = api.OnlineAccounts;
216+
217+ var appId = 'com.ubuntu.developer.me.MyPackage_MyApp';
218+ oa.api.requestAccount(appId,
219+ 'facebook',
220+ function() {
221+ oa.api.getAccounts({ 'application': appId }, function(result) {
222+ for (var i = 0; i < result.length; ++i) {
223+ console.log("name: " + result[i].displayName()
224+ + ', id: ' + result[i].accountId()
225+ + ', providerName: ' + result[i].provider().displayName
226+ + ', enabled: ' + (result[i].enabled() ? "true" : "false")
227+ );
228+ }
229+ });
230+ });
231+ */
232+ requestAccount: function(applicationId, providerId, callback) {
233+ backendBridge.call('OnlineAccounts.Client.requestAccount',
234+ [ applicationId, providerId],
235+ callback);
236+ },
237 },
238
239

Subscribers

People subscribed via source and target branches

to all changes: