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

mobile-core V2 upgrade docs & migration guide #403

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/android-core/Introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Introduction
sidebar_position: 3
sidebar_position: 4
sidebar_class_name: module-seperation
---

Expand Down
2 changes: 1 addition & 1 deletion docs/android-core/pre-call/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"position": 2,
"position": 3,
"label": "Pre-call",
"collapsible": true,
"className":"pre-call-docs"
Expand Down
2 changes: 1 addition & 1 deletion docs/android-core/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tags:
- quickstart
- setup
slug: /
sidebar_position: 1
sidebar_position: 2
---

import Tabs from '@theme/Tabs';
Expand Down
68 changes: 68 additions & 0 deletions docs/android-core/upgrade-v2/1-introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Introduction
sidebar_position: 1
tags:
- android-core
- v2
---

With the v2 release of the Dyte Core SDK, we're introducing a major upgrade focused on making the development experience simpler, more consistent, and intuitive. This upgrade introduces breaking changes across four key areas:

### 1. Migration to V2 REST API Terminology

- `meeting.meta.roomName` -> `meeting.meta.meetingId`
- `DyteMeetingParticipant.clientSpecificId` -> `DyteMeetingParticipant.customParticipantId`
- Removed `DyteMeetingInfo` (V1)


### 2. Removal of Deprecated APIs

We have removed deprecated methods and properties in favour of improved, uniform, and clearer versions.

- Removed `DyteParticipants.screenshares` (use `DyteParticipants.screenShares`). The deprecated type `DyteScreenShareMeetingParticipant` has also been removed
- **Chat Methods**: Removed deprecated file and image send methods. The new lambda-based methods take more reliable `Uri`s & return proper errors
- File message methods:
- Removed:
- `sendFileMessage(filePath: String)`
- `sendFileMessage(filePath: String, fileName: String)`
- `sendFileMessage(fileUri: Uri)`
- Use instead:
- `sendFileMessage(fileUri: Uri, onResult: (ChatFileError?) -> Unit)`
- Removed:
- `sendFileMessage(filePath: String, peerIds: List<String>)`
- `sendFileMessage(fileUri: Uri, peerIds: List<String>)`
- Use instead:
- `sendFileMessage(fileUri: Uri, peerIds: List<String>, onResult: (ChatFileError?) -> Unit)`
- Image message methods:
- Removed:
- `sendImageMessage(filePath: String, fileName: String)`
- `sendImageMessage(imageUri: Uri)`
- `sendImageMessage(imagePath: String)`
- Use instead:
- `sendImageMessage(imageUri: Uri, onResult: (ChatFileError?) -> Unit)`
- Removed:
- `sendImageMessage(imagePath: String, peerIds: List<String>)`
- `sendImageMessage(imageUri: Uri, peerIds: List<String>)`
- `sendImageMessage(filePath: String, fileName: String, peerIds: List<String>)`
- Use instead:
- `sendImageMessage(imageUri: Uri, peerIds: List<String>, onResult: (ChatFileError?) -> Unit)`
- Removed deprecated listener callbacks:
- `DyteSelfEventsListener.onStageStatusUpdated`. Use `DyteStageEventListener.onStageStatusUpdated()`
- `DyteStageEventListener.onPresentRequestAccepted(participant: DyteJoinedMeetingParticipant)`
- `DyteMeetingRoomEventsListener.onActiveTabUpdate(id: String, tabType: ActiveTabType)`.
Use `DyteMeetingRoomEventsListener.onActiveTabUpdate(meeting: DyteMobileClient, activeTab: ActiveTab)`


### 3. Revamped Error Handling

- Errors are categorised by modules, such as `ChatError`, `SelfError`, and `MeetingError`
- All public APIs provide proper errors and additional error data where applicable for better debugging
- Utilises Kotlin sealed classes for better type safety


### 4. API Structural Changes

We made a few direct breaking changes in our APIs to simplify the types, make methods more intuitive and ensure uniformity across platforms. 
For example, `DyteMeetingParticipant` has been restructured to align with real-world entities.

Learn more about the direct breaking changes and migration instructions on the next page.
185 changes: 185 additions & 0 deletions docs/android-core/upgrade-v2/2-breaking-changes-migration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
---
title: Breaking Changes and Migration Guide
sidebar_position: 2
tags:
- android-core
- v2
---

This section provides details about the additional breaking changes made in Dyte Core SDK v2 and provides migration guidance.
The changes span multiple modules, mainly simplifying the APIs or renaming them to ensure uniformity across the platforms.


### Changes in Participant Hierarchy and Simplified Types

The participant hierarchy has been simplified to align better with real-world entities:

- **Old Structure**:
- `DyteMeetingParticipant` was the parent class with direct subtypes:
- `DyteJoinedMeetingParticipant`
- `DyteWaitlistedParticipant`
- `DyteJoinedMeetingParticipant` had two subtypes:
- `DyteScreenShareMeetingParticipant`
- `DyteSelfParticipant` (local user)

- **New Structure**:
- `DyteMeetingParticipant` still represents a participant in a meeting which is simply either:
- `DyteSelfParticipant` (local user) or
- `DyteRemoteParticipant` (other participants in the meeting)

- Moved methods for managing waiting room requests to `DyteParticipants`:
- `DyteWaitlistedParticipant.acceptWaitListedRequest()` -> `DyteParticipants.acceptWaitingRoomRequest(id)`
- `DyteWaitlistedParticipant.rejectWaitListedRequest()` -> `DyteParticipants.rejectWaitingRoomRequest(id)`

The old participant hierarchy was complex, with certain types representing temporary states or behaviour at runtime.
The new structure simplifies this by clearly differentiating between the local user and remote participants.

**Migration Instructions**:

- Replace instances of `DyteJoinedMeetingParticipant` with `DyteRemoteParticipant`.
- Replace any usage of `DyteScreenShareMeetingParticipant` with `DyteMeetingParticipant` or its subtype.
- `DyteSelfParticipant` is now a direct subtype of `DyteMeetingParticipant`.
- Update the Waiting Room management logic to use APIs from `DyteParticipants` for accepting/rejecting waiting room requests.


### Changes in DyteMeetingRoomEventsListener Connection State Callbacks

The following connection state callbacks have been removed:

- `onMeetingRoomDisconnected`, `onConnectingToMeetingRoom`, `onConnectedToMeetingRoom`,
`onDisconnectedFromMeetingRoom`, `onMeetingRoomConnectionFailed`, `onReconnectingToMeetingRoom`,
`onReconnectedToMeetingRoom`, `onMeetingRoomReconnectionFailed`

These callbacks have been consolidated into a single unified callback:
`onSocketConnectionUpdate(newState: SocketConnectionState)`

**Migration Instructions**:

- Move all connection state handling, mainly reconnection logic from the old callbacks to `onSocketConnectionUpdate()`.
The new callback provides a `SocketConnectionState` parameter that represents the current state of the meeting connection.


`DyteMeetingInfoV2.baseUrl` has been renamed to `DyteMeetingInfoV2.baseDomain`. This change is applicable only
if you are using a white-labeled domain.


### Other Breaking Changes module-wise

#### 1. DyteMobileClient (meeting)

- The following methods now return `MeetingError` in the `onFailure` callback instead of `DyteError`:
- `init()`, `leaveRoom()`, `release()`
- Renamed some methods for adding/removing listeners to align with the respective listener names:
- `addParticipantEventsListener()` -> `addParticipantsEventListener()`
- `addPollsEventsListener()` -> `addPollsEventListener()`
- `addStageEventsListener()` -> `addStageEventListener()`
- `addLivestreamEventListener()` -> `addLivestreamEventListener()`
- Changes in `DyteMeetingRoomEventsListener` callbacks:
- Failure callbacks now return standardised `MeetingError` instead of `Exception`:
- `onMeetingInitFailed(exception: Exception)` -> `onMeetingInitFailed(error: MeetingError)`
- `onMeetingRoomJoinFailed(exception: Exception)` -> `onMeetingRoomJoinFailed(error: MeetingError)`
- Relevant callback methods now include `DyteMobileClient` as a parameter, making it easier to access meeting object
- `onMeetingInitCompleted()` -> `onMeetingInitCompleted(meeting: DyteMobileClient)`
- `onMeetingRoomJoinCompleted()` -> `onMeetingRoomJoinCompleted(meeting: DyteMobileClient)`
- `onActiveTabUpdate(activeTab: ActiveTab)` -> `onActiveTabUpdate(meeting: DyteMobileClient, activeTab: ActiveTab)`

#### 2. DyteSelfParticipant (meeting.localUser)

- Renamed the following screen share methods to make the name casing of "ScreenShare" uniform with the rest of the SDK:
- `enableScreenshare()` -> `enableScreenShare()`
- `disableScreenshare()` -> `disableScreenShare()`
- Merged `onScreenShareStarted` & `onScreenShareStopped` into a single callback: `onScreenShareUpdate(isEnabled: Boolean)`
- Moved `onRoomMessage()` callback from `DyteSelfEventsListener` to `DyteParticipantsEventListener` and renamed it to `onNewBroadcastMessage()`
- Removed the unused `onProximityChanged(isNear: Boolean)`

**Migration Instructions**:

- Update enable/disable screen share method names
- Replace the old screen share callbacks with the new `onScreenShareUpdate()` callback
- Move the broadcast message handling logic to `DyteParticipantsEventListener.onNewBroadcastMessage()` callback

#### 3. DyteParticipants (meeting.participants)

- `meeting.participants` now contains data only related to remote participants, excluding the local user
- Changes in `DyteParticipantsEventListener` callbacks:
- Callbacks are now given only for remote participant events. Local user changes are dispatched to `DyteSelfEventsListener`
- Listener renamed from `DyteParticipantEventsListener` to `DyteParticipantsEventListener`
- Merged `onScreenShareStarted` & `onScreenShareEnded` into a single callback:
`onScreenShareUpdate(participant: DyteRemoteParticipant, isEnabled: Boolean)`
- Removed `onNoActiveSpeaker()`. Now `onActiveSpeakerChanged(participant: DyteRemoteParticipant?)` gets a null value when active participant is cleared
- Removed unused, uncalled `onScreenSharesUpdated()`, `onSetAsActiveSpeaker()`, & `onRemovedAsActiveSpeaker()`
- Following callbacks have been tweaked for consistency & clarity:
- `onAudioUpdate(audioEnabled: Boolean, participant: DyteMeetingParticipant)` -> `onAudioUpdate(participant: DyteRemoteParticipant, isEnabled: Boolean)`
- `onVideoUpdate(videoEnabled: Boolean, participant: DyteMeetingParticipant)` -> `onVideoUpdate(participant: DyteRemoteParticipant, isEnabled: Boolean)`
- `onPinned()` -> `onParticipantPinned(participant: DyteRemoteParticipant)`
- `onUnpinned()` -> `onParticipantUnpinned(participant: DyteRemoteParticipant)`

**Migration Instructions**:

- Ensure that local user-related changes are handled using `DyteSelfEventsListener` instead of `DyteParticipantsEventListener`
- Update the callback signatures wherever `DyteParticipantsEventListener` is implemented

#### 4. DyteStage APIs (meeting.stage)

- Stage Host Methods:
- Removed methods `grantAccessAll()` and `denyAccessAll()`
- `grantAccess()`, `denyAccess()`, and `kick()` now take a list of user IDs, making them more flexible
- Removed unused `REJECTED_TO_JOIN_STAGE` constant from `StageStatus` enum
- Removed the `DyteStageStatus` typealias
- DyteStageEventListener: Callbacks now consistently use the term '*stage*' to align with the **DyteStage** module for better clarity
- Redundant peer callbacks have been removed to simplify the API. Those events can be inferred as per use-case by
`onPeerStageStatusUpdated(participant: DyteRemoteParticipant, oldStatus: StageStatus, newStatus: StageStatus)`
- `onPresentRequestReceived()` -> `onStageAccessRequestAccepted()`
- `onStageStatusUpdated(stageStatus: DyteStageStatus)` -> `onStageStatusUpdated(oldStatus: StageStatus, newStatus: StageStatus)`
- `onPresentRequestAdded(participant: DyteJoinedMeetingParticipant)` -> `onNewStageAccessRequest(participant: DyteRemoteParticipant)`
- `onStageRequestsUpdated(accessRequests: List<DyteJoinedMeetingParticipant>)` -> `onStageAccessRequestsUpdated(accessRequests: List<DyteRemoteParticipant>)`
- Removed `onAddedToStage()`, it was called when localUser successfully joined the stage, the name didn’t match the scenario

**Migration Instructions**:

- Update the method calls for granting, denying, and kicking stage participants to use lists of user IDs
- Replace removed/renamed callbacks in `DyteStageEventListener` with the new ones

#### 5. DytePolls APIs (meeting.polls)

- Renamed Classes and Properties
- `DytePollMessage` -> `DytePoll`
- `DytePollEventsListener` -> `DytePollsEventListener`
- `DytePolls.messages` -> `DytePolls.items`
- `DytePollsEventListener` changes:
- `onPollUpdates(pollMessages: List<DytePoll>)` -> `onPollUpdates(pollItems: List<DytePoll>)`

#### 6. DyteRecording APIs (meeting.recording)

- Removed following error callbacks from `DyteRecordingEventsListener` as `DyteRecording` methods now return proper errors:
- `onMeetingRecordingStopError()`, `onMeetingRecordingPauseError()`, `onMeetingRecordingResumeError()`
- `onMeetingRecordingStarted()`, `onMeetingRecordingEnded()`, and `onMeetingRecordingStateUpdated()` have been merged into a single callback:
`onRecordingStateChanged(oldState: DyteRecordingState, newState: DyteRecordingState)`.

**Migration Instructions**

- Remove any references to the deleted error callbacks in your code. Move error handling code to the `onResult` lambda of the recording methods.
- Replace the separate recording state callbacks with the new unified `onRecordingStateChanged` callback.

#### 7. DyteLivestream APIs (meeting.livestream)

- Changed the term "LiveStream" to "Livestream" throughout the SDK
- `meeting.liveStream` -> `meeting.livestream`
- `DyteLiveStream` -> `DyteLivestream`
- Simplified `LivestreamState` enum to align with the Web SDK
- **Old States**: `NONE`, `STARTING`, `STARTED`, `STOPPING`, `STOPPED`, `ERRORED`
- **New States**: `IDLE`, `STARTING`, `STREAMING`, `STOPPING`
- `DyteLivestream.liveStreamUrl` -> `DyteLivestream.playbackUrl`
- Changes in `DyteLivestreamEventsListener`:
- The `DyteLiveStreamEventsListener` has been renamed to `DyteLivestreamEventListener`
- `onLiveStreamStarting`, `onLiveStreamStarted`, `onLiveStreamEnding`, and `onLiveStreamEnded` have been consolidated into
`onLivestreamStateChanged(oldState: LivestreamState, newState: LivestreamState)`
- `onLiveStreamErrored()` -> `onLivestreamError(message: String)`
- `onLiveStreamStateUpdate(data: DyteLivestreamData)` ->  `onLivestreamUpdate(data: DyteLivestreamData)`
- Removed `onStageCountUpdated(count: Int)`

**Migration Instructions**

- Update all class and property references to replace "LiveStream" with "Livestream"
- Use the new `LivestreamState` enum values, replacing old state with the new, simplified states
- Update callbacks in `DyteLivestreamEventListener` to the new versions, ensuring state changes are handled using `onLivestreamStateChanged` and other revised methods
5 changes: 5 additions & 0 deletions docs/android-core/upgrade-v2/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 2,
"label": "2.x Upgrade Guide",
"collapsible": true
}
2 changes: 1 addition & 1 deletion docs/ios-core/Introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Introduction
sidebar_position: 3
sidebar_position: 4
sidebar_class_name: module-seperation
---

Expand Down
2 changes: 1 addition & 1 deletion docs/ios-core/pre-call/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"position": 2,
"position": 3,
"label": "Pre-call",
"collapsible": true,
"className": "pre-call-docs"
Expand Down
2 changes: 1 addition & 1 deletion docs/ios-core/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tags:
- quickstart
- setup
slug: /
sidebar_position: 1
sidebar_position: 2
---

import Tabs from '@theme/Tabs';
Expand Down
68 changes: 68 additions & 0 deletions docs/ios-core/upgrade-v2/1-introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Introduction
sidebar_position: 1
tags:
- iOS-core
- v2
---

With the v2 release of the Dyte Core SDK, we're introducing a major upgrade focused on making the development experience simpler, more consistent, and intuitive. This upgrade introduces breaking changes across four key areas:

### 1. Migration to V2 REST API Terminology

- `meeting.meta.roomName` -> `meeting.meta.meetingId`
- `DyteMeetingParticipant.clientSpecificId` -> `DyteMeetingParticipant.customParticipantId`
- Removed `DyteMeetingInfo` (V1)


### 2. Removal of Deprecated APIs

We have removed deprecated methods and properties in favour of improved, uniform, and clearer versions.

- Removed `DyteParticipants.screenshares` (use `DyteParticipants.screenShares`). The deprecated type `DyteScreenShareMeetingParticipant` has also been removed
- **Chat Methods**: Removed deprecated file and image send methods. The new closure-based methods take `NSURL`s & return proper errors
- File message methods:
- Removed:
- `sendFileMessage(filePath: String)`
- `sendFileMessage(filePath: String, fileName: String)`
- `sendFileMessage(fileUri: NSURL)`
- Use instead:
- `sendFileMessage(fileURL: NSURL, onResult: (ChatFileError?) -> Void)`
- Removed:
- `sendFileMessage(filePath: String, peerIds: [String])`
- `sendFileMessage(fileUri: NSURL, peerIds: [String])`
- Use instead:
- `sendFileMessage(fileURL: NSURL, peerIds: [String], onResult: (ChatFileError?) -> Void)`
- Image message methods:
- Removed:
- `sendImageMessage(filePath: String, fileName: String)`
- `sendImageMessage(imageUri: NSURL)`
- `sendImageMessage(imagePath: String)`
- Use instead:
- `sendImageMessage(imageURL: NSURL, onResult: (ChatFileError?) -> Void)`
- Removed:
- `sendImageMessage(imagePath: String, peerIds: [String])`
- `sendImageMessage(imageUri: NSURL, peerIds: [String])`
- `sendImageMessage(filePath: String, fileName: String, peerIds: [String])`
- Use instead:
- `sendImageMessage(imageURL: NSURL, peerIds: [String], onResult: (ChatFileError?) -> Void)`
- Removed deprecated listener callbacks:
- `DyteSelfEventsListener.onStageStatusUpdated`. Use `DyteStageEventListener.onStageStatusUpdated()`
- `DyteStageEventListener.onPresentRequestAccepted(participant: DyteJoinedMeetingParticipant)`
- `DyteMeetingRoomEventsListener.onActiveTabUpdate(id: String, tabType: ActiveTabType)`.
Use `DyteMeetingRoomEventsListener.onActiveTabUpdate(meeting: DyteMobileClient, activeTab: ActiveTab)`


### 3. Revamped Error Handling

- Errors are categorised by modules, such as `ChatError`, `SelfError`, and `MeetingError`
- All public APIs provide proper errors and additional error data where applicable for better debugging
- Uses enums for error codes, making it easier to handle specific cases


### 4. API Structural Changes

We made a few direct breaking changes in our APIs to simplify the types, make methods more intuitive and ensure uniformity across platforms. 
For example, `DyteMeetingParticipant` has been restructured to align with real-world entities.

Learn more about the direct breaking changes and migration instructions on the next page.
Loading
Loading