Skip to content

Commit

Permalink
Merge pull request #1226 from 100mslive/feature/addHandraiseAPIs
Browse files Browse the repository at this point in the history
added handraise first class APIs
  • Loading branch information
ygit committed Sep 21, 2023
2 parents 77b1931 + 8ddb639 commit 162a28c
Show file tree
Hide file tree
Showing 39 changed files with 934 additions and 605 deletions.
6 changes: 3 additions & 3 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 0.1
cli:
version: 1.15.0
version: 1.16.0
plugins:
sources:
- id: trunk
Expand All @@ -10,8 +10,8 @@ lint:
enabled:
- checkov@2.4.9
- osv-scanner@1.4.0
- trivy@0.45.0
- trufflehog@3.55.1
- trivy@0.45.1
- trufflehog@3.56.1
- oxipng@8.0.0
- yamllint@1.32.0
- ktlint@1.0.0
Expand Down
9 changes: 6 additions & 3 deletions packages/react-native-hms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.1.3"
implementation "androidx.appcompat:appcompat:1.3.1"

implementation "live.100ms:android-sdk:${sdkVersions["android"]}"
implementation "live.100ms:video-view:${sdkVersions["android"]}"
implementation "live.100ms:hls-player:${sdkVersions["android"]}"
// implementation "live.100ms:android-sdk:${sdkVersions["android"]}"
// implementation "live.100ms:video-view:${sdkVersions["android"]}"
// implementation "live.100ms:hls-player:${sdkVersions["android"]}"
implementation "com.github.100mslive.android-sdk:videoview:dev-v2-SNAPSHOT"
implementation "com.github.100mslive.android-sdk:hls-player:dev-v2-SNAPSHOT"
implementation 'com.github.100mslive.android-sdk:lib:dev-v2-SNAPSHOT'
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ object HMSDecoder {
HMSPeerUpdate.NAME_CHANGED -> {
print("$peerUpdateType received")
}
HMSPeerUpdate.HAND_RAISED_CHANGED -> {
peer.putBoolean("isHandRaised", hmsPeer.isHandRaised)
}
else -> {
print("Unhandled Peer Update Type received: $peerUpdateType")
}
Expand Down Expand Up @@ -205,6 +208,9 @@ object HMSDecoder {
HMSPeerUpdate.NAME_CHANGED -> {
print("$peerUpdateType received")
}
HMSPeerUpdate.HAND_RAISED_CHANGED -> {
peer.putBoolean("isHandRaised", hmsPeer.isHandRaised)
}
else -> {
print("Unhandled Peer Update Type received: $peerUpdateType")
}
Expand All @@ -231,6 +237,8 @@ object HMSDecoder {

peer.putMap("role", this.getHmsRole(hmsPeer.hmsRole))

peer.putBoolean("isHandRaised", hmsPeer.isHandRaised)

hmsPeer.networkQuality?.let {
peer.putMap("networkQuality", this.getHmsNetworkQuality(it))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,32 @@ class HMSManager(reactContext: ReactApplicationContext) :
hms?.getRoomLayout(data, promise)
}

@ReactMethod
fun raiseLocalPeerHand(
data: ReadableMap,
promise: Promise?,
) {
val hms = HMSHelper.getHms(data, hmsCollection)
hms?.raiseLocalPeerHand(data, promise)
}

@ReactMethod
fun lowerLocalPeerHand(
data: ReadableMap,
promise: Promise?,
) {
val hms = HMSHelper.getHms(data, hmsCollection)
hms?.lowerLocalPeerHand(data, promise)
}

fun lowerRemotePeerHand(
data: ReadableMap,
promise: Promise?,
) {
val hms = HMSHelper.getHms(data, hmsCollection)
hms?.lowerRemotePeerHand(data, promise)
}

fun emitEvent(
event: String,
data: WritableMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,9 @@ class HMSRNSDK(
"role" -> {
result.putMap("role", HMSDecoder.getHmsRole(peer.hmsRole))
}
"isHandRaised" -> {
result.putBoolean("isHandRaised", peer.isHandRaised)
}
"customerUserID" -> {
if (peer.customerUserID !== null) {
result.putString("customerUserID", peer.customerUserID)
Expand Down Expand Up @@ -2308,4 +2311,64 @@ class HMSRNSDK(
},
)
}

fun raiseLocalPeerHand(
data: ReadableMap,
promise: Promise?,
) {
hmsSDK?.raiseLocalPeerHand(
object : HMSActionResultListener {
override fun onError(error: HMSException) {
promise?.reject(error.code.toString(), error.message)
}

override fun onSuccess() {
promise?.resolve(true)
}
},
)
}

fun lowerLocalPeerHand(
data: ReadableMap,
promise: Promise?,
) {
hmsSDK?.lowerLocalPeerHand(
object : HMSActionResultListener {
override fun onError(error: HMSException) {
promise?.reject(error.code.toString(), error.message)
}

override fun onSuccess() {
promise?.resolve(true)
}
},
)
}

fun lowerRemotePeerHand(
data: ReadableMap,
promise: Promise?,
) {
val peerId = data.getString("peerId")
peerId?.let { peerID ->
hmsSDK?.getRoom()?.let { room ->
val peer = HMSHelper.getPeerFromPeerId(peerID, room)
peer?.let { peer ->
hmsSDK?.lowerRemotePeerHand(
forPeer = peer,
object : HMSActionResultListener {
override fun onError(error: HMSException) {
promise?.reject(error.code.toString(), error.message)
}

override fun onSuccess() {
promise?.resolve(true)
}
},
)
}
}
}
}
}
13 changes: 7 additions & 6 deletions packages/react-native-hms/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.823.0)
aws-partitions (1.824.0)
aws-sdk-core (3.181.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.214.0)
fastlane (2.215.1)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -87,6 +87,7 @@ GEM
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
Expand All @@ -98,7 +99,7 @@ GEM
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
Expand Down Expand Up @@ -180,8 +181,8 @@ GEM
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -191,7 +192,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
unicode-display_width (2.4.2)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
Expand Down
13 changes: 7 additions & 6 deletions packages/react-native-hms/example/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.823.0)
aws-partitions (1.824.0)
aws-sdk-core (3.181.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.214.0)
fastlane (2.215.1)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -87,6 +87,7 @@ GEM
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
Expand All @@ -98,7 +99,7 @@ GEM
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
Expand Down Expand Up @@ -180,8 +181,8 @@ GEM
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -191,7 +192,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
unicode-display_width (2.4.2)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native-hms/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PODS:
- HMSBroadcastExtensionSDK (0.0.9)
- HMSHLSPlayerSDK (0.0.2):
- HMSAnalyticsSDK (= 0.0.2)
- HMSSDK (0.9.12):
- HMSSDK (1.0.1):
- HMSAnalyticsSDK (= 0.0.2)
- HMSWebRTC (= 1.0.5116)
- HMSWebRTC (1.0.5116)
Expand Down Expand Up @@ -292,10 +292,10 @@ PODS:
- React-Core
- react-native-document-picker (8.2.1):
- React-Core
- react-native-hms (1.8.1):
- react-native-hms (1.9.0):
- HMSBroadcastExtensionSDK (= 0.0.9)
- HMSHLSPlayerSDK (= 0.0.2)
- HMSSDK (= 0.9.12)
- HMSSDK (= 1.0.1)
- React-Core
- react-native-safe-area-context (3.4.1):
- React-Core
Expand Down Expand Up @@ -629,7 +629,7 @@ SPEC CHECKSUMS:
HMSAnalyticsSDK: 4d2a88a729b1eb42f3d25f217c28937ec318a5b7
HMSBroadcastExtensionSDK: d80fe325f6c928bd8e5176290b5a4b7ae15d6fbb
HMSHLSPlayerSDK: 6a54ad4d12f3dc2270d1ecd24019d71282a4f6a3
HMSSDK: 65c1445ad2aac04deb127fe7611f65b8e7447752
HMSSDK: 4d3227d2e2499fccaaff25e94a1ff74faf7f2681
HMSWebRTC: ae54e9dd91b869051b283b43b14f57d43b7bf8e1
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
Expand All @@ -649,7 +649,7 @@ SPEC CHECKSUMS:
react-native-avoid-softinput: 71a692888f0c1d426ad9045dc8325773583962cd
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-document-picker: 69ca2094d8780cfc1e7e613894d15290fdc54bba
react-native-hms: fa7f6f547bc110c3f4cd01cad033c52e2ac40572
react-native-hms: df52bcaf0cfbe6d9b9d75da1cd96fcc5f1357cae
react-native-safe-area-context: 9e40fb181dac02619414ba1294d6c2a807056ab9
react-native-simple-toast: 8ee5d23f0b92b935ab7434cdb65159ce12dfb4b7
React-perflogger: 5a890ca0911669421b7611661e9b58f91c805f5c
Expand Down
Loading

0 comments on commit 162a28c

Please sign in to comment.