Merge lp:~gary-wzl77/account-plugins/fix_1638844 into lp:account-plugins

Proposed by Gary.Wang
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 178
Merged at revision: 178
Proposed branch: lp:~gary-wzl77/account-plugins/fix_1638844
Merge into: lp:account-plugins
Diff against target: 58 lines (+36/-2)
2 files modified
data/providers/mcloud.provider.in.in (+2/-2)
qml/mcloud/Main.qml (+34/-0)
To merge this branch: bzr merge lp:~gary-wzl77/account-plugins/fix_1638844
Reviewer Review Type Date Requested Status
Online Accounts Pending
Review via email: mp+309920@code.launchpad.net

Commit message

support to display user id(phone number) for mcloud.

Description of the change

support to display user id(phone number) for mcloud.

To post a comment you must log in.
177. By Gary.Wang

Keep user id clean.

178. By Gary.Wang

keep consistent with official English name.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/providers/mcloud.provider.in.in'
2--- data/providers/mcloud.provider.in.in 2016-06-02 07:24:00 +0000
3+++ data/providers/mcloud.provider.in.in 2016-11-08 02:13:00 +0000
4@@ -1,8 +1,8 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6 <provider id="mcloud">
7- <name>MCloud</name>
8+ <name>mcloud</name>
9 <icon>mcloud</icon>
10- <translations>MCloud</translations>
11+ <translations>mcloud</translations>
12 <domains>.*10086\.cn</domains>
13 <plugin>generic-oauth</plugin>
14 <single-account>true</single-account>
15
16=== modified file 'qml/mcloud/Main.qml'
17--- qml/mcloud/Main.qml 2016-08-29 02:06:03 +0000
18+++ qml/mcloud/Main.qml 2016-11-08 02:13:00 +0000
19@@ -3,5 +3,39 @@
20 OAuthMain {
21 creationComponent: OAuth {
22 userAgent: "Mozilla/5.0 (Linux; Ubuntu 15.04) AppleWebKit/537.36 Chromium/51.0.2704.79 Safari/537.36"
23+
24+ function getFirstChildByTagName(node, name) {
25+ for (var i=0; i < node.childNodes.length; i++) {
26+ if (node.childNodes[i].tagName === name) {
27+ return node.childNodes[i];
28+ }
29+ }
30+ }
31+
32+ function getUserName(reply, callback) {
33+ var url = "https://ose.caiyun.feixin.10086.cn/richlifeApp/devapp/ICatalog";
34+ var body = "<getDisk><MSISDN>thirdparty_anonymous_account</MSISDN><catalogID>root</catalogID><startNumber>-1</startNumber></getDisk>";
35+ var http = new XMLHttpRequest();
36+ http.open("POST", url, true);
37+ http.setRequestHeader("Authorization", "Bearer " + reply.AccessToken);
38+ http.onreadystatechange = function() {
39+ if (http.readyState === 4) {
40+ if (http.status === 200) {
41+ console.log("ok: ")
42+ var disk = http.responseXML.documentElement.firstChild
43+ var folders = getFirstChildByTagName(disk, 'catalogList')
44+ var folder = folders.childNodes[0]
45+ var owner = getFirstChildByTagName(folder, "owner")
46+ callback(owner.childNodes[0].nodeValue);
47+ } else {
48+ console.log("error: " + http.status);
49+ console.log("response text: " + http.responseText);
50+ cancel();
51+ }
52+ }
53+ };
54+ http.send(body);
55+ return true;
56+ }
57 }
58 }

Subscribers

People subscribed via source and target branches