Requirements
- Xcode 9.3 or above
- iOS 11 SDK
- Liferay Portal 6.2 CE/EE, Liferay CE Portal 7.0/7.1, Liferay DXP 7.0+
- Liferay Screens Compatibility app (CE or EE/DXP). This app is preinstalled in Liferay CE Portal 7.0/7.1 and Liferay DXP 7.0+.
Compatibility
- iOS 9 and above
Xamarin Requirements
- Visual Studio 7.2
- Mono .NET framework 5.4.1.6
Features
The Web Content Display Screenlet shows web content elements in your app, rendering the inner HTML of the web content. The Screenlet also supports i18n, rendering contents differently depending on the device’s current locale.
JSON Services Used
Screenlets in Liferay Screens call JSON web services in the portal. This Screenlet calls the following services and methods.
Service | Method | Notes |
---|---|---|
DDMStructureService | getStructureWithStructureId | |
JournalArticleService | getArticleWithGroupId | |
JournalArticleService | getArticleContent | |
ScreensddlrecordService (Screens compatibility plugin) | getJournalArticleContent | With entryQuery |
Module
- WebContent
Themes
- Default
The Default Theme uses a standard UIWebView
to render the HTML. Other Themes
may use a different component, such as iOS 8’s.
Portal Configuration
For the Web Content Display Screenlet to function properly, there should be web content in the Liferay instance your app connects to. For more details on web content, please refer to the Creating Web Content section of the Liferay User Guide.
Offline
This Screenlet supports offline mode so it can function without a network connection. For more information on how offline mode works, see the tutorial on its architecture. Here are the offline mode policies that you can use with this Screenlet:
Policy | What happens | When to use |
---|---|---|
remote-only | The Screenlet loads the content from the portal. If a connection issue occurs, the Screenlet uses the delegate to notify the developer about the error. If the Screenlet successfully loads the content, it stores the data in the local cache for later use. | Use this policy when you always need to show updated content, and show nothing when there’s no connection. |
cache-only | The Screenlet loads the content from the local cache. If the content isn’t there, the Screenlet uses the delegate to notify the developer about the error. | Use this policy when you always need to show local content, without retrieving remote content under any circumstance. |
remote-first | The Screenlet loads the content from the portal. If this succeeds, the Screenlet shows the content to the user and stores it in the local cache for later use. If a connection issue occurs, the Screenlet retrieves the content from the local cache. If the content doesn’t exist there, the Screenlet uses the delegate to notify the developer about the error. | Use this policy to show the most recent version of the content when connected, but show a possibly outdated version when there’s no connection. |
cache-first | The Screenlet loads the content from the local cache. If the content isn’t there, the Screenlet requests it from the portal and notifies the developer about any errors that occur (including connectivity errors). | Use this policy to save bandwidth and loading time in case you have local (but probably outdated) content. |
Required Attributes
articleId
If you have
structured web content,
you can alternatively use templateId
or structureId
with articleId
.
Attributes
Attribute | Data type | Explanation |
---|---|---|
groupId | number | The site (group) identifier where the asset is stored. If this value is 0 , the groupId specified in LiferayServerContext is used. |
articleId | string | The identifier of the web content to display. You can find the identifier by clicking Edit on the web content in the portal. |
templateId | number | The identifier of the template used to render the web content. This is applicable only with structured web content. |
structureId | number | The identifier of the DDMStructure used to model the web content. This parameter lets the Screenlet retrieve and parse the structure. |
autoLoad | boolean | Whether the content should be retrieved from the portal as soon as the Screenlet appears. The default value is true . |
Methods
Method | Return | Explanation |
---|---|---|
loadWebContent() | boolean | Starts the request to load the web content. The HTML is rendered when the response is received. Returns true if the request is sent. |
Delegate
The Web Content Display Screenlet delegates some events to an object that
conforms to the WebContentDisplayScreenletDelegate
protocol. This protocol
lets you implement the following methods:
-
- screenlet:onWebContentResponse:
: Called when the web content’s HTML is received. -
- screenlet:onWebContentError:
: Called when an error occurs in the process. TheNSError
object describes the error. -
- screenlet:onRecordContentResponse:
: Called when a web content record is received. -
- screenlet:onUrlClicked:
: Called when a URL is clicked in the web content. Returntrue
to handle the navigation, orfalse
to cancel it.