Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jsconfig.json
# Xcode
#
build/
!plugin/build
*.pbxuser
!default.pbxuser
*.mode1v3
Expand Down Expand Up @@ -76,7 +77,8 @@ android/keystores/debug.keystore
.turbo/

# generated by bob
lib/
# because we want to be able to use the package from git, we want to release lib so we can build the plugin
# lib/

# React Native Codegen
ios/generated
Expand Down
31 changes: 5 additions & 26 deletions OpentokReactNative.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
s.name = "OpentokReactNative"
Expand All @@ -15,31 +14,11 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/opentok/opentok-react-native.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
s.private_header_files = "ios/generated/**/*.h"
s.public_header_files = "ios/**/*.h"

# Add OTXCFramework dependency
# s.private_header_files = "ios/**/*.h"

s.dependency 'OTXCFramework', '2.31.0'
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
else
s.dependency "React-Core"

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
end
s.swift_version = '5.0'

install_modules_dependencies(s)
end
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,46 @@ See the system requirements for the [OpenTok Android SDK](https://tokbox.com/dev

2. Add the library using `npm` or `yarn`:

* `npm install opentok-react-native0`
* `npm install opentok-react-native`
* `yarn add opentok-react-native`

## Expo Installation

**Expo SDK 54+ is supported with the included config plugin.**

1. Install the library:
```bash
npx expo install opentok-react-native
```

2. Add to your `app.json`:
```json
{
"expo": {
"plugins": [
["opentok-react-native", {
"cameraPermission": "Your camera permission message",
"microphonePermission": "Your microphone permission message"
}]
]
}
}
```

3. Run prebuild and build:
```bash
npx expo prebuild
npx expo run:ios # or run:android
```

The plugin automatically adds required permissions and registers Fabric components.

For detailed Expo setup, see [Expo's config plugins documentation](https://docs.expo.dev/config-plugins/introduction/).

## React Native CLI Installation

If you're using React Native CLI (not Expo), follow these platform-specific instructions:

### iOS Installation

1. Install the iOS pods:
Expand Down
50 changes: 7 additions & 43 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,23 @@ buildscript {
}


def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OpentokReactNative_" + name]).toInteger()
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
}

android {
if (supportsNamespace()) {
namespace "com.opentokreactnative"

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
namespace "com.opentokreactnative"

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

}

buildFeatures {
Expand All @@ -81,12 +56,10 @@ android {

sourceSets {
main {
//if (isNewArchitectureEnabled()) {
java.srcDirs += [
"generated/java",
"generated/jni"
]
//}
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}
Expand All @@ -99,15 +72,6 @@ repositories {
def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
implementation "com.facebook.react:react-android:0.78.0"
implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.opentok.android:opentok-android-sdk:2.31.0'
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "OpentokReactNative"
codegenJavaPackageName = "com.opentokreactnative"
}
}
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ OpentokReactNative_kotlinVersion=2.0.21
OpentokReactNative_minSdkVersion=24
OpentokReactNative_targetSdkVersion=34
OpentokReactNative_compileSdkVersion=35
OpentokReactNative_ndkversion=27.1.12297006
android.useAndroidX=true
OpentokReactNative_ndkVersion=27.1.12297006
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.opentokreactnative">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
2 changes: 0 additions & 2 deletions android/src/main/AndroidManifestNew.xml

This file was deleted.

13 changes: 13 additions & 0 deletions app.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Expo config plugin entry point for opentok-react-native.
*
* This file serves as the main entry point for the Expo config plugin system.
* It loads the compiled TypeScript plugin code from the plugin/build directory.
*
* The plugin automatically configures iOS and Android permissions required for
* video calling with the OpenTok/Vonage Video API.
*
* @see https://docs.expo.dev/config-plugins/introduction/
*/

module.exports = require("./plugin/build/index");
34 changes: 32 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
module.exports = {
presets: ['module:react-native-builder-bob/babel-preset'],
module.exports = function (api) {
const isTest = api.env('test');

// For plugin tests, use a simpler preset that doesn't require React Native
if (isTest && process.env.npm_lifecycle_event === 'test:plugin') {
return {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
}

// For main tests, use React Native preset
if (isTest) {
return {
presets: ['module:@react-native/babel-preset'],
};
}

return {
overrides: [
{
exclude: /\/node_modules\//,
presets: ['module:react-native-builder-bob/babel-preset'],
},
{
include: /\/node_modules\//,
presets: ['module:@react-native/babel-preset'],
},
],
};
};
6 changes: 6 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
41 changes: 25 additions & 16 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ GEM
base64
nkf
rexml
activesupport (7.1.4.2)
activesupport (7.2.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.9)
base64 (0.3.0)
benchmark (0.4.1)
bigdecimal (3.2.3)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -63,20 +66,21 @@ GEM
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.3.3)
connection_pool (2.5.0)
drb (2.2.1)
connection_pool (2.5.4)
drb (2.2.3)
escape (0.0.4)
ethon (0.16.0)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.17.1-arm64-darwin)
ffi (1.17.2)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.9.0)
mutex_m
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.10.2)
json (2.13.2)
logger (1.7.0)
minitest (5.25.5)
molinillo (0.8.0)
mutex_m (0.3.0)
Expand All @@ -85,10 +89,11 @@ GEM
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.4.1)
rexml (3.4.3)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
securerandom (0.4.1)
typhoeus (1.5.0)
ethon (>= 0.9.0, < 0.16.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.25.1)
Expand All @@ -100,16 +105,20 @@ GEM
rexml (>= 3.3.6, < 4.0)

PLATFORMS
arm64-darwin
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, != 7.1.0)
benchmark
bigdecimal
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
concurrent-ruby (< 1.3.4)
logger
mutex_m
xcodeproj (< 1.26.0)

RUBY VERSION
ruby 3.3.6p108

BUNDLED WITH
2.4.7
2.5.22
Loading