Merge lp:~rpadovani/reminders-app/improveFirstRun into lp:reminders-app

Proposed by Riccardo Padovani
Status: Merged
Approved by: Michael Zanetti
Approved revision: 109
Merged at revision: 109
Proposed branch: lp:~rpadovani/reminders-app/improveFirstRun
Merge into: lp:reminders-app
Diff against target: 95 lines (+39/-25)
1 file modified
src/app/qml/reminders.qml (+39/-25)
To merge this branch: bzr merge lp:~rpadovani/reminders-app/improveFirstRun
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+217485@code.launchpad.net

Commit message

Do autologin if a new account is added in system settings

Description of the change

Improve first run, when there is no account: now, when user returns to the app after the setup of a new account in system settings, his new account is logged.

Thanks to ~mardy for the idea

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

86 + if (accounts.count == 1) {

What happens if there are multiple accounts?

review: Needs Information
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Can we make it a button to launch the online accounts part of system settings, rather than tell the user where to go? We already used to do this with update-manager, and still do it if user tries to install apps without an Ubuntu SSO account configured.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Seems I missed the button! Sorry! As you were.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

> 86 + if (accounts.count == 1) {
>
> What happens if there are multiple accounts?

Well, that is a problem beyond the scope of this branch.
This branch wants to resolve this workflow on phone:

User launches the app -> No account setted -> Press the button and open the account settings -> Add an account -> The focus auto return to the app (needs to fix bug 1230091 for this) -> Nothing happens

Now, thanks to this fix, we have
User launches the app -> No account setted -> Press the button and open the account settings -> Add an account -> The focus auto return to the app (needs to fix bug 1230091 for this) -> Autologin in the new account.

On phone a user can add only one account before returns to the app, so there is no problem. If more than one account is setted before the start, there is a page that asks to choose which accounts use or, if there was a previous login, it uses last login.

Also, if user sets up wrong account (e.g. Ubuntu One and not Evernote) the focus returns to the app and nothing happens, so there is the button to open (again) system settings

On desktop otherwise a user can add how much accounts want before returns to the app, so I added the if (accounts.count == 1) to login only with the first account added.

@popey, this is a screenshot of actual implementation: http://people.ubuntu.com/~rpadovani/touch/reminderNoAccount.png

https://bugs.launchpad.net/unity-mir/+bug/1230091

Revision history for this message
Michael Zanetti (mzanetti) wrote :

works for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/reminders.qml'
2--- src/app/qml/reminders.qml 2014-04-04 06:09:17 +0000
3+++ src/app/qml/reminders.qml 2014-04-28 17:56:21 +0000
4@@ -30,7 +30,6 @@
5 */
6
7 MainView {
8-
9 id: root
10
11 // objectName for functional testing purposes (autopilot-qt5)
12@@ -93,6 +92,32 @@
13 }
14 }
15
16+ function doLogin() {
17+ print("got accounts:", accounts.count)
18+ var accountName = accountPreference.accountName;
19+ if (accountName) {
20+ var i;
21+ for (i = 0; i < accounts.count; i++) {
22+ if (accounts.get(i, "displayName") == accountName) {
23+ accountService.objectHandle = accounts.get(i, "accountServiceHandle");
24+ }
25+ }
26+ }
27+ if (!accountService.objectHandle) {
28+ switch (accounts.count) {
29+ case 0:
30+ PopupUtils.open(noAccountDialog)
31+ print("No account available! Please setup an account in the system settings");
32+ break;
33+ case 1:
34+ accountService.objectHandle = accounts.get(0, "accountServiceHandle");
35+ break;
36+ default:
37+ openAccountPage(false);
38+ }
39+ }
40+ }
41+
42 AccountServiceModel {
43 id: accounts
44 service: "evernote"
45@@ -121,30 +146,8 @@
46 height = units.gu(75);
47 }
48
49- pagestack.push(rootTabs)
50- print("got accounts:", accounts.count)
51- var accountName = accountPreference.accountName;
52- if (accountName) {
53- var i;
54- for (i = 0; i < accounts.count; i++) {
55- if (accounts.get(i, "displayName") == accountName) {
56- accountService.objectHandle = accounts.get(i, "accountServiceHandle");
57- }
58- }
59- }
60- if (!accountService.objectHandle) {
61- switch (accounts.count) {
62- case 0:
63- PopupUtils.open(noAccountDialog)
64- print("No account available! Please setup an account in the system settings");
65- break;
66- case 1:
67- accountService.objectHandle = accounts.get(0, "accountServiceHandle");
68- break;
69- default:
70- openAccountPage(false);
71- }
72- }
73+ pagestack.push(rootTabs);
74+ doLogin();
75 }
76
77 Connections {
78@@ -286,6 +289,17 @@
79 objectName: "noAccountDialog"
80 title: i18n.tr("No account available")
81 text: i18n.tr("Please setup an account in the system settings")
82+
83+ Connections {
84+ target: accounts
85+ onCountChanged: {
86+ if (accounts.count == 1) {
87+ PopupUtils.close(noAccount)
88+ doLogin();
89+ }
90+ }
91+ }
92+
93 Button {
94 objectName: "openAccountButton"
95 text: i18n.tr("Open account settings")

Subscribers

People subscribed via source and target branches