File sharing is a feature that allows users to send files such as images, audio files, and videos while chatting in a channel. File sharing appears in the messageInput component of the
In UIKit for iOS, there are currently four different types of file messages that users can send: image file, video file, audio file, and document file. These files can be shared with other members in the channel by either directly taking a photo with the camera on a mobile device or uploading an image, video, audio, or document file from the sender’s mobile device.
Note : In order to use the file sharing feature, you must first create a channel and enable the chat service. To learn how to allow users to chat in a channel, refer to Chat in a channel.
You can customize the UI for file sharing using
SBUMessageCellTheme in the
The following table shows customizable theme properties of file sharing.
The background color of the file icon.
The color of the file icon.
The text font of the file message name element.
The text color of the left side of a file message.
The text color of the right side of a file message.
The text color of a file message's placeholder.
The following table lists customizable properties of
SBUStringSet that can be modified to customize file sharing. The
SBUStringSet is a set of strings used to compose the screen. You need to modify the
stringSet values in advance if you want to make changes to the screen.
A text for file save completion.
A text for file save failure.
A text for file open failure.
The following table shows customizable file sharing icons.
Add a file.
Select a file to send.
An audio file message.
A document file message.
Play a video file message.
UIKit for iOS allows users to compress images when sending them to other users in the channel on the client app. By reducing the image size, they can send and receive image files faster and minimize data storage and data usage.
The following table lists properties in the
SBUGlobals class that are related to image compression. These properties can be customized before you initialize UIKit or create a new channel.
Determines whether to compress the image when sending an image file message. (Default: false)
The value of the compression rate to apply to the image. Acceptable values are 0.0 to 1.0, inclusive. (Default: 0.85)
The value of the size dimensions to apply to the image. (Default: device screen size)
Note: To compress an image without changing the size dimensions, use the
imageCompressionRateproperty. To resize the image, use the