Merge lp:~dano6/podbird/podbird into lp:podbird

Proposed by Daniel Kutka
Status: Merged
Merged at revision: 215
Proposed branch: lp:~dano6/podbird/podbird
Merge into: lp:podbird
Diff against target: 162 lines (+55/-7)
6 files modified
Podbird.apparmor (+2/-1)
app/podbird.qml (+11/-1)
app/ui/EpisodesPage.qml (+0/-2)
app/ui/EpisodesTab.qml (+0/-1)
app/ui/PodcastsTab.qml (+0/-2)
app/ui/SettingsPage.qml (+42/-0)
To merge this branch: bzr merge lp:~dano6/podbird/podbird
Reviewer Review Type Date Requested Status
Michael Sheldon Approve
Review via email: mp+396207@code.launchpad.net

Commit message

Do not turn off display during getting new episodes and add settings to adjust interval of autorefreshing podcasts

Description of the change

This MR should help with https://forums.ubports.com/topic/5138/podbird-freezing-on-start-for-about-1-minute
Getting new episodes with a lot of podcasts added it sometimes takes a minute or more. During that screen turns off, and it suspends the app. This MR should avoid suspending the app during getting new episodes.

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looks good, thanks!

review: Approve
lp:~dano6/podbird/podbird updated
215. By Michael Sheldon

Do not turn off display during getting new episodes and add settings to adjust interval of autorefreshing podcasts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Podbird.apparmor'
2--- Podbird.apparmor 2020-04-04 17:20:08 +0000
3+++ Podbird.apparmor 2021-01-12 21:27:54 +0000
4@@ -4,7 +4,8 @@
5 "audio",
6 "connectivity",
7 "usermetrics",
8- "content_exchange"
9+ "content_exchange",
10+ "keep-display-on"
11 ],
12 "policy_version": 16.04
13 }
14
15=== modified file 'app/podbird.qml'
16--- app/podbird.qml 2020-07-09 11:20:15 +0000
17+++ app/podbird.qml 2021-01-12 21:27:54 +0000
18@@ -24,6 +24,7 @@
19 import Ubuntu.Components 1.3
20 import QtQuick.LocalStorage 2.0
21 import Ubuntu.DownloadManager 1.2
22+import QtSystemInfo 5.5
23 import "ui"
24 import "themes" as Themes
25 import "podcasts.js" as Podcasts
26@@ -42,6 +43,12 @@
27 theme.name: settings.themeName == "Dark.qml" ? "Ubuntu.Components.Themes.SuruDark"
28 : "Ubuntu.Components.Themes.Ambiance"
29
30+ property bool episodesUpdating: false;
31+
32+ ScreenSaver {
33+ id: screenSaver
34+ screenSaverEnabled: !episodesUpdating
35+ }
36
37 // RefreshModel function to call refreshModel() function of the tab currently
38 // visible on application start.
39@@ -51,6 +58,7 @@
40 } else if (tabs.selectedTab === podcastTab) {
41 podcastPage.item.refreshModel()
42 }
43+ episodesUpdating = false;
44 }
45
46 Component.onCompleted: {
47@@ -58,7 +66,8 @@
48
49 var today = new Date()
50 // Only automatically check for podcasts on launch once every 12 hours
51- if (Math.floor((today - settings.lastUpdate)/86400000) >= 0.5) {
52+ if (Math.floor((today - settings.lastUpdate)/86400000) >= settings.refreshEpisodes/24.0) {
53+ episodesUpdating = true;
54 Podcasts.updateEpisodes(refreshModels)
55 }
56 loadingIndicator.opacity = 0
57@@ -116,6 +125,7 @@
58 property bool showListView: true
59 property int skipForward: 30
60 property int skipBack: 10
61+ property int refreshEpisodes: 12
62 property bool continueWhereStopped: true
63 property int playlistIndex: -1
64 property bool downloadOverWifiOnly: true
65
66=== modified file 'app/ui/EpisodesPage.qml'
67--- app/ui/EpisodesPage.qml 2020-07-09 11:20:15 +0000
68+++ app/ui/EpisodesPage.qml 2021-01-12 21:27:54 +0000
69@@ -37,8 +37,6 @@
70 property string tempGuid: "NULL"
71 property string mode: "listened"
72
73- property bool episodesUpdating: false;
74-
75 Component.onCompleted: {
76 loadEpisodes(episodeId, episodeArtist, episodeImage)
77 if (downloader.downloadingGuid != "")
78
79=== modified file 'app/ui/EpisodesTab.qml'
80--- app/ui/EpisodesTab.qml 2020-07-09 11:20:15 +0000
81+++ app/ui/EpisodesTab.qml 2021-01-12 21:27:54 +0000
82@@ -31,7 +31,6 @@
83 property var today: new Date()
84 property int dayToMs: 86400000
85 property string tempGuid: "NULL"
86- property bool episodesUpdating: false
87
88 TabsList {
89 id: tabsList
90
91=== modified file 'app/ui/PodcastsTab.qml'
92--- app/ui/PodcastsTab.qml 2016-03-29 11:30:03 +0000
93+++ app/ui/PodcastsTab.qml 2021-01-12 21:27:54 +0000
94@@ -28,8 +28,6 @@
95 Page {
96 id: podcastPage
97
98- property bool episodesUpdating: false;
99-
100 TabsList {
101 id: tabsList
102 }
103
104=== modified file 'app/ui/SettingsPage.qml'
105--- app/ui/SettingsPage.qml 2020-07-08 19:32:20 +0000
106+++ app/ui/SettingsPage.qml 2021-01-12 21:27:54 +0000
107@@ -126,6 +126,41 @@
108 }
109 }
110
111+ Component {
112+ id: refreshDialog
113+ Dialog {
114+ id: dialogInternal
115+ // TRANSLATORS: This strings refers to refreshing podcasts. Users can set how often they
116+ // want to check for new episodes.
117+ title: i18n.tr("Refresh podcasts after")
118+ Slider {
119+ id: slider
120+ width: parent.width
121+ minimumValue: 0
122+ maximumValue: 72
123+ value: podbird.settings.refreshEpisodes
124+ function formatValue(v) { return i18n.tr("%1 hours").arg(Math.round(v)) }
125+ StyleHints { foregroundColor: podbird.appTheme.focusText }
126+ }
127+
128+ Button {
129+ text: i18n.tr("OK")
130+ color: podbird.appTheme.positiveActionButton
131+ onClicked: {
132+ podbird.settings.refreshEpisodes = Math.round(slider.value)
133+ PopupUtils.close(dialogInternal)
134+ }
135+ }
136+ Button {
137+ text: i18n.tr("Cancel")
138+ color: podbird.appTheme.neutralActionButton
139+ onClicked: {
140+ PopupUtils.close(dialogInternal)
141+ }
142+ }
143+ }
144+ }
145+
146 Column {
147 id: settingsColumn
148
149@@ -198,6 +233,13 @@
150 title.text: i18n.tr("Podcast Episode Settings")
151 }
152
153+ SingleValueListItem {
154+ divider.visible: false
155+ title.text: i18n.tr("Refresh podcasts after")
156+ value: i18n.tr("%1 hours").arg(podbird.settings.refreshEpisodes)
157+ onClicked: PopupUtils.open(refreshDialog, settingsPage);
158+ }
159+
160 ListItem {
161 ListItemLayout {
162 id: deleteLayout

Subscribers

People subscribed via source and target branches

to status/vote changes: