@zelloptt/react-native-zello-sdk 2.0.1 → 4.0.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 +100 -15
- package/android/build.gradle +29 -10
- package/android/gradle.properties +4 -4
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +93 -68
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +25 -0
- package/app.plugin.js +97 -0
- package/ios/Extensions/ZelloContact+Extension.swift +26 -3
- package/ios/Extensions/ZelloHistoryVoiceMessage+Extension.swift +3 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +8 -2
- package/ios/Extensions/ZelloIncomingEmergency+Extension.swift +1 -0
- package/ios/Extensions/ZelloTranscription+Extension.swift +18 -0
- package/ios/ZelloIOSSdkModule.swift +24 -7
- package/ios/ZelloIOSSdkModuleBridge.m +1 -0
- package/ios/ZelloSdkModule.h +8 -0
- package/ios/ZelloSdkModule.mm +189 -0
- package/ios/ZelloSdkModuleImpl.swift +280 -0
- package/lib/commonjs/docs/assets/highlight.css +17 -10
- package/lib/commonjs/docs/assets/icons.js +1 -1
- package/lib/commonjs/docs/assets/icons.js.map +1 -1
- package/lib/commonjs/docs/assets/icons.svg +1 -1
- package/lib/commonjs/docs/assets/main.js +220 -288
- package/lib/commonjs/docs/assets/main.js.map +1 -1
- package/lib/commonjs/docs/assets/navigation.js +1 -1
- package/lib/commonjs/docs/assets/navigation.js.map +1 -1
- package/lib/commonjs/docs/assets/search.js +1 -1
- package/lib/commonjs/docs/assets/search.js.map +1 -1
- package/lib/commonjs/docs/assets/style.css +21 -6
- package/lib/commonjs/docs/classes/sdk.Zello.html +793 -97
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +122 -9
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +155 -10
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +86 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +90 -6
- package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +163 -11
- package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +178 -13
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +130 -10
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +114 -9
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +146 -12
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +114 -9
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +122 -9
- package/lib/commonjs/docs/classes/types.ZelloTranscription.html +122 -0
- package/lib/commonjs/docs/classes/types.ZelloTranslation.html +91 -0
- package/lib/commonjs/docs/classes/types.ZelloUser.html +142 -11
- package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +563 -95
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +67 -5
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelType.html +84 -0
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +68 -3
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +78 -3
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +81 -7
- package/lib/commonjs/docs/hierarchy.html +29 -1
- package/lib/commonjs/docs/index.html +155 -26
- package/lib/commonjs/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
- package/lib/commonjs/docs/modules/events.html +37 -1
- package/lib/commonjs/docs/modules/index.html +37 -1
- package/lib/commonjs/docs/modules/sdk.html +37 -1
- package/lib/commonjs/docs/modules/specs_NativeZelloSdk.html +41 -0
- package/lib/commonjs/docs/modules/types.html +45 -1
- package/lib/commonjs/docs/modules.html +36 -1
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +114 -9
- package/lib/commonjs/docs/types/types.ZelloConfig.html +86 -7
- package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +96 -9
- package/lib/commonjs/docs/types/types.ZelloContact.html +80 -6
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +75 -6
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +97 -8
- package/lib/commonjs/docs/types/types.ZelloMessage.html +91 -7
- package/lib/commonjs/docs/variables/specs_NativeZelloSdk.default.html +34 -0
- package/lib/commonjs/events/index.js +217 -0
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/sdk/index.js +731 -911
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/specs/NativeZelloSdk.js +27 -0
- package/lib/commonjs/specs/NativeZelloSdk.js.map +1 -0
- package/lib/commonjs/types/index.js +423 -302
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +27 -4
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/docs/assets/highlight.css +17 -10
- package/lib/module/docs/assets/icons.js +1 -1
- package/lib/module/docs/assets/icons.js.map +1 -1
- package/lib/module/docs/assets/icons.svg +1 -1
- package/lib/module/docs/assets/main.js +220 -288
- package/lib/module/docs/assets/main.js.map +1 -1
- package/lib/module/docs/assets/navigation.js +1 -1
- package/lib/module/docs/assets/navigation.js.map +1 -1
- package/lib/module/docs/assets/search.js +1 -1
- package/lib/module/docs/assets/search.js.map +1 -1
- package/lib/module/docs/assets/style.css +21 -6
- package/lib/module/docs/classes/sdk.Zello.html +793 -97
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +122 -9
- package/lib/module/docs/classes/types.ZelloChannel.html +155 -10
- package/lib/module/docs/classes/types.ZelloChannelUser.html +86 -4
- package/lib/module/docs/classes/types.ZelloDispatchCall.html +90 -6
- package/lib/module/docs/classes/types.ZelloDispatchChannel.html +163 -11
- package/lib/module/docs/classes/types.ZelloGroupConversation.html +178 -13
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
- package/lib/module/docs/classes/types.ZelloImageMessage.html +130 -10
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +114 -9
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +146 -12
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +114 -9
- package/lib/module/docs/classes/types.ZelloTextMessage.html +122 -9
- package/lib/module/docs/classes/types.ZelloTranscription.html +122 -0
- package/lib/module/docs/classes/types.ZelloTranslation.html +91 -0
- package/lib/module/docs/classes/types.ZelloUser.html +142 -11
- package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
- package/lib/module/docs/enums/events.ZelloEvent.html +563 -95
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +67 -5
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
- package/lib/module/docs/enums/types.ZelloChannelType.html +84 -0
- package/lib/module/docs/enums/types.ZelloConnectionError.html +68 -3
- package/lib/module/docs/enums/types.ZelloConnectionState.html +73 -3
- package/lib/module/docs/enums/types.ZelloContactType.html +73 -3
- package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +78 -3
- package/lib/module/docs/enums/types.ZelloUserStatus.html +81 -7
- package/lib/module/docs/hierarchy.html +29 -1
- package/lib/module/docs/index.html +155 -26
- package/lib/module/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
- package/lib/module/docs/modules/events.html +37 -1
- package/lib/module/docs/modules/index.html +37 -1
- package/lib/module/docs/modules/sdk.html +37 -1
- package/lib/module/docs/modules/specs_NativeZelloSdk.html +41 -0
- package/lib/module/docs/modules/types.html +45 -1
- package/lib/module/docs/modules.html +36 -1
- package/lib/module/docs/types/types.ZelloChannelOptions.html +114 -9
- package/lib/module/docs/types/types.ZelloConfig.html +86 -7
- package/lib/module/docs/types/types.ZelloConsoleSettings.html +96 -9
- package/lib/module/docs/types/types.ZelloContact.html +80 -6
- package/lib/module/docs/types/types.ZelloCredentials.html +75 -6
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +97 -8
- package/lib/module/docs/types/types.ZelloMessage.html +91 -7
- package/lib/module/docs/variables/specs_NativeZelloSdk.default.html +34 -0
- package/lib/module/events/index.js +217 -0
- package/lib/module/events/index.js.map +1 -1
- package/lib/module/sdk/index.js +730 -912
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/specs/NativeZelloSdk.js +25 -0
- package/lib/module/specs/NativeZelloSdk.js.map +1 -0
- package/lib/module/types/index.js +378 -301
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/utils/index.js +27 -5
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/events/index.d.ts +9 -0
- package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdk/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts +55 -0
- package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/index.d.ts +106 -4
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/events/index.d.ts +9 -0
- package/lib/typescript/module/src/events/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -4
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/sdk/index.d.ts +11 -1
- package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts +55 -0
- package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/types/index.d.ts +106 -4
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/algorithms/index.d.ts +1 -1
- package/lib/typescript/module/src/utils/algorithms/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +2 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/package.json +53 -16
- package/react-native-zello-sdk.podspec +23 -24
- package/scripts/podfile-transform.js +416 -0
- package/scripts/setup-ios.js +248 -0
- package/scripts/zello_pods.rb +128 -0
- package/scripts/zello_sdk_requirement.rb +12 -0
- package/src/events/index.ts +9 -0
- package/src/sdk/index.ts +105 -225
- package/src/specs/NativeZelloSdk.ts +89 -0
- package/src/types/index.ts +153 -6
- package/src/utils/index.ts +50 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Zello SDK for React Native.
|
|
4
4
|
|
|
5
|
-
Our React Native SDK offers itself as a thin wrapper around our native iOS and Android SDK’s. It is built with TypeScript, and communicates with the native SDK’s via [
|
|
5
|
+
Our React Native SDK offers itself as a thin wrapper around our native iOS and Android SDK’s. It is built with TypeScript, and communicates with the native SDK’s via a [Turbo Native Module](https://reactnative.dev/docs/turbo-native-modules-introduction) on React Native’s New Architecture.
|
|
6
6
|
|
|
7
7
|
This repository contains both the React Native Bridge, as well as an example app to demonstrate usage.
|
|
8
8
|
|
|
@@ -13,6 +13,9 @@ The following instructions are for the installation of the SDK into your applica
|
|
|
13
13
|
## Prerequisites
|
|
14
14
|
A React Native application and environment.
|
|
15
15
|
|
|
16
|
+
- **React Native 0.86+** with the **New Architecture enabled** (the default since 0.76). This SDK is a Turbo Native Module and does not support the legacy architecture.
|
|
17
|
+
- **Node 20+** (Node 22+ recommended, matching the React Native 0.86 toolchain).
|
|
18
|
+
|
|
16
19
|
A thorough understanding of Zello. The best place to get started is our [documentation](https://sdk.zello.com/).
|
|
17
20
|
|
|
18
21
|
|
|
@@ -25,9 +28,82 @@ npm install @zelloptt/react-native-zello-sdk
|
|
|
25
28
|
|
|
26
29
|
### iOS
|
|
27
30
|
|
|
28
|
-
Before getting started, please reference the [iOS Installation Guide](https://
|
|
31
|
+
Before getting started, please reference the [iOS Installation Guide](https://developers.zello.com/sdk/latest/ios/documentation/zellosdk/getting-started). There is no need to add the native `ZelloSDK` to your project directly — this library declares it for you.
|
|
32
|
+
|
|
33
|
+
The native ZelloSDK is consumed through **Swift Package Manager only** (product `ZelloSDKUmbrella` from [`github.com/zelloptt/ios-mobile-sdk`](https://github.com/zelloptt/ios-mobile-sdk)); it is no longer available through CocoaPods. React Native itself still requires CocoaPods, so the React Native layer of this library stays a CocoaPod and a small Podfile helper wires the Swift package into your app.
|
|
34
|
+
|
|
35
|
+
Requirements:
|
|
36
|
+
|
|
37
|
+
- **React Native 0.86 or later**: the podspec uses React Native's `spm_dependency` and raises during `pod install` on older versions.
|
|
38
|
+
- **iOS 17.0 or later**, in **both** places: `platform :ios, '17.0'` in your `Podfile`, and the `IPHONEOS_DEPLOYMENT_TARGET` of your app target and of any app extension (for example the Notification Service Extension).
|
|
39
|
+
- Native ZelloSDK `3.3.2` or later, below `4.0.0`. The requirement is `upToNextMajorVersion` from `3.3.2`; a fresh resolve picks the newest `3.x`, while a committed `Package.resolved` keeps its pin until you use *File > Packages > Update to Latest Package Versions*.
|
|
40
|
+
|
|
41
|
+
#### Setup
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install @zelloptt/react-native-zello-sdk@4
|
|
45
|
+
npx @zelloptt/react-native-zello-sdk setup-ios
|
|
46
|
+
cd ios && bundle exec pod install
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`setup-ios` edits only your `Podfile` (it never touches the `.xcodeproj`): it prints a diff and asks for confirmation. Options: `--dry-run` (print the diff only), `--yes` (non-interactive), `--project-root <dir>` / `--podfile <path>` (monorepos), `--app-target <name>` and `--extension-target <name>` (repeatable) when the targets cannot be detected. Only top-level `Podfile` targets whose name contains `Extension`, `NSE` or `Widget` are detected as extensions; list any other extension with `--extension-target`. It exits with code `2` and changes nothing when it needs a manual step.
|
|
50
|
+
|
|
51
|
+
Or make the changes yourself:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
# Podfile — before `prepare_react_native_project!`
|
|
55
|
+
require Pod::Executable.execute_command('node', ['-p',
|
|
56
|
+
"require.resolve('@zelloptt/react-native-zello-sdk/scripts/zello_pods.rb', {paths: [process.argv[1]]})",
|
|
57
|
+
__dir__]).strip
|
|
58
|
+
|
|
59
|
+
platform :ios, '17.0'
|
|
60
|
+
|
|
61
|
+
target 'MyApp' do
|
|
62
|
+
# ...
|
|
63
|
+
post_install do |installer|
|
|
64
|
+
zello_post_install(installer, app_target: 'MyApp', extension_targets: ['NotificationServiceExtension'])
|
|
65
|
+
react_native_post_install(installer, config[:reactNativePath])
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`zello_post_install` adds the package to your Xcode project, links `ZelloSDKUmbrella` into the app and embeds it, and links it (without embedding) into the listed extension targets. It is idempotent, and raises with an explanation if the deployment target is below 17.0 or a `ZelloSDK` pod is still present. Open the `.xcworkspace` afterwards; Xcode resolves the package on first build.
|
|
29
71
|
|
|
30
|
-
|
|
72
|
+
If your app project already references `github.com/zelloptt/ios-mobile-sdk`, `zello_post_install` keeps your version requirement unless it is an *Up to Next Major Version* rule with a lower minimum than `3.3.2`; then it raises the minimum to `3.3.2`. The bridge pod always requires `3.3.2` up to the next major, and Xcode resolves one version that satisfies both.
|
|
73
|
+
|
|
74
|
+
Static and dynamic `use_frameworks!` as well as no `use_frameworks!` are all supported. With static or no `use_frameworks!`, `pod install` prints `[SPM] WARNING!!! Pod react-native-zello-sdk is using swift package(s) ZelloSDKUmbrella with static linking, this might cause linker errors`; this is expected, because `zello_post_install` links the dynamic `ZelloSDKUmbrella` into the app.
|
|
75
|
+
|
|
76
|
+
#### Upgrading from 3.x
|
|
77
|
+
|
|
78
|
+
1. Run the three commands above. `setup-ios` removes `pod 'ZelloSDK'`, the CocoaPods resilient-pods `post_install` workaround (`BUILD_LIBRARY_FOR_DISTRIBUTION` for `PhoneNumberKit`, `SnowplowTracker`, `CocoaLumberjack`, `PromisesSwift`) and raises `platform :ios` to `17.0`. If you did it by hand, remove those as well as any `ZELLO_USE_SPM` setting and any manually added `ZelloSDKUmbrella` package reference in your extension targets.
|
|
79
|
+
2. Raise the app and extension deployment targets to 17.0 if they are lower.
|
|
80
|
+
3. Do a **Clean Build Folder** in Xcode (or `rm -rf ios/build`) once: frameworks previously embedded by CocoaPods can linger in an incremental build and clash with the new ones.
|
|
81
|
+
|
|
82
|
+
#### Troubleshooting (Swift Package Manager)
|
|
83
|
+
|
|
84
|
+
- `[CP] Copy Pods Resources ... Operation not permitted` with static or no `use_frameworks!`: set `ENABLE_USER_SCRIPT_SANDBOXING = NO` on the app and extension targets.
|
|
85
|
+
- `Multiple commands produce '*.ttf'` with static or no `use_frameworks!`: remove the duplicated font files from the app target's *Copy Bundle Resources* phase (keep them in `UIAppFonts`); CocoaPods already copies them.
|
|
86
|
+
- **PhoneNumberKit:** ZelloSDK pulls PhoneNumberKit via Swift Package Manager — the `marmelroy/PhoneNumberKit` 3.x on native `3.3.2`, the 5.x from the PhoneNumberKit organization's repository on `3.3.3` and later. These are two different repositories sharing one package identity, so:
|
|
87
|
+
- an app that depends on `marmelroy/PhoneNumberKit` itself gets *package 'phonenumberkit' is required using two different URLs* once `3.3.3` resolves — switch your dependency to the PhoneNumberKit organization repository, or drop it;
|
|
88
|
+
- builds that disable automatic resolution (`-onlyUsePackageVersionsFromResolvedFile`) fail until their `Package.resolved` is updated;
|
|
89
|
+
- a PhoneNumberKit **pod** next to the Swift package duplicates classes — remove the pod.
|
|
90
|
+
|
|
91
|
+
#### Expo
|
|
92
|
+
|
|
93
|
+
Add the config plugin, plus `expo-build-properties` to raise the app's deployment target, to `app.json`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"expo": {
|
|
98
|
+
"plugins": [
|
|
99
|
+
["expo-build-properties", { "ios": { "deploymentTarget": "17.0" } }],
|
|
100
|
+
["@zelloptt/react-native-zello-sdk", { "extensionTargets": ["NotificationServiceExtension"] }]
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The plugin applies the same Podfile changes as `setup-ios` on `expo prebuild`, and sets the deployment target of the listed `extensionTargets` to 17.0. Expo applies plugin mods in reverse order, so list it **before** any plugin that creates the extension target; prebuild fails if a listed extension target is not in the Xcode project. Expo apps use no `use_frameworks!` unless `ios.useFrameworks` is set.
|
|
31
107
|
|
|
32
108
|
#### Troubleshooting
|
|
33
109
|
|
|
@@ -62,29 +138,38 @@ repositories {
|
|
|
62
138
|
|
|
63
139
|
#### Linking
|
|
64
140
|
|
|
65
|
-
Since the Zello Android SDK requires Hilt, and we must inject the `Zello` instance into the
|
|
141
|
+
Since the Zello Android SDK requires Hilt, and we must inject the `Zello` instance into the package, the project does not work with autolinking.
|
|
66
142
|
|
|
67
|
-
|
|
143
|
+
Because the module is now a Turbo Native Module (New Architecture), the package must be a `BaseReactPackage` that exposes the module through a `ReactModuleInfoProvider` with `isTurboModule = true`:
|
|
68
144
|
|
|
69
145
|
```kotlin
|
|
70
146
|
/// ZelloAndroidSdkPackage.kt
|
|
71
147
|
|
|
72
|
-
import com.facebook.react.
|
|
148
|
+
import com.facebook.react.BaseReactPackage
|
|
73
149
|
import com.facebook.react.bridge.NativeModule
|
|
74
150
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
75
|
-
import com.facebook.react.
|
|
151
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
152
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
76
153
|
import com.zello.sdk.Zello
|
|
77
154
|
import com.zellosdk.ZelloAndroidSdkModule
|
|
78
155
|
import javax.inject.Inject
|
|
79
156
|
|
|
80
|
-
class ZelloAndroidSdkPackage @Inject constructor(private val zello: Zello) :
|
|
81
|
-
|
|
82
|
-
override fun
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
157
|
+
class ZelloAndroidSdkPackage @Inject constructor(private val zello: Zello) : BaseReactPackage() {
|
|
158
|
+
|
|
159
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
|
|
160
|
+
if (name == "NativeZelloSdk") ZelloAndroidSdkModule(reactContext, zello) else null
|
|
161
|
+
|
|
162
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
163
|
+
mapOf(
|
|
164
|
+
"NativeZelloSdk" to ReactModuleInfo(
|
|
165
|
+
"NativeZelloSdk", // name
|
|
166
|
+
"NativeZelloSdk", // className
|
|
167
|
+
false, // canOverrideExistingModule
|
|
168
|
+
false, // needsEagerInit
|
|
169
|
+
false, // isCxxModule
|
|
170
|
+
true // isTurboModule
|
|
171
|
+
)
|
|
172
|
+
)
|
|
88
173
|
}
|
|
89
174
|
}
|
|
90
175
|
```
|
package/android/build.gradle
CHANGED
|
@@ -11,10 +11,9 @@ buildscript {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath "com.android.tools.build:gradle:8.
|
|
14
|
+
classpath "com.android.tools.build:gradle:8.13.0"
|
|
15
15
|
// noinspection DifferentKotlinGradleVersion
|
|
16
16
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
17
|
-
classpath("com.google.dagger:hilt-android-gradle-plugin:2.51")
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -29,12 +28,11 @@ def isNewArchitectureEnabled() {
|
|
|
29
28
|
|
|
30
29
|
apply plugin: "com.android.library"
|
|
31
30
|
apply plugin: "kotlin-android"
|
|
32
|
-
apply plugin: 'com.google.dagger.hilt.android'
|
|
33
|
-
apply plugin: 'kotlin-kapt'
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
// Note: this library does NOT apply Hilt/kapt. Its only @Inject was on a class
|
|
33
|
+
// that the host app constructs manually (see ZelloAndroidSdkPackage), so Hilt
|
|
34
|
+
// never processed it. Avoiding kapt also lets the generated TurboModule codegen
|
|
35
|
+
// spec compile cleanly (kapt doesn't reliably see generated sources).
|
|
38
36
|
|
|
39
37
|
if (isNewArchitectureEnabled()) {
|
|
40
38
|
apply plugin: "com.facebook.react"
|
|
@@ -68,6 +66,21 @@ android {
|
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
|
|
69
|
+
if (isNewArchitectureEnabled()) {
|
|
70
|
+
// Make the generated TurboModule spec (NativeZelloSdkSpec) visible to the
|
|
71
|
+
// Kotlin/kapt compile. The RN Gradle plugin generates it under
|
|
72
|
+
// build/generated/source/codegen and adds it via finalizeDsl, but because
|
|
73
|
+
// this library uses kapt (Hilt) that late addition isn't reliably picked up,
|
|
74
|
+
// so register the dir explicitly here.
|
|
75
|
+
sourceSets {
|
|
76
|
+
main {
|
|
77
|
+
java.srcDirs += [
|
|
78
|
+
layout.buildDirectory.dir("generated/source/codegen/java").get().asFile
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
71
84
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
72
85
|
|
|
73
86
|
defaultConfig {
|
|
@@ -102,7 +115,7 @@ repositories {
|
|
|
102
115
|
|
|
103
116
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
104
117
|
|
|
105
|
-
def zelloSdkVersion = "
|
|
118
|
+
def zelloSdkVersion = "3.+"
|
|
106
119
|
|
|
107
120
|
dependencies {
|
|
108
121
|
// For < 0.71, this will be from the local maven repo
|
|
@@ -119,6 +132,12 @@ dependencies {
|
|
|
119
132
|
}
|
|
120
133
|
implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
|
|
121
134
|
implementation("com.google.firebase:firebase-messaging")
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (isNewArchitectureEnabled()) {
|
|
138
|
+
react {
|
|
139
|
+
jsRootDir = file("../src/")
|
|
140
|
+
libraryName = "NativeZelloSdk"
|
|
141
|
+
codegenJavaPackageName = "com.zellosdk"
|
|
142
|
+
}
|
|
124
143
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
ZelloSdk_kotlinVersion=
|
|
1
|
+
ZelloSdk_kotlinVersion=2.3.21
|
|
2
2
|
ZelloSdk_minSdkVersion=24
|
|
3
|
-
ZelloSdk_targetSdkVersion=
|
|
4
|
-
ZelloSdk_compileSdkVersion=
|
|
5
|
-
ZelloSdk_ndkversion=
|
|
3
|
+
ZelloSdk_targetSdkVersion=36
|
|
4
|
+
ZelloSdk_compileSdkVersion=36
|
|
5
|
+
ZelloSdk_ndkversion=27.1.12297006
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
package com.zellosdk
|
|
4
4
|
|
|
5
|
+
// NativeZelloSdkSpec is generated by RN codegen into this same package
|
|
6
|
+
// (com.zellosdk), driven by codegenConfig.android.javaPackageName in
|
|
7
|
+
// package.json — so it needs no import.
|
|
5
8
|
import com.facebook.react.bridge.Arguments
|
|
6
|
-
import com.facebook.react.bridge.
|
|
9
|
+
import com.facebook.react.bridge.Promise
|
|
7
10
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
11
|
import com.facebook.react.bridge.ReactContext
|
|
9
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
10
|
-
import com.facebook.react.bridge.ReactMethod
|
|
11
12
|
import com.facebook.react.bridge.ReadableArray
|
|
13
|
+
import com.facebook.react.bridge.ReadableMap
|
|
12
14
|
import com.facebook.react.bridge.WritableMap
|
|
13
15
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
14
16
|
import com.zello.sdk.Zello
|
|
@@ -32,12 +34,11 @@ import com.zello.sdk.ZelloConsoleSettings
|
|
|
32
34
|
import com.zello.sdk.ZelloGroupConversation
|
|
33
35
|
import com.zello.sdk.ZelloState
|
|
34
36
|
import com.zello.sdk.ZelloTextMessage
|
|
35
|
-
import javax.inject.Inject
|
|
36
37
|
|
|
37
|
-
class ZelloAndroidSdkModule
|
|
38
|
+
class ZelloAndroidSdkModule(
|
|
38
39
|
reactContext: ReactApplicationContext,
|
|
39
40
|
private val zello: Zello
|
|
40
|
-
) :
|
|
41
|
+
) : NativeZelloSdkSpec(reactContext), Zello.Listener {
|
|
41
42
|
companion object {
|
|
42
43
|
private const val BRIDGE_EVENT_NAME = "zellosdk"
|
|
43
44
|
private const val EVENT_NAME = "eventName"
|
|
@@ -48,26 +49,33 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
48
49
|
zello.framework = Zello.Framework.REACT_NATIVE
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
// getName() is provided by NativeZelloSdkSpec (returns "NativeZelloSdk").
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
override fun configure(config: ReadableMap) {
|
|
55
|
+
val android = config.getMap("android")
|
|
56
|
+
val enableOfflineMessagePushNotifications =
|
|
57
|
+
android?.takeIf { it.hasKey("enableOfflineMessagePushNotifications") }
|
|
58
|
+
?.getBoolean("enableOfflineMessagePushNotifications") ?: false
|
|
59
|
+
val enableForegroundService =
|
|
60
|
+
android?.takeIf { it.hasKey("enableForegroundService") }
|
|
61
|
+
?.getBoolean("enableForegroundService") ?: false
|
|
54
62
|
zello.configure(enableOfflineMessagePushNotifications, enableForegroundService)
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
override fun connect(network: String, username: String, password: String) {
|
|
58
66
|
zello.connect(ZelloCredentials(network, username, password))
|
|
59
67
|
}
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
override fun disconnect() {
|
|
62
70
|
zello.disconnect()
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
val contact = contactFrom(name,
|
|
73
|
+
override fun selectContact(name: String, contactType: String) {
|
|
74
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
67
75
|
zello.setSelectedContact(contact)
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
override fun setAccountStatus(status: String) {
|
|
71
79
|
val accountStatus = when (status) {
|
|
72
80
|
"available" -> ZelloAccountStatus.AVAILABLE
|
|
73
81
|
"busy" -> ZelloAccountStatus.BUSY
|
|
@@ -76,28 +84,39 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
76
84
|
zello.setAccountStatus(accountStatus)
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
override fun connectChannel(name: String) {
|
|
80
88
|
val channel = zello.getChannel(name) ?: return
|
|
81
89
|
zello.connectChannel(channel)
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
override fun disconnectChannel(name: String) {
|
|
85
93
|
val channel = zello.getChannel(name) ?: return
|
|
86
94
|
zello.disconnectChannel(channel)
|
|
87
95
|
}
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
override fun connectGroupConversation(name: String) {
|
|
98
|
+
// ZelloGroupConversation extends ZelloChannel, so connectChannel(ZelloChannel)
|
|
99
|
+
// accepts a group conversation directly.
|
|
100
|
+
val conversation = zello.getGroupConversation(name) ?: return
|
|
101
|
+
zello.connectChannel(conversation)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
override fun disconnectGroupConversation(name: String) {
|
|
105
|
+
val conversation = zello.getGroupConversation(name) ?: return
|
|
106
|
+
zello.disconnectChannel(conversation)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
override fun startVoiceMessage(name: String, contactType: String) {
|
|
110
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
91
111
|
zello.startVoiceMessage(contact)
|
|
92
112
|
}
|
|
93
113
|
|
|
94
|
-
|
|
114
|
+
override fun stopVoiceMessage() {
|
|
95
115
|
zello.stopVoiceMessage()
|
|
96
116
|
}
|
|
97
117
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
val contact = contactFrom(name, type) ?: return
|
|
118
|
+
override fun sendImage(name: String, contactType: String, data: ReadableArray) {
|
|
119
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
101
120
|
val byteArray = ByteArray(data.size())
|
|
102
121
|
for (i in 0 until data.size()) {
|
|
103
122
|
byteArray[i] = data.getInt(i).toByte()
|
|
@@ -105,21 +124,18 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
105
124
|
zello.sendImage(byteArray, contact)
|
|
106
125
|
}
|
|
107
126
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
val contact = contactFrom(name, type) ?: return
|
|
127
|
+
override fun sendLocation(name: String, contactType: String) {
|
|
128
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
111
129
|
zello.sendLocation(contact)
|
|
112
130
|
}
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
val contact = contactFrom(name, type) ?: return
|
|
132
|
+
override fun sendText(name: String, contactType: String, text: String) {
|
|
133
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
117
134
|
zello.sendText(text, contact)
|
|
118
135
|
}
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
val contact = contactFrom(name, type) ?: return
|
|
137
|
+
override fun sendAlert(name: String, contactType: String, text: String, level: String) {
|
|
138
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
123
139
|
val channelAlertLevel = when (level) {
|
|
124
140
|
"all" -> ZelloAlertMessage.ChannelLevel.ALL
|
|
125
141
|
"connected" -> ZelloAlertMessage.ChannelLevel.CONNECTED
|
|
@@ -128,89 +144,92 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
128
144
|
zello.sendAlert(contact, text, channelAlertLevel)
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
|
|
132
|
-
fun submitProblemReport() {
|
|
147
|
+
override fun submitProblemReport() {
|
|
133
148
|
zello.submitProblemReport()
|
|
134
149
|
}
|
|
135
150
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
val contact = contactFrom(name, type) ?: return
|
|
151
|
+
override fun muteContact(name: String, contactType: String) {
|
|
152
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
139
153
|
zello.muteContact(contact)
|
|
140
154
|
}
|
|
141
155
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
val contact = contactFrom(name, type) ?: return
|
|
156
|
+
override fun unmuteContact(name: String, contactType: String) {
|
|
157
|
+
val contact = contactFrom(name, contactType) ?: return
|
|
145
158
|
zello.unmuteContact(contact)
|
|
146
159
|
}
|
|
147
160
|
|
|
148
|
-
|
|
149
|
-
fun startEmergency() {
|
|
161
|
+
override fun startEmergency() {
|
|
150
162
|
zello.startEmergency()
|
|
151
163
|
}
|
|
152
164
|
|
|
153
|
-
|
|
154
|
-
fun stopEmergency() {
|
|
165
|
+
override fun stopEmergency() {
|
|
155
166
|
zello.stopEmergency()
|
|
156
167
|
}
|
|
157
168
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
val messages = if (size != null) zello.getHistory(contact, size) else zello.getHistory(contact)
|
|
162
|
-
callback.invoke(ZelloAndroidSdkModuleHelper.historyMessagesToWritableArray(messages))
|
|
169
|
+
override fun stopIncomingEmergency(emergencyId: String) {
|
|
170
|
+
val incomingEmergency = zello.incomingEmergencies.firstOrNull { it.emergencyId == emergencyId } ?: return
|
|
171
|
+
zello.stopIncomingEmergency(incomingEmergency)
|
|
163
172
|
}
|
|
164
173
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
override fun getHistory(name: String, contactType: String, maxMessages: Double, promise: Promise) {
|
|
175
|
+
val contact = contactFrom(name, contactType)
|
|
176
|
+
if (contact == null) {
|
|
177
|
+
promise.resolve(Arguments.createArray())
|
|
178
|
+
return
|
|
179
|
+
}
|
|
180
|
+
val messages = zello.getHistory(contact, maxMessages.toInt())
|
|
181
|
+
promise.resolve(ZelloAndroidSdkModuleHelper.historyMessagesToWritableArray(messages))
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
override fun playHistoryMessage(historyId: String, contactName: String, contactType: String) {
|
|
185
|
+
val contact = contactFrom(contactName, contactType) ?: return
|
|
168
186
|
val message = zello.getHistoryMessage(historyId, contact) as? ZelloHistoryVoiceMessage ?: return
|
|
169
187
|
zello.playHistoryMessage(message)
|
|
170
188
|
}
|
|
171
189
|
|
|
172
|
-
|
|
173
|
-
fun stopHistoryMessagePlayback() {
|
|
190
|
+
override fun stopHistoryMessagePlayback() {
|
|
174
191
|
zello.stopHistoryMessagePlayback()
|
|
175
192
|
}
|
|
176
193
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
194
|
+
override fun getHistoryImageData(historyId: String, contactName: String, contactType: String, promise: Promise) {
|
|
195
|
+
val contact = contactFrom(contactName, contactType)
|
|
196
|
+
if (contact == null) {
|
|
197
|
+
promise.resolve(null)
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
val message = zello.getHistoryMessage(historyId, contact) as? ZelloHistoryImageMessage
|
|
201
|
+
if (message == null) {
|
|
202
|
+
promise.resolve(null)
|
|
203
|
+
return
|
|
204
|
+
}
|
|
181
205
|
zello.loadBitmapForHistoryImageMessage(message) {
|
|
182
|
-
|
|
206
|
+
promise.resolve(ZelloAndroidSdkModuleHelper.bitmapToBase64String(it))
|
|
183
207
|
}
|
|
184
208
|
}
|
|
185
209
|
|
|
186
|
-
|
|
187
|
-
fun endDispatchCall(channelName: String) {
|
|
210
|
+
override fun endDispatchCall(channelName: String) {
|
|
188
211
|
val dispatchChannel = zello.getChannel(channelName) as? ZelloDispatchChannel ?: return
|
|
189
212
|
val call = dispatchChannel.currentCall ?: return
|
|
190
213
|
zello.endDispatchCall(call, dispatchChannel)
|
|
191
214
|
}
|
|
192
215
|
|
|
193
|
-
|
|
194
|
-
fun createGroupConversation(usernames: ReadableArray, displayName: String?) {
|
|
216
|
+
override fun createGroupConversation(usernames: ReadableArray, displayName: String) {
|
|
195
217
|
val users = usernames.toArrayList().mapNotNull { zello.getUser(it as String) }
|
|
196
|
-
zello.createGroupConversation(users, displayName)
|
|
218
|
+
zello.createGroupConversation(users, displayName.ifEmpty { null })
|
|
197
219
|
}
|
|
198
220
|
|
|
199
|
-
|
|
200
|
-
fun addUsersToGroupConversation(conversationName: String, usernames: ReadableArray) {
|
|
221
|
+
override fun addUsersToGroupConversation(conversationName: String, usernames: ReadableArray) {
|
|
201
222
|
val conversation = zello.getGroupConversation(conversationName) ?: return
|
|
202
223
|
val users = usernames.toArrayList().mapNotNull { zello.getUser(it as String) }
|
|
203
224
|
zello.addUsersToGroupConversation(conversation, users)
|
|
204
225
|
}
|
|
205
226
|
|
|
206
|
-
|
|
207
|
-
fun leaveGroupConversation(conversationName: String) {
|
|
227
|
+
override fun leaveGroupConversation(conversationName: String) {
|
|
208
228
|
val conversation = zello.getGroupConversation(conversationName) ?: return
|
|
209
229
|
zello.leaveGroupConversation(conversation)
|
|
210
230
|
}
|
|
211
231
|
|
|
212
|
-
|
|
213
|
-
fun renameGroupConversation(conversationName: String, newName: String) {
|
|
232
|
+
override fun renameGroupConversation(conversationName: String, newName: String) {
|
|
214
233
|
val conversation = zello.getGroupConversation(conversationName) ?: return
|
|
215
234
|
zello.renameGroupConversation(conversation, newName)
|
|
216
235
|
}
|
|
@@ -363,6 +382,7 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
363
382
|
putMap("contact", ZelloAndroidSdkModuleHelper.sdkContactToWritableMap(contact = message.contact))
|
|
364
383
|
putMap("channelUser", ZelloAndroidSdkModuleHelper.channelUserToWritableMap(message.channelUser))
|
|
365
384
|
putString("timestamp", message.timestamp.toString())
|
|
385
|
+
putBoolean("isTranslation", message.isTranslation)
|
|
366
386
|
})
|
|
367
387
|
}
|
|
368
388
|
|
|
@@ -371,6 +391,7 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
371
391
|
putMap("contact", ZelloAndroidSdkModuleHelper.sdkContactToWritableMap(contact = message.contact))
|
|
372
392
|
putMap("channelUser", ZelloAndroidSdkModuleHelper.channelUserToWritableMap(message.channelUser))
|
|
373
393
|
putString("timestamp", message.timestamp.toString())
|
|
394
|
+
putBoolean("isTranslation", message.isTranslation)
|
|
374
395
|
})
|
|
375
396
|
}
|
|
376
397
|
|
|
@@ -470,6 +491,10 @@ class ZelloAndroidSdkModule @Inject constructor(
|
|
|
470
491
|
sendEvent(reactApplicationContext, "onHistoryUpdated", null)
|
|
471
492
|
}
|
|
472
493
|
|
|
494
|
+
override fun onHistoryVoiceMessageTranscriptionAvailable(zello: Zello, message: ZelloHistoryVoiceMessage) {
|
|
495
|
+
sendEvent(reactApplicationContext, "onHistoryVoiceMessageTranscriptionAvailable", ZelloAndroidSdkModuleHelper.historyVoiceMessageToWritableMap(message))
|
|
496
|
+
}
|
|
497
|
+
|
|
473
498
|
override fun onConsoleSettingsChanged(zello: Zello, settings: ZelloConsoleSettings) {
|
|
474
499
|
sendEvent(reactApplicationContext, "onConsoleSettingsChanged", ZelloAndroidSdkModuleHelper.consoleSettingsToWritableMap(settings))
|
|
475
500
|
}
|
|
@@ -19,6 +19,7 @@ import com.zello.sdk.ZelloHistoryTextMessage
|
|
|
19
19
|
import com.zello.sdk.ZelloHistoryVoiceMessage
|
|
20
20
|
import com.zello.sdk.ZelloIncomingEmergency
|
|
21
21
|
import com.zello.sdk.ZelloRecentEntry
|
|
22
|
+
import com.zello.sdk.ZelloTranscription
|
|
22
23
|
import com.zello.sdk.ZelloUser
|
|
23
24
|
import java.io.ByteArrayOutputStream
|
|
24
25
|
|
|
@@ -66,6 +67,8 @@ object ZelloAndroidSdkModuleHelper {
|
|
|
66
67
|
putBoolean("isConnected", contact.status == ZelloChannel.ConnectionStatus.CONNECTED)
|
|
67
68
|
putBoolean("isConnecting", contact.status == ZelloChannel.ConnectionStatus.CONNECTING)
|
|
68
69
|
putInt("usersOnline", contact.usersOnline)
|
|
70
|
+
putString("channelType", contact.type.toString())
|
|
71
|
+
putBoolean("translationsEnabled", contact.translationsEnabled)
|
|
69
72
|
putMap("options", WritableNativeMap().apply {
|
|
70
73
|
val options = contact.options
|
|
71
74
|
putBoolean("noDisconnect", options.noDisconnect)
|
|
@@ -74,6 +77,8 @@ object ZelloAndroidSdkModuleHelper {
|
|
|
74
77
|
putBoolean("allowAlerts", options.allowAlerts)
|
|
75
78
|
putBoolean("allowTextMessages", options.allowTextMessages)
|
|
76
79
|
putBoolean("allowLocations", options.allowLocations)
|
|
80
|
+
putBoolean("allowEmergencyEndOwn", options.allowEmergencyEndOwn)
|
|
81
|
+
putBoolean("allowEmergencyEndOthers", options.allowEmergencyEndOthers)
|
|
77
82
|
})
|
|
78
83
|
if (contact is ZelloDispatchChannel) {
|
|
79
84
|
putBoolean("isDispatchChannel", true)
|
|
@@ -173,6 +178,26 @@ object ZelloAndroidSdkModuleHelper {
|
|
|
173
178
|
putString("historyId", message.historyId)
|
|
174
179
|
putBoolean("incoming", message.incoming)
|
|
175
180
|
putInt("durationMs", message.durationMs.toInt())
|
|
181
|
+
message.transcription?.let {
|
|
182
|
+
putMap("transcription", transcriptionToWritableMap(it))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
fun transcriptionToWritableMap(transcription: ZelloTranscription): WritableMap {
|
|
188
|
+
return Arguments.createMap().apply {
|
|
189
|
+
putString("text", transcription.text)
|
|
190
|
+
putString("language", transcription.language)
|
|
191
|
+
putBoolean("isTruncated", transcription.isTruncated)
|
|
192
|
+
putDouble("confidence", transcription.confidence)
|
|
193
|
+
putArray("translations", WritableNativeArray().apply {
|
|
194
|
+
transcription.translations.forEach { translation ->
|
|
195
|
+
pushMap(Arguments.createMap().apply {
|
|
196
|
+
putString("text", translation.text)
|
|
197
|
+
putString("language", translation.language)
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
})
|
|
176
201
|
}
|
|
177
202
|
}
|
|
178
203
|
|