Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show info messages for push #1560

Merged
merged 6 commits into from
Sep 22, 2017
Merged

Show info messages for push #1560

merged 6 commits into from
Sep 22, 2017

Conversation

tobiasKaminsky
Copy link
Member

@tobiasKaminsky tobiasKaminsky commented Sep 20, 2017

Show warnings if

  • no push possible (fdroid)
  • push possible, but old login

I hope my idea is correct to use the push url / push return from google server.

Do we use polling, e.g. 1x / minute for fdroid, if this is possible? If not, then I will open up a new issue for 2.1.

resolves #1519

Old login:
2017-09-20-091204

Fdroid (thanks to Björn for helping with wording ;-) ):
2017-09-20-091006

@tobiasKaminsky tobiasKaminsky changed the title Show messages for push Show info messages for push Sep 20, 2017
@tobiasKaminsky tobiasKaminsky added this to the Nextcloud App 2.0.0 milestone Sep 20, 2017
@AndyScherzinger
Copy link
Member

Do we use polling, e.g. 1x / minute for fdroid, if this is possible? If not, then I will open up a new issue for 2.1.

afaik we don't have polling implemented yet but would recommend to have a 10-15 minutes interval to not drain the battery. As a second step we could then of course go for a "smarter" polling looking at the frequency of notifications coming in.

@@ -703,4 +703,6 @@

<string name="common_warning" translatable="false">Warning</string>
<string name="corrupt_account_info" translatable="false">Accounts have been corrupted in case you have been using a release candidate of 2.0.0 between RC1 and RC5.\n\nWe are sorry to tell you that you need to remove the Nextcloud accounts from your device and need to re-login again completely in order to get fully working login-sessions on this device!</string>
<string name="push_notifications_not_implemented">For this version push notification were disabled due to dependencies on proprietary Google play services.</string>
Copy link
Member

@AndyScherzinger AndyScherzinger Sep 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we can shorten this to "Push notifications disabled due to dependencies on proprietary Google play services."

@AndyScherzinger
Copy link
Member

I hope my idea is correct to use the push url / push return from google server.

Yes that should work just fine

@AndyScherzinger
Copy link
Member

AndyScherzinger commented Sep 20, 2017

👍 nice solution. One optimization though would be to add an action like "dismiss" or "OK" to hide the snackbar again. Future improvements could then be to have an action which navigates you to the account management screen in case of the old login scenario.

Approved with PullApprove

@mario
Copy link
Contributor

mario commented Sep 20, 2017

"due to old login method" means nothing for the majority of people.

Also, this shouldn't go in 2.0. We really have bugfixes to do for 2.0, and things like this can go maybe in 2.0.1.

You have to use AlarmManager for F-droid as that is the only thing that currently guarantees the device will wake up. The interval can be decided I guess, but in order to know which notifications to show we'll have to store notifications in the DB and show only ones we haven't shown etc etc.

As for other issue I see with this PR: it could happen that even with the proper login (webview) the first time you open notifications Push registration didn't finish yet. Or it failed. In this case a "wrong" error message would be shown that would confuse people.

Also "Google play" -> "Google Play"

@AndyScherzinger
Copy link
Member

@mario would you leave out the messages for 2.0.0 as well or just the polling because yes the polling is post 2.0.0 like Tobias mentioned in the description so I'd say we would be fine adding the messages (especially the Google Play one for the f-droid users). As for your scenario is there a way to detect that the push registration is not finished so we could then show yet another variant of the message?

@mario
Copy link
Contributor

mario commented Sep 20, 2017

@AndyScherzinger there is currently no way to distinguish between a "just failed this time" and "failed because you use old login", but I guess I/you/whoever could add support for this by adding a status column to PushConfigurationState and handling return codes from the server.

If you want the messages as a first step, sure - but please change the typo/capitalization and do the shortening.

@AndyScherzinger
Copy link
Member

but please change the typo/capitalization and do the shortening.

sure! As for the shortening do you mean the one I proposed?

@mario
Copy link
Contributor

mario commented Sep 20, 2017

@AndyScherzinger yup. Plus find a way to change the "old login method" wording to something else. cc @tobiasKaminsky

@tobiasKaminsky
Copy link
Member Author

We decided at the conf to show only warnings as a first step for 2.0.

there is currently no way to distinguish between a "just failed this time" and "failed because you use old login", but I guess I/you/whoever could add support for this by adding a status column to PushConfigurationState and handling return codes from the server.

Is there a way to trigger "failing one time" so that I can catch the correct result type?
In https://github.com/nextcloud/android-library/blob/master/src/com/owncloud/android/lib/resources/notifications/RegisterAccountDeviceForProxyOperation.java#L87 is the status set, so we already can use it, but I would need the error codes to distinguish.

Regarding the wordings:
Fdroid: Push notification disabled due to dependencies on proprietary Google Play services.
Old login: Push notifications require auth token based login. Please consider to re-create your account.

@mario
Copy link
Contributor

mario commented Sep 20, 2017

You actually need to check the return of the registration done with Nc server, not the proxy server.

https://github.com/nextcloud/notifications/blob/master/docs/push-v2.md

If you get a 400 when posting to POST /ocs/v2.php/apps/notifications/api/v2/push, and the Body contains INVALID_SESSION_TOKEN, then you're using a password instead of the app token and you could show this message.

Also "Please consider to recreating your account." maybe?

@tobiasKaminsky
Copy link
Member Author

tobiasKaminsky commented Sep 20, 2017

I added a third case:

  • pushUrl is set -> push should theoretically work
  • "new login" (no error on registration)
  • BUT pushValue provided by google is empty/null

--> temporary failure

I hope this is now correct :-)

For discussion of polling I'll open now a new issue: #1561

@tobiasKaminsky
Copy link
Member Author

Regarding Drone/Lint: the one new warning is "obsolete dependencies" with targets the library.
After testing and before merging this needs to be changed to a stable lib release, and then drone is satisfied.

Rebase done

@AndyScherzinger
Copy link
Member

👍 please rebase 😁 cc @mario for review

@tobiasKaminsky
Copy link
Member Author

Rebase done

@AndyScherzinger
Copy link
Member

Sweet, then it can be merged after @mario approved it via 👍

@mario
Copy link
Contributor

mario commented Sep 22, 2017

Fine for now :) 👍

@AndyScherzinger AndyScherzinger merged commit f2cdedd into master Sep 22, 2017
@AndyScherzinger AndyScherzinger deleted the pushWarning branch September 22, 2017 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push notification with old login
3 participants