partly correct the transitions between talk overlays
Tapping browser back button now does not show the underlying article However clicking the back icon does (which can be fixed by a hack see I80328b388b2e2da105bd670a3679b4ed3061b33a ) This works because displaying the talk overlay triggers a load to mobile.talk.overlays (for talk topic board) so the other overlays are guaranteed to be ready by the time you want to transition to them. Bug: T221978 Change-Id: Ic3b448169d52880b38408da47af9e4576c585e16
This commit is contained in:
parent
9ece509c99
commit
02c43249cd
|
@ -45,6 +45,19 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a talk overlay for a given section
|
||||||
|
* @param {string} id (a number e.g. '1' or the string 'new')
|
||||||
|
* @param {Object} talkOptions
|
||||||
|
* @return {Overlay}
|
||||||
|
*/
|
||||||
|
function talkSectionOverlay( id, talkOptions ) {
|
||||||
|
if ( id === 'new' ) {
|
||||||
|
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
|
||||||
|
}
|
||||||
|
return new ( M.require( 'mobile.talk.overlays/TalkSectionOverlay' ) )( talkOptions );
|
||||||
|
}
|
||||||
|
|
||||||
overlayManager.add( /^\/talk\/?(.*)$/, function ( id ) {
|
overlayManager.add( /^\/talk\/?(.*)$/, function ( id ) {
|
||||||
var title = talkTitle.toText(),
|
var title = talkTitle.toText(),
|
||||||
talkOptions = {
|
talkOptions = {
|
||||||
|
@ -72,11 +85,14 @@
|
||||||
|
|
||||||
// talk case
|
// talk case
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
return loader.loadModule( 'mobile.talk.overlays' ).then( function () {
|
// If the module is already loaded return it instantly and synchronously.
|
||||||
if ( id === 'new' ) {
|
// this avoids a flash of
|
||||||
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
|
// content when transitioning from mobile.talk.overlay to this overlay (T221978)
|
||||||
}
|
return mw.loader.getState( 'mobile.talk.overlays' ) === 'ready' ?
|
||||||
return new ( M.require( 'mobile.talk.overlays/TalkSectionOverlay' ) )( talkOptions );
|
talkSectionOverlay( id, talkOptions ) :
|
||||||
|
// otherwise pull it from ResourceLoader async
|
||||||
|
loader.loadModule( 'mobile.talk.overlays' ).then( function () {
|
||||||
|
return talkSectionOverlay( id, talkOptions );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
return mobile.talk.overlay( title, gateway );
|
return mobile.talk.overlay( title, gateway );
|
||||||
|
|
Loading…
Reference in New Issue