Howdy,

We encountered a need for the feature described in JIRA-3813 earlier this year 
and have implemented a solution locally. I'd like to contribute some of this 
back to the community and have attached a patch which is a bit of a mix of 
Bruno's design with ours.

There are a few major changes from Bruno's original thoughts.

FIrst, we implemented the fallback inside of a Device object. This way the 
structure of fallbacks is far more flexible to certain devices. This is 
especially important if projects treat the devices differently (e.g. whether an 
iPad falls back to a tablet design or an iOS device).

Second, we allowed individual components to specify their device. This is 
important for us as we have many reusable components which use device specific 
markup in differing ways.

Third, we added a hook point in which this component specific device logic can 
be externalized to a central location (Session). This is important if there's 
an external rules engine which is determining which devices should be used for 
which components).

Finally, we moved the logic for determining the correct extension to the 
DefaultMarkupResourceStreamProvider. This aligns it with the logic for finding 
Style, Variation, and Locale, as well as giving it access to the component (for 
our above requirements) without requiring an API change.

Thanks,
-David Phillips - USAA

Reply via email to