Merge lp:~abreu-alexandre/webapps-core/fix-facebook-links-share-ui into lp:webapps-core
- fix-facebook-links-share-ui
- Merge into trunk
Proposed by
Alexandre Abreu
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Alberto Mardegan | ||||||||
Approved revision: | 133 | ||||||||
Merged at revision: | 135 | ||||||||
Proposed branch: | lp:~abreu-alexandre/webapps-core/fix-facebook-links-share-ui | ||||||||
Merge into: | lp:webapps-core | ||||||||
Diff against target: |
624 lines (+335/-200) 4 files modified
webapp-facebook/manifest.json (+1/-1) webapp-facebook/unity-webapps-facebook/HubSharer.qml (+20/-4) webapp-facebook/unity-webapps-facebook/Share.qml (+29/-195) webapp-facebook/unity-webapps-facebook/ShareComponent.qml (+285/-0) |
||||||||
To merge this branch: | bzr merge lp:~abreu-alexandre/webapps-core/fix-facebook-links-share-ui | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Mardegan (community) | Approve | ||
Review via email: mp+287350@code.launchpad.net |
Commit message
Improve facebook share ui for links & pictures
Description of the change
Improve facebook share ui for links & pictures
To post a comment you must log in.
- 134. By Alexandre Abreu
-
bump version to 1.4
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'webapp-facebook/manifest.json' |
2 | --- webapp-facebook/manifest.json 2016-02-11 11:24:27 +0000 |
3 | +++ webapp-facebook/manifest.json 2016-04-07 14:17:14 +0000 |
4 | @@ -19,5 +19,5 @@ |
5 | "maintainer": "Webapps Team <webapps@lists.launchpad.net>", |
6 | "name": "com.ubuntu.developer.webapps.webapp-facebook", |
7 | "title": "Facebook", |
8 | - "version": "1.2.3" |
9 | + "version": "1.4" |
10 | } |
11 | |
12 | === modified file 'webapp-facebook/unity-webapps-facebook/HubSharer.qml' |
13 | --- webapp-facebook/unity-webapps-facebook/HubSharer.qml 2015-04-16 14:59:02 +0000 |
14 | +++ webapp-facebook/unity-webapps-facebook/HubSharer.qml 2016-04-07 14:17:14 +0000 |
15 | @@ -1,6 +1,22 @@ |
16 | -import QtQuick 2.0 |
17 | -import Ubuntu.Components 0.1 |
18 | -import Ubuntu.Content 0.1 |
19 | +/* |
20 | + * Copyright (C) 2016 Canonical, Ltd. |
21 | + * |
22 | + * This program is free software; you can redistribute it and/or modify |
23 | + * it under the terms of the GNU General Public License as published by |
24 | + * the Free Software Foundation; version 3. |
25 | + * |
26 | + * This program is distributed in the hope that it will be useful, |
27 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | + * GNU General Public License for more details. |
30 | + * |
31 | + * You should have received a copy of the GNU General Public License |
32 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
33 | + */ |
34 | + |
35 | +import QtQuick 2.4 |
36 | +import Ubuntu.Components 1.3 |
37 | +import Ubuntu.Content 1.3 |
38 | |
39 | Item { |
40 | id: main |
41 | @@ -59,7 +75,7 @@ |
42 | contentType: main.contentType |
43 | callback: _callback |
44 | |
45 | - onCanceled: { |
46 | + onCancelled: { |
47 | completed(JSON.stringify({status: "cancelled"}), |
48 | function(result) { uploadCompleted(result); }); |
49 | main.destroy(); |
50 | |
51 | === modified file 'webapp-facebook/unity-webapps-facebook/Share.qml' |
52 | --- webapp-facebook/unity-webapps-facebook/Share.qml 2015-09-21 15:53:37 +0000 |
53 | +++ webapp-facebook/unity-webapps-facebook/Share.qml 2016-04-07 14:17:14 +0000 |
54 | @@ -1,5 +1,5 @@ |
55 | /* |
56 | - * Copyright (C) 2012-2013 Canonical, Ltd. |
57 | + * Copyright (C) 2012-2013-2016 Canonical, Ltd. |
58 | * |
59 | * This program is free software; you can redistribute it and/or modify |
60 | * it under the terms of the GNU General Public License as published by |
61 | @@ -14,13 +14,14 @@ |
62 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
63 | */ |
64 | |
65 | -import QtQuick 2.0 |
66 | +import QtQuick 2.4 |
67 | import QtQuick.Window 2.0 |
68 | -import Ubuntu.Components 0.1 |
69 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
70 | +import Ubuntu.Components 1.3 |
71 | +import Ubuntu.Components.ListItems 1.3 as ListItem |
72 | import Ubuntu.OnlineAccounts 0.1 |
73 | import Ubuntu.OnlineAccounts.Client 0.1 |
74 | |
75 | + |
76 | Item { |
77 | id: root |
78 | anchors.fill: parent |
79 | @@ -29,6 +30,7 @@ |
80 | property string contentType |
81 | property var callback |
82 | |
83 | + readonly property string applicationId: "com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook" |
84 | readonly property string serviceType: "webapps" |
85 | readonly property string provider: "facebook" |
86 | |
87 | @@ -37,17 +39,36 @@ |
88 | property var account |
89 | |
90 | signal accountSelected |
91 | - signal canceled |
92 | + signal cancelled |
93 | signal uploadCompleted(bool success) |
94 | |
95 | onUploadCompleted: { |
96 | - activitySpinner.visible = false; |
97 | + shareComponent.shareCompleted(success); |
98 | if (success) |
99 | print ("Successfully posted"); |
100 | else |
101 | print ("Failed to post"); |
102 | } |
103 | |
104 | + ShareComponent { |
105 | + id: shareComponent |
106 | + visible: false |
107 | + |
108 | + anchors.fill: parent |
109 | + |
110 | + accountProviderIconName: root.account.provider.iconName |
111 | + accountProviderDisplayName: root.account.displayName |
112 | + |
113 | + resourceToShare: root.fileToShare |
114 | + contentType: root.contentType |
115 | + |
116 | + onCancelled: root.cancelled() |
117 | + onShare: callback(root.accessToken, |
118 | + root.fileToShare, |
119 | + userMessage, |
120 | + uploadCompleted); |
121 | + } |
122 | + |
123 | AccountServiceModel { |
124 | id: accounts |
125 | serviceType: root.serviceType |
126 | @@ -73,193 +94,6 @@ |
127 | } |
128 | } |
129 | |
130 | - Item { |
131 | - id: shareComponent |
132 | - objectName: "shareComponent" |
133 | - anchors { |
134 | - left: parent.left |
135 | - right: parent.right |
136 | - } |
137 | - visible: false |
138 | - |
139 | - Column { |
140 | - anchors.fill: parent |
141 | - spacing: units.gu(1) |
142 | - |
143 | - Item { |
144 | - id: serviceHeader |
145 | - y: 0 |
146 | - anchors.left: parent.left |
147 | - anchors.right: parent.right |
148 | - anchors.topMargin: units.gu(1) |
149 | - anchors.leftMargin: units.gu(1) |
150 | - anchors.rightMargin: units.gu(1) |
151 | - height: childrenRect.height |
152 | - |
153 | - ListItem.Subtitled { |
154 | - anchors { |
155 | - left: parent.left |
156 | - right: parent.right |
157 | - } |
158 | - iconName: root.account.provider.iconName |
159 | - text: root.account.provider.displayName |
160 | - subText: root.account.displayName |
161 | - showDivider: false |
162 | - } |
163 | - } |
164 | - |
165 | - ListItem.ThinDivider {} |
166 | - |
167 | - UbuntuShape { |
168 | - id: messageArea |
169 | - objectName: "messageArea" |
170 | - anchors.left: parent.left |
171 | - anchors.right: parent.right |
172 | - anchors.topMargin: units.gu(1) |
173 | - anchors.leftMargin: units.gu(1) |
174 | - anchors.rightMargin: units.gu(1) |
175 | - height: units.gu(20) |
176 | - color: "#f2f2f2" |
177 | - |
178 | - TextArea { |
179 | - id: message |
180 | - //color: "#333333" |
181 | - anchors.top: parent.top |
182 | - anchors.left: snapshot.right |
183 | - anchors.bottom: parent.bottom |
184 | - anchors.margins: units.gu(1) |
185 | - wrapMode: Text.Wrap |
186 | - width: parent.width - snapshot.width - |
187 | - snapshot.anchors.margins * 2 - |
188 | - message.anchors.leftMargin - message.anchors.rightMargin |
189 | - clip: true |
190 | - font.pixelSize: FontUtils.sizeToPixels("medium") |
191 | - font.weight: Font.Light |
192 | - focus: true |
193 | - } |
194 | - |
195 | - ActivityIndicator { |
196 | - id: activitySpinner |
197 | - anchors.centerIn: message |
198 | - visible: false |
199 | - running: visible |
200 | - } |
201 | - |
202 | - UbuntuShape { |
203 | - id: snapshot |
204 | - |
205 | - anchors.top: parent.top |
206 | - anchors.left: parent.left |
207 | - anchors.margins: units.gu(1) |
208 | - width: units.gu(10) |
209 | - height: units.gu(10) |
210 | - |
211 | - image: Image { |
212 | - source: contentType === 'Pictures' ? fileToShare : null |
213 | - visible: contentType === 'Pictures' |
214 | - sourceSize.height: snapshot.height |
215 | - sourceSize.width: snapshot.width |
216 | - fillMode: Image.PreserveAspectCrop |
217 | - } |
218 | - } |
219 | - } |
220 | - |
221 | - Item { |
222 | - id: actionsBar |
223 | - anchors.left: parent.left |
224 | - anchors.right: parent.right |
225 | - anchors.topMargin: units.gu(2) |
226 | - anchors.leftMargin: units.gu(1) |
227 | - anchors.rightMargin: units.gu(1) |
228 | - height: childrenRect.height |
229 | - |
230 | - Button { |
231 | - objectName: "cancelButton" |
232 | - anchors.left: parent.left |
233 | - text: i18n.dtr("ubuntu-ui-extras", "Cancel") |
234 | - color: "#cccccc" |
235 | - width: units.gu(10) |
236 | - height: units.gu(4) |
237 | - onClicked: canceled() |
238 | - } |
239 | - |
240 | - Button { |
241 | - objectName: "postButton" |
242 | - anchors.right: parent.right |
243 | - anchors.top: parent.top |
244 | - text: i18n.dtr("ubuntu-ui-extras", "Post") |
245 | - color: "#dd4814" |
246 | - width: units.gu(10) |
247 | - height: units.gu(4) |
248 | - enabled: !activitySpinner.visible |
249 | - onClicked: { |
250 | - activitySpinner.visible = true; |
251 | - callback(accessToken, |
252 | - fileToShare, |
253 | - message.text, |
254 | - uploadCompleted); |
255 | - } |
256 | - } |
257 | - } |
258 | - |
259 | - // toggle to enable including location - Not implemented yet |
260 | - /* |
261 | - UbuntuShape { |
262 | - id: useLocation |
263 | - anchors { |
264 | - left: parent.left |
265 | - leftMargin: units.gu(1) |
266 | - topMargin: units.gu(1) |
267 | - } |
268 | - color: selected ? "#cccccc" : "transparent" |
269 | - property bool selected: false |
270 | - width: units.gu(4.5) |
271 | - height: units.gu(4) |
272 | - |
273 | - AbstractButton { |
274 | - anchors.fill: parent |
275 | - onClicked: parent.selected = !parent.selected |
276 | - Image { |
277 | - source: "assets/icon_location.png" |
278 | - anchors.centerIn: parent |
279 | - height: parent.height * 0.75 |
280 | - fillMode: Image.PreserveAspectFit |
281 | - smooth: true |
282 | - } |
283 | - } |
284 | - } |
285 | - |
286 | - Label { |
287 | - anchors.left: useLocation.right |
288 | - anchors.baseline: useLocation.top |
289 | - anchors.baselineOffset: units.gu(3) |
290 | - anchors.leftMargin: units.gu(1) |
291 | - text: i18n.dtr("ubuntu-ui-extras", "Include location") |
292 | - fontSize: "small" |
293 | - } |
294 | - */ |
295 | - // End location toggle |
296 | - |
297 | - } |
298 | - |
299 | - states: [ |
300 | - State { |
301 | - name: "landscape-with-keyborad" |
302 | - PropertyChanges { |
303 | - target: serviceHeader |
304 | - y: - serviceHeader.height |
305 | - } |
306 | - PropertyChanges { |
307 | - target: messageArea |
308 | - height: units.gu(12) |
309 | - } |
310 | - } |
311 | - ] |
312 | - |
313 | - state: ((Screen.orientation === Qt.LandscapeOrientation) || |
314 | - (Screen.orientation === Qt.InvertedLandscapeOrientation)) && |
315 | - Qt.inputMethod.visible ? "landscape-with-keyborad" : "" |
316 | - } |
317 | |
318 | /* Menu listing online accounts */ |
319 | Item { |
320 | @@ -381,12 +215,12 @@ |
321 | |
322 | ProviderModel { |
323 | id: providerModel |
324 | - applicationId: "com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook" |
325 | + applicationId: applicationId |
326 | } |
327 | |
328 | Setup { |
329 | id: setup |
330 | - applicationId: "com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook" |
331 | + applicationId: applicationId |
332 | } |
333 | } |
334 | } |
335 | |
336 | === added file 'webapp-facebook/unity-webapps-facebook/ShareComponent.qml' |
337 | --- webapp-facebook/unity-webapps-facebook/ShareComponent.qml 1970-01-01 00:00:00 +0000 |
338 | +++ webapp-facebook/unity-webapps-facebook/ShareComponent.qml 2016-04-07 14:17:14 +0000 |
339 | @@ -0,0 +1,285 @@ |
340 | +/* |
341 | + * Copyright (C) 2016 Canonical, Ltd. |
342 | + * |
343 | + * This program is free software; you can redistribute it and/or modify |
344 | + * it under the terms of the GNU General Public License as published by |
345 | + * the Free Software Foundation; version 3. |
346 | + * |
347 | + * This program is distributed in the hope that it will be useful, |
348 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
349 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
350 | + * GNU General Public License for more details. |
351 | + * |
352 | + * You should have received a copy of the GNU General Public License |
353 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
354 | + */ |
355 | + |
356 | +import QtQuick 2.4 |
357 | +import QtQuick.Window 2.0 |
358 | +import Ubuntu.Components 1.3 |
359 | +import Ubuntu.Components.ListItems 1.3 as ListItem |
360 | + |
361 | +Item { |
362 | + id: shareComponent |
363 | + |
364 | + property string accountProviderIconName |
365 | + property string accountProviderDisplayName |
366 | + property string contentType |
367 | + property string resourceToShare |
368 | + |
369 | + signal cancelled() |
370 | + signal share(string userMessage) |
371 | + |
372 | + objectName: "shareComponent" |
373 | + |
374 | + function shareSuccessful(result) { |
375 | + activitySpinner.visible = result |
376 | + } |
377 | + |
378 | + ActivityIndicator { |
379 | + id: activitySpinner |
380 | + |
381 | + anchors.centerIn: parent |
382 | + z: 1 |
383 | + visible: false |
384 | + |
385 | + running: visible |
386 | + } |
387 | + |
388 | + Column { |
389 | + id: bla |
390 | + |
391 | + anchors.fill: parent |
392 | + |
393 | + spacing: units.gu(1) |
394 | + |
395 | + Item { |
396 | + id: serviceHeader |
397 | + |
398 | + anchors.left: parent.left |
399 | + anchors.right: parent.right |
400 | + |
401 | + anchors.topMargin: units.gu(1) |
402 | + anchors.leftMargin: units.gu(1) |
403 | + anchors.rightMargin: units.gu(1) |
404 | + |
405 | + height: childrenRect.height |
406 | + |
407 | + ListItem.Subtitled { |
408 | + anchors { |
409 | + left: parent.left |
410 | + right: parent.right |
411 | + } |
412 | + |
413 | + iconName: accountProviderIconName |
414 | + text: accountProviderDisplayName |
415 | + subText: accountProviderDisplayName |
416 | + |
417 | + showDivider: false |
418 | + } |
419 | + } |
420 | + |
421 | + ListItem.ThinDivider {} |
422 | + |
423 | + Rectangle { |
424 | + id: messageArea |
425 | + objectName: "messageArea" |
426 | + |
427 | + anchors.left: parent.left |
428 | + anchors.right: parent.right |
429 | + anchors.topMargin: units.gu(1) |
430 | + anchors.leftMargin: units.gu(1) |
431 | + anchors.rightMargin: units.gu(1) |
432 | + |
433 | + height: units.gu(30) |
434 | + |
435 | + color: "#f2f2f2" |
436 | + |
437 | + Column { |
438 | + anchors.fill: parent |
439 | + |
440 | + spacing: units.gu(1) |
441 | + |
442 | + Rectangle { |
443 | + id: sharedResourcePreview |
444 | + |
445 | + visible: contentType === 'Pictures' || contentType === 'Links' |
446 | + |
447 | + color: "#f2f2f2" |
448 | + |
449 | + anchors.left: parent.left |
450 | + anchors.right: parent.right |
451 | + |
452 | + anchors.margins: units.gu(1) |
453 | + |
454 | + height: units.gu(15) |
455 | + |
456 | + UbuntuShape { |
457 | + id: imageSnapshot |
458 | + |
459 | + anchors.verticalCenter: parent.verticalCenter |
460 | + |
461 | + height: units.gu(13) |
462 | + width: units.gu(13) |
463 | + |
464 | + visible: contentType === 'Pictures' |
465 | + |
466 | + source: Image { |
467 | + source: contentType === 'Pictures' ? resourceToShare : '' |
468 | + sourceSize.height: imageSnapshot.height |
469 | + sourceSize.width: imageSnapshot.width |
470 | + fillMode: Image.PreserveAspectCrop |
471 | + } |
472 | + } |
473 | + Text { |
474 | + id: linksSnapshot |
475 | + |
476 | + anchors.left: parent.left |
477 | + anchors.right: parent.right |
478 | + |
479 | + anchors.verticalCenter: parent.verticalCenter |
480 | + |
481 | + anchors.margins: units.gu(1) |
482 | + |
483 | + visible: contentType === 'Links' |
484 | + |
485 | + wrapMode: Text.NoWrap |
486 | + text: resourceToShare |
487 | + clip: true |
488 | + elide: Text.ElideRight |
489 | + |
490 | + font.pixelSize: FontUtils.sizeToPixels("medium") |
491 | + font.weight: Font.Light |
492 | + } |
493 | + } |
494 | + |
495 | + TextArea { |
496 | + id: message |
497 | + |
498 | + //color: "#333333" |
499 | + |
500 | + anchors.left: parent.left |
501 | + anchors.right: parent.right |
502 | + |
503 | + anchors.margins: units.gu(1) |
504 | + |
505 | + wrapMode: Text.Wrap |
506 | + |
507 | + clip: true |
508 | + font.pixelSize: FontUtils.sizeToPixels("medium") |
509 | + font.weight: Font.Light |
510 | + focus: true |
511 | + } |
512 | + } |
513 | + } |
514 | + |
515 | + Item { |
516 | + id: actionsBar |
517 | + |
518 | + anchors.left: parent.left |
519 | + anchors.right: parent.right |
520 | + anchors.topMargin: units.gu(2) |
521 | + anchors.leftMargin: units.gu(1) |
522 | + anchors.rightMargin: units.gu(1) |
523 | + |
524 | + height: childrenRect.height |
525 | + |
526 | + Button { |
527 | + objectName: "cancelButton" |
528 | + |
529 | + anchors.left: parent.left |
530 | + |
531 | + text: i18n.dtr("ubuntu-ui-extras", "Cancel") |
532 | + |
533 | + color: "#cccccc" |
534 | + |
535 | + width: units.gu(10) |
536 | + height: units.gu(4) |
537 | + |
538 | + onClicked: cancelled() |
539 | + } |
540 | + |
541 | + Button { |
542 | + objectName: "shareButton" |
543 | + |
544 | + anchors.right: parent.right |
545 | + anchors.top: parent.top |
546 | + |
547 | + text: i18n.dtr("ubuntu-ui-extras", "Share") |
548 | + color: "#dd4814" |
549 | + |
550 | + width: units.gu(10) |
551 | + height: units.gu(4) |
552 | + |
553 | + enabled: !activitySpinner.visible |
554 | + |
555 | + onClicked: { |
556 | + if (activitySpinner.visible) { |
557 | + return; |
558 | + } |
559 | + |
560 | + activitySpinner.visible = true; |
561 | + |
562 | + share(message.text); |
563 | + } |
564 | + } |
565 | + } |
566 | + |
567 | + // toggle to enable including location - Not implemented yet |
568 | + /* |
569 | + UbuntuShape { |
570 | + id: useLocation |
571 | + anchors { |
572 | + left: parent.left |
573 | + leftMargin: units.gu(1) |
574 | + topMargin: units.gu(1) |
575 | + } |
576 | + color: selected ? "#cccccc" : "transparent" |
577 | + property bool selected: false |
578 | + width: units.gu(4.5) |
579 | + height: units.gu(4) |
580 | + |
581 | + AbstractButton { |
582 | + anchors.fill: parent |
583 | + onClicked: parent.selected = !parent.selected |
584 | + Image { |
585 | + source: "assets/icon_location.png" |
586 | + anchors.centerIn: parent |
587 | + height: parent.height * 0.75 |
588 | + fillMode: Image.PreserveAspectFit |
589 | + smooth: true |
590 | + } |
591 | + } |
592 | + } |
593 | + |
594 | + Label { |
595 | + anchors.left: useLocation.right |
596 | + anchors.baseline: useLocation.top |
597 | + anchors.baselineOffset: units.gu(3) |
598 | + anchors.leftMargin: units.gu(1) |
599 | + text: i18n.dtr("ubuntu-ui-extras", "Include location") |
600 | + fontSize: "small" |
601 | + } |
602 | + */ |
603 | + // End location toggle |
604 | + |
605 | + } |
606 | + |
607 | + states: [ |
608 | + State { |
609 | + name: "landscape-with-keyborad" |
610 | + PropertyChanges { |
611 | + target: serviceHeader |
612 | + y: - serviceHeader.height |
613 | + } |
614 | + PropertyChanges { |
615 | + target: messageArea |
616 | + height: units.gu(12) |
617 | + } |
618 | + } |
619 | + ] |
620 | + |
621 | + state: ((Screen.orientation === Qt.LandscapeOrientation) || |
622 | + (Screen.orientation === Qt.InvertedLandscapeOrientation)) && |
623 | + Qt.inputMethod.visible ? "landscape-with-keyborad" : "" |
624 | +} |
LGTM!