livevoice-sdk-react-native 2.0.0 → 3.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 +158 -7
- package/android/build.gradle +18 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
- package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
- package/ios/LiveVoiceRNBridge.swift +362 -0
- package/ios/LiveVoiceSdkReactNative.mm +247 -145
- package/ios/__SDK.h +16 -2
- package/ios/livevoice_spm_backport.rb +202 -0
- package/lib/module/components/BrandingView.js +71 -50
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +368 -54
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +17 -16
- package/lib/module/components/ErrorView.js.map +1 -1
- package/lib/module/components/LiveVoiceSpinner.js +81 -0
- package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
- package/lib/module/components/LiveVoiceView.js +351 -104
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PasswordPrompt.js +165 -0
- package/lib/module/components/PasswordPrompt.js.map +1 -0
- package/lib/module/components/PlayButtonView.js +192 -254
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +43 -62
- package/lib/module/components/ReconnectingView.js.map +1 -1
- package/lib/module/components/WarningView.js +12 -10
- package/lib/module/components/WarningView.js.map +1 -1
- package/lib/module/icons/branding-ios.png +0 -0
- package/lib/module/icons/camera-off-android.png +0 -0
- package/lib/module/icons/camera-off-android@2x.png +0 -0
- package/lib/module/icons/camera-off-android@3x.png +0 -0
- package/lib/module/icons/cpu-android.png +0 -0
- package/lib/module/icons/cpu-android@2x.png +0 -0
- package/lib/module/icons/cpu-android@3x.png +0 -0
- package/lib/module/icons/cpu-ios.png +0 -0
- package/lib/module/icons/cpu-ios@2x.png +0 -0
- package/lib/module/icons/cpu-ios@3x.png +0 -0
- package/lib/module/icons/lock-android.png +0 -0
- package/lib/module/icons/lock-android@2x.png +0 -0
- package/lib/module/icons/lock-android@3x.png +0 -0
- package/lib/module/icons/lock-ios.png +0 -0
- package/lib/module/icons/lock-ios@2x.png +0 -0
- package/lib/module/icons/lock-ios@3x.png +0 -0
- package/lib/module/icons/mic-off-android.png +0 -0
- package/lib/module/icons/mic-off-android@2x.png +0 -0
- package/lib/module/icons/mic-off-android@3x.png +0 -0
- package/lib/module/icons/mic-slash-ios.png +0 -0
- package/lib/module/icons/mic-slash-ios@2x.png +0 -0
- package/lib/module/icons/mic-slash-ios@3x.png +0 -0
- package/lib/module/icons/video-slash-ios.png +0 -0
- package/lib/module/icons/video-slash-ios@2x.png +0 -0
- package/lib/module/icons/video-slash-ios@3x.png +0 -0
- package/lib/module/index.js +24 -225
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/Bridge.js +236 -0
- package/lib/module/sdk/Bridge.js.map +1 -0
- package/lib/module/sdk/Event.js +160 -0
- package/lib/module/sdk/Event.js.map +1 -0
- package/lib/module/sdk/Lifecycle.js +331 -0
- package/lib/module/sdk/Lifecycle.js.map +1 -0
- package/lib/module/sdk/LiveVoiceSdk.js +365 -0
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
- package/lib/module/sdk/LiveVoiceState.js +234 -0
- package/lib/module/sdk/LiveVoiceState.js.map +1 -0
- package/lib/module/sdk/LogEntries.js +99 -0
- package/lib/module/sdk/LogEntries.js.map +1 -0
- package/lib/module/sdk/Models.js +2 -0
- package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
- package/lib/module/sdk/NativeSdkVersions.js +24 -0
- package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
- package/lib/module/sdk/Observables.js +391 -0
- package/lib/module/sdk/Observables.js.map +1 -0
- package/lib/module/sdk/Passwords.js +298 -0
- package/lib/module/sdk/Passwords.js.map +1 -0
- package/lib/module/sdk/Playback.js +35 -0
- package/lib/module/sdk/Playback.js.map +1 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +14 -11
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/module/util/Translations.js +46 -21
- package/lib/module/util/Translations.js.map +1 -1
- package/lib/module/util/freeze.js +26 -0
- package/lib/module/util/freeze.js.map +1 -0
- package/lib/module/util/logger.js +114 -0
- package/lib/module/util/logger.js.map +1 -0
- package/lib/typescript/src/components/BrandingView.d.ts +4 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
- package/lib/typescript/src/components/ChannelView.d.ts +29 -3
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
- package/lib/typescript/src/components/ErrorView.d.ts +5 -3
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
- package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
- package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
- package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
- package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +15 -144
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
- package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Event.d.ts +97 -0
- package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
- package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Models.d.ts +114 -0
- package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Observables.d.ts +123 -0
- package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
- package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Playback.d.ts +9 -0
- package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -1
- package/lib/typescript/src/util/Translations.d.ts +30 -8
- package/lib/typescript/src/util/Translations.d.ts.map +1 -1
- package/lib/typescript/src/util/freeze.d.ts +6 -0
- package/lib/typescript/src/util/freeze.d.ts.map +1 -0
- package/lib/typescript/src/util/logger.d.ts +33 -0
- package/lib/typescript/src/util/logger.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +41 -16
- package/package.json +26 -14
- package/src/components/BrandingView.tsx +55 -66
- package/src/components/ChannelView.tsx +342 -48
- package/src/components/ErrorView.tsx +21 -22
- package/src/components/LiveVoiceSpinner.tsx +87 -0
- package/src/components/LiveVoiceView.tsx +360 -151
- package/src/components/PasswordPrompt.tsx +144 -0
- package/src/components/PlayButtonView.tsx +177 -279
- package/src/components/ReconnectingView.tsx +40 -86
- package/src/components/WarningView.tsx +12 -10
- package/src/icons/branding-ios.png +0 -0
- package/src/icons/camera-off-android.png +0 -0
- package/src/icons/camera-off-android@2x.png +0 -0
- package/src/icons/camera-off-android@3x.png +0 -0
- package/src/icons/cpu-android.png +0 -0
- package/src/icons/cpu-android@2x.png +0 -0
- package/src/icons/cpu-android@3x.png +0 -0
- package/src/icons/cpu-ios.png +0 -0
- package/src/icons/cpu-ios@2x.png +0 -0
- package/src/icons/cpu-ios@3x.png +0 -0
- package/src/icons/lock-android.png +0 -0
- package/src/icons/lock-android@2x.png +0 -0
- package/src/icons/lock-android@3x.png +0 -0
- package/src/icons/lock-ios.png +0 -0
- package/src/icons/lock-ios@2x.png +0 -0
- package/src/icons/lock-ios@3x.png +0 -0
- package/src/icons/mic-off-android.png +0 -0
- package/src/icons/mic-off-android@2x.png +0 -0
- package/src/icons/mic-off-android@3x.png +0 -0
- package/src/icons/mic-slash-ios.png +0 -0
- package/src/icons/mic-slash-ios@2x.png +0 -0
- package/src/icons/mic-slash-ios@3x.png +0 -0
- package/src/icons/video-slash-ios.png +0 -0
- package/src/icons/video-slash-ios@2x.png +0 -0
- package/src/icons/video-slash-ios@3x.png +0 -0
- package/src/index.tsx +105 -252
- package/src/sdk/Bridge.ts +259 -0
- package/src/sdk/Event.ts +187 -0
- package/src/sdk/Lifecycle.ts +366 -0
- package/src/sdk/LiveVoiceSdk.ts +384 -0
- package/src/sdk/LiveVoiceState.ts +259 -0
- package/src/sdk/LogEntries.ts +88 -0
- package/src/sdk/Models.ts +129 -0
- package/src/sdk/NativeSdkVersions.ts +21 -0
- package/src/sdk/Observables.ts +414 -0
- package/src/sdk/Passwords.ts +286 -0
- package/src/sdk/Playback.ts +30 -0
- package/src/specs/NativeLiveVoiceSdk.ts +56 -46
- package/src/util/Colors.ts +14 -11
- package/src/util/Translations.ts +46 -22
- package/src/util/freeze.ts +23 -0
- package/src/util/logger.ts +119 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
- package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
- package/lib/module/components/AudioOutputSwitchView.js +0 -138
- package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/module/components/index.js +0 -22
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/icons/mic.png +0 -0
- package/lib/module/util/ForegroundServiceConfig.js +0 -28
- package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/module/util/PlayingState.js +0 -21
- package/lib/module/util/PlayingState.js.map +0 -1
- package/lib/module/util/UIState.js +0 -4
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/src/components/index.d.ts +0 -9
- package/lib/typescript/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/src/util/UIState.d.ts +0 -66
- package/lib/typescript/src/util/UIState.d.ts.map +0 -1
- package/src/components/AudioOutputSwitchView.tsx +0 -146
- package/src/components/index.tsx +0 -19
- package/src/icons/mic.png +0 -0
- package/src/util/ForegroundServiceConfig.tsx +0 -32
- package/src/util/PlayingState.ts +0 -18
- package/src/util/UIState.ts +0 -89
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
|
|
1
|
+
#===----------------------------------------------------------------------===#
|
|
2
|
+
#
|
|
3
|
+
# This source file is part of the LiveVoice SDK project
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) LiveVoice GmbH
|
|
6
|
+
# Licensed under the MIT license
|
|
7
|
+
#
|
|
8
|
+
# See LICENSE for license information
|
|
9
|
+
#
|
|
10
|
+
# SPDX-License-Identifier: MIT
|
|
11
|
+
#
|
|
12
|
+
#===----------------------------------------------------------------------===#
|
|
13
13
|
|
|
14
14
|
require "json"
|
|
15
|
+
require_relative "ios/livevoice_spm_backport"
|
|
15
16
|
|
|
16
17
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
17
18
|
|
|
@@ -24,13 +25,37 @@ Pod::Spec.new do |s|
|
|
|
24
25
|
s.authors = package["author"]
|
|
25
26
|
|
|
26
27
|
s.platforms = { :ios => min_ios_version_supported }
|
|
27
|
-
|
|
28
|
+
# Autolinking reads this podspec from node_modules, so the source is never
|
|
29
|
+
# fetched; CocoaPods still needs one. It names the published npm package.
|
|
30
|
+
s.source = { :http => "https://registry.npmjs.org/livevoice-sdk-react-native/-/livevoice-sdk-react-native-#{s.version}.tgz" }
|
|
28
31
|
|
|
29
32
|
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
30
33
|
s.exclude_files = "ios/generated/**/*"
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
s.
|
|
34
|
+
# The TurboModule's headers are internal to the pod; apps import nothing
|
|
35
|
+
# from it.
|
|
36
|
+
s.private_header_files = "ios/**/*.h"
|
|
37
|
+
|
|
38
|
+
# The native LiveVoice SDK, from its Swift package. The version is exact:
|
|
39
|
+
# each wrapper release pins the native SDK it was tested with.
|
|
40
|
+
# LIVEVOICE_SDK_SWIFT_URL replaces the package's URL, to test a build of
|
|
41
|
+
# the native SDK that is not published yet.
|
|
42
|
+
native_url = ENV.fetch("LIVEVOICE_SDK_SWIFT_URL", "https://github.com/LiveVoiceOfficial/livevoice-sdk-swift.git")
|
|
43
|
+
native_requirement = { kind: "exactVersion", version: "3.0.0" }
|
|
44
|
+
# The LiveVoiceSDK product brings both dynamic frameworks.
|
|
45
|
+
native_frameworks = ["LiveVoiceSDK", "WebRTC"]
|
|
46
|
+
if LiveVoiceSPMBackport.native_support?
|
|
47
|
+
spm_dependency(s, url: native_url, requirement: native_requirement,
|
|
48
|
+
products: ["LiveVoiceSDK"], embed_frameworks: native_frameworks)
|
|
49
|
+
else
|
|
50
|
+
spm_dependency(s, url: native_url, requirement: native_requirement,
|
|
51
|
+
products: ["LiveVoiceSDK"])
|
|
52
|
+
LiveVoiceSPMBackport.install(
|
|
53
|
+
pod_name: s.name,
|
|
54
|
+
frameworks: native_frameworks,
|
|
55
|
+
requirement_comment: "#{native_url} #{native_requirement}"
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
s.swift_version = "5.9"
|
|
34
59
|
|
|
35
60
|
|
|
36
61
|
install_modules_dependencies(s)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "livevoice-sdk-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "The LiveVoice SDK for integrating simultaneous interpretation, AI voice translation, guided tours, silent events, and more into your app.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"./package.json": "./package.json"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"src",
|
|
17
|
-
"lib",
|
|
18
|
-
"android",
|
|
19
|
-
"ios",
|
|
20
|
-
"cpp",
|
|
21
|
-
"
|
|
22
|
-
"react-native.config.js",
|
|
16
|
+
"./src",
|
|
17
|
+
"./lib",
|
|
18
|
+
"./android",
|
|
19
|
+
"./ios",
|
|
20
|
+
"./cpp",
|
|
21
|
+
"./livevoice-sdk-react-native.podspec",
|
|
22
|
+
"./react-native.config.js",
|
|
23
23
|
"!ios/build",
|
|
24
24
|
"!ios/generated",
|
|
25
25
|
"!android/generated",
|
|
@@ -37,9 +37,22 @@
|
|
|
37
37
|
"example": "yarn workspace livevoice-sdk-react-native-example",
|
|
38
38
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
39
39
|
"prepare": "bob build",
|
|
40
|
+
"prepublishOnly": "node tool/check-publish.mjs",
|
|
41
|
+
"test": "jest --runInBand",
|
|
40
42
|
"typecheck": "tsc",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
+
"check:headers": "node tool/license-headers.mjs --check",
|
|
44
|
+
"fix:headers": "node tool/license-headers.mjs --fix",
|
|
45
|
+
"check:pins": "node tool/check-native-pins.mjs",
|
|
46
|
+
"headers:check": "node tool/license-headers.mjs --check",
|
|
47
|
+
"headers:fix": "node tool/license-headers.mjs --fix",
|
|
48
|
+
"native-version-generate": "node tool/generate-native-versions.mjs",
|
|
49
|
+
"versions:sync": "node tool/generate-native-versions.mjs",
|
|
50
|
+
"test:matrix-tool": "node --test tool/tests/*.test.mjs",
|
|
51
|
+
"matrix:list": "node tool/test-rn-version.mjs --list-versions-json",
|
|
52
|
+
"matrix:test": "node tool/test-rn-version.mjs",
|
|
53
|
+
"clear-all": "node tool/clean-all.mjs",
|
|
54
|
+
"clean:all": "node tool/clean-all.mjs",
|
|
55
|
+
"typecheck:example": "tsc -p example/tsconfig.json"
|
|
43
56
|
},
|
|
44
57
|
"keywords": [
|
|
45
58
|
"react-native",
|
|
@@ -51,10 +64,6 @@
|
|
|
51
64
|
"silent events",
|
|
52
65
|
"realtime audio"
|
|
53
66
|
],
|
|
54
|
-
"repository": {
|
|
55
|
-
"type": "git",
|
|
56
|
-
"url": "git+https://livevoice.iolivevoice.io.git"
|
|
57
|
-
},
|
|
58
67
|
"author": "LiveVoice GmbH <sdk-support@livevoice.io> (https://livevoice.io)",
|
|
59
68
|
"license": "MIT",
|
|
60
69
|
"bugs": {
|
|
@@ -67,11 +76,14 @@
|
|
|
67
76
|
"devDependencies": {
|
|
68
77
|
"@react-native-community/cli": "latest",
|
|
69
78
|
"@react-native/babel-preset": "0.85.0",
|
|
79
|
+
"@react-native/jest-preset": "0.85.0",
|
|
70
80
|
"@types/react": "^19.2.0",
|
|
71
81
|
"del-cli": "^7.0.0",
|
|
82
|
+
"jest": "^29.7.0",
|
|
72
83
|
"react": "19.2.3",
|
|
73
84
|
"react-native": "0.85.0",
|
|
74
85
|
"react-native-builder-bob": "^0.41.0",
|
|
86
|
+
"react-test-renderer": "19.2.3",
|
|
75
87
|
"turbo": "^2.8.21",
|
|
76
88
|
"typescript": "^6.0.2"
|
|
77
89
|
},
|
|
@@ -1,81 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
View,
|
|
15
|
-
Text,
|
|
16
|
-
useColorScheme,
|
|
17
|
-
StyleSheet,
|
|
18
|
-
Image,
|
|
19
|
-
Pressable
|
|
20
|
-
} from 'react-native';
|
|
15
|
+
import { Image, Platform, Pressable, StyleSheet, Text, useColorScheme } from 'react-native';
|
|
21
16
|
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
17
|
+
import { openLiveVoiceWebsite } from '../sdk/LiveVoiceSdk';
|
|
18
|
+
import { Translations } from '../util/Translations';
|
|
24
19
|
|
|
25
20
|
export interface BrandingProps {
|
|
26
21
|
isDarkMode?: boolean;
|
|
27
22
|
}
|
|
28
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The "Live Audio Streaming by LiveVoice" footer, drawn exactly as the native SDK of the platform
|
|
26
|
+
* draws it: iOS `LogoView`, Android `LiveVoiceSdkBranding`. Change them together.
|
|
27
|
+
*/
|
|
29
28
|
export const BrandingView: React.FC<BrandingProps> = (props) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const scheme = useColorScheme();
|
|
30
|
+
const isDarkMode = props.isDarkMode ?? scheme === 'dark';
|
|
31
|
+
// Both native footers draw the text and the logo in plain black or white.
|
|
32
|
+
const color = isDarkMode ? '#FFFFFF' : '#000000';
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<Pressable onPress={
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
height: 30,
|
|
46
|
-
tintColor: isDarkMode ? COLORS.white : COLORS.black,
|
|
47
|
-
},
|
|
48
|
-
]}
|
|
49
|
-
resizeMode="contain"
|
|
50
|
-
/>
|
|
51
|
-
</View>
|
|
35
|
+
<Pressable onPress={() => { openLiveVoiceWebsite(); }} style={styles.container}>
|
|
36
|
+
<Text style={[styles.text, { color }]} allowFontScaling={Platform.OS !== 'ios'}>
|
|
37
|
+
{Translations.streamingByTitle()}
|
|
38
|
+
</Text>
|
|
39
|
+
<Image
|
|
40
|
+
source={Platform.OS === 'ios' ? require('../icons/branding-ios.png') : require('../icons/branding.png')}
|
|
41
|
+
style={[styles.logo, { tintColor: color }]}
|
|
42
|
+
resizeMode="contain"
|
|
43
|
+
/>
|
|
52
44
|
</Pressable>
|
|
53
45
|
);
|
|
54
46
|
};
|
|
55
47
|
|
|
56
|
-
const styles = StyleSheet.create(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
aspectRatio: 4,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
48
|
+
const styles = StyleSheet.create(Platform.OS === 'ios'
|
|
49
|
+
? {
|
|
50
|
+
// iOS: `.padding()` (16 pt) around a 4 pt stack of a fixed 12 pt medium text and the logo
|
|
51
|
+
// set 100 pt wide. The logo artwork keeps the margins of the SDK's SVG (196 × 48).
|
|
52
|
+
container: { alignSelf: 'center', alignItems: 'center', padding: 16 },
|
|
53
|
+
text: { textAlign: 'center', fontSize: 12, fontWeight: '500', marginBottom: 4 },
|
|
54
|
+
logo: { width: 100, height: (100 * 48) / 196 },
|
|
55
|
+
}
|
|
56
|
+
: {
|
|
57
|
+
// Android: 8 dp above (from the view), below and at the sides; bodyMedium text and a
|
|
58
|
+
// 92 × 28 dp logo, each inset 8 dp more at the sides.
|
|
59
|
+
container: { alignSelf: 'center', alignItems: 'center', paddingTop: 8, paddingBottom: 8, paddingHorizontal: 8 },
|
|
60
|
+
text: {
|
|
61
|
+
textAlign: 'center',
|
|
62
|
+
fontSize: 14,
|
|
63
|
+
lineHeight: 20,
|
|
64
|
+
letterSpacing: 0.25,
|
|
65
|
+
fontWeight: '400',
|
|
66
|
+
includeFontPadding: false,
|
|
67
|
+
marginHorizontal: 8,
|
|
68
|
+
},
|
|
69
|
+
logo: { width: 92, height: 28, marginHorizontal: 8 },
|
|
70
|
+
});
|