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

Subscribers

People subscribed via source and target branches