Skip to content

Commit

Permalink
Release 1.10.5: Develop to main (#1393)
Browse files Browse the repository at this point in the history
# Description

- Release 1.10.5: Develop to main

### Pre-launch Checklist

- [x] The [Documentation] is updated accordingly, or this PR doesn't
require it.
- [x] I have updated the `ExampleAppChangelog.txt` file with relevant
changes.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making, or this PR is
test-exempt.
- [x] All existing and new tests are passing.

<!-- Links -->

[Documentation]: https://www.100ms.live/docs
  • Loading branch information
ygit committed May 15, 2024
2 parents fbcd559 + b71bcda commit 0d598ad
Show file tree
Hide file tree
Showing 63 changed files with 1,458 additions and 463 deletions.
11 changes: 9 additions & 2 deletions packages/react-native-hms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ buildscript {
if (ext.has("kotlinVersion")) {
ext.kotlinVersion()
} else {
ext.safeExtGet("kotlinVersion", "1.6.0")
ext.safeExtGet("kotlinVersion", "1.7.20")
}
}
ext.getKotlinGradlePluginVersion = {
if (ext.has("kotlinGradlePluginVersion")) {
ext.kotlinGradlePluginVersion()
} else {
ext.safeExtGet("kotlinGradlePluginVersion", "1.8.0")
}
}
if (project == rootProject) {
Expand All @@ -30,7 +37,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinGradlePluginVersion()}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ object HMSDecoder {
permissions.putBoolean("changeRole", hmsPermissions.changeRole)
permissions.putBoolean("pollRead", hmsPermissions.pollRead)
permissions.putBoolean("pollWrite", hmsPermissions.pollWrite)

val whiteboardPermissionMap: WritableMap = Arguments.createMap()
hmsPermissions.whiteboard.let { whiteBoardPermission ->
whiteboardPermissionMap.putBoolean("admin", whiteBoardPermission.admin)
whiteboardPermissionMap.putBoolean("read", whiteBoardPermission.read)
whiteboardPermissionMap.putBoolean("write", whiteBoardPermission.write)
}
permissions.putMap("whiteboard", whiteboardPermissionMap)
}
return permissions
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,44 @@ class HMSManager(reactContext: ReactApplicationContext) :
}
// endregion

//region Whiteboard
@ReactMethod
fun startWhiteboard(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK = HMSHelper.getHms(data, hmsCollection)
rnSDK?.let { sdk ->
sdk.interactivityCenter?.let { center ->
center.startWhiteboard(data, promise)
return
}
}
promise?.reject(
"6004",
"HMS SDK not initialized",
)
}

@ReactMethod
fun stopWhiteboard(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK = HMSHelper.getHms(data, hmsCollection)
rnSDK?.let { sdk ->
sdk.interactivityCenter?.let { center ->
center.stopWhiteboard(promise)
return
}
}
promise?.reject(
"6004",
"HMS SDK not initialized",
)
}
//endregion

// region Noise Cancellation Plugin
@ReactMethod
fun enableNoiseCancellationPlugin(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ class HMSRNSDK(
delegate.emitEvent("ON_PREVIEW", data)
}

/*
override fun peerListUpdated(addedPeers: ArrayList<HMSPeer>?, removedPeers: ArrayList<HMSPeer>?) {
override fun peerListUpdated(
addedPeers: ArrayList<HMSPeer>?,
removedPeers: ArrayList<HMSPeer>?,
) {
super.peerListUpdated(addedPeers, removedPeers)
if (eventsEnableStatus["ON_PEER_LIST_UPDATED"] != true) {
return
}
Expand All @@ -278,11 +280,11 @@ class HMSRNSDK(
}
}

data.putString("id", id)
data.putArray("addedPeers", addedPeersArray)
data.putArray("removedPeers", removedPeersArray)
delegate.emitEvent("ON_PEER_LIST_UPDATED", data)
}
*/
},
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ import live.hms.video.polls.network.HMSPollLeaderboardEntry
import live.hms.video.polls.network.HMSPollLeaderboardSummary
import live.hms.video.polls.network.PollLeaderboardResponse
import live.hms.video.polls.network.PollResultsDisplay
import live.hms.video.whiteboard.HMSWhiteboard
import live.hms.video.whiteboard.HMSWhiteboardUpdate
import live.hms.video.whiteboard.State

object HMSInteractivityDecoder {
//region poll methods
fun getPollUpdateType(hmsPollUpdateType: HMSPollUpdateType): Int {
return when (hmsPollUpdateType) {
HMSPollUpdateType.started -> 0
Expand Down Expand Up @@ -280,31 +284,6 @@ object HMSInteractivityDecoder {
return readableArray
}

/*
static func getHMSPollQuestionResponseResults(_ hmsPollQuestionResponseResults: [HMSPollQuestionResponseResult]) -> [[String: AnyHashable]] {
var results = [[String: AnyHashable]]()
hmsPollQuestionResponseResults.forEach { result in
results.append(getHMSPollQuestionResponseResult(result))
}
return results
}
static func getHMSPollQuestionResponseResult(_ hmsPollQuestionResponseResult: HMSPollQuestionResponseResult) -> [String: AnyHashable] {
var result: [String: AnyHashable] = [
"question": hmsPollQuestionResponseResult.question
]
if let correct = hmsPollQuestionResponseResult.correct {
result["correct"] = correct
}
if let error = hmsPollQuestionResponseResult.error {
result["error"] = error.localizedDescription
}
return result
}
*/
fun getHMSPollQuestionResponseResults(hmsPollQuestionResponseResults: PollAnswerResponse): WritableArray {
val results = Arguments.createArray()

Expand Down Expand Up @@ -410,4 +389,50 @@ object HMSInteractivityDecoder {

return result
}
//endregion

//region whiteboard methods
fun getHMSWhiteboard(hmsWhiteboard: HMSWhiteboard): WritableMap {
val data: WritableMap = Arguments.createMap()

data.putString("id", hmsWhiteboard.id)
data.putBoolean("isOwner", hmsWhiteboard.isOwner)
data.putString("state", getWhiteboardState(hmsWhiteboard.state))
hmsWhiteboard.title?.let { title ->
data.putString("title", title)
}
hmsWhiteboard.owner?.let { owner ->
data.putMap("owner", HMSDecoder.getHmsPeerSubset(owner))
}
data.putString("url", hmsWhiteboard.url)
return data
}

enum class JSWhiteboardState(val label: String) {
Start("STARTED"),
Stop("STOPPED"),
}

private fun getWhiteboardState(hmsWhiteboardState: State): String {
return when (hmsWhiteboardState) {
State.Started -> {
JSWhiteboardState.Start.label
}
State.Stopped -> {
JSWhiteboardState.Stop.label
}
}
}

fun getWhiteboardUpdateType(hmsWhiteboardUpdate: HMSWhiteboardUpdate): String {
return when (hmsWhiteboardUpdate) {
is HMSWhiteboardUpdate.Start -> {
JSWhiteboardState.Start.label
}
is HMSWhiteboardUpdate.Stop -> {
JSWhiteboardState.Stop.label
}
}
}
//endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import live.hms.video.polls.network.PollLeaderboardResponse
import live.hms.video.sdk.HMSActionResultListener
import live.hms.video.sdk.HMSSDK
import live.hms.video.sdk.HmsTypedActionResultListener
import live.hms.video.whiteboard.HMSWhiteboardUpdate
import live.hms.video.whiteboard.HMSWhiteboardUpdateListener

class HMSRNInteractivityCenter(private val sdk: HMSSDK, private val rnSDK: HMSRNSDK) {
init {
// Listen for poll updates
//region Listen for poll updates
this.sdk.getHmsInteractivityCenter().pollUpdateListener =
object : HmsPollUpdateListener {
override fun onPollUpdate(
Expand All @@ -35,8 +37,34 @@ class HMSRNInteractivityCenter(private val sdk: HMSSDK, private val rnSDK: HMSRN
rnSDK.delegate.emitEvent("ON_POLL_UPDATE", data)
}
}
//endregion

//region Listen for whiteboard updates
this.sdk.getHmsInteractivityCenter().setWhiteboardUpdateListener(
object : HMSWhiteboardUpdateListener {
override fun onUpdate(hmsWhiteboardUpdate: HMSWhiteboardUpdate) {
if (rnSDK.eventsEnableStatus["ON_WHITEBOARD_UPDATE"] != true) {
return
}
val data: WritableMap = Arguments.createMap()
when (hmsWhiteboardUpdate) {
is HMSWhiteboardUpdate.Start -> {
data.putMap("hmsWhiteboard", HMSInteractivityDecoder.getHMSWhiteboard(hmsWhiteboardUpdate.hmsWhiteboard))
data.putString("updateType", HMSInteractivityDecoder.getWhiteboardUpdateType(hmsWhiteboardUpdate))
}
is HMSWhiteboardUpdate.Stop -> {
data.putMap("hmsWhiteboard", HMSInteractivityDecoder.getHMSWhiteboard(hmsWhiteboardUpdate.hmsWhiteboard))
data.putString("updateType", HMSInteractivityDecoder.getWhiteboardUpdateType(hmsWhiteboardUpdate))
}
}
rnSDK.delegate.emitEvent("ON_WHITEBOARD_UPDATE", data)
}
},
)
//endregion
}

//region poll methods
fun quickStartPoll(
data: ReadableMap,
promise: Promise?,
Expand Down Expand Up @@ -159,4 +187,44 @@ class HMSRNInteractivityCenter(private val sdk: HMSSDK, private val rnSDK: HMSRN
},
)
}
//endregion

//region whiteboard methods
fun startWhiteboard(
data: ReadableMap,
promise: Promise?,
) {
val whiteboardTitle = data.getString("title")
if (whiteboardTitle == null) {
promise?.reject("6004", "whiteboard title is required")
return
}
sdk.getHmsInteractivityCenter().startWhiteboard(
whiteboardTitle,
object : HMSActionResultListener {
override fun onSuccess() {
promise?.resolve(true)
}

override fun onError(error: HMSException) {
promise?.reject(error.code.toString(), error.description)
}
},
)
}

fun stopWhiteboard(promise: Promise?) {
sdk.getHmsInteractivityCenter().stopWhiteboard(
object : HMSActionResultListener {
override fun onSuccess() {
promise?.resolve(true)
}

override fun onError(error: HMSException) {
promise?.reject(error.code.toString(), error.description)
}
},
)
}
//endregion
}
14 changes: 7 additions & 7 deletions packages/react-native-hms/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.916.0)
aws-sdk-core (3.192.1)
aws-partitions (1.921.0)
aws-sdk-core (3.193.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (1.80.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.147.0)
aws-sdk-core (~> 3, >= 3.192.0)
aws-sdk-s3 (1.148.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -138,7 +138,7 @@ GEM
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-cloud-storage (1.50.0)
google-cloud-storage (1.51.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-core (~> 0.13)
Expand Down
14 changes: 7 additions & 7 deletions packages/react-native-hms/example/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.916.0)
aws-sdk-core (3.192.1)
aws-partitions (1.921.0)
aws-sdk-core (3.193.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (1.80.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.147.0)
aws-sdk-core (~> 3, >= 3.192.0)
aws-sdk-s3 (1.148.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -131,7 +131,7 @@ GEM
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-cloud-storage (1.50.0)
google-cloud-storage (1.51.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-core (~> 0.13)
Expand Down
Loading

0 comments on commit 0d598ad

Please sign in to comment.