Skip to content

Commit

Permalink
Merge pull request #1043 from 100mslive/release1.6.2
Browse files Browse the repository at this point in the history
Release 1.6.2: To main
  • Loading branch information
ygit authored May 18, 2023
2 parents a4c4c2a + 28c21d6 commit 1f93aff
Show file tree
Hide file tree
Showing 28 changed files with 330 additions and 118 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.appcompat:appcompat:1.3.1'
}
}
14 changes: 11 additions & 3 deletions android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ class HMSRNSDK(
return data
}

fun emitHMSMessageSuccess(hmsMessage: HMSMessage): ReadableMap {
val data: WritableMap = Arguments.createMap()
data.putString("message", hmsMessage.message)
data.putString("messageId", hmsMessage.messageId)
return data
}

fun preview(credentials: ReadableMap) {
if (previewInProgress) {
self.emitCustomError("PREVIEW_IS_IN_PROGRESS")
Expand Down Expand Up @@ -377,6 +384,7 @@ class HMSRNSDK(

data.putMap("sender", HMSDecoder.getHmsPeerSubset(message.sender))
data.putString("message", message.message)
data.putString("messageId", message.messageId)
data.putString("type", message.type)
data.putString("time", message.serverReceiveTime.toString())
data.putString("id", id)
Expand Down Expand Up @@ -670,7 +678,7 @@ class HMSRNSDK(
callback?.reject(error.code.toString(), error.message)
}
override fun onSuccess(hmsMessage: HMSMessage) {
callback?.resolve(emitHMSSuccess(hmsMessage))
callback?.resolve(emitHMSMessageSuccess(hmsMessage))
}
},
)
Expand Down Expand Up @@ -702,7 +710,7 @@ class HMSRNSDK(
callback?.reject(error.code.toString(), error.message)
}
override fun onSuccess(hmsMessage: HMSMessage) {
callback?.resolve(emitHMSSuccess(hmsMessage))
callback?.resolve(emitHMSMessageSuccess(hmsMessage))
}
},
)
Expand Down Expand Up @@ -733,7 +741,7 @@ class HMSRNSDK(
callback?.reject(error.code.toString(), error.message)
}
override fun onSuccess(hmsMessage: HMSMessage) {
callback?.resolve(emitHMSSuccess(hmsMessage))
callback?.resolve(emitHMSMessageSuccess(hmsMessage))
}
},
)
Expand Down
10 changes: 5 additions & 5 deletions example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Board: https://github.com/100mslive/react-native-hms/projects/20
Board: https://github.com/100mslive/react-native-hms/projects/21

- Corrected applying HMSView scaletype
https://github.com/100mslive/react-native-hms/pull/1034
- Add messageId to HMSMessage
https://github.com/100mslive/react-native-hms/pull/1044/

React Native SDK: 1.6.1
Android SDK: 2.6.3
React Native SDK: 1.6.2
Android SDK: 2.6.4
iOS SDK: 0.9.4
2 changes: 1 addition & 1 deletion 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.764.0)
aws-partitions (1.765.0)
aws-sdk-core (3.172.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ android {
applicationId "live.hms.rn"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 200
versionName "2.1.64"
versionCode 201
versionName "2.1.65"
missingDimensionStrategy 'react-native-camera', 'general'
}
splits {
Expand Down
2 changes: 1 addition & 1 deletion 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.764.0)
aws-partitions (1.765.0)
aws-sdk-core (3.172.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ PODS:
- React-Core
- react-native-document-picker (8.2.1):
- React-Core
- react-native-hms (1.6.1):
- react-native-hms (1.6.2):
- HMSBroadcastExtensionSDK (= 0.0.9)
- HMSSDK (= 0.9.4)
- React-Core
Expand Down Expand Up @@ -622,7 +622,7 @@ SPEC CHECKSUMS:
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-cameraroll: 8ffb0af7a5e5de225fd667610e2979fc1f0c2151
react-native-document-picker: 69ca2094d8780cfc1e7e613894d15290fdc54bba
react-native-hms: 687061da689231515992d70ec6cb1b161cab1be2
react-native-hms: eb0e01eed0ab02a719558602e18bcf7064e376b6
react-native-safe-area-context: 9e40fb181dac02619414ba1294d6c2a807056ab9
react-native-simple-toast: 8ee5d23f0b92b935ab7434cdb65159ce12dfb4b7
react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253
Expand Down
8 changes: 4 additions & 4 deletions example/ios/RNHMSExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 200;
CURRENT_PROJECT_VERSION = 201;
DEVELOPMENT_TEAM = 5N85PP82A9;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand Down Expand Up @@ -484,7 +484,7 @@
CODE_SIGN_ENTITLEMENTS = RNHMSExample/RNHMSExample.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 200;
CURRENT_PROJECT_VERSION = 201;
DEVELOPMENT_TEAM = 5N85PP82A9;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand Down Expand Up @@ -654,7 +654,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 200;
CURRENT_PROJECT_VERSION = 201;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 5N85PP82A9;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -699,7 +699,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 200;
CURRENT_PROJECT_VERSION = 201;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 5N85PP82A9;
ENABLE_BITCODE = NO;
Expand Down
4 changes: 2 additions & 2 deletions example/ios/RNHMSExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.64</string>
<string>2.1.65</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>200</string>
<string>201</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
28 changes: 14 additions & 14 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RNHMSExample",
"version": "1.6.1",
"version": "1.7.0",
"private": true,
"scripts": {
"preinstall": "cd ../ && npm install && cd ./example",
Expand Down
54 changes: 41 additions & 13 deletions example/src/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ const ChatList = ({
/>
)}
</View>
<Text
style={[styles.messageText, {color: 'gray'}]}
ellipsizeMode="middle"
>
{data.messageId}
</Text>
<Text style={styles.messageText}>{data.message}</Text>
</View>
);
Expand Down Expand Up @@ -299,38 +305,60 @@ export const ChatWindow = ({localPeer}: {localPeer?: HMSLocalPeer}) => {
};

const sendMessage = () => {
let hmsMessageRecipient: HMSMessageRecipient;
if (text.length > 0) {
if (text.length > 0 && hmsInstance) {
let hmsMessageRecipient: HMSMessageRecipient;

if (type === 'role') {
hmsMessageRecipient = new HMSMessageRecipient({
recipientType: HMSMessageRecipientType.ROLES,
recipientRoles: [receiverObject as HMSRole],
});
hmsInstance?.sendGroupMessage(text, [receiverObject as HMSRole]);
} else if (type === 'direct') {
hmsMessageRecipient = new HMSMessageRecipient({
recipientType: HMSMessageRecipientType.PEER,
recipientPeer: receiverObject as HMSPeer,
});
hmsInstance?.sendDirectMessage(text, receiverObject as HMSPeer);
} else {
hmsMessageRecipient = new HMSMessageRecipient({
recipientType: HMSMessageRecipientType.BROADCAST,
});
hmsInstance?.sendBroadcastMessage(text);
}
dispatch(
addMessage(
new HMSMessage({
message: text,

// Saving reference of `text` state to local variable
// to use the typed message after clearing state
const messageText = text;

setText('');

const handleMessageID = ({
messageId,
}: {
messageId: string | undefined;
}) => {
if (messageId) {
const localMessage = new HMSMessage({
messageId: messageId,
message: messageText,
type: HMSMessageType.CHAT,
time: new Date(),
sender: localPeer,
recipient: hmsMessageRecipient,
}),
),
);
setText('');
});
dispatch(addMessage(localMessage));
}
};

if (type === 'role') {
hmsInstance
.sendGroupMessage(messageText, [receiverObject as HMSRole])
.then(handleMessageID);
} else if (type === 'direct') {
hmsInstance
.sendDirectMessage(messageText, receiverObject as HMSPeer)
.then(handleMessageID);
} else {
hmsInstance.sendBroadcastMessage(messageText).then(handleMessageID);
}
}
};

Expand Down
16 changes: 10 additions & 6 deletions example/src/components/LiveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,30 @@ export interface LiveButtonProps {
isLive: boolean;
onPress(): void;
disabled?: boolean;
size?: 'normal' | 'small'
size?: 'normal' | 'small';
}

const LiveButton: React.FC<LiveButtonProps> = ({
containerStyle,
isLive,
onPress,
disabled,
size = 'normal'
size = 'normal',
}) => {
const textStyle: StyleProp<TextStyle> = size !== 'normal' ? { fontSize: 10 } : null;
const indicatorStyle: StyleProp<ViewStyle> = size !== 'normal' ? { width: 4, height: 4, borderRadius: 2 } : null;
const pressableStyle: StyleProp<ViewStyle> = size !== 'normal' ? { padding: 4 } : null;
const textStyle: StyleProp<TextStyle> =
size !== 'normal' ? {fontSize: 10} : null;
const indicatorStyle: StyleProp<ViewStyle> =
size !== 'normal' ? {width: 4, height: 4, borderRadius: 2} : null;
const pressableStyle: StyleProp<ViewStyle> =
size !== 'normal' ? {padding: 4} : null;

return (
<View style={containerStyle}>
<TouchableOpacity
onPress={onPress}
style={[styles.touchable, pressableStyle]}
disabled={disabled}>
disabled={disabled}
>
<View
style={[
styles.liveIndicator,
Expand Down
8 changes: 6 additions & 2 deletions example/src/components/PeerSettingsModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export const PeerSettingsModalContent: React.FC<
const toggleMuteAudio = () => {
cancelModal();

if (peerTrackNode.peer.isLocal) return;
if (peerTrackNode.peer.isLocal) {
return;
}

hmsInstance?.changeTrackState(
peerTrackNode.peer.audioTrack!!,
Expand All @@ -71,7 +73,9 @@ export const PeerSettingsModalContent: React.FC<
const toggleMuteVideo = () => {
cancelModal();

if (peerTrackNode.peer.isLocal) return;
if (peerTrackNode.peer.isLocal) {
return;
}

hmsInstance?.changeTrackState(
peerTrackNode.peer.videoTrack!!,
Expand Down
Loading

0 comments on commit 1f93aff

Please sign in to comment.