Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new structure for ios-core docs #349

Merged
merged 21 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/ios-core/Introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Introduction
sidebar_position: 3
sidebar_class_name: module-seperation
---

import ProductSection from '/docs/partials/_product-section.mdx';

# Introduction

The Dyte Core SDK is designed to provide you with an easy way to incorporate live video, voice, livestream and chat capabilities
into your iOS apps. The Core SDK acts as a data-only layer. It provides simple APIs offering high-level primitives and
abstracting away complex media and networking optimizations.

## Why Core SDK?

The Core SDK was developed with a user-friendly approach to eliminate the complexity of managing streams. Unlike traditional
SDKs that require knowledge of WebRTC internals, Dyte's Core SDK provides a simple API that abstracts out the complexity,
making it easier for developers to use. For instance, enabling video with Dyte's Core SDK is as easy as calling
`meeting.localUser.enableVideo()`.

## Utility Modules

The Core SDK includes various modules for in-call utilities like chat, polls, and recording that enable building a UI on top of
it. The following are the core SDK modules:

- **meeting.localUser**: This consists of properties and methods corresponding to the current (local) user, such as enabling or
disabling their audio and video, getting a list of media devices or changing the device, or sharing your mobile screen.
- **meeting.participants**: Use this module to get useful information about the other participants that are present in the
meeting. A host can use this module for access control. For example, the host can mute or kick a participant.
- **meeting.chat**: It provides the methods to integrate chat features such as sending/receiving text, images, and files.
- **meeting.polls**: Meetings can have polls. This module lets you perform actions related to polls, that is create and manage
a poll within a meeting.
- **meeting.recording**: When a meeting needs to be recorded, this module can be used. It lets you start or stop a recording,
and get the current status of an ongoing recording.
- **meeting.meta**: This object consists of all the metadata related to the current meeting, such as the title, the timestamp
of when it started, and more.
- **meeting.plugins**: Provides the list of available plugins and active plugins. Use this module to enable or disable plugins as needed.

<head>
<title>iOS Core Introduction</title>
</head>
2 changes: 1 addition & 1 deletion docs/ios-core/chat/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"position": 6,
"label": "Chat",
"collapsible": true
}
}
58 changes: 44 additions & 14 deletions docs/ios-core/chat/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
---
title: Introducing chat
description: >-
Get started with Dyte's chat capabilities in iOS Core. Follow our guide for an
introduction to chat features in iOS Core.
Learn the basics of integrating Dyte's chat functionality into your iOS
application – a step towards immersive real-time communication.
sidebar_position: 1
tags:
- mobile-core
- ios-core
- chat
---

# Introducing chat

The meeting chat object is stored in `meeting.chat`, which has methods for
sending and receiving messages. There are 3 types of messages that can be sent
in chat - text messages, images, and files.
The meeting chat object is stored in `meeting.chat`, which has methods for sending and receiving messages. There are 3 types of messages that can be sent in chat - text messages, images, and files.

The `meeting.chat.messages` array contains all the messages that have been sent
in the chat. This is an array of objects, where each object is of type
Expand All @@ -22,16 +20,48 @@ in the chat. This is an array of objects, where each object is of type
We support three types of chat messages, they are as follows

- Text Message

```swift
class DyteTextMessage {
let userId: String
let displayName: String
let read: Bool
let pluginId: String?
let message: String
let time: String
let channelId: String? = null
}
```

- Image Message

```swift
class DyteImageMessage{
let userId: String
let displayName: String
let read: Bool
let pluginId: String?
let link: String
let time: String
let channelId: String? = null
}
```

- File Message

```swift
class DyteFileMessage{
let userId: String
let displayName: String
let read: Bool
let pluginId: String?
let name: String
let time: String
let link: String
let size: Int64
let channelId: String? = null
}
```

All above objects are of type `DyteChatMessage` along with their own class
variables.

<head>
<title>iOS Core Introducing chat</title>
<meta
name="description"
content="Get started with Dyte's chat capabilities in iOS Core. Follow our guide for an introduction to chat features in iOS Core."
/>
</head>
66 changes: 15 additions & 51 deletions docs/ios-core/chat/receiving-chat-messages.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Receiving chat messages
description: >-
Learn how to receive chat messages in iOS Core with Dyte Docs. Enhance your
app's communication capabilities with seamless chat integration.
"Discover how to implement the functionality to receive chat messages in your
iOS app using Dyte
sidebar_position: 3
tags:
- mobile-core
- ios-core
- chat
---

Expand All @@ -14,56 +14,20 @@ tags:
To be able to receive chat messages you need to implement a method
`onChatUpdates()` method from callback `DyteChatEventsListener`. You can
subscribe to this events by calling
`meeting.addMeetingEventsListener(dyteChatEventsListener)`
`meeting.addChatEventsListener(dyteChatEventsListener)`

```swift
extension MeetingViewModel: DyteChatEventsListener {
func onChatUpdates(messages: [DyteChatMessage]) {
// any update in chat messages
}

func onNewChatMessage(message: DyteChatMessage) {
// updates for new chat messages only
}
}
extension MeetingViewModel: DyteChatEventsListener {
func onChatUpdates(messages: [DyteChatMessage]) {
// to load chat messages
}

func onNewChatMessage(message: DyteChatMessage) {
// when a new chat message is shared in the meeting
}
}
```

Here, the `message` is of type `Message`, as defined in
[introduction](./introduction). `messages` is a list of all chat messages in the
meeting, which is the same as `meeting.chat.messages`.

When a chat message is received, the `meeting.chat.messages` list is also
updated.

DyteChatMessage has different implementations of it, thus you will need to cast and use appropriate type as follows:

```swift
func onNewChatMessage(message: DyteChatMessage) {
if let msg = message {
switch msg.type {
case .text:
if let textMsg = msg as? DyteTextMessage {
//print("onNewChatMessage: Text : \(textMsg)")
}
case .file:
if let fileMsg = msg as? DyteFileMessage {
//print("onNewChatMessage: File : \(fileMsg.name)")
}
case .image:
if let imgMsg = msg as? DyteImageMessage {
//print("onNewChatMessage: Image : \(imgMsg.link)")
}

default:
print("Error! Message type unknown!")
}
}
```
The `onChatUpdates()` method will be called whenever there is a change in the chat messages. The `messages` parameter is a list of `DyteChatMessage` objects that have been sent in the chat.

<head>
<title>iOS Core Receiving chat messages</title>
<meta
name="description"
content="Learn how to receive chat messages in iOS Core with Dyte Docs. Enhance your app's communication capabilities with seamless chat integration."
/>
</head>
The `onNewChatMessage()` method will be called whenever a new chat message is shared in the meeting. The `message` parameter is a `DyteChatMessage` object that has been sent in the chat.
42 changes: 14 additions & 28 deletions docs/ios-core/chat/sending-a-chat-message.mdx
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
---
title: Sending a chat message
description: >-
Explore the process of sending a chat message in iOS Core with Dyte Docs.
Empower users to communicate effectively within your app.
"Master the process of sending chat messages within your iOS application
with Dyte
sidebar_position: 2
tags:
- mobile-core
- ios-core
- chat
---

# Sending a chat message

As mentioned in [introduction](./introduction), there are 3 types of chat
messages - text messages, images, and files. There is a method in `meeting.chat`
to send a message of each type.
As mentioned in [introduction](./introduction), there are 3 types of chat messages - text messages, images, and files. There is a method in `meeting.chat` to send a message of each type.

## Send a text message

To send a text message, the `meeting.chat.sendTextMessage()` method can be used.
This accepts a string `message` and sends it to the room.
To send a text message, the `meeting.chat.sendTextMessage()` method can be used. This accepts a string `message` and sends it to the room.

```swift
let message = "Is this the real life?"
meeting.chat.sendTextMessage(message: message)
var message = "Is this the real life?"
meeting.chat.sendTextMessage(message)
```

## Send an image
Expand All @@ -31,28 +28,17 @@ You can send an image with the help of `meeting.chat.sendImageMessage()` and
sends it to the participants in the meeting.

```swift
let filePath = "file_path_of_image"
let fileName = "file_name"
meeting.chat.sendImageMessage(filePath: filePath, fileName: fileName)
var filePath = "file_path_of_image"
var fileName = "file_name"
meeting.chat.sendImageMessage(filePath, fileName)
```

## Send a file

Sending a file is quite similar to sending an image. The only difference is that
when you send an image, a preview will be shown in the meeting chat, which is
not the case for sending files. That being said, an image can be sent as a file
too using `meeting.chat.sendFileMessage()`.
Sending a file is quite similar to sending an image. The only difference is that when you send an image, a preview will be shown in the meeting chat, which is not the case for sending files. That being said, an image can be sent as a file too using `meeting.chat.sendFileMessage()`.

```swift
let filePath = "file_path_of_image"
let fileName = "file_name"
meeting.chat.sendFileMessage(filePath: filePath, fileName: fileName)
var filePath = "file_path_of_image"
var fileName = "file_name"
meeting.chat.sendFileMessage(filePath, fileName)
```

<head>
<title>iOS Core Sending a chat message</title>
<meta
name="description"
content="Explore the process of sending a chat message in iOS Core with Dyte Docs. Empower users to communicate effectively within your app."
/>
</head>
39 changes: 39 additions & 0 deletions docs/ios-core/error-codes.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: System Error Codes
sidebar_position: 11
---

:::info Note

This information is intended for developers debugging or troubleshooting Dyte's mobile core system errors.

:::

Error codes are a standardized method for developers to convey application errors and issues to users or other developers in a structured manner. Error codes typically consist of a numerical or alphanumeric code and a description that provides more information about the error.

This document lists Dyte's iOS core error codes that you may encounter in various scenarios. System error codes can arise in different parts of the system, and their descriptions may not always provide exact details. To address these codes effectively, you must first understand the programmatic and runtime contexts in which these errors occurred.

## Error codes and format

Error codes consist of a number that are categorized by the type of error and a message that provides more information about the error. The error code format is as follows:

```swift
class DyteError {
let code: Int
let message: String
}
```

### Meeting error codes

Meeting error codes are used to indicate errors that occur during meeting operations. These errors are typically returned by the methods of the `meeting` object such as `init()`, `join()`.

- 1000: Invalid auth token.
- 1002: Failed to initialize meeting.
- 1003: Invalid base URL.
- 1005: Failed to join room.
- 4000: Something went wrong.

<head>
<title>iOS Core System Error Codes</title>
</head>
Loading
Loading