livevoice-sdk-react-native 1.0.2 → 2.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/LICENSE +1 -1
- package/README.md +5 -5
- package/android/{generated/java/io/livevoice/react → app/build/generated/source/codegen/java/com/facebook/fbreact/specs}/NativeLiveVoiceSdkSpec.java +2 -2
- package/android/{generated → app/build/generated/source/codegen}/jni/CMakeLists.txt +1 -9
- package/android/{generated → app/build/generated/source/codegen}/jni/RNLiveVoiceSpec-generated.cpp +3 -3
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +341 -0
- package/android/build.gradle +41 -84
- package/android/gradle.properties +10 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +17 -16
- package/android/src/main/java/io/livevoice/react/LiveVoiceSdkReactNativePackage.kt +12 -13
- package/android/src/main/java/io/livevoice/react/Mappings.kt +36 -5
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +2 -0
- package/android/src/main/java/io/livevoice/react/__SDK.kt +1 -1
- package/ios/LiveVoiceSdkReactNative.h +5 -5
- package/ios/{LivevoiceSdkReactNative.mm → LiveVoiceSdkReactNative.mm} +59 -74
- package/ios/__SDK.h +1 -1
- package/lib/module/components/AudioOutputSwitchView.js +5 -1
- package/lib/module/components/AudioOutputSwitchView.js.map +1 -1
- package/lib/module/components/ChannelView.js +14 -38
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/LiveVoiceView.js +61 -26
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PlayButtonView.js +243 -84
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/icons/captions@1x.png +0 -0
- package/lib/module/icons/captions@2x.png +0 -0
- package/lib/module/icons/pause@1x.png +0 -0
- package/lib/module/icons/pause@2x.png +0 -0
- package/lib/module/icons/play@1x.png +0 -0
- package/lib/module/icons/play@2x.png +0 -0
- package/lib/module/index.js +27 -21
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeLiveVoiceSdk.js +4 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +2 -1
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/components/ChannelView.d.ts +4 -2
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -0
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +341 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -0
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -0
- package/lib/typescript/src/components/WarningView.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/index.d.ts +30 -18
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/specs/NativeLiveVoiceSdk.d.ts +3 -3
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/util/Colors.d.ts +2 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -0
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -0
- package/lib/typescript/src/util/PlayingState.d.ts.map +1 -0
- package/lib/typescript/src/util/Translations.d.ts.map +1 -0
- package/lib/typescript/{module/src → src}/util/UIState.d.ts +22 -1
- package/lib/typescript/src/util/UIState.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +6 -27
- package/package.json +33 -123
- package/src/components/AudioOutputSwitchView.tsx +10 -9
- package/src/components/ChannelView.tsx +18 -25
- package/src/components/LiveVoiceView.tsx +143 -83
- package/src/components/PlayButtonView.tsx +280 -87
- package/src/icons/captions@1x.png +0 -0
- package/src/icons/captions@2x.png +0 -0
- package/src/icons/pause@1x.png +0 -0
- package/src/icons/pause@2x.png +0 -0
- package/src/icons/play@1x.png +0 -0
- package/src/icons/play@2x.png +0 -0
- package/src/index.tsx +99 -75
- package/src/specs/NativeLiveVoiceSdk.ts +7 -5
- package/src/util/Colors.ts +3 -1
- package/src/util/UIState.ts +25 -1
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -398
- package/android/src/main/AndroidManifest.xml +0 -3
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec-generated.mm +0 -292
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec.h +0 -101
- package/ios/generated/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/ios/generated/RNLiveVoiceSpecJSI.h +0 -398
- package/lib/commonjs/components/AudioOutputSwitchView.js +0 -140
- package/lib/commonjs/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/commonjs/components/BrandingView.js +0 -78
- package/lib/commonjs/components/BrandingView.js.map +0 -1
- package/lib/commonjs/components/ChannelView.js +0 -117
- package/lib/commonjs/components/ChannelView.js.map +0 -1
- package/lib/commonjs/components/ErrorView.js +0 -88
- package/lib/commonjs/components/ErrorView.js.map +0 -1
- package/lib/commonjs/components/LiveVoiceView.js +0 -95
- package/lib/commonjs/components/LiveVoiceView.js.map +0 -1
- package/lib/commonjs/components/PlayButtonView.js +0 -161
- package/lib/commonjs/components/PlayButtonView.js.map +0 -1
- package/lib/commonjs/components/ReconnectingView.js +0 -109
- package/lib/commonjs/components/ReconnectingView.js.map +0 -1
- package/lib/commonjs/components/WarningView.js +0 -58
- package/lib/commonjs/components/WarningView.js.map +0 -1
- package/lib/commonjs/components/index.js +0 -94
- package/lib/commonjs/components/index.js.map +0 -1
- package/lib/commonjs/icons/branding.png +0 -0
- package/lib/commonjs/icons/cpu.png +0 -0
- package/lib/commonjs/icons/headphones.png +0 -0
- package/lib/commonjs/icons/mic.png +0 -0
- package/lib/commonjs/icons/pause.png +0 -0
- package/lib/commonjs/icons/play.png +0 -0
- package/lib/commonjs/icons/speaker.png +0 -0
- package/lib/commonjs/index.js +0 -319
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js +0 -19
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js.map +0 -1
- package/lib/commonjs/util/Colors.js +0 -30
- package/lib/commonjs/util/Colors.js.map +0 -1
- package/lib/commonjs/util/ForegroundServiceConfig.js +0 -33
- package/lib/commonjs/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/commonjs/util/PlayingState.js +0 -24
- package/lib/commonjs/util/PlayingState.js.map +0 -1
- package/lib/commonjs/util/Translations.js +0 -47
- package/lib/commonjs/util/Translations.js.map +0 -1
- package/lib/commonjs/util/UIState.js +0 -6
- package/lib/commonjs/util/UIState.js.map +0 -1
- package/lib/module/icons/pause.png +0 -0
- package/lib/module/icons/play.png +0 -0
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/UIState.d.ts +0 -45
- package/lib/typescript/commonjs/src/util/UIState.d.ts.map +0 -1
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/BrandingView.d.ts +0 -6
- package/lib/typescript/module/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ChannelView.d.ts +0 -13
- package/lib/typescript/module/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ErrorView.d.ts +0 -9
- package/lib/typescript/module/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts +0 -6
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/module/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReconnectingView.d.ts +0 -9
- package/lib/typescript/module/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/WarningView.d.ts +0 -8
- package/lib/typescript/module/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/index.d.ts +0 -9
- package/lib/typescript/module/src/components/index.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -133
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts +0 -48
- package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Colors.d.ts +0 -13
- package/lib/typescript/module/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/module/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/module/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Translations.d.ts +0 -22
- package/lib/typescript/module/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/module/src/util/UIState.d.ts.map +0 -1
- package/react-native.config.js +0 -12
- package/src/icons/pause.png +0 -0
- package/src/icons/play.png +0 -0
- /package/android/{generated → app/build/generated/source/codegen}/jni/RNLiveVoiceSpec.h +0 -0
- /package/lib/{typescript/module → module}/package.json +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/AudioOutputSwitchView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/BrandingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ErrorView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/LiveVoiceView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReconnectingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/WarningView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/index.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/ForegroundServiceConfig.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/PlayingState.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/Translations.d.ts +0 -0
|
@@ -23,15 +23,16 @@ import com.facebook.react.modules.systeminfo.ReactNativeVersion
|
|
|
23
23
|
import io.livevoice.sdk.android.publicApi.core.LiveVoice
|
|
24
24
|
import io.livevoice.sdk.android.publicApi.core.model.ForegroundServiceConfig
|
|
25
25
|
import io.livevoice.sdk.android.publicApi.core.model.LiveVoiceOutput
|
|
26
|
-
import io.livevoice.sdk.android.publicApi.core.model.LiveVoicePlayingState.
|
|
27
|
-
import io.livevoice.sdk.android.publicApi.core.model.LiveVoicePlayingState.
|
|
26
|
+
import io.livevoice.sdk.android.publicApi.core.model.channel.LiveVoicePlayingState.Connecting
|
|
27
|
+
import io.livevoice.sdk.android.publicApi.core.model.channel.LiveVoicePlayingState.Playing
|
|
28
28
|
import io.livevoice.sdk.android.publicApi.core.model.NotificationText
|
|
29
29
|
import io.livevoice.sdk.android.publicApi.core.model.SdkPlatform
|
|
30
|
-
import io.livevoice.sdk.android.publicApi.core.model.SdkSubtitleLanguage
|
|
31
|
-
import io.livevoice.sdk.android.publicApi.core.model.SdkSubtitleState
|
|
30
|
+
import io.livevoice.sdk.android.publicApi.core.model.subtitle.SdkSubtitleLanguage
|
|
31
|
+
import io.livevoice.sdk.android.publicApi.core.model.subtitle.SdkSubtitleState
|
|
32
32
|
import io.livevoice.sdk.android.publicApi.core.model.SdkUiState
|
|
33
33
|
import io.livevoice.sdk.android.publicApi.core.model.SdkUiState.Ready
|
|
34
34
|
import io.livevoice.sdk.android.publicApi.core.model.exceptions.SdkUninitializedException
|
|
35
|
+
import kotlinx.serialization.encodeToString
|
|
35
36
|
import kotlinx.coroutines.flow.collectLatest
|
|
36
37
|
import kotlinx.coroutines.launch
|
|
37
38
|
import kotlinx.serialization.ExperimentalSerializationApi
|
|
@@ -116,13 +117,16 @@ class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
private fun launchAvailableSubtitleObservation(activity: AppCompatActivity) {
|
|
120
|
+
activity.lifecycleScope.launch {
|
|
121
|
+
LiveVoice.availableSubtitles.collectLatest { subtitles ->
|
|
122
|
+
val encodedSubtitles = json.encodeToString(subtitles.map { it.mapToNative() })
|
|
123
|
+
emitOnAvailableSubtitleConfigsChanged(encodedSubtitles)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
119
126
|
activity.lifecycleScope.launch {
|
|
120
127
|
emitOnSubtitlesChanged("[]")
|
|
121
128
|
//collectLatest will cancel previous lambda when new subtitleState arrives
|
|
122
129
|
LiveVoice.subtitleState.collectLatest { state: SdkSubtitleState ->
|
|
123
|
-
val encodedSubtitles = json.encodeToString(state.availableSubtitles)
|
|
124
|
-
emitOnAvailableSubtitleConfigsChanged(encodedSubtitles)
|
|
125
|
-
|
|
126
130
|
if (state is SdkSubtitleState.Enabled) {
|
|
127
131
|
//forward/emit all subtitle fragments that arrive!
|
|
128
132
|
state.fragments.collect { fragments: List<String> ->
|
|
@@ -143,7 +147,7 @@ class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
|
143
147
|
|
|
144
148
|
override fun stopChannel() {
|
|
145
149
|
val state = getStateOrNull<Ready>("stopChannel") ?: return
|
|
146
|
-
val channel = state.channels.firstOrNull { it.playingState in listOf(
|
|
150
|
+
val channel = state.channels.firstOrNull { it.playingState in listOf(Connecting, Playing) }
|
|
147
151
|
?: run {
|
|
148
152
|
timber.w("No channel in connecting or playing state to stop!")
|
|
149
153
|
return
|
|
@@ -181,8 +185,8 @@ class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
override fun getCurrentAvailableSubtitleConfigs(): String {
|
|
184
|
-
val value
|
|
185
|
-
return json.encodeToString(value.
|
|
188
|
+
val value = LiveVoice.availableSubtitles.value
|
|
189
|
+
return json.encodeToString(value.map { it.mapToNative() })
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
override fun getCurrentClaims(): String? {
|
|
@@ -194,15 +198,12 @@ class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
|
194
198
|
LiveVoice.changeOutput(value)
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
override fun startSubtitles(channelId: Double
|
|
201
|
+
override fun startSubtitles(channelId: Double) {
|
|
198
202
|
val state = getStateOrNull<Ready>("startSubtitles") ?: return
|
|
199
|
-
val sdkSubtitleLanguage =
|
|
200
|
-
null -> SdkSubtitleLanguage.Transcript
|
|
201
|
-
else -> SdkSubtitleLanguage.Translated(languageCode)
|
|
202
|
-
}
|
|
203
|
+
val sdkSubtitleLanguage = SdkSubtitleLanguage.Transcript
|
|
203
204
|
|
|
204
205
|
val nullableChannelId = if (channelId.toLong() == -1L) null else channelId.toLong()
|
|
205
|
-
state.onStartSubtitles(nullableChannelId
|
|
206
|
+
state.onStartSubtitles(nullableChannelId)
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
override fun stopSubtitles() {
|
|
@@ -18,28 +18,27 @@ import com.facebook.react.bridge.NativeModule
|
|
|
18
18
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
19
19
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
20
20
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
21
|
+
import java.util.HashMap
|
|
21
22
|
|
|
22
23
|
class LiveVoiceSdkReactNativePackage : BaseReactPackage() {
|
|
23
24
|
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
24
25
|
return if (name == LiveVoiceModule.NAME) {
|
|
25
|
-
|
|
26
|
+
LiveVoiceModule(reactContext)
|
|
26
27
|
} else {
|
|
27
28
|
null
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
override fun getReactModuleInfoProvider()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
LiveVoiceModule.NAME,
|
|
36
|
-
|
|
37
|
-
false,
|
|
38
|
-
false,
|
|
39
|
-
|
|
40
|
-
true // isTurboModule
|
|
32
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
33
|
+
mapOf(
|
|
34
|
+
LiveVoiceModule.NAME to ReactModuleInfo(
|
|
35
|
+
name = LiveVoiceModule.NAME,
|
|
36
|
+
className = LiveVoiceModule.NAME,
|
|
37
|
+
canOverrideExistingModule = false,
|
|
38
|
+
needsEagerInit = false,
|
|
39
|
+
isCxxModule = false,
|
|
40
|
+
isTurboModule = true
|
|
41
41
|
)
|
|
42
|
-
|
|
43
|
-
}
|
|
42
|
+
)
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -13,9 +13,38 @@
|
|
|
13
13
|
|
|
14
14
|
package io.livevoice.react
|
|
15
15
|
|
|
16
|
-
import io.livevoice.sdk.android.publicApi.core.model.LiveVoicePlayingState
|
|
16
|
+
import io.livevoice.sdk.android.publicApi.core.model.channel.LiveVoicePlayingState
|
|
17
17
|
import io.livevoice.sdk.android.publicApi.core.model.SdkRetryState
|
|
18
18
|
import io.livevoice.sdk.android.publicApi.core.model.SdkUiState
|
|
19
|
+
import io.livevoice.sdk.android.publicApi.core.model.subtitle.AvailableSubtitle
|
|
20
|
+
import kotlinx.serialization.Serializable
|
|
21
|
+
import kotlinx.serialization.SerialName
|
|
22
|
+
|
|
23
|
+
@Serializable
|
|
24
|
+
sealed interface NativeAvailableSubtitle {
|
|
25
|
+
@Serializable
|
|
26
|
+
@SerialName("Transcript")
|
|
27
|
+
data class Transcript(
|
|
28
|
+
val channelId: Long,
|
|
29
|
+
val name: String,
|
|
30
|
+
val language: String? = null,
|
|
31
|
+
val parentChannelId: Long? = null
|
|
32
|
+
) : NativeAvailableSubtitle
|
|
33
|
+
|
|
34
|
+
@Serializable
|
|
35
|
+
@SerialName("Translated")
|
|
36
|
+
data class Translated(
|
|
37
|
+
val channelId: Long,
|
|
38
|
+
val name: String,
|
|
39
|
+
val language: String,
|
|
40
|
+
val parentChannelId: Long
|
|
41
|
+
) : NativeAvailableSubtitle
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fun AvailableSubtitle.mapToNative(): NativeAvailableSubtitle = when (this) {
|
|
45
|
+
is AvailableSubtitle.Transcript -> NativeAvailableSubtitle.Transcript(channelId, name)
|
|
46
|
+
is AvailableSubtitle.Translated -> NativeAvailableSubtitle.Translated(channelId, name, language, parentChannelId)
|
|
47
|
+
}
|
|
19
48
|
|
|
20
49
|
fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
|
|
21
50
|
SdkUiState.Loading -> NativeLoading
|
|
@@ -27,7 +56,9 @@ fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
|
|
|
27
56
|
isOnline = it.isOnline,
|
|
28
57
|
isAudioMuted = it.isAudioMuted,
|
|
29
58
|
isAiSpeaker = it.isAiSpeaker,
|
|
30
|
-
playingState = it.playingState.mapToNative()
|
|
59
|
+
playingState = it.playingState.mapToNative(),
|
|
60
|
+
hasSubtitles = it.hasSubtitles,
|
|
61
|
+
hasAudio = it.hasAudio,
|
|
31
62
|
)
|
|
32
63
|
},
|
|
33
64
|
)
|
|
@@ -48,7 +79,7 @@ fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
|
|
|
48
79
|
}
|
|
49
80
|
|
|
50
81
|
private fun LiveVoicePlayingState.mapToNative() = when (this) {
|
|
51
|
-
LiveVoicePlayingState.
|
|
52
|
-
LiveVoicePlayingState.
|
|
53
|
-
LiveVoicePlayingState.
|
|
82
|
+
LiveVoicePlayingState.Stopped -> NativePlayingState.STOPPED
|
|
83
|
+
LiveVoicePlayingState.Playing -> NativePlayingState.PLAYING
|
|
84
|
+
LiveVoicePlayingState.Connecting, LiveVoicePlayingState.Stopping -> NativePlayingState.TRANSITIONING
|
|
54
85
|
}
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
//
|
|
12
12
|
//===----------------------------------------------------------------------===//
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
//// See https://reactnative.dev/docs/next/legacy/native-modules-ios
|
|
17
|
-
//#import <React/RCTEventEmitter.h>
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
#import "RNLiveVoiceSpec.h"
|
|
18
16
|
|
|
19
|
-
@interface LiveVoiceSdkReactNative
|
|
17
|
+
@interface LiveVoiceSdkReactNative
|
|
18
|
+
: NativeLiveVoiceSdkSpecBase <NativeLiveVoiceSdkSpec>
|
|
20
19
|
|
|
21
20
|
@end
|
|
21
|
+
#endif
|
|
@@ -13,32 +13,34 @@
|
|
|
13
13
|
|
|
14
14
|
#import "LiveVoiceSdkReactNative.h"
|
|
15
15
|
#import "LiveVoiceSDK/LiveVoiceSDK.h"
|
|
16
|
-
#import "__SDK.h"
|
|
17
16
|
#import "React/RCTVersion.h"
|
|
17
|
+
#import "__SDK.h"
|
|
18
18
|
|
|
19
19
|
// Declare conformance privately
|
|
20
20
|
@interface LiveVoiceSdkReactNative () <LiveVoiceDelegate>
|
|
21
21
|
@end
|
|
22
22
|
|
|
23
23
|
@implementation LiveVoiceSdkReactNative
|
|
24
|
+
|
|
24
25
|
RCT_EXPORT_MODULE(LiveVoiceModule)
|
|
25
26
|
|
|
26
27
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
27
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
28
|
-
{
|
|
28
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
29
29
|
return std::make_shared<facebook::react::NativeLiveVoiceSdkSpecJSI>(params);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- (void)initialize:(NSString *_Nullable)androidServiceConfig {
|
|
34
35
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
35
|
-
|
|
36
|
-
NSDictionary*
|
|
37
|
-
NSString*
|
|
38
|
-
NSString*
|
|
39
|
-
NSString*
|
|
40
|
-
NSString*
|
|
41
|
-
|
|
36
|
+
|
|
37
|
+
NSDictionary *versionInfo = RCTGetReactNativeVersion();
|
|
38
|
+
NSString *major = versionInfo[RCTVersionMajor];
|
|
39
|
+
NSString *minor = versionInfo[RCTVersionMinor];
|
|
40
|
+
NSString *patch = versionInfo[RCTVersionPatch];
|
|
41
|
+
NSString *const PLATFORM_VERSION =
|
|
42
|
+
[NSString stringWithFormat:@"%@.%@.%@", major, minor, patch];
|
|
43
|
+
|
|
42
44
|
[LiveVoice initializeWithDelegate:self
|
|
43
45
|
platform:SDKPlatformReactNative
|
|
44
46
|
platformVersion:PLATFORM_VERSION
|
|
@@ -47,54 +49,46 @@ RCT_EXPORT_MODULE(LiveVoiceModule)
|
|
|
47
49
|
|
|
48
50
|
- (void)joinEvent:(nonnull NSString *)joinCode
|
|
49
51
|
password:(nullable NSString *)password
|
|
50
|
-
apiKey:(nonnull NSString *)apiKey
|
|
51
|
-
{
|
|
52
|
+
apiKey:(nonnull NSString *)apiKey {
|
|
52
53
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
53
54
|
[LiveVoice joinEventWithCode:joinCode password:password apiKey:apiKey];
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
- (void)leaveEvent
|
|
57
|
-
{
|
|
57
|
+
- (void)leaveEvent {
|
|
58
58
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
59
59
|
[LiveVoice leaveEvent];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
- (void)reconnect
|
|
63
|
-
{
|
|
62
|
+
- (void)reconnect {
|
|
64
63
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
65
64
|
[LiveVoice reconnect];
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
#pragma mark - Initial values
|
|
69
68
|
|
|
70
|
-
- (nullable NSString *)getCurrentClaims
|
|
71
|
-
{
|
|
69
|
+
- (nullable NSString *)getCurrentClaims {
|
|
72
70
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
73
71
|
return [LiveVoice currentClaims];
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
- (nonnull NSString *)getCurrentUiState
|
|
77
|
-
{
|
|
74
|
+
- (nonnull NSString *)getCurrentUiState {
|
|
78
75
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
79
76
|
return [LiveVoice currentViewState];
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
//true=speaker, false=headphones
|
|
83
|
-
- (nonnull NSNumber *)getCurrentAudioState
|
|
84
|
-
{
|
|
79
|
+
// true=speaker, false=headphones
|
|
80
|
+
- (nonnull NSNumber *)getCurrentAudioState {
|
|
85
81
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
86
82
|
return [NSNumber numberWithBool:[LiveVoice currentAudioOutputIsSpeaker]];
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
- (nonnull NSString *)getCurrentAvailableSubtitleConfigs
|
|
90
|
-
{
|
|
85
|
+
- (nonnull NSString *)getCurrentAvailableSubtitleConfigs {
|
|
91
86
|
NSString *current = [LiveVoice currentAvailableSubtitles];
|
|
92
87
|
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__, current);
|
|
93
88
|
return current;
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
- (nonnull NSString *)getCurrentSubtitles
|
|
97
|
-
{
|
|
91
|
+
- (nonnull NSString *)getCurrentSubtitles {
|
|
98
92
|
NSString *current = [LiveVoice currentSubtitles];
|
|
99
93
|
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__, current);
|
|
100
94
|
return current;
|
|
@@ -102,35 +96,32 @@ RCT_EXPORT_MODULE(LiveVoiceModule)
|
|
|
102
96
|
|
|
103
97
|
#pragma mark - Actions
|
|
104
98
|
|
|
105
|
-
- (void)setLiveVoiceUseSpeaker:(BOOL)useSpeaker
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
- (void)setLiveVoiceUseSpeaker:(BOOL)useSpeaker {
|
|
100
|
+
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__,
|
|
101
|
+
useSpeaker ? @"speaker" : @"receiver");
|
|
108
102
|
[LiveVoice setAudioOutputToSpeaker:useSpeaker];
|
|
109
103
|
}
|
|
110
104
|
|
|
111
|
-
- (void)startChannel:(double)channelID
|
|
112
|
-
{
|
|
105
|
+
- (void)startChannel:(double)channelID {
|
|
113
106
|
NSLog(@"[SDK] %s %d", __PRETTY_FUNCTION__, (int)channelID);
|
|
114
107
|
[LiveVoice startWithChannelID:channelID];
|
|
115
108
|
}
|
|
116
109
|
|
|
117
|
-
- (void)stopChannel
|
|
118
|
-
{
|
|
110
|
+
- (void)stopChannel {
|
|
119
111
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
120
112
|
[LiveVoice stop];
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
#pragma mark - Subtitles
|
|
124
116
|
|
|
125
|
-
- (void)startSubtitles:(double)channelId
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
[LiveVoice startSubtitlesWithChannelID:optionalChannelID
|
|
117
|
+
- (void)startSubtitles:(double)channelId {
|
|
118
|
+
NSLog(@"[SDK] %s channel: %f", __PRETTY_FUNCTION__, channelId);
|
|
119
|
+
NSNumber *_Nullable optionalChannelID =
|
|
120
|
+
(channelId == -1) ? nil : [NSNumber numberWithLongLong:channelId];
|
|
121
|
+
[LiveVoice startSubtitlesWithChannelID:optionalChannelID];
|
|
130
122
|
}
|
|
131
123
|
|
|
132
|
-
- (void)stopSubtitles
|
|
133
|
-
{
|
|
124
|
+
- (void)stopSubtitles {
|
|
134
125
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
135
126
|
[LiveVoice stopSubtitles];
|
|
136
127
|
}
|
|
@@ -141,11 +132,11 @@ RCT_EXPORT_MODULE(LiveVoiceModule)
|
|
|
141
132
|
|
|
142
133
|
#pragma mark - Translations
|
|
143
134
|
|
|
144
|
-
- (nonnull NSString *)channelStatusOffline {
|
|
135
|
+
- (nonnull NSString *)channelStatusOffline {
|
|
145
136
|
return [Translations channel_status_offline];
|
|
146
137
|
}
|
|
147
138
|
|
|
148
|
-
- (nonnull NSString *)errorScreenRetrying {
|
|
139
|
+
- (nonnull NSString *)errorScreenRetrying {
|
|
149
140
|
return [Translations error_screen_retrying];
|
|
150
141
|
}
|
|
151
142
|
|
|
@@ -153,96 +144,90 @@ RCT_EXPORT_MODULE(LiveVoiceModule)
|
|
|
153
144
|
return [Translations error_screen_retrying_in:(int)seconds];
|
|
154
145
|
}
|
|
155
146
|
|
|
156
|
-
- (nonnull NSString *)sdkErrorGeneric {
|
|
147
|
+
- (nonnull NSString *)sdkErrorGeneric {
|
|
157
148
|
return [Translations sdk_error_generic];
|
|
158
149
|
}
|
|
159
150
|
|
|
160
|
-
- (nonnull NSString *)sdkErrorInactive {
|
|
151
|
+
- (nonnull NSString *)sdkErrorInactive {
|
|
161
152
|
return [Translations sdk_error_inactive];
|
|
162
153
|
}
|
|
163
154
|
|
|
164
|
-
- (nonnull NSString *)sdkErrorInvalidApiKey {
|
|
155
|
+
- (nonnull NSString *)sdkErrorInvalidApiKey {
|
|
165
156
|
return [Translations sdk_error_invalid_api_key];
|
|
166
157
|
}
|
|
167
158
|
|
|
168
|
-
- (nonnull NSString *)sdkErrorListenerLimitReached {
|
|
159
|
+
- (nonnull NSString *)sdkErrorListenerLimitReached {
|
|
169
160
|
return [Translations sdk_error_listener_limit_reached];
|
|
170
161
|
}
|
|
171
162
|
|
|
172
|
-
- (nonnull NSString *)sdkErrorNoNetwork {
|
|
163
|
+
- (nonnull NSString *)sdkErrorNoNetwork {
|
|
173
164
|
return [Translations sdk_error_no_network];
|
|
174
165
|
}
|
|
175
166
|
|
|
176
|
-
- (nonnull NSString *)sdkErrorNotFound {
|
|
167
|
+
- (nonnull NSString *)sdkErrorNotFound {
|
|
177
168
|
return [Translations sdk_error_not_found];
|
|
178
169
|
}
|
|
179
170
|
|
|
180
171
|
- (nonnull NSString *)sdkErrorRequestFailed:(double)errorCode {
|
|
181
|
-
return [Translations
|
|
172
|
+
return [Translations
|
|
173
|
+
sdk_error_request_failed:[NSString stringWithFormat:@"%1.0f", errorCode]];
|
|
182
174
|
}
|
|
183
175
|
|
|
184
|
-
- (nonnull NSString *)sdkErrorWrongPassword {
|
|
176
|
+
- (nonnull NSString *)sdkErrorWrongPassword {
|
|
185
177
|
return [Translations sdk_error_wrong_password];
|
|
186
178
|
}
|
|
187
179
|
|
|
188
|
-
- (nonnull NSString *)sdkNoMatchingChannels {
|
|
180
|
+
- (nonnull NSString *)sdkNoMatchingChannels {
|
|
189
181
|
return [Translations sdk_no_matching_channels];
|
|
190
182
|
}
|
|
191
183
|
|
|
192
|
-
- (nonnull NSString *)streamingByTitle {
|
|
184
|
+
- (nonnull NSString *)streamingByTitle {
|
|
193
185
|
return [Translations streaming_by_title];
|
|
194
186
|
}
|
|
195
187
|
|
|
196
|
-
- (nonnull NSString *)accessibilityChannelPlay {
|
|
188
|
+
- (nonnull NSString *)accessibilityChannelPlay {
|
|
197
189
|
return [Translations a11y_channel_play];
|
|
198
190
|
}
|
|
199
191
|
|
|
200
|
-
|
|
201
|
-
- (nonnull NSString *)accessibilityChannelStatusMuted {
|
|
192
|
+
- (nonnull NSString *)accessibilityChannelStatusMuted {
|
|
202
193
|
return [Translations a11y_channel_status_muted];
|
|
203
194
|
}
|
|
204
195
|
|
|
205
|
-
|
|
206
|
-
- (nonnull NSString *)accessibilityChannelStop {
|
|
196
|
+
- (nonnull NSString *)accessibilityChannelStop {
|
|
207
197
|
return [Translations a11y_channel_stop];
|
|
208
198
|
}
|
|
209
199
|
|
|
210
|
-
|
|
211
|
-
- (nonnull NSString *)isAiChannelStatusMessage {
|
|
200
|
+
- (nonnull NSString *)isAiChannelStatusMessage {
|
|
212
201
|
return [Translations channel_status_is_ai];
|
|
213
202
|
}
|
|
214
203
|
|
|
215
|
-
|
|
216
|
-
- (nonnull NSString *)noChannels {
|
|
204
|
+
- (nonnull NSString *)noChannels {
|
|
217
205
|
return [Translations sdk_no_matching_channels];
|
|
218
206
|
}
|
|
219
207
|
|
|
220
|
-
- (nonnull NSString *)errorRetryNowButton {
|
|
208
|
+
- (nonnull NSString *)errorRetryNowButton {
|
|
221
209
|
return [Translations action_retry_now];
|
|
222
210
|
}
|
|
223
211
|
|
|
224
212
|
#pragma mark - LiveVoiceDelegate
|
|
225
213
|
|
|
226
|
-
- (void)viewStateDidChange:(nonnull NSString *)serializedState
|
|
227
|
-
{
|
|
214
|
+
- (void)viewStateDidChange:(nonnull NSString *)serializedState {
|
|
228
215
|
NSLog(@"[SDK] %s", __PRETTY_FUNCTION__);
|
|
229
216
|
[self emitOnUiStateChanged:serializedState];
|
|
230
217
|
}
|
|
231
218
|
|
|
232
|
-
- (void)audioOutputDidChange:(BOOL)useSpeaker
|
|
233
|
-
|
|
234
|
-
|
|
219
|
+
- (void)audioOutputDidChange:(BOOL)useSpeaker {
|
|
220
|
+
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__,
|
|
221
|
+
useSpeaker ? @"speaker" : @"receiver");
|
|
235
222
|
[self emitOnAudioOutputChanged:useSpeaker];
|
|
236
223
|
}
|
|
237
224
|
|
|
238
|
-
- (void)availableSubtitlesDidChange:(NSString *)available
|
|
239
|
-
{
|
|
225
|
+
- (void)availableSubtitlesDidChange:(NSString *)available {
|
|
240
226
|
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__, available);
|
|
241
227
|
[self emitOnAvailableSubtitleConfigsChanged:available];
|
|
242
228
|
}
|
|
243
229
|
|
|
244
|
-
- (void)subtitlesDidChange:(NSString *)subtitles
|
|
245
|
-
{
|
|
230
|
+
- (void)subtitlesDidChange:(NSString *)subtitles {
|
|
246
231
|
NSLog(@"[SDK] %s %@", __PRETTY_FUNCTION__, subtitles);
|
|
247
232
|
[self emitOnSubtitlesChanged:subtitles];
|
|
248
233
|
}
|
package/ios/__SDK.h
CHANGED
|
@@ -18,10 +18,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
export const AudioOutputSwitchView = props => {
|
|
19
19
|
const [isSpeaker, setIsSpeaker] = useState(() => getCurrentAudioState());
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
onAudioOutputChanged(value => {
|
|
21
|
+
let subscription = onAudioOutputChanged(value => {
|
|
22
22
|
console.log('State changed: ' + value);
|
|
23
23
|
setIsSpeaker(value);
|
|
24
24
|
});
|
|
25
|
+
return () => {
|
|
26
|
+
subscription?.remove();
|
|
27
|
+
subscription = undefined;
|
|
28
|
+
};
|
|
25
29
|
}, []);
|
|
26
30
|
const isDarkMode = props.isDarkMode != undefined ? props.isDarkMode : useColorScheme() === 'dark';
|
|
27
31
|
const animation = useRef(new Animated.Value(isSpeaker ? 1 : 0)).current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getCurrentAudioState","onAudioOutputChanged","setLiveVoiceUseSpeaker","React","useState","useRef","useEffect","View","TouchableOpacity","StyleSheet","Animated","Easing","Image","useColorScheme","jsx","_jsx","jsxs","_jsxs","AudioOutputSwitchView","props","isSpeaker","setIsSpeaker","value","console","log","
|
|
1
|
+
{"version":3,"names":["getCurrentAudioState","onAudioOutputChanged","setLiveVoiceUseSpeaker","React","useState","useRef","useEffect","View","TouchableOpacity","StyleSheet","Animated","Easing","Image","useColorScheme","jsx","_jsx","jsxs","_jsxs","AudioOutputSwitchView","props","isSpeaker","setIsSpeaker","subscription","value","console","log","remove","undefined","isDarkMode","animation","Value","current","timing","toValue","duration","easing","out","circle","useNativeDriver","start","togglePosition","interpolate","inputRange","outputRange","iconColor","activeOpacity","onPress","style","styles","container","darkMode","lightMode","children","iconContainer","source","require","tintColor","width","height","resizeMode","toggle","toggleBackgroundDark","toggleBackgroundLight","transform","translateX","create","borderRadius","flexDirection","alignItems","justifyContent","paddingHorizontal","position","backgroundColor","flex"],"sourceRoot":"../../../src","sources":["components/AudioOutputSwitchView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,oBAAoB,EAAEC,sBAAsB,QAAQ,4BAA4B;AAC/G,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAS,OAAO;AAC3D,SACEC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,cAAc,QACT,cAAc;AAAC,SAAAC,GAAA,I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EAAE;EACnB,CAAC;EACDV,qBAAqB,EAAE;IACrBU,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
import React, { useState } from 'react';
|
|
15
15
|
import { View, Text, StyleSheet, TouchableOpacity, useColorScheme, Image } from 'react-native';
|
|
16
16
|
import { COLORS } from "../util/Colors.js";
|
|
17
|
-
import { Translations } from "../util/Translations.js";
|
|
18
17
|
import PlayButtonView from "./PlayButtonView.js";
|
|
19
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
export const ChannelView = ({
|
|
@@ -22,29 +21,30 @@ export const ChannelView = ({
|
|
|
22
21
|
playingState,
|
|
23
22
|
muted,
|
|
24
23
|
isOnline,
|
|
25
|
-
|
|
24
|
+
hasAudio,
|
|
25
|
+
hasSubtitles,
|
|
26
26
|
isDarkMode = useColorScheme() === 'dark',
|
|
27
|
-
|
|
27
|
+
onAudioPress,
|
|
28
|
+
onSubtitlesPress
|
|
28
29
|
}) => {
|
|
29
30
|
const [collapsed, setCollapsed] = useState(true);
|
|
30
|
-
const backgroundColor = isDarkMode ? COLORS.cardBgDark : COLORS.cardBg;
|
|
31
|
-
const secondaryColor = isDarkMode ? COLORS['gray-300'] : COLORS.gray;
|
|
32
31
|
const iconColor = isDarkMode ? COLORS.white : COLORS.black;
|
|
33
32
|
return /*#__PURE__*/_jsxs(View, {
|
|
34
|
-
style:
|
|
35
|
-
backgroundColor
|
|
36
|
-
}],
|
|
33
|
+
style: styles.container,
|
|
37
34
|
children: [/*#__PURE__*/_jsx(PlayButtonView, {
|
|
38
35
|
playingState: playingState,
|
|
39
|
-
|
|
36
|
+
onAudioPress: onAudioPress,
|
|
37
|
+
onSubtitlesPress: onSubtitlesPress,
|
|
40
38
|
isDarkMode: isDarkMode,
|
|
41
|
-
isChannelOnline: isOnline
|
|
42
|
-
|
|
39
|
+
isChannelOnline: isOnline,
|
|
40
|
+
hasAudio: hasAudio,
|
|
41
|
+
hasSubtitles: hasSubtitles
|
|
42
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
43
43
|
style: {
|
|
44
44
|
flex: 1,
|
|
45
45
|
marginLeft: 10
|
|
46
46
|
},
|
|
47
|
-
children:
|
|
47
|
+
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
48
48
|
onPress: () => setCollapsed(!collapsed),
|
|
49
49
|
activeOpacity: 1,
|
|
50
50
|
children: /*#__PURE__*/_jsx(Text, {
|
|
@@ -55,28 +55,7 @@ export const ChannelView = ({
|
|
|
55
55
|
}],
|
|
56
56
|
children: channelName
|
|
57
57
|
})
|
|
58
|
-
})
|
|
59
|
-
aiSpeaker && /*#__PURE__*/_jsxs(View, {
|
|
60
|
-
style: {
|
|
61
|
-
flex: 1,
|
|
62
|
-
flexDirection: 'row',
|
|
63
|
-
alignItems: 'center'
|
|
64
|
-
},
|
|
65
|
-
children: [/*#__PURE__*/_jsx(Image, {
|
|
66
|
-
source: require('../icons/cpu.png'),
|
|
67
|
-
style: {
|
|
68
|
-
width: 16,
|
|
69
|
-
height: 16,
|
|
70
|
-
tintColor: secondaryColor,
|
|
71
|
-
resizeMode: 'contain'
|
|
72
|
-
}
|
|
73
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
74
|
-
style: [styles.aiText, {
|
|
75
|
-
color: secondaryColor
|
|
76
|
-
}],
|
|
77
|
-
children: Translations.isAiChannelStatusMessage()
|
|
78
|
-
})]
|
|
79
|
-
})]
|
|
58
|
+
})
|
|
80
59
|
}), muted && /*#__PURE__*/_jsx(Image, {
|
|
81
60
|
source: require('../icons/mic.png'),
|
|
82
61
|
style: {
|
|
@@ -92,10 +71,7 @@ const styles = StyleSheet.create({
|
|
|
92
71
|
container: {
|
|
93
72
|
flexDirection: 'row',
|
|
94
73
|
alignItems: 'center',
|
|
95
|
-
padding: 10
|
|
96
|
-
backgroundColor: '#fff',
|
|
97
|
-
borderRadius: 8,
|
|
98
|
-
marginBottom: 10
|
|
74
|
+
padding: 10
|
|
99
75
|
},
|
|
100
76
|
text: {
|
|
101
77
|
fontSize: 16,
|