All pages
Powered by GitBook
Couldn't generate the PDF for 188 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

UIKit 3

iOS (Deprecated)

Social Plus modules are ready-to-use — the only things left to do for our customers are integration and the front-end. Going the extra mile, we've created a UIKit with endless customizations.

Introduction

Our Chat UIKit and Social UIKit for Social Plus is a development kit with a user interface to enable fast integration of standard Social Plus Chat and Social Plus features into new or existing applications. Themes allow you to apply your style through colors and fonts.

We have now open-sourced Social Plus UIKit so you will have complete control of the visual style of your Chat and Social application with endless customizations. Social Plus UIKit open source is now available in our GitHub repository.

To customize Social Plus UIKit open source, download the source code and apply the customizations in the forked source code. Once you fork our UIKit source code separately, you own the product so you are free to customize and build it for your specific use cases.

We recommend that you use Social Plus UIKit open source when:

  1. The standard UIKit does not apply to your use case.

  2. You want to use a Social Plus Chat or Social Plus SDK feature which is not yet supported in our standard UIKit.

Please note that we will extend only limited support once you customize our UIKit open source since we won’t be able to fully know your code once you fork it.

Documentation

We are using the Social Plus UIKit open-source wiki for any documentation related to Social Plus UIKit open-source.

For our standard UIKit, you can refer to the documentation here.

Community Guidelines

If you would like to suggest improvements to the source code, you can submit a pull request. If you find bugs or would like to request features, you can create an issue. Please note that not all changes and requests will be approved but they will be assessed in due course.

For more information on these guidelines, you may refer to the Social Plus UIKit open-source wiki or you may go directly to these related pages:

  • Customizing Social Plus UIKit Open Source

  • Contributing to Social Plus UIKit Open Source

  • Submitting fixes and feature requests

Benefits

  • Easy Installation.

  • Fully featured chat experience with minimal coding.

  • Customize targeted UX flows, and specific views and respond to user interactions to tailor a user experience for just your application.

Overview

Requirement

  • iOS 11.0 or higher

  • Swift 5

  • Xcode 11.7

Implementation Strategies

The UIKit API provides several strategies to integrate with your application.

Page Presentation

  • Use the UIKit as is.

  • Integrate the Chat experience in the least amount of effort.

Page Presentation customized

  • Add a custom theme to the default implementation of the UIKit.

  • Complete control of the visual style of Chat UI by implementing declarative styles (fonts and colors) for your user interface.

Page Integration

  • Use key components from the UIKit SDK and integrate them directly into your application.

  • Add the Chat UI to your existing design.

Key Concepts

Architecture

The UIKit is built on the foundation of the Social Plus API while adding a UI layer to speed product development efforts. At the core, it is leveraging the same Channel and messaging concepts, subscribing to live objects whilst adding a UIKit to accelerate product delivery and UI that delivers great user experience for companies wanting to deploy messaging.

In the current state, there are two modules that can be used. You can follow the steps below. These two modules can be integrated into your application easily in no time.

Module

Description

Community (Group) Module

User can create community, create post content and see new content generate via Feed

Chat Module

User can see list of their friends and start a new chat room - 1:1 or group - with them

iOS UIKit Installation Guide

Social Plus iOS UIKit Migration Guide

iOS UI Kit Migration Instructions

To allow for more customization, we have now open-sourced our UIKits and deprecated the packaged UI Kit version that was previously available.

With open-source, developers have more flexibility and greater customization options, allowing you to have complete control over the visual style. Open sourcing allows for more transparency and visibility and enables contributions from a greater developer community in terms of good design, implementation, code improvement, and fixes, translating into a better product and typical development.

To ensure that you continue to receive the latest features and updates, we encourage you to move off the managed UI Kit to the Open Source UI Kit. This guide will show you how to:

  • Migrate Open Source UI Kit with an existing project

  • Modify the Open Source UI Kit to customize the visual style

  • Get the latest Open Source UI Kit updates

Migrate iOS Open Source UI Kit with Existing Project

Remove existing dependencies

If you've never used UI Kit, you may skip this step and proceed to the next step.

If you're integrating the UI Kit with an existing project, you'll need to remove and unlink the managed UIKit from your project before proceeding with the integration.

Migrate to iOS UIKit Open Source

There are several ways for you to migrate the open-source iOS UI Kit into your projects, depending on your workflow. One way that we recommend is via Git Submodule. This instruction assumes that the app project is already set up with a Git repository.

  1. Add the git submodule of Social Plus UIKit open source into your git repository.

git submodule add https://github.com/AmityCo/ASC-UIKit-iOS-OpenSource

To simplify forking & contributing to the open-source UIKit, we are moving away from using git-lfs in our git repository. We are migrating all development of Open Source UIKit to a new repository https://github.com/AmityCo/ASC-UIKit-iOS-OpenSource starting release v3.12.0. The new repository will not contain any history before the release of v3.12.0. We have stopped active development on our old open-source UIKit repository i.e. https://github.com/AmityCo/Amity-Social-Cloud-UIKit-iOS-OpenSource.

For new users:

If you are just starting to use Open Source UIKit or already using the latest version of Open Source UIKit (i.e. v3.12.0) from the old Repository, We suggest you start pulling changes from the new repository instead.

In this case,

  • If you have forked the old open-source UIKit repository, we suggest you fork the new repository and use that instead.

For Old Users:

If you are using an older version (< 3.12.0) of open-source UIKit, we suggest you upgrade to the latest version of UIKit as soon as possible. Once you are caught up to version 3.12.0, please migrate to use the new repository instead.

  1. Create an Xcode Workspace, and then add both MyApp.xcodeproj and AmityUIKit.xcodeproj together under the same workspace.

Project Directory
Xcode Workspace Project Structure

3.SocialPlusUIKit links with other dependencies such as SocialPlusSDK, Realm etc through SharedFrameworks which is a Swift Package.

Step 1: Reset the Package Cache of your Application Target i.e. YourApp.xcodeproj. [If you are installing AmityUIKit for the first time, you can skip this step]

Select App Target In Xcode Project -> Select File Menu for Xcode-> Packages -> Reset Package Cache

Step 2: Link SharedFrameworks & AmityUIKit.framework to YourApp.xcodeproj target as shown below.

4. On MyApp.xcodeproj, let’s try importing Social Plus UIKit / Social Plus SDK and calling some APIs. You should be able to compile and run the app.

Modify iOS Open Source UI Kit

You can modify the iOS open-source UI Kit to customize behaviors to fit your needs. To modify the code, simply copy and paste it into your local machine.

We recommend that you first fork the repository before starting any customization work so that it will be easier to merge the code with the next version update that we provide from the main repository.

References on forking: https://docs.github.com/en/get-started/quickstart/fork-a-repo

Get Latest iOS Open Source UI Kit Updates

To update to the latest version of the UI Kit, you can pull the latest commit of the git submodule.

cd https://github.com/AmityCo/ASC-UIKit-iOS-OpenSource
git pull origin master
cd ..
git add .
git commit -m “Update ios uikit opensource submodule”
git push origin master

Installing UIKit (deprecated)

Installing managed UIKit through Cocoapods, Carthage & SPM.

This section is about installing managed UIKit through the dependency manager. If you have already installed our Open Source UIKit, you can skip this section.

To provide greater customization options, we have open-sourced our UIKit and deprecated the packaged UIKit version previously available. For the best quality and access to the latest features, we strongly recommend integrating our UIKit with the open-source version. For more details, please refer to the iOS UIKit Installation Guide section.

Create a project

Go to Xcode and create a project for iOS.

  1. Enter a project name

  2. Select Swift as your language option

Using Dependency Manager

Social Plus UIKit supports installation via dependency managers, we highly recommend SwiftPM installation as the best practice.

  • SwiftPM

  • Cocoapods

  • Carthage

SwiftPM Installation

To integrate Social Plus UIKit into your project via SwiftPM, please follow the instructions below.

  • Add a Package Dependency

Enter the repository URL to search the package, and choose to install Social Plus UIKit.

https://github.com/AmityCo/Amity-Social-Cloud-UIKit-iOS-SwiftPM

Carthage Installation

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate the Social Plus UIKit. First, add the following to your Cartfile.

binary "https://raw.githubusercontent.com/AmityCo/Amity-Social-Cloud-UIKit-iOS/main/AmityUIKit.json" ~> 2.0

Now you can install Social Plus UIKit into your project by running the following command.

$ carthage update

Cocoapods Installation

If you are using CocoaPods to integrate Social Plus UIKit into your Xcode project. First, open a terminal and run this command to create Podfile.

$ pod init

Then, add the following lines to the Podfile

source "https://github.com/AmityCo/Amity-Social-Cloud-UIKit-iOS.git"
target 'SampleApp' do
  use_frameworks!
  pod 'AmityUIKit'
end

Now you can install Social Plus UIKit into your project.

$ pod install

If problems happen during pod install step. Please try cleaning Cocoapods cache before running pod install again.

To clear the cache please go to ~/Library/Caches/Cocoapods and remove all folders.

If this doesn't work, please visit the Cocoapods Github repo for further resolutions.

Usage

After finished installing SDK. You will be able to import AmityUIKit.

import AmityUIKit

Social Plus UIKit already includes our SDK. Don’t install Social Plus SDK separately if you have already installed the UIKit.

From the version 3.x. please install the UIKit with the open source guideline here iOS UIKit Installation Guide.

Setup & Authentication

With Social Plus UIKit 2.3, we have introduced a new way to Authentication process. Just follow the guide below.

Adding required permissions

Your app may require the following permissions to work properly;

  1. Camera access

  2. Microphone access

  3. Photo library usage access

Before submitting your application to the store, please make sure the following permissions are already granted. Here are the steps to ask for permission.

Locate the info.plist file and add:

  1. NSCameraUsageDescription

  2. NSMicrophoneUsageDescription

  3. NSPhotoLibraryUsageDescription

Setup API key

Social Plus UIKit requires an API key. You need a valid API key to begin using the UIKit. Please find your account API key in the Social Plus Cloud Console.

After logging in Console:

  1. Click Settings to expand the menu.

  2. Select Security.

  3. On the Security page, you can find the API key in the Keys section.

API key in Security page

If you have trouble finding this, you can post in our community forum at community.social.plus.co so our support team can assist you.

import AmityUIKit

// in order to use AmityRegionalEndpoint enum, importing AmitySDK is required.
import AmitySDK 

AmityUIKitManager.setup(apiKey: "api-key", region: .SG)

AmityUIKitManager.setup should only be called once when app starts running. Calling the method repeatedly will create connection problems.

Specify Endpoints Manually (Optional)

By default, AmityClient will connect to AmityRegion.SG. You can specify endpoints manually via AmityEndpoint struct. API endpoints for each data center are different so you need to adjust the endpoint accordingly.

let endpoint = AmityEndpoint(httpUrl: "http-endpoint",
                             rpcUrl: "rpc-endpoint",
                             mqttHost: "mqtt-host")
        
AmityUIKitManager.setup(apiKey: "api-key", endpoint: endpoint)

We currently support multi-data center capabilities for the following regions:

Region

Endpoint

Europe

AmityRegion.EU

Singapore

AmityRegion.SG

United States

AmityRegion.US

Authentication

Register device

To use any SDK feature, you must first register the current device with a userId. A device registered with an userId will be permanently tied to that userId until you explicitly unregister the device, or until the device has been inactive for more than 90 days. A device registered with a specific userId will receive all messages belonging to that user.

Additionally, an optional displayName can be provided if you wish to have this user identified in push notifications.

AmityUIKitManager.registerDevice(withUserId: "USER_ID", displayName: "Ali Connors", authToken: "AUTH_TOKEN")

Register the device for push notifications

Registering your app for push notifications will require a device token as a parameter.

Social Plus's UIKit does not manage:

  • User-facing requests for push notifications and authorizations

  • The creation and refreshing of push notification tokens

It's up to your app to take those steps and pass the device token.

UIKitManager.registerDeviceForPushNotification("device-token") { isSuccess, error in
   // Handle completion here
}

Unregister

If your user logs out, you should explicitly unregister the user from the SDK as well, to prevent the current device from receiving any unnecessary or restricted data.

AmityUIKitManager.unregisterDevice()

Unregistering a device is a synchronous operation. Once theunregisterDevice method is called, the SDK disconnects from the server and wipes out the user session.

Using Themes

Using the default theme

Social Plus UIKit uses the default theme as part of the design language.

Theme customization

With no customization, UIKit already looks good. However, if you wish to customize the theme, you can declare changes to both colors and typography.

Colors

UIKit uses a small set of declared colors to simplify the design task for developers. These colors are automatically rendered at appropriate shades to communicate states and interactions to the users.

Color

Description

Default

Primary

Used for buttons and primary call to actions

#1054DE

Secondary

Used in secondary UI elements

#292B32

Alert

Used when informing users of errors or information that requires attention

#FA4D30

Highlight

Used for hyperlink text

#1054DE

Base

Text presented on light background

#292B32

Base Inverse

Text presented on dark background

#FFFFFF

Message Bubble

Background color of message bubble sent by the user

#1054DE

Message Bubble Inverse

Background color of message bubble sent to the user

#EBECEF

Usage

To declare your own colors on iOS:

  1. Create an instance from the provided class AmityTheme

  2. Set the theme instance through AmityUIKitManager

// default colors
let myTheme = AmityTheme()
    
// partially overriding colors
let myTheme = AmityTheme(
    primary: UIColor.systemBlue,
    secondary: UIColor.systemOrange)

// fully overriding colors
let myTheme = AmityTheme(
    primary: UIColor.systemBlue,
    secondary: UIColor.systemOrange,
    alert: UIColor.systemRed,
    highlight: UIColor.systemBlue,
    base: UIColor.white,
    baseInverse: UIColor.black,
    messageBubble: UIColor.systemTeal,
    messageBubbleInverse: UIColor.systemRed)

AmityUIKitManager.set(theme: myTheme)

Typography

The AmityTypography is a class that manages a set of UIFont properties used in Social Plus UIKit. All fonts used in our UIKit are configured under this class.

Element

Font/Weight

Size (points)

HeaderLine

System/Bold

20

Title

System/Semibold

17

Body

System/Regular

15

Body bold

System/Semibold

15

Caption

System/Regular

13

Caption bold

System/Semibold

13

Usage

To declare your own typography on iOS:

  1. Create an instance from the provided class AmityTypography.

  2. Set the typography instance through AmityUIKitManager.

// default typography
let myTypography = AmityTypography()
    
// partially overriding typography
let myTypography = AmityTypography(
    headerLine: UIFont(name: "Georgia-Bold", size: 20)!,
    title: UIFont(name: "Georgia", size: 20)!)

// fully overriding typography
let myTypography = AmityTypography(
    headerLine: UIFont(name: "Georgia-Bold", size: 20)!,
    title: UIFont(name: "Georgia", size: 20)!,
    bodyBold: UIFont.systemFont(ofSize: 16, weight: .regular),
    body: UIFont.systemFont(ofSize: 16, weight: .regular),
    captionBold: UIFont.systemFont(ofSize: 13, weight: .regular),
    caption: UIFont.systemFont(ofSize: 13, weight: .light))

AmityUIKitManager.set(typography: myTypography)

Social UIKit

Our community group functionality within the Social Plus UIKit will allow you to explore social features and how they will look in your app.

Using as a whole feature with the default settings

The quickest way to start using the Community feature, all the default logic and navigation has already been defined.

Usage

Create a view controller

let viewController = AmityCommunityHomePageViewController.make()

// push
navigationController?.pushViewController(viewController, animated: true)

// present
let navigationController = UINavigationController(rootViewController: viewController)
present(navigationController, animated: true, completion: nil)

Our Components

There are many components that you can use and integrate into your existing application.

Component Customization Limitation

Social Plus UIKit provides already built UI elements on a single page. You can change the appearance such as color and typography, in the global settings. However, the UIKit does not allow you to replace these small components with other views. In addition, you cannot modify the view hierarchy inside the page.

Community Home Page

This page consists of two components represented in tabs.

Empty state of community home page
Entering search mode

Components

  • Explore

  • New feed

Usage:

Create a view controller

let viewController = AmityCommunityHomePageViewController.make()

Newsfeed

This component consists of My community and Global feed components.

New feed tab in empty state
New feed tab with my community component and global feed

Components

  • My Community

  • Global feed

Usage

Create a view controller

let viewController = AmityNewsfeedViewController.make()

Global Feed

This component shows the global feed.

Features

Feature

Description

Global feed

Scroll vertically to see a list of posts from the global feed.

Usage

You can use either of these two methods:

  1. make - the posts will be ranked in chronological order. Below is the sample code.

    let viewController = AmityGlobalFeedViewController.make()

  2. makeCustomPostRanking - the posts will be ranked according to a score-sorting mechanism. Refer to Custom Post Ranking for more information about this feature. You can retrieve your global feed sorted by ranking score with this code.

    let viewController = AmityGlobalFeedViewController.makeCustomPostRanking()

My Community Preview

This component shows a preview of the communities that the user has joined.

Features

Feature

Description

My Community list

User can scroll horizontally to see a list of up to eight communities that the user has joined sorted in alphabetical order.

Navigation to Community profile page

When a user selects an community item, the user is navigated to Community Profile page

Navigation to My community page

When a user selects the arrow, the user is navigated to My community page

Usage

Create a view controller

let viewController = AmityMyCommunityPreviewViewController.make()

Explore Tab

This component consists of Recommend community, Top trending community, and Categories components.

Components

  • Recommended Community

  • Top trending

  • Categories

Usage

Create a view controller

let viewController = AmityCommunityExplorerViewController.make()

Recommended Community

This component shows a list of recommended communities.

Features

Feature

Description

Recommended

Community list

User can scroll horizontally to see up to four recommended communities.

Navigation to Community profile

When a user selects a community item, the user is navigated to Community Profile page

Usage

Create a view controller

let viewController = AmityRecommendedCommunityViewController.make()

Top Trending

This component shows up to five top trending communities.

Features

Feature

Description

Top trending

Community list

User can see up to five top trending communities.

Navigation to Community profile

When a user selects a community item, the user is navigated to Community Profile page.

Usage

Create a view controller

let viewController = AmityTrendingCommunityViewController.make()

Categories

This component shows a list of up to eight categories in alphabetical order.

Features

Feature

Description

Category list

User can see up to eight categories sorted in alphabetical order.

Navigation to Category detail page

When a user clicks on a category item, the user is navigated to Category detail page.

Navigation to Category list

When a user selects the arrow, the user is navigated to Category list page.

Usage

Create a view controller

let viewController = AmityCategoryListViewController.make()

My Community Page

This page shows a list of all communities that a user has joined sorted in alphabetical order.

Features

Feature

Description

My community list

User can scroll vertically to see a list of communities that the user has joined sorted in alphabetical order.

Community search

User can search for community by name.

Community creation

User can click on + button , to open Community Creation page.

Usage

let viewController = AmityMyCommunityViewController.make()

Category List Page

This page shows a list of all categories sorted in alphabetical order.

Features

Feature

Description

Category list

User can see a list of all categories sorted in alphabetical order.

Navigation to Category detail page

When a user selects a category item, the user is navigated to Category detail page.

Usage

Create a view controller

let viewController = AmityCategoryListViewController.make()

Community List by Category Page

This page shows a list of all communities that belong to a category sorted in alphabetical order.

Features

Feature

Description

Community list by category

User can see a list of all communities that belong to a category sorted in alphabetical order.

Navigation to Community Profile page

When a user selects a community item, the user is navigated to Community Profile page.

Usage

Create a view controller

let viewController = EkoCategoryCommunityListViewController.make(categoryId: "CATEGORY_ID")

Community Creation Page

This page provides a form for community creation.

Default state of community creation page

In this version, there is no support for Only admin can post

Feature and Component

Feature

Description

Community creation

User can create a community by filling the required fields and tapping the Create community button.

Usage

Create a view controller

// Create type
let viewController = AmityCommunityCreatorViewController.make()

// Edit type
let viewController = AmityCommunityEditorViewController.make(withCommunityId: "COMMUNITY_ID")

Community Profile Edit Page

This page provides a form for community profile update.

In this version, there is no support for Only admin can post.

Features

Feature

Description

Community profile update

User can update the information such as avatar, community name, description, categories, etc for this community. Profile will be updated upon tapping Save.

Usage

Create a view controller

let viewController = AmityUserProfileEditorViewController.make()

Community Setting Page

This page provides option for user to manage the community.

Community setting page in moderator view

This page is not yet officially supported.

Features

Feature

Description

Leave community

Leave the community by tapping Leave community. If you are the last remaining moderator in the community you need to transfer your moderator role to other members before you can leave the community.

Transfer moderator role

Promote a community member to a moderator

Edit community profile page(moderator user)

Access the Community Profile Edit Page

Close community(moderator user)

Close the community by tapping Close community

Community member page

Access the Community member page

Community Notification setting

View notification setting status and access the Community Push notification setting page

Community Push Notification Settings Page

This page allow user to set the push notification for each community.

Error state and disable of community push notification

Features

Feature

Description

Toggle on/off notification community level setting

Users can choose to toggle on/off the notification setting for this specific community

Hide disable notification setting.

Users will not receive push notifications that have been turned off

Error state handle

When users tries to change the status of the community push notification setting and get an error from our back-end due to a failed attempt

No internet connection state

If users do not have a stable internet connection, the system will show the error

Community Push Notification Settings - Comment and Reply Relate Event Page

Learn how to set push notifications for comment and reply.

Features

Feature

Description

toggle on/off notification community level setting

Users can choose to toggle on/off the notification setting for this specific community

Hide disable notification setting.

Users will not see push notifications that have been turned off

error state handle

When users try to change the status of the community push notification setting and get an error from our back-end due to a failed attempt

Community Push Notification Settings - Post Relate Event Page

Where user can set the push notification related to posts.

Role-related notification settings will be supported soon‌.

Features

Feature

Description

Toggle on/off notification community level setting

User can choose to toggle on / off the notification setting for this specific community

Hide disable notification setting.

User will not see the push notifications that have been turned off

Error state handle

When use tries to change the status of the community push notification setting but not success due to get error from Backend , we will show pop up and return the toggle state to the previous state

Post Creation Page

This page provides a form for post creation.

This is the default state of post creation

Text only

Example of how it looks for text only post
Example on how the hyperlink appears in creation page and on the post component
Mention users in a text post

Text and Images

After image selected & displayed in post creation flow

The user can select images from 2 sources.

Device Camera

System will launch the device camera view

Device Image Gallery

Text and Files

System shows the device file picker
Once file selected, system displays the upload progress bar

Text and Videos

Polls

You can create a poll post and other users can interact with that poll post by selecting from the poll options.

Creating a poll post
Mention users in a poll post

Live Stream

Mention users in a livestream post

To create a live stream post and for a detailed discussion on the live stream features, refer to Livestream Post documentation.

Refer to our Live Stream documentation to enable live stream functionalities.

Features

Feature
Description

Post creation

Create post by adding content such as text, images, videos, and files. Refer to Supported types for more details.

Mention in post

Mention users in post by typing @ to activate mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greater than 50000 or mentions count is greater than 30.

Supported types

  • File: All file types are supported

  • Image: JPG, JPEG, and PNG

  • Video: 3GP, AVI, FLV, MP4 and MPEG-2

  1. The maximum file, image, or video size that you can upload is 1 GB.

  2. Uploaded images or videos whose format is not supported (e.g. HEIC, HEVC) will be automatically converted to PNG for images and MP4 for videos.

Usage

Create a view controller

// Post to user feed
let viewController = AmityPostCreatorViewController.make(postTarget: .myFeed)

// Post to community feed
let viewController = AmityPostCreatorViewController.make(postTarget: .community(object: postModel))

// Poll post
let viewController = AmityPollCreatorViewController.make(postTarget: <your post target>)
self.present(viewController, animated: true, completion: nil)

Parameter

Parameter

Description

postTarget

enums to determine where is the target feed consist of myFeed and community(AmityCommunityModel)

AmityCommunityModel is a wrapper class of AmityCommunity which is a live object from Social Plus SDK.

Attachment options

By default AmityPostCreatorViewController allows all attachments when creating a post. You can optionally choose attachment options when creating the post.

All available attachment options are image, video, and file. These can be found in AmityPostAttachmentType.

// Only allow file attachment in post creator page.
let settings = AmityPostEditorSettings()
settings.allowPostAttachments = [.file]
let postCreator = AmityPostCreatorViewController.make(postTarget: postTarget, settings: settings)

Livestream Post

Host your events virtually and see community interaction as it happens

Social Plus UIKit provides the livestream recording feature that allows you to record livestreams and broadcast simultaneously in real-time. You can also play historical streams when the livestream ends.

This section describes the livestream feature in detail. Refer to our Livestream documentation to enable livestream functionalities.

A livestream post can be viewed in the following feeds:

  • Community feed

  • User feed

  • Global feed

  • Content feed

You will be able to see the livestream post and interact with it as soon as the livestreamer starts streaming.

Livestream in a community feed

Creating a livestream post

To create a livestream post, follow these steps:

  1. Create a livestream post by selecting Livestream from the pop-up and selecting a location where you want to post the stream.

  2. Provide a title and description for your livestream. The Go live button will not enable if you don't provide a title and description.

  3. Add a cover thumbnail from your media gallery for the livestream post and preview the cover image. This step however is optional. You may also update and delete the cover thumbnail.

    Note: A default cover will be used if no cover thumbnail is selected.

  4. Tap Go live to start streaming.

  5. There will be a time indicator on the upper left. It will indicate how long it has been since the livestream started.

  6. The livestream post will then show in the feed.

  7. Tap Finish to end livestreaming. It will then show Ending livestream once the livestream has ended.

    Note: You have the option to edit or delete the livestream post from the feed.

Viewing a livestream post

Live

Other viewers can watch your livestreaming while you are simultaneously recording it. They will see a LIVE indicator on the video.

Tapping the play button in the livestream post will play the video in a full screen mode.

Livestream in full screen

Livestream ended

After ending your livestreaming, the playback video may not be available instantly for viewers to see while it is still in the process of producing the playback video. The viewers will see a message that the playback will be available for watching shortly.

The livestream has ended but the playback is still transcoding

Playback

When the playback video is already available for viewing, a RECORDED indicator is shown on the video post.

Playing a recorded stream and an option to report the post

Idle state

The livestream may be in an idle state. This happens when you delete the livestream in console or or other issues that will not enable the livestreaming to start. The viewer will see a message that the stream is currently unavailable.

Read-only mode

A livestream post will have the same privacy and access controls as with the other posts. This means that users without the permission, such as those who are not members of the community, won’t be able to view the livestreaming/playback video in a private community. If the community is public, non-members can view the post as read-only so they won't be able to interact with it.

Permissions

If it's your first time creating a livestream, your device will prompt to allow access to your device's camera and microphone.

You need to allow access to be able to start a livestream. The pop-up below will not show once you allow access to your camera and microphone.

Post Detail Page

This page shows content of a post including reactions and comments.

Reply feature is coming soon.

Features

Feature

Description

Post content

View content of the post including reactions and comments.

Edit post

Navigate to Post Edit page

Delete post

Tap ... and select Delete post. Tap Delete in the confirmation message to confirm post deletion. Otherwise, tap Cancel.

Report post

Tap ... and tap Report or Undo Report to report or undo report respectively.

Comment creation

Create a comment by adding text to the compose bar and tapping Post

Edit comment

Will navigate to Comment Edit page

Delete comment

Tap ... below the comment and tap Delete comment. Tap Delete in the confirmation message to confirm deletion. Otherwise, press Cancel.

How to use

Create a view controller

let viewController = AmityPostDetailViewController.make(withPostId: "POST_ID")

Link Preview in Post

The Link Preview feature in posts is designed to enrich user experience by providing a visual and informative preview of external links. This feature enhances content sharing, making it more interactive and engaging. This feature significantly improves the user's posting experience. It allows for a preliminary check of the link's accuracy and relevance, adding visual appeal to the post with an informative preview.

When a user includes a link in a post, the feature automatically extracts and displays key information: the title, main image, and a short description, creating an informative preview of the linked content. If the link is unavailable, it will show a empty placeholder or error view instead.

Editing Capability

Users can edit the link preview even after the post is created. This flexibility ensures that the information remains up-to-date and accurate, enhancing the overall quality of the post.

Limitations and Use Cases:

The preview feature is designed to only display images, titles, and descriptions after a post is created. This ensures clarity and relevance in the shared content.

Post Edit Page

This page provides a form to edit post content.

Edit post
Edit post with mention

Limitation: Images and files can only be removed from a post. New images or files cannot be added.

Features

Feature

Description

Text editing

User can edit text content

Image removal

User can remove images

File removal

User can remove files

Usage

Create a view controller

let viewController = AmityPostEditorViewController.make(withPostId: "POST_ID")

Parameter

Parameter

Description

postId

identifier of the particular post

Comment Creation

This page provides information on creating comment.

Create comment
Mention users in a comment

Features

Feature
Description

Comment creation

Add comments to post

Mention in comments

Mention users in comments by typing @ to activate mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greater than 50000 or mentions count is greater than 30.

Usage

Create a view controller

let editCommentViewController = AmityCommentCreatorViewController.make(comment: AmityCommentModel, communityId: String?)

The function will create a new instance of AmityCommentCreatorViewController.

Parameters

Parameter

Data type

Description

comment

AmityCommentModel

Comment model

communityId

String

Target community identifier

Comment Edit Page

This page provides information on editing comment content.

Edit comment
Editing mention in a comment

Features

Feature

Description

Comment editing

Edit comment content and tap Save to submit changes.

Mention in comment

Mention users in comments by typing @ to activate mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greater than 50000 or mentions count is greater than 30.

Usage

Create a view controller

let editCommentViewController = AmityCommentEditorViewController.make(comment: AmityCommentModel, communityId: String?)

The function will create a new instance of AmityCommentEditorViewController.

Parameters

Parameter

Data type

Description

comment

AmityCommentModel

Comment model

communityId

String

Target community identifier

Community Profile Page

This page shows the profile of a community including its own feed.

Non-member View

Non-member view

Community Member View

Community member view

Community Creator View

Components

  • Community feed

  • Media Gallery

Features

Feature

Description

Becoming a member

User can tap Join button to join a community

Post creation

User can tap the floating action button to open Post creation page

Community profile update

Creator can tap Edit profile button to open Community profile edit page

Usage

Create a view controller

let viewController = AmityCommunityProfilePageViewController
.make(withCommunityId: "COMMUNITY_ID")

Community Feed

This component shows a list of posts from a community feed.

Features

Feature

Description

Community feed

User can scroll vertically to see a list of posts from a community feed

Usage

let viewController = AmityCommunityFeedViewController.make(communityId: "COMMUNITY_ID")

Media Gallery

This component shows a collection of images and videos posted in the community feed.

Gallery filtered to show photos only
Gallery filtered to show videos only

Features

Feature

Description

Gallery

Scroll vertically to see images and videos from posts in a community feed.

Media Filter

Filters according to media type (Photos and Videos). Tap the corresponding tabs to see the filtered posts.

Community Member Page

Community member page

Note: In current version, we do not support searching of members and display of moderator list.

Features

Feature

Description

Navigation to user profile page

User can view profile page by tapping on member list item

Report user

User can report members present in community

Usage

let viewController = AmityCommunityMemberSettingsViewController.make(community: community)
navigationController?.pushViewController(viewController, animated: true)

Parameter

Description

community

AmityCommunityModel

User Profile Page

This page shows user profile information as well as user feed.

There are 2 states of User profile page:

1. User's own profile

Community member page

2. Other User's Profile

Components

  • User feed

Features

Feature

Description

User Profile

User can view display name and description

Post creation

User can tap the floating action button to open Post creation page to create a post on user's own page

User profile update

User can tap Edit profile to open User profile edit page to update user's own profile

Usage

let viewController = AmityUserProfilePageViewController.make(withUserId: "USER_ID")

User Feed

This component shows a user feed of a specific user.

Empty state of other user's profile

Features

Feature

Description

User feed

User can scroll vertically to see a list of posts from a user feed

Usage

// Current user feed
let viewController = AmityMyFeedViewController.make()

// Some user feed
let viewController = AmityUserFeedViewController.makeUserFeed(withUserId: "USER_ID")

User Profile Page (2.2)

This User profile page can support the Follow feature and User Privacy feature.

There are two views for the user profile page.

1. User's own profile

This view allows the user to see his own user profile detail and his own user feed, there are two state user can see.

Default state : Allows user to see his own following user counter and Follower user counter.

Request pending state : Allows user to see his own following user counter, Follower user counter, and also the follow request he received.

Feature

Description

Follower counter

Shows the total count of followers. It will redirect to Following / Follower user list page when clicked.

Following counter

Shows the total count of users that you're following. It will redirect to Following / Follower user list page when clicked.

Pending follow request section

If you have pending follow requests from other users, you will see the pending request section. It will redirect to Follow request page when clicked.

Edit user profile

It will redirect to User profile edit page when clicked.

Components

  • User feed (2.2)

You can get this view by using this code:

let userProfileViewController = AmityUserProfilePageViewController.make(withUserId: "userId")

2. Other user's profile

This view allows the user to see other user's profile detail and their user feed. There are two states user can see

In the other user view , UIKIT has two main views that support the Follow user connection and the User privacy view.

Default state : Allows user to see the connection between the current user and the target user profile.

If the current user is NOT connected to the viewing user and Private setting is Public

Follow button shows if user is not yet connect with the viewing user

If the current user is connected to the viewing user and Private setting is Public

Follow button will not show if User is already connected

If the current user is NOT connected to the viewing user and Private setting is Private

User feed is not shown since the current user is not connect and private setting is private.

If the current user has send request to the viewing user and Private setting is Private

Cancel request is shown if user has pending request and waiting for the request to be accept

Feature

Description

Follow button

When clicked, the system will make a connection with the User.

If the Connection method = with request, system will change to cancel pending state.

Cancel request button

When clicked, follow request will be canceled.

Follower counter

Shows the total count of followers. It will redirect to Following / Follower user list page when clicked.

Following counter

Shows the total count of users that you're following. It will redirect to to Following / Follower user list page when clicked.

Pending follow request section

If you have pending follow requests from other users, you will see the pending request section. It will redirect to Follow request page when clicked.

Edit user profile

It will redirect to User profile page when clicked.

User feed (Private view)

If a connection was not established, the user profile and the Private setting is Private.

Components

  • User feed (2.2)

You can get this view by using this code:

let userProfileViewController = AmityUserProfilePageViewController.make(withUserId: "userId")

User Feed (2.2)

This component shows a user feed of a specific user.

Default User Feed

This view allows user to view and interact with the feed content normally. This also applies when the Privacy setting is Public.

Private User Feed

This view blocks any user to see the target user's feed content. This view only exist if the Private setting is Private.

Features

Feature

Description

User feed

User can scroll vertically to see a list of posts from a user feed

Private feed

User cannot see the feed content if user is not connected and the Privacy setting is Private

Usage

// Current user feed
let viewController = AmityMyFeedViewController.make()

// Some user feed
let viewController = AmityUserFeedViewController.makeUserFeed(withUserId: "USER_ID")

User Setting Page(2.2)

User's Own Profile Setting Page

Feature

Description

Edit profile

When clicked, user will be redirect to User profile edit page.

Other User's profile setting page

There are two main state based on the user connection.

If user is already connected with the target user

In version 2.2, we do not have the User notification setting in the menu.

If user is not connected with the target user

Feature

Description

Report / unreport

User can report or unreport user in this user setting page.

Unfollow

User can unfollow other user.

You can try this code:

let userSettingsViewController = AmityUserSettingsViewController.make(withUserId: "userId")

User Profile Edit Page

This page allows a user to edit their own profile information.

`

Features

Feature

Description

User profile update

User can update the information such as avatar, display name, and description. Profile will be updated upon tapping Save.

Usage

let viewController = AmityUserProfileEditorViewController.make()

Following / Follower User List Page (2.2)

In this page , user will see the list of the following user (users who the target userId has been following) and the follower user(users who follow the target userId).

In the current state , NO search in Following and follower list.

user can remove his own follower user.

Features

Feature

Description

Current user profile

If current user will access other user's following and Follower user list, he will see his own profile on top of the list

Report / undo report user

User can send report or undo report in this page via the action menu UIKIT included in this page

Remove user from follower list

If current user will access his own follower list, he can remove followers via the three dots button and action menu

Redirect user to user profile page.

If user taps on the user item list, he will be redirected to user profile page of that user

You can try it with this code:

let vc = AmityUserFollowersViewController.make(withUserId: "userId")
navigationController?.pushViewController(vc, animated: true)

Follow Request Page (2.2)

In this page, user can see all the follow request he has received. He can either accept or decline the request as well.

If user can accept or decline successfully, system shows popup and removes the request.
If the request is not available or has server connection issues, a system error will show

The user sorting will be based on what the server provides.

The follow request will not automatically update. User needs to accept or decline first and if the follow request is not available, system will remove the request from list and prompt that the request is unavailable.

Feature

Description

Accept Follow request

If user accepts the follow request , system will create a relationship with the request sender and the request item will be removed from the list.

Decline Follow request

If user declines the follow request, system will invalidate the follow request

You can use the component with this code:

let requestsViewController = AmityFollowRequestsViewController.make(withUserId: "userId")
navigationController?.pushViewController(requestsViewController, animated: true)

Member Selection Page

User selection flow
Search Flow

Features

Feature

Description

Member Selection

User can select a list of users

Usage

let vwiewController = AmityMemberPickerViewController.make()
navigationController?.pushViewController(viewController, animated: true)

Post Target Selection Page

This page provides a list of community feeds that user can create a post on.

Features

Feature

Description

Post creation on user's own feed

When a user selects My Timeline, UIKit will open Post Creation page with the user's own feed as the target.

Post creation on community feed

When a user selects a community, UIKit will open Post Creation page with the selected community.

Usage

let viewController = AmityPostTargetPickerViewController.make()

Using Your Own Component

Social Plus UIKit allows some parts of the component to be customized:

  • Using your own navigation bar

Using Your Own Navigation Bar

Usage

let communityHomePage = AmityCommunityHomePageViewController.make()
communityHomePage.navigationBarType = .custom

// create custom view
let label = UILabel()
label.text = "This is a navigation custom view"
label.backgroundColor = .orange

// assign custom view to title view
homepage.navigationItem.titleView = label

Overriding UIKit Behaviour

UIKIT allows the default behaviour to be overridden by custom logic.

Feed UI Settings

  • Post Sharing

  • Post Rendering

Post Sharing

Post Sharing Settings

This setting allows you to control where a post can be shared to based on the post origin.

There are five possible targets that a post can be shared to

My feed - The post can be shared to my feed. This option will enable "Share to my timeline" menu when user clicks share button.

Public community - The post can be shared to any public community. This option will enable "Share to group" menu when user clicks share button.

Private community - The post can be shared to any private community. This option will enable "Share to group" menu when user clicks share button.

External - The post can be shared externally. This option will enable "More options" menu when user clicks share button.

Origin - The post can be shared within the community feed that it was created. If the post was created in either public or private community, this option will enable "Share to group" menu when user clicks share button.

There are four possible origins

My feed post - Posts that were created on my feed. By default, possible sharing targets are My feed, Public community, and Private community.

User feed post - Posts that were created on any other users' feed. By default, possible sharing targets are My feed, Public community, and Private community.

Public community feed post - Posts that were created on any public community. By default, possible sharing targets are My feed, Public community, and Private community.

Private community feed post - Posts that were created on any private community. By default, possible sharing target is Origin.

Usage

You can select a set of targets for each post origin.

// In your AppDelegate class

// Ensure post created in private community cannot be shared elsewhere
let privateCommunityShringTargets: Set<AmityPostSharingTarget> = [.originFeed]

// Allow post created by any other user to be shared anywhere
let publicCommunityShringTargets: Set<AmityPostSharingTarget> = [.myFeed, .originFeed, .publicCommunity, .external]

// Allow post created by logged-in user to be shared anywhere
let myFeedShringTargets: Set<AmityPostSharingTarget> = [.myFeed, .originFeed, .external]
        
let sharingSettings = AmityPostSharingSettings(privateCommunity: privateCommunityShringTargets, publicCommunity: publicCommunityShringTargets, myFeed: myFeedShringTargets)
        
AmityUIKitManager.feedUISettings.setPostSharingSettings(settings: sharingSettings)

Post Sharing Events

Based on Post sharing settings, there are up to three post sharing events that can be emitted by UIKit.

Share to my timeline - an event emitted when a user clicks on "Share to my timeline" button.

Share to group - an event emitted when a user clicks on "Share to group" button.

Share externally - an event emitted when a user clicks "More options" button.

Usage

You can choose to intercept one or all of the events and apply your custom behavior.

// In your AppDelegate class

// Create custom event handler class
class CustomFeedEventHandler: AmityFeedEventHandler {
    // Event handler for more options
    override func sharePostDidTap(from source: AmityViewController, postId: String) {
        // generate a link 
        let urlString = "https://amity.co/posts/\(postId)"
        guard let url = URL(string: urlString) else { return }
        
        // create AmityActivityController to share generated link
        let viewController = AmityActivityController.make(activityItems: [url])
        source.present(viewController, animated: true, completion: nil)
    }
    
    // Event handler for share post to group
    override func sharePostToGroupDidTap(from source: AmityViewController, postId: String) {
        // Handle event here
    }
    
    // Event handler for share to my timeline
    override func sharePostToMyTimelineDidTap(from source: AmityViewController, postId: String) {
        // Handle event here
    }
}

...

AmityUIKitManager.feedUISettings.eventHandler = CustomFeedEventHandler()

Post Rendering

Custom Post Rendering

UIKit provides default renderers for the core data types: text, image, and file. It also provides a way to render your own UI for your custom post.

Post Structure:

A single post UI is composed of 1 or more UITableViewCell. This allows reusability of cell components such as header or footer which can be shared by different kinds of posts.

Text Post Structure

This is an example of simple text post which contains 3 tableview cell. Top cell represents the header, middle cell contains text content and bottom cell is footer cell.

Creating UI for custom posts :

There are 3 steps involved in creating custom post renderer.

Step 1: Create your UI using UITableView cells.

class MyPostHeaderCell: UITableViewCell { 
    // ...
}

class MyPostContentCell: UITableViewCell {
    // ...
}

Step 2: Compose a post UI component. For this create a component which conforms to AmityPostComposable protocol.

struct MyCustomPostComponent: AmityPostComposable {
    
    var post: AmityPostModel
    
    // Post data model which you can use to render ui.
    init(post: AmityPostModel) {
        self.post = post
    }
    
    func getComponentCount(for index: Int) -> Int {
        return 2
    }
    
    func getComponentCell(_ tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
        switch indexPath.row {
        case 0:
            let cell = tableView.dequeueReusableCell(withIdentifier: "my-cell-identifier", for: indexPath) as! MyPostHeaderCell
            // ... populate cell data here
            return cell
        case 1:
            let cell = tableView.dequeueReusableCell(withIdentifier: "my-cell-identifier", for: indexPath) as! MyPostContentCell
            // ... populate cell data here
            return cell
        default:
						fatalError("indexPath is out of bound")
        }
    }
    
    // Height for each cell component
    func getComponentHeight(indexPath: IndexPath) -> CGFloat {
        return UITableView.automaticDimension
    }
}

You can also use our default header cell AmityPostHeaderTableViewCell & default footer cell AmityPostFooterTableViewCell in your custom post component.

Step 3: Register your custom cell & implement datasource.

class YourViewController: UIViewController {
    
		func showFeed() {
				// 1.
				// Register your cell here. You can register both 
				// nib as well as class itself.
				AmityFeedUISettings.shared.register(UINib(nibName: "PostThumbsupTableViewCell", bundle: nil), forCellReuseIdentifier: "PostThumbsupTableViewCell")
        AmityFeedUISettings.shared.dataSource = self

        // Showing our feed UI
				let feedViewController = AmityGlobalFeedViewController.make()
	      navigationController?.pushViewController(feedViewController, animated: true)
		}
}

extension YourViewController: AmityFeedDataSource {
    
    // 2. 
    // Provide your rendering component for custom post.
    func getUIComponentForPost(post: AmityPostModel, at index: Int) -> AmityPostComposable? {
        switch post.dataType {
        case "your-data-type":
            return MyCustomPostComponent(post: post)
        default:
            return nil
        }
    }
}

Event Handling

Custom Event Handler

There are many pages and actions on Social Plus UIKit. Pages can be nested inside others and it would be hard to override events on the nested pages. To solve this problem, we provide EkoEventHandler which is a behavior controller for actions that happen in UIKit.

Supported Events

Event

Parameter

Condition

communityDidTap

communityId

community avatar or community display name is tapped

userDidTap

userId

user avatar or user display name is tapped

editUserDidTap

userId

edit user button is tapped

postDidtap

postId

post or comment on social feed is tapped

editPostDidTap

postId

edit post button is tapped

channelDidTap

channelId

user channel list or user chat button is tapped

communityChannelDidTap

channelId

n/a

Example

When a user clicks on the user profile avatar at the post creator area, UIKit will open User profile page.

When user clicks in the area, system opens user profile page

However, you can intercept the event and define your own logic following the example below.

Usage

To customize message cell layouts, please follow these instructions:

  1. Create a subclass of UITableViewCell and conform it to AmityMessageCellProtocol

  2. To bind message data to UI, implement display(message:). You can also implement height(for message:boundingWidth:) to specify the cell height. We've included some examples below for static-height calculation and dynamic-height calculation as reference

  3. Subclass AmityEventHandler, and override its default functions channelDidTap(from:channelId:) and conform to AmityMessageListDataSource.

class CustomChannelEventHandler: AmityChannelEventHandler {
    
    override func channelDidTap(from source: AmityViewController, channelId: String) {
        let viewController = AmityMessageListViewController.make(channelId: channelId, settings: settings)
        viewController.dataSource = self
        source.navigationController?.pushViewController(viewController, animated: true)
    }
    
}

extension CustomChannelEventHandler: AmityMessageListDataSource {
    func cellForMessageTypes() -> [AmityMessageTypes : AmityMessageCellProtocol.Type] {
	// determine which cell represents for which message type.
        return [
            .imageIncoming: StaticHeightMessageCell.self,
	.textIncoming: DynamicHeightMessageCell.self
        ]
    }
}

4. Assign a class instance through a set function of AmityUIKitManager

AmityUIKitManager.set(channelEventHandler: CustomChannelEventHandler())

Customizing Cells with Different Layouts

Static-Height Cell Layout

You can use static-height cell layout types for static content, where the cell height is fixed and will not be scaled regardless of the data being received.

Below is an example of how you can configure a static-height cell layout. In this example, we're assuming that the image message is a class named StaticHeightMessageCell.

class StaticHeightMessageCell: UITableViewCell, AmityMessageCellProtocol {
    
    func display(message: AmityMessageModel) {
        // configure cell here, e.g. set message text to label.
    }
    
    static func height(for message: AmityMessageModel, boundingWidth: CGFloat) -> CGFloat {
        // Calculate the actualHeight by summing up all components height.
        let actualHeight: CGFloat = 34 + 228 + 34 // 296
        
        return actualHeight
    }
    
}

Dynamic-Height Cell Layout

You can use dynamic-height cell layout when you require your cell height to expand dynamically according to the data (e.g. label expands upon strings).

Dynamic-height cell layouts require more complexity in height calculation. Let's look at a text message as an example, where the height of the cell needs to expand dynamically to display the full content.

class DynamicHeightMessageCell: UITableViewCell, AmityMessageCellProtocol {
    
    func display(message: AmityMessageModel) {
        // configure cell here, e.g. set message text to label.
    }
    
    static func height(for message: AmityMessageModel, boundingWidth: CGFloat) -> CGFloat {
        
        // (1) Calculate the width that is reserved by other components.
        let reservedWidth: CGFloat = 12 + 40 + 12 + 8 + 8 + 76 // 156
        
        // (2) Calculate the maximum possible width that content can fit in.
        //
        // A `boundingWidth` is a width that returns from table view. In this example is 375.
        // To get the possible with. We need to subtract it by (1).
        let possibleWith: CGFloat = boundingWidth - reservedWidth // 375 - 156 = 210
        
        // (3) Calculate the content height using font and string.
        let messageHeight = message.text?.height(withConstrainedWidth: possibleWith, font: AmityFontSet.body) ?? 0.0
        
        // (4) Calculate the height that is reserved by other component.
        let reservedHeight: CGFloat = 34 + 8 + 8 + 34 // 84
        
        // (5) Calculate the actualHeight by summing up (3) and (4).
        let actualHeight: CGFloat = messageHeight + reservedHeight
        
        return actualHeight
    }
    
}

Roles & Permissions

From v1.8 onwards, UIKit provides the capability for you to manage roles & permissions via the integration with SDK.

UIKIT offers you a ready-to-use integration solution with the SDK Role & Permission feature. The default Community level role is Moderator.

Permissions

Description

Add user

Moderator user can add new member to the community.

Remove user

Moderator user can remove member from the community.

Assign Moderator role to other users

Moderator user can assign Moderator role to another member in the same community

Remove Moderator role from a Moderator user

Moderator user can remove Moderator role from another Moderator in the same community

Edit community

Moderator user can rename community, change community type as he see fit

Close community

Moderator user can close the community

Moderator badge

the "Moderator" badge shown on the post indicates it was created by a moderator user

Moderator badge

The "Moderator" badge shown on the post and the comment indicates it was created by a moderator user.

Chat UIKit

With our chat functionality in Social Plus UIKit, you can explore how best to integrate and design messaging features and how they will look in your app.

Using as a Whole Feature with the Default Settings

This is the fastest way to use the chat function. All standard logics and navigations are already defined.

Usage

import UIKit
import AmityUIKit

class ClientViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func showChatListPage(_ sender: UIButton) {
        let chatHomeVC = AmityChatHomePageViewController.make()
        present(chatHomeVC, animated: true)
    }
}

Using Only Some Components

There are many components that you can use and integrate into your existing application.

Limitation

UIKit provides already built UI elements in one page. You can change the appearances, such as color and typography in the global settings. However, UIKit does not allow you to replace these small components with other views. And you cannot modify the view hierarchy inside the page.

Chat Home Page

This page consists of one component in a single tab.

Components

  • Recent chat

Usage

import UIKit
import AmityUIKit

class ClientViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func showChatListPage(_ sender: UIButton) {
        let chatHomePageVC = AmityChatHomePageViewController.make()
        present(chatHomePageVC, animated: true)
    }
}

Recent chat

This page shows a list of the most recent chats.

Empty chat

Features

Feature

Description

Recent chat list

User can see a list of the most recent chats

Navigation to Message list

When a user selects a chat, UIKit opens a chatroom page

Usage

import UIKit
import AmityUIKit

class ClientViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func showChatListPage(_ sender: UIButton) {
        let recentChatVC = AmityRecentChatViewController.make()
        present(recentChatVC, animated: true)
    }
}

Chat Room Page

This page shows all the messages in a direct chat.

Direct one to one chat

Message List Page Header

Feature

Description

User avatar

If the user has no avatar, the system will show the default avatar.

User Display name

If the user has no display name, the display name will be 'anonymous'.

Back button

Redirects user back to the previous page.

Message List

Feature

Description

Show list of message

The latest message bubble will be at the bottom of the screen. Scroll up to see all messages.

Date label

Grouping of messages by the sent date

Message Bubble - Text Message Bubble

Feature

Description

Read more mode

When the text is more than 13 lines, the system show read more mode. Once it is clicked on the read more button, it expands text to the full size.

Long press to delete

If the long click event occurs, the system will show the delete option.

Long press to edit

If the long click event occurs, the system will show the edit option. When click the edit option, the system will redirect the user to the edit message page.

Error to send message indicator

If the message can not be sent, the system will show the error indicator in front of the message bubble.

Sent time stamp

Show as time stamp HH:MM

Edited label

If the message is edited, the edited label will be shown.

Deleted message

If the message is deleted, the deleted view will be shown.

Message bubble - Image message bubble

Feature

Description

Image thumbnails

The system shows the image base on the image ratio. Once it is clicked, it will redirect the user to the edit message page.

Image upload state

The system will show the image uploading indicator while the image is being uploaded.

Image Preview Page

Feature

Description

Pinch zoom gesture

The user can pinch the screen to zoom in or out the image.

back

Redirect user back to the previous page.

Message Bubble - Audio Message Bubble

Feature

Description

Click to play

If the user clicks on the voice message , the system will play the audio

Click to stop

If the user clicks on the playing voice message or play another voice message, the system will stop playing the playing audio.

Audio Message Recorder

Feature

Description

Hold to record

The user can hold to record an audio message for up to 60 seconds. Once the user releases the finger, the system will send the audio message.

Discard the record

The user can drag the finger to the bin button to discard the current recording session.

Edit Text Message Page

Feature

Description

Add text

User can update the text from the original input

Save

User can click save button to save the change he made.

Discard change

user can click x to discard all change before user click save.

Usage

import UIKit
import AmityUIKit

class ClientViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func showMessageListPage(_ sender: UIButton) {
        let messageVC = AmityMessageListViewController.make(channelId: "CHANNEL_ID")
        present(messageVC, animated: true)
    }
}

Parameters

Parameter

Description

channelId

Use to query channel info and message list

Specify Custom Settings

You can create and specify Settings object when creating AmityMessageListViewController.

// 1. Create the settings object.
var settings = AmityMessageListViewController.Settings()
settings.composeBarStyle = .textOnly

// 2. Specify the settings as parameter.
let messageVC = AmityMessageListViewController.make(channelId: "CHANNEL_ID", settings: settings)

The available settings are shown below.

Compose Bar Style

There are two compose bar styles available in the UIKit.

  1. ComposeBarStyle.default - has full functionalities including text, audio and, image message sending

  2. ComposeBarStyle.textOnly - has simple functionalities which are only limited to text message sending

The default settings for compose bar style is ComposeBarStyle.default.

Using your own component

Social Plus UIKit allows you to personalise some parts of the component.

Message Bubble

UIKit allows all types of message bubble to be replaced.

Text Message Bubble

Image Massage Bubble

Audio Message Bubble

Usage

To customize message UI, create a new UITableViewCell and conform to AmityMessageCellProtocol.

import UIKit
import AmityUIKit

class CustomTableViewCell: UITableViewCell, AmityMessageCellProtocol {
    func display(message: AmityMessageModel) {
        // Do stuff
    }
}
import UIKit
import AmityUIKit

class ClientViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func showChatPage(_ sender: UIButton) {
        let chatVC = AmityChatHomePageViewController.make()
        chatVC.messageDataSource = self
        present(recentChatVC, animated: true)
    }
}

extension ClientViewController: AmityMessageListDataSource {
    func cellForMessageTypes() -> [AmityMessageTypes: AmityMessageCellProtocol.Type] {
        return [.textIncoming: CustomTableViewCell.self]
    }
}

Video UIKit

Our video functionality within the Social Plus UIKit will allows for richer, interactive experiences by enabling live streaming on your application

More than ever, videos are increasingly dominating mobile screens. From fun short-form clips to promote new products to live-streamed talk shows to educate your customers, videos have the potential to transform the way customers experience your brand.

Livestream

The UIKit now supports live stream posts so you can create and watch live streams.

Installation

To enable live stream functionalities easily, we’ve provided AmityUIKitLiveStream, which is built on top of Social Plus UIKit and Social Plus SDK.

The plugin provides:

  • LiveStreamBroadcastViewController to create and broadcast live stream posts

  • LiveStreamPlayerViewController to watch live streams

The live stream plugin can be installed via Swift Package Manager with these steps:

  1. In Xcode, select File > Swift Packages > Add Package Dependency.

  2. Specify the Repository: https://github.com/AmityCo/Amity-Social-Cloud-UIKit-LiveStream-iOS-SwiftPM.

  3. Select Up to Next Major, then click Next.

  4. Select AmityUIKitLiveStream, then click Finish.

After successfully installing the plugin, you must override the live stream behaviors with these steps:

  1. Create AmityEventHandler subclass, and override live stream functions.

    import UIKit
    import AVKit
    import AmityUIKit
    import AmitySDK
    import AmityUIKitLiveStream
    import AmityVideoPlayerKit
    
    class CustomEventHandler: AmityEventHandler {
        
        override func createLiveStreamPost(
            from source: AmityViewController,
            targetId: String?,
            targetType: AmityPostTargetType,
            destinationToUnwindBackAfterFinish: UIViewController
        ) {
            
            let broadcastVC =
                LiveStreamBroadcastViewController(client: AmityUIKitManager.client, targetId: targetId, targetType: targetType)
            broadcastVC.destinationToUnwindBackAfterFinish = destinationToUnwindBackAfterFinish
            broadcastVC.modalPresentationStyle = .fullScreen
            source.present(broadcastVC, animated: true, completion: nil)
            
        }
        
        override func openLiveStreamPlayer(from source: AmityViewController, postId: String, streamId: String) {
            
            let playerVC = LiveStreamPlayerViewController(streamIdToWatch: streamId)
            source.present(playerVC, animated: true, completion: nil)
            
        }
        
        override func openRecordedLiveStreamPlayer(from source: AmityViewController, postId: String, stream: AmityStream) {
            let player = AmityRecordedStreamPlayer(client: AmityUIKitManager.client, stream: stream)
            let playerViewController = AVPlayerViewController()
            playerViewController.player = player
            source.present(playerViewController, animated: true) { [weak player] in
                player?.play()
            }
        }
        
    }
  2. Set the custom event handler for Social Plus UIKit.

    AmityUIKitManager.set(eventHandler: CustomEventHandler())

App Permissions

LiveStreamBroadcastViewController requires these permissions:

  1. Camera Permission - to broadcast live stream video

  2. Microphone Permission - to broadcast live stream audio

After LiveStreamBroadcastViewController is presented, it will prompt to ask permission automatically if needed. You must include these permission keys in your app’s Info.plist file:

  1. NSCameraUsageDescription

  2. NSMicrophoneUsageDescription

Android (Deprecated)

Social Plus modules are ready-to-use — the only things left to do for our customers are integration and front-end. Going the extra mile, we've created a UIKit with endless customizations.

Introduction

Our Chat UIKit and Social UIKit for Social Plus is a development kit with a user interface to enable fast integration of standard Social Plus Chat and Social Plus features into new or existing applications. Themes allow you to apply your style through colors and fonts.

We have now open-sourced Social Plus UIKit so you will have complete control of the visual style of your Chat and Social application with endless customizations. Social Plus UIKit open source is now available in our GitHub repository.

To customize Social Plus UIKit open source, download the source code and apply the customizations in the forked source code. Once you fork our UIKit source code separately, you basically own the product so you are free to customize and build it for your specific use cases.

We recommend that you use Social Plus UIKit open source when:

  1. The standard UIKit is not applicable to your use case.

  2. You want to use a Social Plus Chat or Social SDK feature which is not yet supported in our standard UIKit.

Please note that we will extend only limited support once you customize our UIKit open source since we won’t be able to fully know your code once you fork it.

Documentation

We are using the Social Plus UIKit open-source wiki for any documentation related to Social Plus UIKit open-source.

For our standard UIKit, you can refer to the documentation here.

Community Guidelines

If you would like to suggest improvements to the source code, you can submit a pull request. If you find bugs or would like to request features, you can create an issue. Please note that not all changes and requests will be approved but they will be assessed in due course.

For more information on these guidelines, you may refer to the Social Plus UIKit open-source wiki or you may go directly to these related pages:

  • Customizing Social Plus UIKit Open Source

  • Contributing to Social Plus UIKit Open Source

  • Submitting fixes and feature requests

Benefits

  • Easy Installation.

  • Fully-featured chat experience with minimal coding.

  • Customize targeted UX flows, and specific views and respond to user interactions to tailor a user experience for just your application.

Overview

Requirements

  • Android 5.0 (API level 21 or higher)

  • Java 8

  • AndroidX

  • Material components

  • Gradle 3.4.0 or higher

Implementation Strategies

The UIKit API provides several strategies to integrate with your application.

Page Presentation

  • Use the UIKit, ready to use out of the box

  • Integrate the Chat experience in the least amount of effort.

Page Presentation (Custom)

  • Add a custom theme to the default implementation of the UIKit.

  • Complete control of the visual style of Chat UI by implementing declarative styles (fonts and colors) for your user interface.

Page Integration

  • Use key components from the UIKit SDK and integrate them directly into your application.

  • Add the Chat UI to your existing design.

Key Concepts

Architecture

The UIKit is built on the foundation of the Social Plus API. We add a UI layer to speed product development efforts of your application. At the core, it is leveraging the same Channel, Messaging concepts, subscribing to live objects whilst adding a UIKit to accelerate product delivery and UI that delivers great user experience for companies wanting to deploy messaging and other functionality.

In the current state, there are two modules that can be used. You can follow the steps below. These two modules can be integrated into your application with ease using this documentation.

Module

Description

​Community (Group) Module​

A feature for Social media. User can create community, create post content and view new content generated via Feed.

​Chat Module​

A feature that allows user to create chat groups, sending a variety of message type such as text, image, etc.

Android UIKit Installation Guide

Social Plus Android UIKit Installation Guide

To allow for more customization, we have now open sourced our UI Kits and deprecated the packaged UI Kit version that was previously available.

With open source, developers have more flexibility and greater customization options, allowing you to have complete control over the visual style. Open sourcing allows for more transparency and visibility, and enables contributions from a greater developer community in terms of good design, implementation, code improvement, and fixes, translating into a better product and development experience.

To ensure that you continue to receive the latest features and updates, we encourage you to migrate over to the open source version. This guide will help you:

  • Migrate Android Open Source UI Kit with an existing project

  • Modify Open Source UI Kit to customize the visual style

  • Get latest Open Source UI Kit updates

Migrate Android Open Source UI Kit with Existing Project

Remove existing gradle dependency

If you've never used UI Kit from a gradle dependency before, you may skip this step and proceed to the next step. If you are migrating the UIKit with an existing gradle dependency, you will need to remove it from the gradle at the application level.

implementation 'com.github.AmityCo.Amity-Social-Cloud-UIKit-Android:amity-uikit:x.y.z'

Import UI Kit module to your existing project

  • Clone or download source code from an open-source Github repository. https://github.com/AmityCo/Amity-Social-Cloud-UIKit-Android-OpenSource

  • Navigate to your current application in Android Studio, then at the top navigation bar go to File > New > Import Module...

  • Choose the source directory where you downloaded/cloned UI Kit source code.

  • Make sure that you import :chat , :common, :social, and :amity-uikit module as per the screenshot described. The :sample module is optional and solely contains examples of UIKit Fragments and Activities.

  • Navigate to the root project's settings.gradle file once the modules have been successfully imported. You may see that Android Studio generated a dependency path from the UI Kit source code directory you specified initially. However, there's a chance that Android Studio won't do so or may generate the incorrect path. Please double-check that the path is accurate.

  • Additionally, in the root project's settings.gradle it's also mandatory to declare jitpack.io repository destination by adding maven { url https://jitpack.io } to dependencyResolutionManagement > repositories.

  • Add the imported module to application's gradle file by adding:

implementation project(path: ':amity-uikit')
  • Exclude these META-INF from the packaging options in application's gradle

 packagingOptions {
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/io.netty.versions.properties'
    }
  • Lastly, apply this in the project-level build.gradle file. apply from: "../Amity-Social-Cloud-UIKit-Android/buildsystem/dependencies.gradle"

Also make sure that your settings android.nonTransitiveRClass=false in gradle.properties file.

Woohoo! All set now you're ready to explore and modify our UI Kit in your application project.

Modifying Android Open Source UI Kit

You can modify the Android open-source UI Kit to customize behaviors to fit your needs. To modify the code, simply copy and paste it into your local machine.

We recommend that you first fork the repository before starting any customization work so that it will be easier to merge the code with the next version update that we provide from the main repository.

Reference on forking: https://docs.github.com/en/get-started/quickstart/fork-a-repo

Get Latest Open Source UI Kit Updates

To update to the latest version of the UI Kit, you can pull the latest commit of the git submodule.

cd Amity-Social-Cloud-UIKit-Android-OpenSource
git pull origin master
cd ..
git add .
git commit -m “Update android uikit opensource submodule”
git push origin branch_name

Installing UIKit (deprecated)

The Android SDK is delivered via Jitpack repository.

To provide greater customization options, we have open-sourced our UIKit and deprecated the managed UIKit version previously available. For the best quality and access to the latest features, we strongly recommend integrating our UIKit with the open-source version. For more details Please refer to Android UIKit Installation Guide section.

Prerequisite

SDK supports Android 5.0 (API Level 21) and above

android {
    ...
    defaultConfig {
        minSDKVersion 21 // at least 21
    }
}

Installation

Add the Jitpack repository in your project level build.grade at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency in your module level build.grade. Find latest UIKit version at Changelog.

// add buildFeatures, compileOptions and kotlinOptions in android tag
android {

    buildFeatures {
        dataBinding = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
    
}
    
dependency {
implementation 'com.github.AmityCo.Amity-Social-Cloud-UIKit-Android:amity-uikit:x.y.z'
}

AmityUIKit already includes our SDK. Don’t install AmitySDK separately if you have already installed the UIKit.

From the version 3.x. please install the UIKit with the open source guideline here Android UIKit Installation Guide

Managing Conflicting File Generation

In your app module's build.gradle , add the following packaging options.

android {
    ...
    packagingOptions {
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/io.netty.versions.properties'
    }
}

Code Obfuscation

By using our SDK, you can use the Android ProGuard tool to obfuscate, shrink, and optimize your code. Obfuscated code can be more difficult for other people to reverse engineer. ProGuard renames classes, fields, and methods with semantically obscure names and removes unused code. However, you need to add these configurations to your ProGuard rules when using our SDK.

-keep class com.ekoapp.ekosdk.** { *; }
-keep interface com.ekoapp.ekosdk.** { *; }
-keep enum com.ekoapp.ekosdk.** { *; }
-keep class com.amity.socialcloud.** { *; }
-keep interface com.amity.socialcloud.** { *; }
-keep enum com.amity.socialcloud.** { *; }

Setup & Authentication

Compatibility

We are always working to enhance our existing UIKit. As a result, the minimum compatibility may vary for our previous version releases. Below is the compatibility list for our latest release. For a complete compatibility history of any given UIKit version, you may refer to our changelogs.

  • Glide - 4.12.0

  • OKHTTP3 - 4.9.02

  • Retrofit2 - 2.9.1

  • Android Paging Data Library - 3.1.1

  • Room - 2.5.1

  • RxJava3 - 3.1.5

  • Gson - 2.8.10

  • Kotlin-std-lib - 1.7.20

  • Kotlin-coroutines - 1.5.0

  • Media 3 - 1.1.0

  • HiveMQ mqtt client - 1.3.1

Initialize the SDK

Before using the SDK, you need to initialize the SDK with your API key. Please find your account API key in Social Plus Cloud Console.

After logging in Console:

  1. Click Settings to expand the menu.

  2. Select Security.

  3. On the Security page, you can find the API key in the Keys section.

API key in Security page

You can specify endpoints manually via optional parameters. API endpoints for each data center are different so you need to adjust the endpoint accordingly.

We currently support multi-data center capabilities for the following regions:

Region

Endpoint

Endpoint URL

Europe

AmityRegionalEndpoint.EU

api.eu.amity.co

Singapore

AmityRegionalEndpoint.SG

api.sg.amity.co

United States

AmityRegionalEndpoint.US

api.us.amity.co

Authentication

You must first register the current device with a userId. A device registered with a userId will be permanently tied to that userId until you deliberately unregister the device, or until the device has been inactive for more than 90 days. A device registered with a specific userId will receive all messages belonging to that user.

Using Themes

Using the default theme

UIKit uses the default theme as part of the design language.

Theme customization

The UIKit looks great without any customizations, though you can also edit the colors and fronts in the themes to suit your preferences all the same. However, if you wish to customize the theme, you can declare changes to both colors and typography.

Colors

UIKit uses a small set of declared colors to simplify the design task for developers. These colors are automatically rendered at appropriate shades to communicate states and interaction to the users.

Color

Description

Default

Primary

Used for buttons and primary call to actions

#1054DE

Secondary

Used in secondary UI elements

#292B32

Alert

Used when informing users of errors or information that requires an attention.

#FA4D30

Highlight

Used for hyperlink text

#1054DE

Base

Text presented on light background

#292B32

Base Inverse

Text presented on dark background

#FFFFFF

Message Bubble

Background color of message bubble sent by the user

#1054DE

Message Bubble Inverse

Background color of message bubble sent to the user

#EBECEF

Usage

Customize color theme by declaring color code to the specific color key.

colors.xml

<resources>
    <color name="amityColorPrimary">#1054DE</color>
    <color name="amityColorSecondary">#292B32</color>
    <color name="amityColorAlert">#FA4D30</color>
    <color name="amityColorHighlight">#1054DE</color>
    <color name="amityColorBase">#292B32</color>
    <color name="amityColorBaseInverse">#FFFFFF</color>
    <color name="amityMessageBubble">#1054DE</color>
    <color name="amityMessageBubbleInverse">#EBECEF</color>
</resources>

Overriding the default UIKit theme

When you integrate UIKit to your application, it applies the our customized theme to UIKit by default. This Amity.Base.Theme.AmityApp style extends a theme from our material based theme and includes overrides for styling attributes that are used by key UI elements. So you can quickly customize UIkit style by overriding the provided theme file and its attributes. Please note that all following attributes must be overriden.

For example, your styles.xml file should look similar to this:

    <!--     Override Amity UIKIT Theme, all of these attributes are mandatory. You could override them , but please don't remove any. Otherwise ui theme may be strange-->
    <style name="Amity.Base.Theme.AmityApp" parent="Amity.Base.Theme.MaterialThemeBuilder">
        <!--        Color of status bar-->
        <item name="android:statusBarColor">#000000</item>
        <!--        Light/dark theme of status bar-->
        <item name="android:windowLightStatusBar" tools:targetApi="23">false</item>
        <!--        Navigation bar color-->
        <item name="android:navigationBarColor">#000000</item>
        <!--        Global toolbar style-->
        <item name="toolbarStyle">@style/MyToolbarStyle</item>

        <!--        Primary accent color-->
        <item name="colorPrimary">@color/amityColorPrimary</item>
        <!--        Secondary accent color-->
        <item name="colorSecondary">@color/amityColorSecondary</item>
        <!--        Global background color-->
        <item name="android:colorBackground">@color/amityColorWhite</item>
        <item name="colorSurface">@color/amityColorWhite</item>

        <item name="colorError">@color/amityColorAlert</item>
        <item name="colorOnError">@color/amityColorWhite</item>
        <item name="android:actionMenuTextColor">@color/amityColorHighlight</item>

        <item name="materialAlertDialogTheme">@style/AmityAlertDialogTheme</item>
        <!--        Snackbar style-->
        <item name="snackbarStyle">@style/AmitySnackBarStyle</item>
        <!--        Search view style-->
        <item name="searchViewStyle">@style/AmitySearchViewStyle</item>

        <item name="shapeAppearanceSmallComponent">@style/Amity.ShapeAppearance.Theme.SmallComponent
        </item>
        <item name="shapeAppearanceMediumComponent">
            @style/Amity.ShapeAppearance.Theme.MediumComponent
        </item>
        <item name="shapeAppearanceLargeComponent">@style/Amity.ShapeAppearance.Theme.LargeComponent
        </item>
        <item name="bottomSheetDialogTheme">@style/Amity.ThemeOverlay.Theme.BottomSheetDialog</item>
    </style>

    <!--       Example of custom toolbar style, color is the only option can be customised here-->
    <style name="MyToolbarStyle" parent="Widget.MaterialComponents.Toolbar">
        <!--       Color of toolbar-->
        <item name="android:background">#3A3A3A</item>
    </style>

    <!--     Override Amity UIKIT text style in toolbar, all of these attributes are mandatory.
              You could override them but please don't remove any. Otherwise ui theme may be strange-->
    <style name="ToolBarLeftTextStyle">
        <!--     Please don't change width and height-->
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">wrap_content</item>
        <!--     Text size of the toolbar title text-->
        <item name="android:textSize">@dimen/amity_text_size_title</item>
        <!--     Style of the toolbar title text-->
        <item name="android:textStyle">bold</item>
        <!--     Margin of the toolbar title text-->
        <item name="android:layout_marginStart">@dimen/amity_padding_m1</item>
        <!--     Text color of the toolbar title text-->
        <item name="android:textColor">#FFFF</item>
        <item name="android:maxLines">1</item>
        <item name="android:ellipsize">end</item>
        <item name="android:layout_marginEnd">@dimen/amity_padding_m1</item>
    </style>

    <!--     Override Amity UIKIT left icon in toolbar, all of these attributes are mandatory.
          You could override them but please don't remove any. Otherwise ui theme may be strange-->
    <style name="ToolBarLeftDrawableStyle">
        <!--     Please don't change width and height-->
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <!--     Color of the toolbar icon-->
        <item name="android:tint">#FFFF</item>
        <item name="android:layout_marginStart">@dimen/amity_padding_m2</item>
    </style>

Social UIKit

Our community group functionality within UIKit allows you to explore social features and see how they will look in your app.

Using as a whole feature with the default settings

This is the quickest way to start using the Community feature. All the default logic and navigations have already been defined.

Usage

Start an Activity

val intent = Intent(this, AmityCommunityHomePageActivity::class.java)
startActivity(intent)

Create a Fragment

class MyCommunityHomeActivity: AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_my_community_home)
        if(savedInstanceState == null) {
            val fragmentManager = supportFragmentManager
            val fragmentTransaction = fragmentManager.beginTransaction()
            val fragment = createCommunityHomeFragment()
            fragmentTransaction.replace(R.id.fragmentContainer, fragment)
            fragmentTransaction.commit()
        }
    }

    private fun createCommunityHomeFragment(): Fragment {
        return AmityCommunityHomePageFragment.Builder().build(activity)
    }
}

Our Components

There are many components that you can use and integrate into your existing application.

Limitation

UIKit provides already built UI elements in one page. You can change the appearances, such as color and typography in the global settings. However, UIKit does not allow you to replace these small components with other views. And you cannot modify the view hierarchy inside the page.

Community Home Page

This page consists of two components represented in tabs.

Empty state of community home page

Components

  • Explore

  • Newsfeed

Usage

Create a Fragment

AmityCommunityHomePageFragment
           .newInstance()
           .build()

Newsfeed

This page consists of two components - My community and Global feed.

News feed tab in empty state
News feed tab with My Community component and global feed active

Components

  • My Community

  • Global feed

Usage

Create a Fragment

AmityNewsFeedFragment.newInstance().build()

Global Feed

This component shows the global feed.

Features

Feature

Description

Global feed

Scroll vertically to see a list of posts from the global feed.

Usage

Create a Fragment

You can use either of these two methods:

  1. build - the posts will be ranked in chronological order. Below is the sample code.

    AmityGlobalFeedFragment.newInstance().build()

  2. <newCustomPostRankingmethod> - the posts will be ranked according to a score-sorting mechanism. Refer to Custom Post Ranking for more information about this feature. You can retrieve your global feed sorted by ranking score with this code.

    let viewController = AmityGlobalFeedViewController.makeCustomPostRanking()

My Community Preview

This component shows a preview of the communities that the user has joined.

Features

Feature

Description

My Community list

User can scroll horizontally to see a list of up to eight communities that the user has joined sorted in alphabetical order.

Navigation to Community profile page

When a user selects a community item, the user is navigated to Community Profile page.

Navigation to My community page

When a user selects the arrow, the user is navigated to the My community page.

Usage

Create a Fragment

AmityMyCommunityPreviewFragment.newInstance().build()

Explore Tab

This component consists of three components - Recommend community, Top trending community, and Categories components.

Components

  • Recommended Community

  • Top trending

  • Categories

Usage

Create a Fragment

AmityExploreFragment.newInstance().build()

Recommended Community

This component shows a list of recommended communities.

Features

Feature

Description

Recommended

Community list

User can scroll horizontally to see up to four recommended communities.

Navigation to Community profile

When a user selects a community item, the user is navigated to the Community Profile page.

Usage

Create a Fragment

AmityRecommendedCommunityFragment.newInstance().build()

Top Trending Community

This component shows up to five top trending communities.

Features

Feature

Description

Top trending

Community list

User can see up to five top trending communities.

Navigation to Community profile

When a user selects a community item , the user is navigated to the Community Profile page.

Usage

Create a Fragment

AmityTrendingCommunityFragment.newInstance().build()

Categories

This component shows a list of up to eight categories in alphabetical order.

Features

Feature

Description

Category list

User can see up to eight categories sorted in alphabetical order.

Navigation to Category detail page

When a user clicks on a category item, the user is navigated to Category detail page.

Navigation to Category list

When a user selects the arrow, the user is navigated to Category list page.

Usage

Create a Fragment

AmityCategoryPreviewFragment.newInstance().build()

My Community Page

This page shows a list of all communities that a user has joined, sorted in alphabetical order.

My community search view

Features

Feature

Description

My community list

User can scroll vertically to see a list of communities that the user has joined sorted in alphabetical order.

Community search

User can search for a community using the Community name.

Community creation

User can click on + button, to open Community Creation page.

Usage

AmityMyCommunityFragment
    .newInstance()
    .enableSearch(true) // seach view to search community
    .showOptionsMenu(true) // option menu to create community in toolbar
    .build()

Category List Page

This page shows a list of all categories sorted in alphabetical order.

Features

Feature

Description

Category list

User can see a list of all categories sorted in alphabetical order.

Navigation to Category detail page

When a user selects a category item, the user is navigated to the Category detail page.

Usage

Start an Activity

val intent = Intent(this, AmityCategoryListActivity::class.java)
startActivity(intent)

Create a Fragment

AmityCategoryListFragment.newInstance().build(activity)

Community List By Category Page

This page shows a list of all communities that belong to a category sorted in alphabetical order.

Features

Feature

Description

Community list by category

User can see a list of all communities that belong to a category sorted in alphabetical order.

Navigation to Community Profile page

When a user selects a community item, the user is navigated to Community Profile page.

Usage

Start an Activity

val intent = AmityCategoryCommunityListActivity.newIntent( this, category)
startActivity(intent)

Create a Fragment

AmityCategoryCommunityListFragment
            .newInstance()
            .category(category)
            .build()

Community Creation Page

This page provides a form for community creation.

Default state of community creation page

Feature and Component

Feature

Description

Community creation

User can create a community by filling the required fields and tapping + Create community.

Usage

Start an Activity

val intent =  Intent(this, AmityCommunityCreatorActivity::class.java)
startActivity(intent)

Create a Fragment

AmityCommunityCreatorFragment.newInstance().build()

Community Profile Edit Page

This page provides a form for community profile update.

Features

Feature

Description

Community profile update

User can update the information such as avatar, community name, description, categories, etc for this community. Profile will be updated upon tapping SAVE.

Usage

Create a Fragment

AmityCommunityEditorFragment
    .newInstance(community or communityId)
    .build(activity)

Post Creation Page

This page provides a form for post creation.

The default state of post creation

Types of Post Creations:

Text

example of text post
Mention users in a post
Example of hyperlink generated from URL input

Text and Images

User can select images from 2 sources.

Device Camera

System will launch the device camera view

Device Image Gallery

Text and Files

Text and Videos

Polls

Poll post
Mention users in a poll post

Livestream

To create a live stream post and for a detailed discussion on the live stream features, refer to Livestream post documentation.

Mention users in a livestream post

Features

Feature

Description

Post creation

User can create post by adding content such as text, images, videos and files.

Mention in post

Mention users in post by typing @ to activate mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greater than 50000 or mentions count is greater than 30.

Usage

Create a Fragment

User can create a post either on a community feed or user's own feed.

Attachment options

We currently support three types of attachment option when creating a post. These are:

  1. AmityPostAttachmentItem.PHOTO

  2. AmityPostAttachmentItem.VIDEO

  3. AmityPostAttachmentItem.FILE .

You can optionally choose to allow these attachment options by using the method allowPostAttchments. By default the fragment includes all attachment options.

Create a post on community feed

//for text, image, file, video post
AmityPostCreatorFragment.newInstance()
    .onCommunityFeed(community or communityId)
     //optional
     .allowPostAttachments(
           listOf(
                   AmityPostAttachmentOptionItem.PHOTO,
                   AmityPostAttachmentOptionItem.VIDEO,
                   AmityPostAttachmentOptionItem.FILE
               )
           )
    .build()
    
//for poll post    
AmityPollPostCreatorFragment.newInstance()
    .onCommunityFeed(community or communityId)
    .build()

Create a post on user's own feed

//for text, image, file, video post
AmityPostCreatorFragment.newInstance()
     .onMyFeed()
     //optional
     .allowPostAttachments(
           listOf(
                   AmityPostAttachmentOptionItem.PHOTO,
                   AmityPostAttachmentOptionItem.VIDEO,
                   AmityPostAttachmentOptionItem.FILE
               )
           )
     .build()
   
//for poll post      
AmityPollPostCreatorFragment.newInstance()
     .onMyFeed()
     .build()

Livestream Post

Host your events virtually and see community interaction as it happens.

Our UIKit provides the livestream recording feature that allows you to record livestreams and broadcast simultaneously in real-time. You can also play historical streams when the livestream ends.

This section describes the livestream recording feature in detail.

A livestream post can be viewed in the following feeds:

  • Community feed

  • User feed

  • Global feed

  • Content feed

You will be able to see the livestream post and interact with it as soon as the livestreamer starts streaming.

Creating a livestream post

To create a livestream post, follow these steps:

  1. Create a livestream post by selecting Livestream from the pop-up and selecting a location where you want to post the stream.

  2. Provide a title and description for your livestream. The title and description will be blank if you will not provide any.

  3. Add a cover thumbnail from your media gallery for the livestream post and preview the cover image. This step however is optional. You may also update and delete the cover thumbnail.

  4. Tap Go live to start streaming.

  5. There will be a time indicator on the upper left. It will indicate how long it has been since the livestream started.

  6. The livestream post will then show in the feed.

  7. Tap Finish to end livestreaming. It will then show Ending livestream once the livestream has ended.

    Note: You have the option to edit or delete the post from the feed.

Viewing a livestream post

Live

Other viewers can watch your livestreaming while you are simultaneously recording it. They will see a LIVE indicator on the video.

Tapping the play button in the livestream post will play the video in a full screen mode.

Livestream in full screen

Livestream ended

After ending your livestreaming, the playback video may not be available instantly for viewers to see while it is still in the process of producing the playback video. The viewers will see a message that the playback will be available for watching shortly.

The livestream has ended but the playback is still transcoding

Playback

When the playback video is already available for viewing, a RECORDED indicator is shown on the video post.

Playing a recorded stream and an option to report the post

Idle state

The livestream may be in idle state. This happens when you delete the livestream in console or or other issues that will not enable the livestreaming to start. The viewer will see a message that the stream is currently unavailable.

Read-only mode

A livestream post will have the same privacy and access controls as with the other posts. This means that users without the permission, such as those who are not members of the community, won’t be able to view the livestreaming/playback video in a private community. If the community is public, non-members can view the post as read only so they won't be able to interact with it.

Permissions

If it's your first time creating a livestream, your device will prompt to allow access to your device's camera and microphone.

You need to allow access to be able to start a livestream. The pop-up below will not show once you allow access to your camera and microphone.

Post Details Page

This page shows content of a post including reactions and comments.

Reply feature is coming soon.

Features

Feature

Description

Post content

User can view content of the post including reactions and comments.

Comment creation

User can create a comment by adding text to the compose bar and tapping Post.

Usage

Create a Fragment

AmityPostDetailFragment
         .newInstance(postId)
         .build()

Link Preview in Post

The Link Preview feature in posts is designed to enrich user experience by providing a visual and informative preview of external links. This feature enhances content sharing, making it more interactive and engaging. This feature significantly improves the user's posting experience. It allows for a preliminary check of the link's accuracy and relevance, adding visual appeal to the post with an informative preview.

When a user includes a link in a post, the feature automatically extracts and displays key information: the title, main image, and a short description, creating an informative preview of the linked content. If the link is unavailable, it will show a empty placeholder or error view instead.

Editing Capability

Users can edit the link preview even after the post is created. This flexibility ensures that the information remains up-to-date and accurate, enhancing the overall quality of the post.

Limitations and Use Cases

The preview feature is designed to only display images, titles, and descriptions after a post is created. This ensures clarity and relevance in the shared content.

Post Edit Page

This page provides a form to edit post content.

Post edit page
Edit mentioned users in a post

Limitation: Images and files can only be removed from a post. New images or files cannot be added.

Features

Feature

Description

Text editing

User can edit text content

Image removal

User can remove images

File removal

User can remove files

Usage

Create a Fragment

AmityPostEditorFragment()
        .newInstance(postId)
        .build()

Comment Creation

Comment creation
Mention users in a comment

Features

Feature
Description

Comment creation

Add comments to post.

Mention in comment

Mention users in comments by typing @ to activat mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greate than 50000 or mentions count is greater than 30.

Comment Edit Page

Edit mentioned users in a comment

Features

Feature

Description

Comment editing

Edit comment content and tap Save to submit changes.

Mention in comment

Mention users in comments by typing @ to activat mention suggestion and selecting their names in the suggestion list. Up to 30 users can be mentioned per post.

An alert will be shown if character count is greate than 50000 or mentions count is greater than 30.

Community Profile Page (2.5)

This page shows profile of a community including its own feed.

Non-member view
Community member view
Community creator view

Components

  • Community feed

Features

Feature

Description

Becoming a member

User can tap Join button to join a community.

Post creation

User can tap the floating action button to open Post creation page.

Community profile update

Creator can tap Edit profile button to open Community profile edit page.

Usage

Create a Fragment

AmityCommunityPageFragment()
          .newInstance(communityId)
          .build(activity)

Community Feed (2.5)

This component shows a list of posts from a community feed.

Features

Feature

Description

Community feed

User can scroll vertically to see a list of posts from a community feed.

Usage

Create a Fragment


AmityCommunityFeedFragment
         .newInstance(community or communityId)
         .feedType(AmityFeedType.PUBLISHED) // optional, available from version 2.4
         .build(appcompatActivity)
                

Media Gallery

This component shows a collection of images and videos posted in the community feed.

Gallery filtered to show photos only
Gallery filtered to show videos only

Features

Feature

Description

Gallery

Scroll vertically to see images and videos from posts in a community feed.

Media Filter

Filters according to media type (Photos and Videos). Tap the corresponding tabs to see the filtered posts.

Community Member Page

This page displays the list of members for a given community.

A community member page

Note: In the current version, we do not support searching of members and a visual display of the moderator list.

Features

Feature

Description

Navigation to user profile page

User can view profile page by tapping on member list item.

Report user

User can report members present in community.

How to use

AmityCommunityMemberSettingsFragment
          .newInstance(communutyId)
          .build()

User Profile Page

This page shows user profile information as well as user feed.

User Profile Behavior

User's own profile

A community member page

Other user's profile

Components

  • User feed

Features

Feature

Description

User Profile

User can view display name and description.

Post creation

User can tap the floating action button to open Post creation page to create a post on user's own page.

User profile update

User can tap Edit profile to open User profile edit page to update user's own profile.

Usage

Create a Fragment

AmityUserProfilePageFragment
          .newInstnce(user or userId)
          .build(activity)

Customise components with Fragment builder

A delegate can be passed to customise the components.

Method

Description

feedFragmentDelegate

Fragment delegation for AmityFeedFragment

User Feed

This component shows a user feed of a specific user.

Features

Feature

Description

User feed

User can scroll vertically to see a list of posts from a user feed.

Usage

Create a Fragment


AmityUserFeedFragment
                .newInstance(user or userId)
                .build(activity)