cobrowse-sdk-react-native
Advanced tools
Comparing version 0.0.8 to 1.0.0
@@ -30,2 +30,10 @@ 'use strict'; | ||
static set customData(customData) { | ||
CobrowseIONative.customData(customData); | ||
} | ||
static set deviceToken(token) { | ||
CobrowseIONative.deviceToken(token); | ||
} | ||
static currentSession(cb) { | ||
@@ -32,0 +40,0 @@ CobrowseIONative.currentSession(cb); |
@@ -49,4 +49,6 @@ import React, { Component } from 'react'; | ||
componentDidMount() { | ||
if (this.props.api) CobrowseIO.api = this.props.api; | ||
if (this.props.license) CobrowseIO.license = this.props.license; | ||
if (this.props.license) { | ||
console.warn('Passing license to view is deprecated. Use CobrowseIO.license = "..." instead'); | ||
CobrowseIO.license = this.props.license; | ||
} | ||
@@ -53,0 +55,0 @@ if (this.props.code) { |
{ | ||
"name": "cobrowse-sdk-react-native", | ||
"version": "0.0.8", | ||
"version": "1.0.0", | ||
"description": "Cobrowse SDK for React Native", | ||
@@ -5,0 +5,0 @@ "main": "./js/index.js", |
@@ -5,6 +5,4 @@ # CobrowseIO SDK - Remote Screenshare Service | ||
## Try it out | ||
You can try the Cobrowse.io service for **free** and **without signing up for an account**. Just follow the installation instructions below using the license key `trial`, then head to <https://cobrowse.io/trial> to use the trial dashboard. | ||
You can try the Cobrowse.io service for **free** and **without signing up for an account**. Just follow the installation instructions below, then head to <https://cobrowse.io/trial> to use the trial dashboard. | ||
## Installation | ||
@@ -17,80 +15,36 @@ | ||
**Note:** For iOS you need to be using Pods to manage dependencies for `react-native link` to work out of the box. If you're not using pods you'll need to manually add the Frameworks for CobrowseIO, SocketIO (and it's dependencies) to your Xcode project. | ||
Once you've signed up for a free account at [cobrowse.io](https://cobrowse.io), you'll be able to find your license key at <https://cobrowse.io/dashboard/settings>. You can add this to your SDK setup: | ||
## Usage from Javascript | ||
```javascript | ||
import CobrowseIO from 'cobrowse-sdk-react-native'; | ||
We've provided a view that will do all the session creation and management for you. All you need to do is include this somewhere in your react native view hierarchy. It's not a requirement to use this UI, continue reading to learn about creating your own interface (it's easy!). | ||
CobrowseIO.license = "<your license key here>"; | ||
```javascript | ||
import { CobrowseView } from 'cobrowse-sdk-react-native'; | ||
export default class App extends Component { | ||
render() { | ||
return ( | ||
<View> | ||
<CobrowseView license='trial' /> | ||
</View> | ||
); | ||
} | ||
} | ||
``` | ||
## API | ||
**Note:** For iOS you need to be using Pods to manage dependencies for `react-native link` to work out of the box (and also remember to run `pod install` after the link step). | ||
It's likely you'll want to customise the UI for starting or managing an active session. We've provided an API as a part of this SDK that allows you to bypass the default UI we provide and create your own: | ||
## Agent-initiated Sessions | ||
### Session Management | ||
Without any additional UI in your app, authenticated support agents are able to initiate sessions remotely via our online dashboard. To do this in an efficient way, we send an invisible push notification to the target device with a custom payload. To set up agent-initiated sessions: | ||
`CobrowseIO.createSession(callback)` | ||
1. Set up Firebase Cloud Messaging for your app. See the latest Firebase documentation for instructions at <https://firebase.google.com/docs/cloud-messaging/>. | ||
2. Enter your FCM Server Key from the FCM admin settings into your Cobrowse.io account at https://cobrowse.io/dashboard/settings. | ||
3. For Android devices, when you FCM token changes pass it into the Cobrowse SDK: | ||
`CobrowseIO.loadSession(code, callback)` | ||
```javascript | ||
import CobrowseIO from 'cobrowse-sdk-react-native'; | ||
`CobrowseIO.currentSession(callback)` | ||
CobrowseIO.deviceToken = "<your FCM token>"; | ||
`CobrowseIO.activateSession(callback)` | ||
``` | ||
`CobrowseIO.endSession(callback)` | ||
## Further Reading | ||
`CobrowseIO.addListener(event, callback)` | ||
[User Initiated Sessions](./docs/user-initiated-sessions.md) | ||
### Properties | ||
[API Documentation](./docs/api.md) | ||
`CobrowseIO.license` | ||
### Constants | ||
`CobrowseIO.SESSION_UPDATED` | ||
`CobrowseIO.SESSION_ENDED` | ||
See the [CobrowseView](./js/CobrowseView.js) code for an example of how to use these APIs. | ||
### Add your license key | ||
Once you've signed up for a free account at [cobrowse.io](https://cobrowse.io), you'll be able to find your license key at <https://cobrowse.io/dashboard/settings>. Add this to your SDK setup: | ||
```javascript | ||
CobrowseIO.license = "<your license key here>"; | ||
``` | ||
Alternatively, you can pass this as the `license` prop to the `CobrowseView` if you're using the default UI. | ||
## Requirements | ||
* iOS 9.0, Android API 21 or above. | ||
## Troubleshooting | ||
**Issue: Could not find any matches for io.cobrowse:cobrowse-sdk-android:0.+ as no versions of io.cobrowse:cobrowse-sdk-android are available.** | ||
Cobrowse uses a maven distribution on Android. Add these lines to your Project gradle.build file: | ||
**In your project build.gradle** | ||
Esnure that JCenter is added to your list of repositories: | ||
```gradle | ||
repositories { | ||
jcenter() | ||
} | ||
``` | ||
* iOS 9.0, Android API 19 or above. |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
79835
32
192
0
49