ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01203
[Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
Andrew Hayzen has proposed merging lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app.
Commit message:
* Delay urlhandler/content-hub calls until after walkthrough is complete
Requested reviews:
Music App Developers (music-app-dev)
Related bugs:
Bug #1438317 in Ubuntu Music App: "[music] Using content-hub or url-handler on first run causes the walkthrough issues"
https://bugs.launchpad.net/music-app/+bug/1438317
For more details, see:
https://code.launchpad.net/~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough/+merge/254756
* Delay urlhandler/content-hub calls until after walkthrough is complete
TESTING:
Set firstRun=true in the config
* Start music app via scope (should delay until walkthrough is complete)
* Start music app via scope, don't dismiss walkthrough select another album via scope (should delay until walkthrough is complete and play second call)
* Start music app via content-hub import (should delay until walkthrough is complete)
* Start music app via content-hub import, don't dismiss walkthrough select another import (should delay until walkthrough is complete, import both and play second import)
Set firstRun=false in the config
* Start music app via scope (should play straight away)
* Start music app via content-hub import (should import and play straight away)
--
Your team Music App Developers is requested to review the proposed merge of lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app.
=== modified file 'music-app.qml'
--- music-app.qml 2015-03-24 02:17:30 +0000
+++ music-app.qml 2015-03-31 13:35:38 +0000
@@ -49,6 +49,13 @@
property bool firstRun: true
property int queueIndex: 0
property int tabIndex: -1
+
+ onFirstRunChanged: {
+ if (!firstRun) {
+ uriHandler.runDelayed()
+ contentHub.runDelayed()
+ }
+ }
}
// Global keyboard shortcuts
@@ -184,6 +191,8 @@
id: uriHandler
target: UriHandler
+ property var delayed: []
+
function processAlbum(uri) {
selectedAlbum = true;
var split = uri.split("/");
@@ -232,7 +241,10 @@
}
function process(uri, play) {
- if (uri.indexOf("album:///") === 0) {
+ if (firstRun) {
+ uriHandler.delayed.push([uri, play])
+ console.debug("Delaying uri call", uri)
+ } else if (uri.indexOf("album:///") === 0) {
uriHandler.processAlbum(uri.substring(9));
}
else if (uri.indexOf("file://") === 0) {
@@ -246,6 +258,13 @@
}
}
+ function runDelayed() {
+ for (var i=0; i < uriHandler.delayed.length; i++) {
+ console.debug("Running delayed uri call", uriHandler.delayed[i][0])
+ uriHandler.process(uriHandler.delayed[i][0], uriHandler.delayed[i][1])
+ }
+ }
+
onOpened: {
for (var i=0; i < uris.length; i++) {
console.debug("URI=" + uris[i])
@@ -270,62 +289,24 @@
Connections {
id: contentHub
target: ContentHub
+
+ property var delayed: []
+ property var searchPaths: []
+
onImportRequested: {
activeTransfer = transfer;
if (activeTransfer.state === ContentTransfer.Charged) {
importItems = activeTransfer.items;
- var processId = importId++;
-
- console.debug("Triggering content-hub import ID", processId);
-
- searchPaths = [];
-
- var err = [];
- var path;
- var res;
- var success = true;
- var url;
-
- for (var i=0; i < importItems.length; i++) {
- url = importItems[i].url.toString()
- console.debug("Triggered content-hub import for item", url)
-
- // fixed path allows for apparmor protection
- path = "~/Music/Imported/" + Qt.formatDateTime(new Date(), "yyyy/MM/dd/hhmmss") + "-" + url.split("/").pop()
- res = contentHub.importFile(importItems[i], path)
-
- if (res !== true) {
- success = false;
- err.push(url.split("/").pop() + " " + res)
- }
- }
-
-
- if (success === true) {
- if (contentHubWaitForFile.processId === -1) {
- contentHubWaitForFile.dialog = PopupUtils.open(contentHubWait, mainView)
- contentHubWaitForFile.searchPaths = contentHub.searchPaths;
- contentHubWaitForFile.processId = processId;
- contentHubWaitForFile.start();
-
- // Stop queue loading in bg
- queueLoaderWorker.canLoad = false
- } else {
- contentHubWaitForFile.searchPaths.push.apply(contentHubWaitForFile.searchPaths, contentHub.searchPaths);
- contentHubWaitForFile.count = 0;
- contentHubWaitForFile.restart();
- }
- }
- else {
- var errordialog = PopupUtils.open(contentHubError, mainView)
- errordialog.errorText = err.join("\n")
+ if (firstRun) {
+ console.debug("Delaying content-hub import")
+ contentHub.delayed.push(importItems)
+ } else {
+ contentHub.importRequested(importItems)
}
}
}
- property var searchPaths: []
-
function importFile(contentItem, path) {
var contentUrl = contentItem.url.toString()
@@ -373,6 +354,62 @@
}
}
}
+
+ function importRequested(importItems) {
+ var processId = importId++;
+
+ console.debug("Triggering content-hub import ID", processId);
+
+ searchPaths = [];
+
+ var err = [];
+ var path;
+ var res;
+ var success = true;
+ var url;
+
+ for (var i=0; i < importItems.length; i++) {
+ url = importItems[i].url.toString()
+ console.debug("Triggered content-hub import for item", url)
+
+ // fixed path allows for apparmor protection
+ path = "~/Music/Imported/" + Qt.formatDateTime(new Date(), "yyyy/MM/dd/hhmmss") + "-" + url.split("/").pop()
+ res = contentHub.importFile(importItems[i], path)
+
+ if (res !== true) {
+ success = false;
+ err.push(url.split("/").pop() + " " + res)
+ }
+ }
+
+
+ if (success === true) {
+ if (contentHubWaitForFile.processId === -1) {
+ contentHubWaitForFile.dialog = PopupUtils.open(contentHubWait, mainView)
+ contentHubWaitForFile.searchPaths = contentHub.searchPaths;
+ contentHubWaitForFile.processId = processId;
+ contentHubWaitForFile.start();
+
+ // Stop queue loading in bg
+ queueLoaderWorker.canLoad = false
+ } else {
+ contentHubWaitForFile.searchPaths.push.apply(contentHubWaitForFile.searchPaths, contentHub.searchPaths);
+ contentHubWaitForFile.count = 0;
+ contentHubWaitForFile.restart();
+ }
+ }
+ else {
+ var errordialog = PopupUtils.open(contentHubError, mainView)
+ errordialog.errorText = err.join("\n")
+ }
+ }
+
+ function runDelayed() {
+ for (var i=0; i < contentHub.delayed.length; i++) {
+ console.debug("Running delayed content-hub import")
+ contentHub.importRequested(contentHub.delayed[i])
+ }
+ }
}
Timer {
Follow ups
-
[Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: noreply, 2015-04-04
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-04
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Victor Thompson, 2015-04-04
-
[Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Victor Thompson, 2015-04-04
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Victor Thompson, 2015-04-03
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-03
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Victor Thompson, 2015-04-03
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-04-03
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Victor Thompson, 2015-04-02
-
Re: [Merge] lp:~ahayzen/music-app/fix-1438317-delay-urlhandler-contenthub-after-walkthrough into lp:music-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-03-31