Skip to content

Commit b1b9651

Browse files
authored
Initial implementation
1 parent e1e23f4 commit b1b9651

29 files changed

+20659
-1
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
indent_style = space
10+
indent_size = 2
11+
12+
end_of_line = lf
13+
charset = utf-8
14+
trim_trailing_whitespace = true
15+
insert_final_newline = true

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pbxproj -text
2+
# specific for windows script files
3+
*.bat text eol=crlf

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# XDE
6+
.expo/
7+
8+
# VSCode
9+
.vscode/
10+
jsconfig.json
11+
12+
# Xcode
13+
#
14+
build/
15+
*.pbxuser
16+
!default.pbxuser
17+
*.mode1v3
18+
!default.mode1v3
19+
*.mode2v3
20+
!default.mode2v3
21+
*.perspectivev3
22+
!default.perspectivev3
23+
xcuserdata
24+
*.xccheckout
25+
*.moved-aside
26+
DerivedData
27+
*.hmap
28+
*.ipa
29+
*.xcuserstate
30+
project.xcworkspace
31+
**/.xcode.env.local
32+
33+
# Android/IJ
34+
#
35+
.classpath
36+
.cxx
37+
.gradle
38+
.idea
39+
.project
40+
.settings
41+
local.properties
42+
android.iml
43+
44+
# Cocoapods
45+
#
46+
example/ios/Pods
47+
48+
# Ruby
49+
example/vendor/
50+
51+
# node.js
52+
#
53+
node_modules/
54+
npm-debug.log
55+
yarn-debug.log
56+
yarn-error.log
57+
58+
# BUCK
59+
buck-out/
60+
\.buckd/
61+
android/app/libs
62+
android/keystores/debug.keystore
63+
64+
# Yarn
65+
.yarn/*
66+
!.yarn/patches
67+
!.yarn/plugins
68+
!.yarn/releases
69+
!.yarn/sdks
70+
!.yarn/versions
71+
72+
# Expo
73+
.expo/
74+
75+
# Turborepo
76+
.turbo/
77+
78+
# generated by bob
79+
lib/
80+
81+
# React Native Codegen
82+
ios/generated
83+
android/generated
84+
example/android
85+
example/ios
86+
87+
# React Native Nitro Modules
88+
nitrogen/
89+
90+
91+
# Auto-generated files
92+
src/version.ts

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.20.0

.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,59 @@
11
# ultravox-client-sdk-react-native
2-
React native client SDK for Ultravox.
2+
React Native client SDK for [Ultravox](https://ultravox.ai).
3+
4+
[![npm package](https://img.shields.io/npm/v/ultravox-react-native?label=ultravox-react-native&color=orange)](https://www.npmjs.com/package/ultravox-react-native)
5+
6+
## Installation
7+
8+
9+
```sh
10+
npm install ultravox-react-native
11+
```
12+
13+
14+
## Usage
15+
16+
17+
```js
18+
import { useUltravox } from 'ultravox-react-native';
19+
20+
// ...
21+
22+
const { joinCall, leaveCall } = useUltravox();
23+
24+
useEffect(() => {
25+
joinCall(joinUrl).catch((error) => {
26+
console.error('Failed to join call:', error);
27+
});
28+
29+
return () => {
30+
leaveCall().catch((error) => {
31+
console.error('Failed to leave call:', error);
32+
});
33+
};
34+
}, [joinUrl, joinCall, leaveCall]);
35+
```
36+
37+
See the included example app for a more complete example. To get a `joinUrl`, you'll want to integrate your server with the [Ultravox REST API](https://docs.ultravox.ai)
38+
39+
## Testing SDK Changes
40+
41+
This repo includes a basic example application that can be used with the SDK. To run it from the main directory:
42+
43+
```bash
44+
npm install --force
45+
cd example
46+
npm run android
47+
npm run start -- --tunnel
48+
```
49+
50+
An Expo server will start, from which you can open an Android build on your connected device.
51+
52+
## Publishing
53+
54+
1. Test using the example app.
55+
1. Bump version in `package.json`.
56+
1. `npm publish --dry-run --git-checks=false`
57+
1. Open PR, get changes merged, then continue from `main`.
58+
1. `npm publish`
59+
1. Create a new Tag and Release on GitHub please.

babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
overrides: [
3+
{
4+
exclude: /\/node_modules\//,
5+
presets: ['module:react-native-builder-bob/babel-preset'],
6+
},
7+
{
8+
include: /\/node_modules\//,
9+
presets: ['module:@react-native/babel-preset'],
10+
},
11+
],
12+
};

eslint.config.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { fixupConfigRules } from '@eslint/compat';
2+
import { FlatCompat } from '@eslint/eslintrc';
3+
import js from '@eslint/js';
4+
import prettier from 'eslint-plugin-prettier';
5+
import { defineConfig } from 'eslint/config';
6+
import path from 'node:path';
7+
import { fileURLToPath } from 'node:url';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
});
16+
17+
export default defineConfig([
18+
{
19+
extends: fixupConfigRules(compat.extends('@react-native', 'prettier')),
20+
plugins: { prettier },
21+
rules: {
22+
'react/react-in-jsx-scope': 'off',
23+
'prettier/prettier': 'error',
24+
},
25+
},
26+
{
27+
ignores: ['node_modules/', 'lib/', 'src/version.ts'],
28+
},
29+
]);

example/app.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"expo": {
3+
"name": "example",
4+
"slug": "example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
10+
"splash": {
11+
"image": "./assets/splash-icon.png",
12+
"resizeMode": "contain",
13+
"backgroundColor": "#ffffff"
14+
},
15+
"ios": {
16+
"supportsTablet": true,
17+
"bundleIdentifier": "ultravoxreactnative.example"
18+
},
19+
"android": {
20+
"adaptiveIcon": {
21+
"foregroundImage": "./assets/adaptive-icon.png",
22+
"backgroundColor": "#ffffff"
23+
},
24+
"edgeToEdgeEnabled": true,
25+
"package": "ultravoxreactnative.example"
26+
},
27+
"web": {
28+
"favicon": "./assets/favicon.png"
29+
}
30+
}
31+
}

example/assets/adaptive-icon.png

17.1 KB
Loading

0 commit comments

Comments
 (0)