Page MenuHomePhabricator

Replace mobile.toast with mw.notification?
Closed, ResolvedPublic

Description

It seems, that mobile.toast (our primary module for generating notifications in MobileFrontend) looks very similar to mw.notification notifications (thanks to @Jdlrobson). This task should be a reminder (for me) and a question into the round: wouldn't it make sense to kill one of these systems to create notifications (e.g. mobile.toast) and use only one of them? What blocks us doing that (e.g. pending toasts for edits, btw. it's only used by mobile.editor as far as I know, and desktop does a similar thing, maybe we can merge these methods, too).

Event Timeline

Florian created this task.Oct 25 2015, 11:23 PM
Florian raised the priority of this task from to Needs Triage.
Florian updated the task description. (Show Details)
Florian added a project: MobileFrontend.
Florian added subscribers: Florian, Jdlrobson.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 25 2015, 11:23 PM
Florian updated the task description. (Show Details)Oct 26 2015, 6:31 AM
Florian set Security to None.

In principle it sounds good.

That said size difference mediawiki.notifications is double the size (5.5kb compared with "2.8 kB" for mobile toast)
What does this module do that mobile toast doesn't?
Is it worth the extra payload?
Can we reduce the size of the payload?

Once we can answer the above questions I think we can do this.

Jdlrobson triaged this task as Normal priority.Oct 26 2015, 3:59 PM

What does this module do that mobile toast doesn't?

AFAICT it seems to be the auto-hide handling part (start/pause/stop and so on) which takes some of the size, and general styling (parts of what mobile.toast has in View.js is in mediawiki.notification).

Is it worth the extra payload?

I would say: Yes :) It could be useful in mobile, too, to have an auto hide handling code, and it would make to use core methods for notifications (e.g. to use them when the whole mobile part moves to core).

Can we reduce the size of the payload?

Adhoc I don't see much space without removing functionality (which is maybe used in other functions, too). I would, btw., suggest to do the same as in core: Use a small helper module, like mediawiki.notify, which is really small and it's only task is to load the notification module only, if it's needed (so that all notifications goes through this).

mediawiki.notify has a size of (compressed) 263 Bytes (maybe it increases a bit, depends on how we implement the pending toasts), but that would effectively reduce the payload for the most pages a lot.

Sumit added a subscriber: Sumit.Dec 13 2015, 3:13 PM

If toasts are replaced by mw.notification, I suppose the only code remaining in MobileFronted would be to show pending toasts and the helper module that will call mw.notification, isn't it?

Change 258969 had a related patch set uploaded (by Sumit):
MobileFrontend mw.notification instead of toast

https://gerrit.wikimedia.org/r/258969

Jdlrobson assigned this task to Sumit.Dec 14 2015, 9:22 PM

Change 258969 merged by jenkins-bot:
MobileFrontend mw.notification instead of toast

https://gerrit.wikimedia.org/r/258969

Florian closed this task as Resolved.Dec 17 2015, 10:53 PM