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
=== modified file 'debian/control'
--- debian/control 2015-01-08 19:36:38 +0000
+++ debian/control 2015-03-04 17:01:07 +0000
@@ -35,7 +35,8 @@
35 qtdeclarative5-accounts-plugin,35 qtdeclarative5-accounts-plugin,
36 ${misc:Depends},36 ${misc:Depends},
37 ${shlibs:Depends},37 ${shlibs:Depends},
38Suggests: qtdeclarative5-ubuntu-content1,38Suggests: qtdeclarative5-online-accounts-client0.1 (>= 0.3+14.10.20140530),
39 qtdeclarative5-ubuntu-content1,
39 qtdeclarative5-ubuntu-download-manager0.140 qtdeclarative5-ubuntu-download-manager0.1
40Description: Unity Webapps QML component41Description: Unity Webapps QML component
41 Unity Webapps QML is a QML component that binds to a QML WebView and allows42 Unity Webapps QML is a QML component that binds to a QML WebView and allows
4243
=== modified file 'examples/api-bindings/online-accounts/www/js/app.js'
--- examples/api-bindings/online-accounts/www/js/app.js 2014-05-09 13:17:09 +0000
+++ examples/api-bindings/online-accounts/www/js/app.js 2015-03-04 17:01:07 +0000
@@ -4,13 +4,23 @@
4 var api = external.getUnityObject('1.0');4 var api = external.getUnityObject('1.0');
5 var oa = api.OnlineAccounts;5 var oa = api.OnlineAccounts;
66
7 oa.api.getProviders({"applicationId": "webbrowser-app"}, function(providers) {7 var appId = "shotwell";
8
9 oa.api.getProviders({"applicationId": appId}, function(providers) {
8 var ul = document.querySelector('#providers ul');10 var ul = document.querySelector('#providers ul');
911
10 for (var i = 0; i < providers.length; ++i) {12 for (var i = 0; i < providers.length; ++i) {
11 var li = document.createElement('li');13 var li = document.createElement('li');
14 var button = document.createElement('input');
15 button.type = 'button';
16 button.providerId = providers[i].providerId;
17 button.value = 'Request account';
18 button.addEventListener('click', function() {
19 oa.api.requestAccount(appId, this.providerId, function() {});
20 });
12 li.innerHTML = 'displayName: ' + providers[i].displayName21 li.innerHTML = 'displayName: ' + providers[i].displayName
13 + ', providerId: ' + providers[i].providerId;22 + ', providerId: ' + providers[i].providerId;
23 li.appendChild(button);
14 ul.appendChild(li);24 ul.appendChild(li);
15 }25 }
16 });26 });
1727
=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.pro'
--- src/Ubuntu/UnityWebApps/UnityWebApps.pro 2014-07-11 17:13:18 +0000
+++ src/Ubuntu/UnityWebApps/UnityWebApps.pro 2015-03-04 17:01:07 +0000
@@ -60,7 +60,9 @@
60alarm_binding_backend_js_files.files = ./bindings/alarm-api/backend/alarm-api.js60alarm_binding_backend_js_files.files = ./bindings/alarm-api/backend/alarm-api.js
6161
62online_accounts_binding_backend_js_files.path = $$installPath/bindings/online-accounts/backend/62online_accounts_binding_backend_js_files.path = $$installPath/bindings/online-accounts/backend/
63online_accounts_binding_backend_js_files.files = ./bindings/online-accounts/backend/online-accounts.js63online_accounts_binding_backend_js_files.files = \
64 ./bindings/online-accounts/backend/online-accounts.js \
65 ./bindings/online-accounts/backend/online-accounts-client.js
6466
65runtime_api_binding_backend_js_files.path = $$installPath/bindings/runtime-api/backend/67runtime_api_binding_backend_js_files.path = $$installPath/bindings/runtime-api/backend/
66runtime_api_binding_backend_js_files.files = ./bindings/runtime-api/backend/runtime-api.js68runtime_api_binding_backend_js_files.files = ./bindings/runtime-api/backend/runtime-api.js
6769
=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2015-01-08 19:36:38 +0000
+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2015-03-04 17:01:07 +0000
@@ -26,6 +26,7 @@
26import "./bindings/alarm-api/backend/alarm-api.js" as AlarmApiBackend26import "./bindings/alarm-api/backend/alarm-api.js" as AlarmApiBackend
27import "./bindings/content-hub/backend/content-hub.js" as ContentHubApiBackend27import "./bindings/content-hub/backend/content-hub.js" as ContentHubApiBackend
28import "./bindings/online-accounts/backend/online-accounts.js" as OnlineAccountsApiBackend28import "./bindings/online-accounts/backend/online-accounts.js" as OnlineAccountsApiBackend
29import "./bindings/online-accounts/backend/online-accounts-client.js" as OnlineAccountsClientApiBackend
29import "./bindings/download-manager/backend/download-api.js" as DownloadApiBackend30import "./bindings/download-manager/backend/download-api.js" as DownloadApiBackend
3031
31/*!32/*!
3233
=== added file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js'
--- src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts-client.js 2015-03-04 17:01:07 +0000
@@ -0,0 +1,87 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This file is part of unity-webapps-qml.
5 *
6 * unity-webapps-qml is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * unity-webapps-qml is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 *
21 * Online Accounts client API backend binding
22 *
23 */
24function createOnlineAccountsClientApi(backendDelegate) {
25 var PLUGIN_URI = 'Ubuntu.OnlineAccounts.Client';
26 var VERSION = 0.1;
27
28 function Setup(params) {
29 var result = backendDelegate.createQmlObject(
30 PLUGIN_URI, VERSION, 'Setup', params);
31 this._id = result.id;
32 this._object = result.object;
33 };
34 Setup.prototype = {
35 _validate: function() {
36 if (! this._object)
37 throw new TypeError("Invalid object null");
38 },
39
40 destroy: function() {
41 if (! this._object)
42 return;
43 this._object.destroy();
44 backendDelegate.deleteId(this._id);
45 },
46
47 // object methods
48 serialize: function() {
49 this._validate();
50 return {
51 type: 'object-proxy',
52 apiid: 'OnlineAccounts.Client',
53 objecttype: 'Setup',
54 objectid: this._id,
55 }
56 },
57
58 // methods
59 exec: function(callback) {
60 this._validate();
61
62 var self = this;
63
64 var onFinished = function() {
65 self._object.onFinished.disconnect(onFinished);
66 callback();
67 }
68
69 this._object.onFinished.connect(onFinished);
70 this._object.exec();
71 }
72 };
73
74 return {
75 requestAccount: function(applicationId, providerId, callback) {
76 var setup = new Setup({
77 'applicationId': applicationId,
78 'providerId': providerId,
79 });
80 var onFinished = function() {
81 setup.destroy();
82 callback();
83 };
84 setup.exec(onFinished);
85 },
86 };
87}
088
=== modified file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js'
--- src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js 2014-05-22 08:54:56 +0000
+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/backend/online-accounts.js 2015-03-04 17:01:07 +0000
@@ -673,6 +673,8 @@
673 }673 }
674 },674 },
675675
676 Client: OnlineAccountsClientApiBackend.createOnlineAccountsClientApi(backendDelegate),
677
676 // Internal678 // Internal
677679
678 dispatchToObject: function(infos) {680 dispatchToObject: function(infos) {
679681
=== modified file 'src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js'
--- src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js 2014-05-09 13:17:09 +0000
+++ src/Ubuntu/UnityWebApps/bindings/online-accounts/client/online-accounts.js 2015-03-04 17:01:07 +0000
@@ -161,7 +161,7 @@
161 *161 *
162 * @method api.getAccounts162 * @method api.getAccounts
163 * @param filters {Object} A dictionary of parameters to filter the result. The filtering keys are:163 * @param filters {Object} A dictionary of parameters to filter the result. The filtering keys are:
164 * - application: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)164 * - applicationId: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)
165 * - provider: the ID of a provider (see /usr/share/accounts/providers/ or ~/.local/share/accounts/providers/ for a list of the available providers)165 * - provider: the ID of a provider (see /usr/share/accounts/providers/ or ~/.local/share/accounts/providers/ for a list of the available providers)
166 * - service: the ID of a service (see /usr/share/accounts/services/ or ~/.local/share/accounts/services/ for a list of the available services)166 * - service: the ID of a service (see /usr/share/accounts/services/ or ~/.local/share/accounts/services/ for a list of the available services)
167 *167 *
@@ -215,6 +215,51 @@
215 , [filters]215 , [filters]
216 , callback);216 , callback);
217 },217 },
218 /**
219 * Requests access to an account.
220 *
221 * Applications must invoke this method in order to obtain access
222 * to an account. The user will be prompted to grant access to
223 * either an existing account, to create a new one or to decline
224 * the request.
225 *
226 * @method api.requestAccount
227 * @param applicationId {String} The ID of the application
228 * requesting the account (see /usr/share/accounts/applications/ or
229 * ~/.local/share/accounts/applications/ for a list of the
230 * available applications)
231 * @param providerId {String} The ID of the provider of the desired
232 * account (see /usr/share/accounts/providers/ or
233 * ~/.local/share/accounts/providers/ for a list of the available
234 * providers)
235 * @param callback {Function()} Callback which will be invoked
236 * after the access request has been decided (either with the
237 * access to an account being granted, or with a refusal).
238 *
239 * @example
240 var api = external.getUnityObject(1.0);
241 var oa = api.OnlineAccounts;
242
243 var appId = 'com.ubuntu.developer.me.MyPackage_MyApp';
244 oa.api.requestAccount(appId,
245 'facebook',
246 function() {
247 oa.api.getAccounts({ 'application': appId }, function(result) {
248 for (var i = 0; i < result.length; ++i) {
249 console.log("name: " + result[i].displayName()
250 + ', id: ' + result[i].accountId()
251 + ', providerName: ' + result[i].provider().displayName
252 + ', enabled: ' + (result[i].enabled() ? "true" : "false")
253 );
254 }
255 });
256 });
257 */
258 requestAccount: function(applicationId, providerId, callback) {
259 backendBridge.call('OnlineAccounts.Client.requestAccount',
260 [ applicationId, providerId],
261 callback);
262 },
218 },263 },
219264
220265

Subscribers

People subscribed via source and target branches

to all changes: