Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
The app framework is a name for Magnolia 5 functionality that deals with apps. It also controls app lifecycle events such as starting and stopping and bringing the app into focus.
The app framework maintains a history of app use and remembers what app was used last. The purpose of remembering the history is to make it visual to the user in the Shell. When a user leaves an app running and goes back to the Apps screen, the running app is still visible in the app stack. You can see the running app through the transparent App screen. This gives the user reassurance that the app is still in the same state, that no work has been lost and that the user can continue from where they left off.
As an app developer you will use the app framework to create new subapps. The subapp receives callbacks from the framework regarding location changes. A location change can occur for example when a user requests a URL that has a history fragment or when the user does something that requires the app to react with a new location. An example of the latter is when the user clicks Edit page in the Pages app. This requires a new detail subapp to be opened and brought into focus. The framework dispatches the location to the correct app, in this case to the parent app Pages. Think of the app framework as the master that gives instructions to slave subapps.
The AppController manages a context for each running app and exposes an
AppContext object to the app. An app uses the AppContext to interact with the app framework. The
AppContext is available for injection anywhere in an app. Interacting with the AppController directly isn't necessary.
You can use
AppContext to open new subapps and bring them to fullscreen mode. The
AppContext to send messages to the current user or all users and display confirmation dialogs. The methods provided by the
AppContext are convenient because you don’t have to search for the manager responsible for messaging. Here are some example methods:
Each app needs to implement the
App interface. The Magnolia Shell calls the
App interface when the user interacts with the app. The subapp represents a view open in a tab within the app.
The location is routed down the tree as
When a location changes, this is what happens in the app framework:
appit gets passed to the app framework.
locationChangedmethod on it, passing the whole location. This allows the subapp to react to any additional parameters in the location.
locationChangedallowing the app to open a new sub app.