Merge lp:~bfiller/gallery-app/gallery-app-share-handler into lp:gallery-app

Proposed by Bill Filler
Status: Merged
Approved by: Bill Filler
Approved revision: 933
Merged at revision: 1008
Proposed branch: lp:~bfiller/gallery-app/gallery-app-share-handler
Merge into: lp:gallery-app
Diff against target: 357 lines (+80/-96)
4 files modified
po/gallery-app.pot (+33/-37)
rc/qml/MediaViewer/MediaViewer.qml (+25/-55)
tests/autopilot/gallery_app/emulators/photo_viewer.py (+9/-4)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+13/-0)
To merge this branch: bzr merge lp:~bfiller/gallery-app/gallery-app-share-handler
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+225355@code.launchpad.net

This proposal supersedes a proposal from 2014-06-20.

Commit message

Switch to using the content-hub for sharing. When selecting the share action, the ContentPeerPicker will be shown with a list of apps that provide sharing.

Description of the change

Switch to using the content-hub for sharing. When selecting the share action, the ContentPeerPicker will be shown with a list of apps that provide sharing.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
932. By Bill Filler

fix import

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
933. By Bill Filler

fix test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

went through the test plan, all working
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
yes

Did CI run pass? If not, please explain why.
yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/gallery-app.pot'
2--- po/gallery-app.pot 2014-05-09 19:52:57 +0000
3+++ po/gallery-app.pot 2014-07-02 22:11:28 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: gallery-app\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2014-05-09 16:45-0300\n"
9+"POT-Creation-Date: 2014-06-05 11:23-0400\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -17,7 +17,7 @@
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16
17-#: desktop/gallery-app.desktop.in:3 rc/qml/MediaViewer/PopupPhotoViewer.qml:65
18+#: desktop/gallery-app.desktop.in:3 rc/qml/MediaViewer/PopupPhotoViewer.qml:64
19 msgid "Gallery"
20 msgstr ""
21
22@@ -34,16 +34,16 @@
23 msgstr ""
24
25 #: rc/qml/AlbumEditor/AlbumEditMenu.qml:50
26-#: rc/qml/AlbumViewer/AlbumViewer.qml:439
27-#: rc/qml/MediaViewer/MediaViewer.qml:488
28-#: rc/qml/MediaViewer/MediaViewer.qml:494
29-#: rc/qml/MediaViewer/MediaViewer.qml:548 rc/qml/Utility/EditingHUD.qml:67
30+#: rc/qml/AlbumViewer/AlbumViewer.qml:438
31+#: rc/qml/MediaViewer/MediaViewer.qml:479
32+#: rc/qml/MediaViewer/MediaViewer.qml:485
33+#: rc/qml/MediaViewer/MediaViewer.qml:538 rc/qml/Utility/EditingHUD.qml:67
34 #: rc/qml/Utility/SelectionToolbarAction.qml:51
35 msgid "Delete"
36 msgstr ""
37
38 #: rc/qml/AlbumEditor/AlbumEditor.qml:40
39-#: rc/qml/Components/MediaSelector.qml:90 rc/qml/PickerScreen.qml:114
40+#: rc/qml/Components/MediaSelector.qml:92 rc/qml/PickerScreen.qml:114
41 #: rc/qml/Utility/SelectionToolbarAction.qml:66
42 msgid "Cancel"
43 msgstr ""
44@@ -68,42 +68,42 @@
45 msgid "Red"
46 msgstr ""
47
48-#: rc/qml/AlbumViewer/AlbumViewer.qml:84
49+#: rc/qml/AlbumViewer/AlbumViewer.qml:90
50 msgid "Album"
51 msgstr ""
52
53-#: rc/qml/AlbumViewer/AlbumViewer.qml:428
54+#: rc/qml/AlbumViewer/AlbumViewer.qml:427
55 msgid "Add to album"
56 msgstr ""
57
58-#: rc/qml/AlbumViewer/AlbumViewer.qml:434
59-#: rc/qml/MediaViewer/MediaViewer.qml:483
60-#: rc/qml/MediaViewer/MediaViewer.qml:538 rc/qml/Utility/EditingHUD.qml:77
61+#: rc/qml/AlbumViewer/AlbumViewer.qml:433
62+#: rc/qml/MediaViewer/MediaViewer.qml:474
63+#: rc/qml/MediaViewer/MediaViewer.qml:528 rc/qml/Utility/EditingHUD.qml:77
64 #: rc/qml/Utility/SelectionToolbarAction.qml:44
65 msgid "Add"
66 msgstr ""
67
68-#: rc/qml/AlbumViewer/AlbumViewer.qml:448
69-#: rc/qml/MediaViewer/MediaViewer.qml:512
70-#: rc/qml/MediaViewer/MediaViewer.qml:567
71+#: rc/qml/AlbumViewer/AlbumViewer.qml:447
72+#: rc/qml/MediaViewer/MediaViewer.qml:502
73+#: rc/qml/MediaViewer/MediaViewer.qml:557
74 msgid "Back"
75 msgstr ""
76
77-#: rc/qml/AlbumsOverview.qml:186 rc/qml/Components/PopupAlbumPicker.qml:91
78+#: rc/qml/AlbumsOverview.qml:197 rc/qml/Components/PopupAlbumPicker.qml:91
79 msgid "Add new album"
80 msgstr ""
81
82-#: rc/qml/AlbumsOverview.qml:204 rc/qml/Utility/PhotosToolbarActions.qml:46
83+#: rc/qml/AlbumsOverview.qml:215 rc/qml/Utility/PhotosToolbarActions.qml:46
84 msgid "Camera"
85 msgstr ""
86
87 #: rc/qml/Components/DeleteDialog.qml:36
88-#: rc/qml/MediaViewer/MediaViewer.qml:297
89+#: rc/qml/MediaViewer/MediaViewer.qml:288
90 msgid "Yes"
91 msgstr ""
92
93 #: rc/qml/Components/DeleteDialog.qml:45
94-#: rc/qml/MediaViewer/MediaViewer.qml:308
95+#: rc/qml/MediaViewer/MediaViewer.qml:299
96 msgid "No"
97 msgstr ""
98
99@@ -115,8 +115,8 @@
100 msgid "Delete album + contents"
101 msgstr ""
102
103-#: rc/qml/Components/MediaSelector.qml:56
104-#: rc/qml/Components/MediaSelector.qml:78
105+#: rc/qml/Components/MediaSelector.qml:59
106+#: rc/qml/Components/MediaSelector.qml:80
107 msgid "Add to Album"
108 msgstr ""
109
110@@ -128,21 +128,21 @@
111 msgid "Loading…"
112 msgstr ""
113
114-#: rc/qml/MainScreen.qml:80
115+#: rc/qml/MainScreen.qml:96
116 msgid "Albums"
117 msgstr ""
118
119-#: rc/qml/MainScreen.qml:97 rc/qml/MainScreen.qml:120
120+#: rc/qml/MainScreen.qml:113 rc/qml/MainScreen.qml:136
121 #: rc/qml/PickerScreen.qml:54
122 msgid "Events"
123 msgstr ""
124
125-#: rc/qml/MainScreen.qml:118 rc/qml/MainScreen.qml:162
126+#: rc/qml/MainScreen.qml:134 rc/qml/MainScreen.qml:178
127 #: rc/qml/Utility/PhotosToolbarActions.qml:33
128 msgid "Select"
129 msgstr ""
130
131-#: rc/qml/MainScreen.qml:130 rc/qml/MainScreen.qml:164
132+#: rc/qml/MainScreen.qml:146 rc/qml/MainScreen.qml:180
133 #: rc/qml/PickerScreen.qml:74
134 msgid "Photos"
135 msgstr ""
136@@ -172,37 +172,33 @@
137 msgid "Revert to original"
138 msgstr ""
139
140-#: rc/qml/MediaViewer/MediaViewer.qml:234
141-msgid "Configure Facebook for photo sharing..."
142-msgstr ""
143-
144-#: rc/qml/MediaViewer/MediaViewer.qml:286 rc/qml/PhotosOverview.qml:75
145+#: rc/qml/MediaViewer/MediaViewer.qml:277 rc/qml/PhotosOverview.qml:75
146 msgid "Delete a photo"
147 msgstr ""
148
149-#: rc/qml/MediaViewer/MediaViewer.qml:464
150+#: rc/qml/MediaViewer/MediaViewer.qml:455
151 msgid "Edit"
152 msgstr ""
153
154-#: rc/qml/MediaViewer/MediaViewer.qml:475
155+#: rc/qml/MediaViewer/MediaViewer.qml:466
156 msgid "Add photo to album"
157 msgstr ""
158
159-#: rc/qml/MediaViewer/MediaViewer.qml:501
160+#: rc/qml/MediaViewer/MediaViewer.qml:492
161 msgid "Share photo"
162 msgstr ""
163
164-#: rc/qml/MediaViewer/MediaViewer.qml:507
165-#: rc/qml/MediaViewer/MediaViewer.qml:558 rc/qml/Utility/EditingHUD.qml:72
166+#: rc/qml/MediaViewer/MediaViewer.qml:498
167+#: rc/qml/MediaViewer/MediaViewer.qml:548 rc/qml/Utility/EditingHUD.qml:72
168 #: rc/qml/Utility/SelectionToolbarAction.qml:58
169 msgid "Share"
170 msgstr ""
171
172-#: rc/qml/MediaViewer/MediaViewer.qml:525
173+#: rc/qml/MediaViewer/MediaViewer.qml:515
174 msgid "Pause"
175 msgstr ""
176
177-#: rc/qml/MediaViewer/MediaViewer.qml:525
178+#: rc/qml/MediaViewer/MediaViewer.qml:515
179 msgid "Play"
180 msgstr ""
181
182
183=== modified file 'rc/qml/MediaViewer/MediaViewer.qml'
184--- rc/qml/MediaViewer/MediaViewer.qml 2014-06-17 03:23:39 +0000
185+++ rc/qml/MediaViewer/MediaViewer.qml 2014-07-02 22:11:28 +0000
186@@ -23,7 +23,7 @@
187 import Ubuntu.Components 0.1
188 import Ubuntu.Components.Popups 0.1
189 import Ubuntu.Components.ListItems 0.1 as ListItem
190-import Ubuntu.Components.Extras 0.1
191+import Ubuntu.Content 0.1
192 import "../Components"
193 import "../Utility"
194 import "../../js/Gallery.js" as Gallery
195@@ -224,42 +224,32 @@
196 !editHUD.actionActive
197
198 Component {
199- id: shareConfigurePopover
200-
201- ActionSelectionPopover {
202- objectName: "shareConfigurePopover"
203- visible: false
204- actions: ActionList {
205- Action {
206- text: i18n.tr("Configure Facebook for photo sharing...")
207- onTriggered: {
208- Qt.openUrlExternally("settings:///system/online-accounts");
209- }
210- }
211- }
212- }
213+ id: contentItemComp
214+ ContentItem {}
215 }
216
217- FacebookAccount {
218- id: facebook
219-
220- property ActionSelectionPopover _lastPopover: null
221-
222- function configureOrStartSharing(button) {
223- if (_lastPopover) {
224- PopupUtils.close(_lastPopover);
225- _lastPopover = null;
226- } else {
227- if (facebook.id == -1) {
228- _lastPopover = PopupUtils.open(shareConfigurePopover, button);
229- } else {
230- sharePanel.fileToShare = viewerWrapper.media.path;
231- sharePanel.userAccountId = facebook.id;
232- sharePanel.visible = true;
233- viewerWrapper.tools.opened = false;
234- _lastPopover = null;
235+ Rectangle {
236+ id: sharePicker
237+ anchors.fill: parent
238+ visible: false
239+
240+ ContentPeerPicker {
241+ objectName: "sharePicker"
242+ anchors.fill: parent
243+ visible: parent.visible
244+ contentType: galleryPhotoViewer.media.type === MediaSource.Video ? ContentType.Videos : ContentType.Pictures
245+ handler: ContentHandler.Share
246+
247+ onPeerSelected: {
248+ parent.visible = false;
249+ var curTransfer = peer.request();
250+ if (curTransfer.state === ContentTransfer.InProgress)
251+ {
252+ curTransfer.items = [ contentItemComp.createObject(parent, {"url": viewerWrapper.media.path}) ];
253+ curTransfer.state = ContentTransfer.Charged;
254 }
255 }
256+ onCancelPressed: parent.visible = false;
257 }
258 }
259
260@@ -546,7 +536,7 @@
261 text: i18n.tr("Share photo")
262 iconSource: "../../img/share.png"
263 onTriggered: {
264- facebook.configureOrStartSharing(photoShareButton);
265+ sharePicker.visible = true;
266 }
267 }
268 text: i18n.tr("Share")
269@@ -602,7 +592,7 @@
270 text: i18n.tr("Share")
271 iconSource: "../../img/share.png"
272 onTriggered: {
273- facebook.configureOrStartSharing(videoShareButton);
274+ sharePicker.visible = true;
275 }
276 }
277
278@@ -617,24 +607,4 @@
279 }
280 }
281 }
282-
283- Loader {
284- id: sharePanel
285- anchors.fill: parent
286- visible: false
287- sourceComponent: (fileToShare !== "" && userAccountId !== "") ? component_sharePanel : null
288-
289- property string fileToShare
290- property string userAccountId
291-
292- Component {
293- id: component_sharePanel
294- Share {
295- fileToShare: sharePanel.fileToShare
296- userAccountId: sharePanel.userAccountId
297- onUploadCompleted: sharePanel.visible = false;
298- onCanceled: sharePanel.visible = false;
299- }
300- }
301- }
302 }
303
304=== modified file 'tests/autopilot/gallery_app/emulators/photo_viewer.py'
305--- tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-06-13 13:57:20 +0000
306+++ tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-07-02 22:11:28 +0000
307@@ -29,10 +29,15 @@
308 return self.app.wait_select_single("PopupAlbumPicker",
309 objectName="popupAlbumPicker")
310
311- def get_share_dialog(self):
312- """Returns the photo viewer share dialog."""
313- return self.app.wait_select_single("SharePopover",
314- objectName="sharePopover")
315+ def get_content_peer_picker_cancel_button(self):
316+ """Returns the ContentPeerPicker cancel button."""
317+ return self.app.wait_select_single("Button",
318+ objectName="contentPeerPickerCancelButton")
319+
320+ def get_share_peer_picker(self):
321+ """Returns the photo viewer share picker."""
322+ return self.app.wait_select_single("ContentPeerPicker",
323+ objectName="sharePicker")
324
325 def get_photo_edit_dialog(self):
326 """Returns the photo edit dialog."""
327
328=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
329--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-05-20 15:19:35 +0000
330+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-07-02 22:11:28 +0000
331@@ -10,6 +10,8 @@
332
333 from testtools.matchers import Equals, NotEquals, GreaterThan, Is
334 from autopilot.matchers import Eventually
335+from testtools import skipIf
336+from autopilot.platform import model
337
338 from gallery_app.emulators.photo_viewer import PhotoViewer
339 from gallery_app.emulators.media_viewer import MediaViewer
340@@ -109,6 +111,17 @@
341 photo_viewer = self.photo_viewer.get_main_photo_viewer()
342 self.assertThat(photo_viewer.visible, Eventually(Equals(False)))
343
344+ @skipIf(model() == 'Desktop', 'Share not supported on desktop')
345+ def test_share_button(self):
346+ """Clicking the share button must show the ContentPeerPicker."""
347+ photo_viewer = self.photo_viewer.get_main_photo_viewer()
348+ self.main_view.open_toolbar().click_button("shareButton")
349+ share_picker = self.photo_viewer.get_share_peer_picker()
350+ self.assertThat(share_picker.visible, Eventually(Equals(True)))
351+ cancel_button = self.photo_viewer.get_content_peer_picker_cancel_button()
352+ self.click_item(cancel_button)
353+ self.assertThat(share_picker.visible, Eventually(Equals(False)))
354+
355 def delete_one_picture(self):
356 self.main_view.open_toolbar().click_button("deleteButton")
357 self.get_delete_dialog()

Subscribers

People subscribed via source and target branches