Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cawfree committed Oct 30, 2019
1 parent f1ebd28 commit 380d929
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 17 deletions.
89 changes: 76 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,82 @@
# react-native-quiet

## Getting started
This is a [React Native](https://facebook.github.io/react-native/) wrapper around the [Quiet Project](https://github.com/quiet/quiet), which enables us to transfer data over sound at a high speed. This has a number of benefits:

`$ npm install react-native-quiet --save`
- Super cross-platform. (You just need a microphone and a speaker.)
- Broadcast to devices within range without pairing.

### Mostly automatic installation
Quiet can even go _ultrasonic_, allowing us to communicate without impacting on noise levels that are perceptible by human ears.

`$ react-native link react-native-quiet`
New to Quiet? Try the awesome online demo [here](https://quiet.github.io/quiet-js/).

### Manual installation
## 🚀 Getting started

Using [`npm`]():

```bash
$ npm install react-native-quiet --save
```

Using [`yarn`]():

```bash
yarn add react-native-quiet
```

### ✍️ Example

```javascript
import RNQuiet from 'react-native-quiet';

// Start listening. (This will ask for microphone permissions!)
RNQuiet
.start('ultrasonic-experimental')
.then(
() => {
// Listen for Messages.
const { unsubscribe } = RNQuiet.addListener(msg => /* do something with received message */);
// Send Messages. (Careful; you can hear your own!)
RNQuiet.send(
'hello, world!',
);
// Stop listening.
RNQuiet.stop();
// Release the observer.
unsubscribe();
},
)
.catch(
(e) => /* user rejected permission */
);

```

### ⚙️ Installation (> 0.60.0)

React Native takes care of most of the heavy lifting when integrating this library. However, there are a couple of additional steps you need to execute to integrate with Android and iOS.

#### Android

In your `<project-dir>/android/settings.gradle`, append the `:quiet` native project, which is packaged inside of `react-native-quiet`:

```java
include ':quiet'
project(':quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android/org.quietmodem.Quiet/quiet')

```

#### iOS

On iOS, after installing be sure to sync your Cocoapods. Ensure that:

1. The line `pod 'react-native-quiet', :path => '../../react-native-quiet.podspec'` is visible in your `Podfile`.
2. You have ran `pod install` inside your `/ios` directory.

### Mostly automatic installation (Pre: 0.60.0)

1. `$ react-native link react-native-quiet`

### Manual installation

#### iOS

Expand All @@ -27,17 +94,13 @@
```
include ':react-native-quiet'
project(':react-native-quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android')
include ':quiet'
project(':quiet').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-quiet/android/org.quietmodem.Quiet/quiet')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-quiet')
```


## Usage
```javascript
import RNQuiet from 'react-native-quiet';

// TODO: What to do with the module?
RNQuiet;
```
### ✌️ License
[MIT](https://opensource.org/licenses/MIT)
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "react-native-quiet",
"title": "React Native Quiet",
"version": "1.0.0",
"description": "TODO",
"version": "0.0.1",
"description": "🤫 Quiet for React Native.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -13,10 +13,19 @@
"baseUrl": "https://github.com/cawfree/react-native-quiet"
},
"keywords": [
"react-native"
"react",
"react-native",
"quiet",
"quietjs",
"ultrasonic",
"data",
"audio",
"send",
"transmit",
"chirp"
],
"author": {
"name": "Alex Thomas",
"name": "Alex Thomas (@cawfree)",
"email": "hello@cawfree.com"
},
"license": "MIT",
Expand Down

0 comments on commit 380d929

Please sign in to comment.