Merge lp:~mardy/account-plugins/onedrive_provider into lp:~gary-wzl77/account-plugins/onedrive_provider

Proposed by Alberto Mardegan
Status: Needs review
Proposed branch: lp:~mardy/account-plugins/onedrive_provider
Merge into: lp:~gary-wzl77/account-plugins/onedrive_provider
Diff against target: 48 lines (+8/-7)
2 files modified
data/providers/microsoft.provider.in.in (+1/-1)
qml/microsoft/Main.qml (+7/-6)
To merge this branch: bzr merge lp:~mardy/account-plugins/onedrive_provider
Reviewer Review Type Date Requested Status
Gary.Wang Pending
Review via email: mp+309841@code.launchpad.net

Description of the change

Use new api to get username, log errors.

To post a comment you must log in.

Unmerged revisions

181. By Alberto Mardegan

Update plugin to new API

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/providers/microsoft.provider.in.in'
2--- data/providers/microsoft.provider.in.in 2016-10-26 11:47:38 +0000
3+++ data/providers/microsoft.provider.in.in 2016-11-02 12:04:34 +0000
4@@ -17,7 +17,7 @@
5 <setting name="RedirectUri">https://login.live.com/oauth20_desktop.srf</setting>
6 <setting name="ResponseType">token</setting>
7 <setting name="ClientId">@MICROSOFT_CLIENT_ID@</setting>
8- <setting type="as" name="Scope">['onedrive.readwrite onedrive.appfolder']</setting>
9+ <setting type="as" name="Scope">['onedrive.readwrite', 'onedrive.appfolder']</setting>
10 <setting type="b" name="DisableStateParameter">true</setting>
11 </group>
12 </group>
13
14=== modified file 'qml/microsoft/Main.qml'
15--- qml/microsoft/Main.qml 2016-11-02 08:34:54 +0000
16+++ qml/microsoft/Main.qml 2016-11-02 12:04:34 +0000
17@@ -2,7 +2,7 @@
18
19 OAuthMain {
20 creationComponent: OAuth {
21- function getUserName(reply) {
22+ function getUserName(reply, callback) {
23 var http = new XMLHttpRequest();
24 var url = "https://api.onedrive.com/v1.0/drive";
25 http.open("GET", url, true);
26@@ -11,16 +11,17 @@
27 if (http.readyState === 4) {
28 if (http.status === 200) {
29 var response = JSON.parse(http.responseText);
30- account.updateDisplayName(response.owner.user.displayName +
31- " ( id: " + response.owner.user.id + ")");
32- account.synced.connect(finished);
33- account.sync();
34+ callback(response.owner.user.displayName +
35+ " ( id: " + response.owner.user.id + ")");
36 } else {
37+ console.log("error: " + http.status);
38+ console.log("response text: " + http.responseText);
39 cancel();
40 }
41 }
42 };
43 http.send(null);
44+ return true;
45 }
46- }
47+ }
48 }

Subscribers

People subscribed via source and target branches

to all changes: