opentok-react-native
Advanced tools
Comparing version 0.17.2 to 0.18.0
@@ -0,1 +1,8 @@ | ||
# 0.18.0 (Jun 24, 2021) | ||
- [Update]: update SDKs iOS to 2.20.0 and Android to 2.20.1 | ||
- [Fix]: fix crash in OTPublisherLayout when sessionId is null. Fix: https://github.com/opentok/opentok-react-native/issues/462#issuecomment-752171962 | ||
- [Fix]: Downgrade uuidv4 module to `3.4.0` due to [UUID#375](https://github.com/uuidjs/uuid/issues/375) | ||
- [Fix]: OTCustomAudioDrive added file in project.pbxproj | ||
- [Fix]: Update Github Actions | ||
# 0.17.2 (May 27, 2021) | ||
@@ -2,0 +9,0 @@ - **[Fix]**: Fixed incorrect audio bitrate sanitization [#473](https://github.com/opentok/opentok-react-native/pull/473) |
{ | ||
"name": "opentok-react-native", | ||
"version": "0.17.2", | ||
"version": "0.18.0", | ||
"description": "React Native components for OpenTok iOS and Android SDKs", | ||
@@ -31,3 +31,3 @@ "main": "src/index.js", | ||
"underscore": "^1.13.0", | ||
"uuid": "^8.3.2" | ||
"uuid": "^3.4.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -56,3 +56,3 @@ # opentok-react-native | ||
# Pods for <YourProject> | ||
pod 'OpenTok', '2.18.1' | ||
pod 'OpenTok', '2.20.0' | ||
end | ||
@@ -59,0 +59,0 @@ |
@@ -5,4 +5,13 @@ import React, { Component } from 'react'; | ||
import { isNull } from 'underscore'; | ||
import { checkAndroidPermissions, OT, removeNativeEvents, nativeEvents, setNativeEvents } from './OT'; | ||
import { sanitizeProperties, sanitizePublisherEvents } from './helpers/OTPublisherHelper'; | ||
import { | ||
checkAndroidPermissions, | ||
OT, | ||
removeNativeEvents, | ||
nativeEvents, | ||
setNativeEvents, | ||
} from './OT'; | ||
import { | ||
sanitizeProperties, | ||
sanitizePublisherEvents, | ||
} from './helpers/OTPublisherHelper'; | ||
import OTPublisherView from './views/OTPublisherView'; | ||
@@ -12,3 +21,2 @@ import { getOtrnErrorEventHandler } from './helpers/OTHelper'; | ||
import OTContext from './contexts/OTContext'; | ||
const uuid = require('uuid/v4'); | ||
@@ -28,13 +36,22 @@ | ||
this.componentEvents = { | ||
sessionConnected: Platform.OS === 'android' ? 'session:onConnected' : 'session:sessionDidConnect', | ||
sessionConnected: | ||
Platform.OS === 'android' | ||
? 'session:onConnected' | ||
: 'session:sessionDidConnect', | ||
}; | ||
this.componentEventsArray = Object.values(this.componentEvents); | ||
this.otrnEventHandler = getOtrnErrorEventHandler(this.props.eventHandlers); | ||
this.publisherEvents = sanitizePublisherEvents(this.state.publisherId, this.props.eventHandlers); | ||
this.componentEventsArray = Object.values(this.componentEvents); | ||
this.otrnEventHandler = getOtrnErrorEventHandler(this.props.eventHandlers); | ||
this.publisherEvents = sanitizePublisherEvents( | ||
this.state.publisherId, | ||
this.props.eventHandlers | ||
); | ||
setNativeEvents(this.publisherEvents); | ||
OT.setJSComponentEvents(this.componentEventsArray); | ||
if (this.context.sessionId) { | ||
this.sessionConnected = nativeEvents.addListener(`${this.context.sessionId}:${this.componentEvents.sessionConnected}`, () => this.sessionConnectedHandler()); | ||
this.sessionConnected = nativeEvents.addListener( | ||
`${this.context.sessionId}:${this.componentEvents.sessionConnected}`, | ||
() => this.sessionConnectedHandler() | ||
); | ||
} | ||
} | ||
}; | ||
componentDidMount() { | ||
@@ -44,3 +61,4 @@ this.createPublisher(); | ||
componentDidUpdate(previousProps) { | ||
const useDefault = (value, defaultValue) => (value === undefined ? defaultValue : value); | ||
const useDefault = (value, defaultValue) => | ||
value === undefined ? defaultValue : value; | ||
const shouldUpdate = (key, defaultValue) => { | ||
@@ -58,3 +76,3 @@ const previous = useDefault(previousProps.properties[key], defaultValue); | ||
} else { | ||
OT[key](this.state.publisherId, value); | ||
OT[key](this.state.publisherId, value); | ||
} | ||
@@ -83,3 +101,3 @@ } | ||
} | ||
} | ||
}; | ||
createPublisher() { | ||
@@ -100,29 +118,41 @@ if (Platform.OS === 'android') { | ||
const publisherProperties = sanitizeProperties(this.props.properties); | ||
OT.initPublisher(this.state.publisherId, publisherProperties, (initError) => { | ||
if (initError) { | ||
this.setState({ | ||
initError | ||
}); | ||
this.otrnEventHandler(initError); | ||
} else { | ||
if (this.context.sessionId) { | ||
OT.getSessionInfo(this.context.sessionId, (session) => { | ||
if (!isNull(session) && isNull(this.state.publisher) && isConnected(session.connectionStatus)) { | ||
this.publish(); | ||
} | ||
OT.initPublisher( | ||
this.state.publisherId, | ||
publisherProperties, | ||
(initError) => { | ||
if (initError) { | ||
this.setState({ | ||
initError, | ||
}); | ||
this.otrnEventHandler(initError); | ||
} else { | ||
if (this.context.sessionId) { | ||
OT.getSessionInfo(this.context.sessionId, (session) => { | ||
if ( | ||
!isNull(session) && | ||
isNull(this.state.publisher) && | ||
isConnected(session.connectionStatus) | ||
) { | ||
this.publish(); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
}); | ||
); | ||
} | ||
publish() { | ||
OT.publish(this.context.sessionId, this.state.publisherId, (publishError) => { | ||
if (publishError) { | ||
this.otrnEventHandler(publishError); | ||
} else { | ||
this.setState({ | ||
publisher: true, | ||
}); | ||
OT.publish( | ||
this.context.sessionId, | ||
this.state.publisherId, | ||
(publishError) => { | ||
if (publishError) { | ||
this.otrnEventHandler(publishError); | ||
} else { | ||
this.setState({ | ||
publisher: true, | ||
}); | ||
} | ||
} | ||
}); | ||
); | ||
} | ||
@@ -133,3 +163,9 @@ render() { | ||
if (publisher && publisherId) { | ||
return <OTPublisherView publisherId={publisherId} sessionId={sessionId} {...this.props} />; | ||
return ( | ||
<OTPublisherView | ||
publisherId={publisherId} | ||
sessionId={sessionId} | ||
{...this.props} | ||
/> | ||
); | ||
} | ||
@@ -136,0 +172,0 @@ return <View />; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308981
1361
+ Addeduuid@3.4.0(transitive)
- Removeduuid@8.3.2(transitive)
Updateduuid@^3.4.0