edoctor-sendbird-calls 1.0.4 → 1.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -5
- package/edoctor-sendbird-calls.podspec +18 -4
- package/ios/CXProvider.swift +2 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,140 @@
|
|
|
1
1
|
# edoctor-sendbird-calls
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React Native module for Sendbird Calls SDK.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
### 1. Install the npm package
|
|
8
|
+
|
|
7
9
|
```sh
|
|
10
|
+
yarn add edoctor-sendbird-calls
|
|
11
|
+
# or
|
|
8
12
|
npm install edoctor-sendbird-calls
|
|
9
13
|
```
|
|
10
14
|
|
|
15
|
+
### 2. iOS setup (SPM + Pods)
|
|
16
|
+
|
|
17
|
+
SendBirdCalls SDK is delivered via Swift Package Manager. The React Native bridge still comes from this pod.
|
|
18
|
+
|
|
19
|
+
**Steps**
|
|
20
|
+
1) `cd ios && pod install`
|
|
21
|
+
2) Open your `.xcworkspace` in Xcode.
|
|
22
|
+
3) Add the SPM package: File → Add Package Dependencies… → `https://github.com/sendbird/sendbird-calls-ios` → version **1.11.1** or later.
|
|
23
|
+
4) In the “Add to Target” column, select **both**:
|
|
24
|
+
- Your app target (e.g. `EdoctorSendbirdCallsExample`).
|
|
25
|
+
- The pod target `edoctor-sendbird-calls` (Pods project). If it is not offered, add the package first to the workspace, then go to Pods.xcodeproj → target `edoctor-sendbird-calls` → Build Phases → Link Binary With Libraries → `+` → pick `SendBirdCalls`.
|
|
26
|
+
5) Ensure `SendBirdCalls.framework` is in Link Binary With Libraries for both targets and set to **Do Not Embed**.
|
|
27
|
+
|
|
28
|
+
> If you rerun `pod install`, Pods.xcodeproj is regenerated; re-check that the `edoctor-sendbird-calls` pod target still links `SendBirdCalls`.
|
|
29
|
+
|
|
30
|
+
Starting from version 1.11.0, this library requires **SendBirdCalls** to be added via **Swift Package Manager (SPM)** in your main project. This reduces the npm package size significantly.
|
|
31
|
+
|
|
32
|
+
#### Step-by-step SPM Integration:
|
|
33
|
+
1. Open your project in Xcode (`.xcworkspace`).
|
|
34
|
+
2. Go to **File** → **Add Package Dependencies...**.
|
|
35
|
+
3. Enter the package URL: `https://github.com/sendbird/sendbird-calls-ios`.
|
|
36
|
+
4. Select version **1.11.1** or later.
|
|
37
|
+
5. Click **Add Package**.
|
|
38
|
+
6. Select your main app target and click **Add Package**.
|
|
39
|
+
|
|
40
|
+
#### Requirements:
|
|
41
|
+
- **iOS**: 14.0 or later
|
|
42
|
+
- **Xcode**: 15.0 or later
|
|
43
|
+
- **CocoaPods**: 1.10.0 or later
|
|
44
|
+
|
|
45
|
+
#### Privacy Info:
|
|
46
|
+
This library includes a `PrivacyInfo.xcprivacy` file as required by Apple.
|
|
47
|
+
|
|
48
|
+
#### Info.plist permissions:
|
|
49
|
+
Add these keys to your `Info.plist`:
|
|
50
|
+
|
|
51
|
+
```xml
|
|
52
|
+
<key>NSMicrophoneUsageDescription</key>
|
|
53
|
+
<string>$(PRODUCT_NAME) needs access to the microphone for voice calls</string>
|
|
54
|
+
<key>NSCameraUsageDescription</key>
|
|
55
|
+
<string>$(PRODUCT_NAME) needs access to the camera for video calls</string>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Enable Background Modes:
|
|
59
|
+
In your Xcode project, go to **Signing & Capabilities** → **+ Capability** → **Background Modes**, then enable:
|
|
60
|
+
- **Audio, AirPlay, and Picture in Picture**
|
|
61
|
+
- **Voice over IP**
|
|
62
|
+
|
|
63
|
+
### 3. Android Setup
|
|
64
|
+
|
|
65
|
+
The library handles most configuration automatically. Ensure your `minSdkVersion` is at least **24** in `android/build.gradle`.
|
|
66
|
+
|
|
11
67
|
## Usage
|
|
12
68
|
|
|
69
|
+
### 1. Initialize and Authenticate
|
|
13
70
|
|
|
14
|
-
```
|
|
15
|
-
import {
|
|
71
|
+
```javascript
|
|
72
|
+
import { SendBirdCalls } from 'edoctor-sendbird-calls';
|
|
16
73
|
|
|
17
|
-
//
|
|
74
|
+
// Initialize
|
|
75
|
+
await SendBirdCalls.initSendBird('YOUR_APP_ID');
|
|
18
76
|
|
|
19
|
-
|
|
77
|
+
// Authenticate
|
|
78
|
+
const result = await SendBirdCalls.authenticate(userId, accessToken);
|
|
79
|
+
if (result.succeeded) {
|
|
80
|
+
console.log('User authenticated:', result.userId);
|
|
81
|
+
}
|
|
20
82
|
```
|
|
21
83
|
|
|
84
|
+
### 2. Making a Call
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
// Dial a call
|
|
88
|
+
const dialResult = await SendBirdCalls.dial(
|
|
89
|
+
targetUserId,
|
|
90
|
+
isVideoCall, // boolean
|
|
91
|
+
true, // isVideoEnabled
|
|
92
|
+
true // isAudioEnabled
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
if (dialResult.succeeded) {
|
|
96
|
+
console.log('Call started with ID:', dialResult.callId);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Handling Events
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
import { SendBirdCallsEvents } from 'edoctor-sendbird-calls';
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const ringingListener = SendBirdCallsEvents.listenerRinging((data) => {
|
|
107
|
+
console.log('Incoming call:', data.callId);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const connectedListener = SendBirdCallsEvents.listenerConnected((data) => {
|
|
111
|
+
console.log('Call connected');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const endedListener = SendBirdCallsEvents.listenerEnded((data) => {
|
|
115
|
+
console.log('Call ended');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return () => {
|
|
119
|
+
ringingListener.remove();
|
|
120
|
+
connectedListener.remove();
|
|
121
|
+
endedListener.remove();
|
|
122
|
+
};
|
|
123
|
+
}, []);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 4. Video Component
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
import { SendBirdCallsVideo } from 'edoctor-sendbird-calls';
|
|
130
|
+
|
|
131
|
+
// In your render function
|
|
132
|
+
<SendBirdCallsVideo
|
|
133
|
+
callId={callId}
|
|
134
|
+
local={false} // false for remote view, true for local preview
|
|
135
|
+
style={{ flex: 1 }}
|
|
136
|
+
/>
|
|
137
|
+
```
|
|
22
138
|
|
|
23
139
|
## Contributing
|
|
24
140
|
|
|
@@ -10,12 +10,26 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package["license"]
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
s.
|
|
13
|
+
# SendBirdCalls 1.11.1 requires iOS 14.0+
|
|
14
|
+
s.platforms = { :ios => '14.0' }
|
|
15
|
+
s.source = { :git => "https://git.9vil.com/edoctor/app/mobile-core/sendbird-sdk", :tag => s.version.to_s }
|
|
15
16
|
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
s.source_files = "ios/*.{h,m,mm,swift}", "ios/Extensions/**/*.{h,m,mm,swift}"
|
|
17
18
|
s.resource_bundles = {'edoctor-sendbird-calls_PrivacyInfo' => ['ios/PrivacyInfo.xcprivacy'] }
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
s.static_framework = true
|
|
21
|
+
|
|
22
|
+
s.dependency "React-Core"
|
|
23
|
+
|
|
24
|
+
s.frameworks = "UIKit", "Foundation", "AVFoundation", "AudioToolbox", "CoreMedia", "CoreTelephony", "Network", "SystemConfiguration", "VideoToolbox", "CallKit", "CoreVideo", "CoreGraphics", "GLKit", "Metal", "MetalKit", "QuartzCore", "PushKit", "AVKit", "MediaPlayer"
|
|
25
|
+
s.libraries = "c++", "sqlite3", "z"
|
|
26
|
+
|
|
27
|
+
s.pod_target_xcconfig = {
|
|
28
|
+
'DEFINES_MODULE' => 'YES',
|
|
29
|
+
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
30
|
+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(BUILT_PRODUCTS_DIR)/PackageFrameworks',
|
|
31
|
+
'OTHER_LDFLAGS' => '$(inherited) -framework SendBirdCalls -framework WebRTC'
|
|
32
|
+
}
|
|
19
33
|
|
|
20
34
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
35
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/ios/CXProvider.swift
CHANGED
|
@@ -11,12 +11,8 @@ import UIKit
|
|
|
11
11
|
extension CXProviderConfiguration {
|
|
12
12
|
// The app's provider configuration, representing its CallKit capabilities
|
|
13
13
|
static var `default`: CXProviderConfiguration {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
providerConfiguration = CXProviderConfiguration()
|
|
17
|
-
} else {
|
|
18
|
-
providerConfiguration = CXProviderConfiguration(localizedName: "eDoctor")
|
|
19
|
-
}
|
|
14
|
+
// iOS 14.0+ is now required (SendBirdCalls 1.11.1)
|
|
15
|
+
let providerConfiguration = CXProviderConfiguration()
|
|
20
16
|
if let image = UIImage(named: "icLogoSymbolInverse") {
|
|
21
17
|
providerConfiguration.iconTemplateImageData = image.pngData()
|
|
22
18
|
}
|