Comment Display Screenlet for iOS

Requirements

Compatibility

  • iOS 9 and above

Xamarin Requirements

  • Visual Studio 7.2
  • Mono .NET framework 5.4.1.6

Features

Comment Display Screenlet can show one comment of an asset in a Liferay instance. It also lets the user update or delete the comment.

JSON Services Used

Screenlets in Liferay Screens call JSON web services in the portal. This Screenlet calls the following services and methods.

ServiceMethodNotes
ScreenscommentService (Screens compatibility plugin)getCommentWithCommentId
ScreenscommentService (Screens compatibility plugin)updateComment
CommentmanagerjsonwsServicedeleteComment

Module

  • None

Themes

  • Default

The Default Theme uses User Portrait Screenlet and iOS UILabel elements to show an asset’s comment. Other Themes may use different components to show the comment.

Figure 1: Comment Display Screenlet using the Default Theme.

Figure 1: Comment Display Screenlet using the Default Theme.

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. This Screenlet supports the remote-only, cache-only, remote-first, and cache-first offline mode policies.

These policies take the following actions when loading a comment from a Liferay instance:

PolicyWhat happensWhen to use
remote-onlyThe Screenlet loads the data from the Liferay instance. If a connection issue occurs, the Screenlet uses the listener to notify the developer about the error. If the Screenlet successfully loads the data, it stores it in the local cache for later use.Use this policy when you always need to show updated data, and show nothing when there’s no connection.
cache-onlyThe Screenlet loads the data from the local cache. If the data isn’t there, the Screenlet uses the listener to notify the developer about the error.Use this policy when you always need to show local data, without retrieving remote information under any circumstance.
remote-firstThe Screenlet loads the data from the Liferay instance. If this succeeds, the Screenlet shows the data to the user and stores it in the local cache for later use. If a connection issue occurs, the Screenlet retrieves the data from the local cache. If the data doesn’t exist there, the Screenlet uses the listener to notify the developer about the error.Use this policy to show the most recent version of the data when connected, but show an outdated version when there’s no connection.
cache-firstThe Screenlet loads the data from the local cache. If the data isn’t there, the Screenlet requests it from the Liferay instance 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) data.

These policies take the following actions when updating or deleting a comment in a Liferay instance:

PolicyWhat happensWhen to use
remote-onlyThe Screenlet sends the data to the Liferay instance. If a connection issue occurs, the Screenlet uses the delegate to notify the developer about the error, but it also discards the data.Use this policy to make sure the Liferay instance always has the most recent version of the data.
cache-onlyThe Screenlet stores the data in the local cache.Use this policy when you need to save the data locally, but don’t want to update it in the Liferay instance.
remote-firstThe Screenlet sends the data to the Liferay instance. If this succeeds, it also stores the data in the local cache for later use. If a connection issue occurs, the Screenlet stores the data in the local cache and sends it to the Liferay instance when the connection is re-established.Use this policy when you need to make sure the Screenlet sends the data to the Liferay instance as soon as the connection is restored.
cache-firstThe Screenlet stores the data in the local cache and then attempts to send it to the Liferay instance. If a connection issue occurs, the Screenlet sends the data to the Liferay instance when the connection is re-established.Use this policy when you need to make sure the Screenlet sends the data to the Liferay instance as soon as the connection is restored. Compared to remote-first, this policy always stores the data in the cache. The remote-first policy only stores the data in the event of a network error.

Required Attributes

  • commentId

Attributes

AttributeData typeExplanation
commentIdnumberThe primary key of the comment to display.
autoLoadbooleanWhether the list should automatically load when the Screenlet appears in the app’s UI. The default value is true.
editablebooleanWhether the user can edit the comment.
offlinePolicystringThe offline mode setting. The default is remote-first. See the Offline section for details.

Methods

MethodReturnExplanation
load()noneStarts the request to load the comment.

Delegate

Comment Display Screenlet delegates some events to an object that conforms to the CommentDisplayScreenletDelegate protocol. This protocol lets you implement the following methods:

  • - screenlet:onCommentLoaded:: Called when the Screenlet loads the comment.

  • - screenlet:onLoadCommentError:: Called when an error occurs in the process. The NSError object describes the error.

  • - screenlet:onSelectedComment:: Called when a comment is selected.

  • - screenlet:onDeletedComment:: Called when a comment is deleted.

  • - screenlet:onCommentDelete:: Called when the Screenlet prepares the comment for deletion.

  • - screenlet:onUpdatedComment:: Called when a comment is updated.

  • - screenlet:onCommentUpdate:: Called when the Screenlet prepares the comment for update.

« Comment List Screenlet for iOSComment Add Screenlet for iOS »
Was this article helpful?
0 out of 0 found this helpful