Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addListeners() {
// Listen here for message FROM popup
window.addEventListener('message', this.handleMessage)
if (isMobileApp()) {
this.popup.addEventListener('loadstart', this.handleLoadStart)
this.popup.addEventListener('exit', this.handleClose)
}
}
const hasNext = currentIndex < fileCount - 1
// this `expanded` property makes the next/previous controls cover the displayed image
const expanded = currentFile && currentFile.class === 'image'
return (
{this.renderViewer(currentFile)}
)
}
static getOnClickHref(props, nativeAppIsAvailable) {
const { slug, nativePath } = props
let href = props.href
let onClick = null
const usingNativeApp = isMobileApp()
const appInfo = NATIVE_APP_INFOS[slug]
if (usingNativeApp) {
if (nativeAppIsAvailable) {
// If we are on the native app and the other native app is available,
// we open the native app
onClick = AppLinker.openNativeFromNative.bind(this, props)
href = '#'
} else {
// If we are on a native app, but the other native app is not available
// we open the web link, this is done by the href prop. We still
// have to call the prop callback
onClick = AppLinker.openWeb.bind(this, props)
}
} else if (isMobile() && appInfo) {
// If we are on the "mobile web version", we try to open the native app
// if it exists with an universal links. If it fails, we redirect to the web
removeListeners() {
window.removeEventListener('message', this.handleMessage)
// rest of instructions only if popup is still opened
if (this.popup.closed) return
if (isMobileApp()) {
this.popup.removeEventListener('loadstart', this.handleLoadStart)
this.popup.removeEventListener('exit', this.handleClose)
}
}
// this `expanded` property makes the next/previous controls cover the displayed image
const expanded = currentFile && currentFile.class === 'image'
return (
{this.renderViewer(currentFile)}
)
}
}
return (
}>
)
}
componentDidMount() {
if (isMobileApp()) {
this.checkAppAvailability()
}
}
/>
<div>
<title>Client info</title>
URI
<p>{client.stackClient.uri}</p>
{client.stackClient.oauthOptions ? (
<>
OAuth document id
<p>{client.stackClient.oauthOptions.clientID}</p>
) : null}
</div>
<div>
<title>Notifications</title>
{isMobileApp() ? : null}
<button label="Send notification"> this.sendNotification()}
/>
</button></div>
<div>
<title>Services</title>
</div>
<div>
<title>Flags</title>
</div>