livevoice-sdk-react-native 2.0.0 → 2.0.1

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.
Files changed (97) hide show
  1. package/README.md +119 -7
  2. package/android/build.gradle +14 -3
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +89 -123
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +16 -2
  5. package/ios/LiveVoiceSdkReactNative.mm +110 -37
  6. package/ios/__SDK.h +16 -2
  7. package/lib/module/components/AudioOutputSwitchView.js +13 -13
  8. package/lib/module/components/AudioOutputSwitchView.js.map +1 -1
  9. package/lib/module/components/BrandingView.js +13 -11
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +14 -11
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +12 -10
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceView.js +141 -72
  16. package/lib/module/components/LiveVoiceView.js.map +1 -1
  17. package/lib/module/components/PlayButtonView.js +12 -10
  18. package/lib/module/components/PlayButtonView.js.map +1 -1
  19. package/lib/module/components/ReconnectingView.js +16 -13
  20. package/lib/module/components/ReconnectingView.js.map +1 -1
  21. package/lib/module/components/WarningView.js +12 -10
  22. package/lib/module/components/WarningView.js.map +1 -1
  23. package/lib/module/components/index.js +12 -10
  24. package/lib/module/components/index.js.map +1 -1
  25. package/lib/module/index.js +14 -220
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/sdk/LiveVoiceSdk.js +371 -0
  28. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  29. package/lib/module/sdk/LiveVoiceState.js +66 -0
  30. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  31. package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
  32. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  33. package/lib/module/util/Colors.js +12 -10
  34. package/lib/module/util/Colors.js.map +1 -1
  35. package/lib/module/util/ForegroundServiceConfig.js +21 -11
  36. package/lib/module/util/ForegroundServiceConfig.js.map +1 -1
  37. package/lib/module/util/PlayingState.js +12 -10
  38. package/lib/module/util/PlayingState.js.map +1 -1
  39. package/lib/module/util/Translations.js +12 -10
  40. package/lib/module/util/Translations.js.map +1 -1
  41. package/lib/module/util/logger.js +76 -0
  42. package/lib/module/util/logger.js.map +1 -0
  43. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -1
  44. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  45. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  46. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  47. package/lib/typescript/src/components/LiveVoiceView.d.ts +22 -0
  48. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  49. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  50. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  51. package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
  52. package/lib/typescript/src/components/index.d.ts.map +1 -1
  53. package/lib/typescript/src/index.d.ts +6 -144
  54. package/lib/typescript/src/index.d.ts.map +1 -1
  55. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +210 -0
  56. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  57. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +12 -0
  58. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  59. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +3 -0
  60. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  61. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  62. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +7 -0
  63. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -1
  64. package/lib/typescript/src/util/PlayingState.d.ts.map +1 -1
  65. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  66. package/lib/typescript/src/util/UIState.d.ts +22 -2
  67. package/lib/typescript/src/util/UIState.d.ts.map +1 -1
  68. package/lib/typescript/src/util/logger.d.ts +23 -0
  69. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  70. package/livevoice-sdk-react-native.podspec +14 -14
  71. package/package.json +16 -7
  72. package/src/components/AudioOutputSwitchView.tsx +13 -13
  73. package/src/components/BrandingView.tsx +13 -11
  74. package/src/components/ChannelView.tsx +14 -11
  75. package/src/components/ErrorView.tsx +12 -10
  76. package/src/components/LiveVoiceView.tsx +183 -92
  77. package/src/components/PlayButtonView.tsx +12 -10
  78. package/src/components/ReconnectingView.tsx +20 -13
  79. package/src/components/WarningView.tsx +12 -10
  80. package/src/components/index.tsx +12 -10
  81. package/src/index.tsx +19 -252
  82. package/src/sdk/LiveVoiceSdk.ts +408 -0
  83. package/src/sdk/LiveVoiceState.ts +89 -0
  84. package/src/specs/NativeLiveVoiceSdk.ts +16 -10
  85. package/src/util/Colors.ts +12 -10
  86. package/src/util/ForegroundServiceConfig.tsx +21 -11
  87. package/src/util/PlayingState.ts +12 -10
  88. package/src/util/Translations.ts +12 -10
  89. package/src/util/UIState.ts +30 -13
  90. package/src/util/logger.ts +92 -0
  91. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
  92. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  93. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  94. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
  95. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
  96. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
  97. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
@@ -1,85 +0,0 @@
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
-
14
- package io.livevoice.react
15
-
16
- import io.livevoice.sdk.android.publicApi.core.model.channel.LiveVoicePlayingState
17
- import io.livevoice.sdk.android.publicApi.core.model.SdkRetryState
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
- }
48
-
49
- fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
50
- SdkUiState.Loading -> NativeLoading
51
- is SdkUiState.Ready -> NativeReady(
52
- channels = channels.map {
53
- NativeChannel(
54
- id = it.id,
55
- name = it.name,
56
- isOnline = it.isOnline,
57
- isAudioMuted = it.isAudioMuted,
58
- isAiSpeaker = it.isAiSpeaker,
59
- playingState = it.playingState.mapToNative(),
60
- hasSubtitles = it.hasSubtitles,
61
- hasAudio = it.hasAudio,
62
- )
63
- },
64
- )
65
-
66
- is SdkUiState.Error -> NativeError(
67
- message = message,
68
- canBeRetried = onRetry != null
69
- )
70
-
71
- is SdkUiState.Reconnecting -> {
72
- val retryState = when (val state = this.retryState) {
73
- is SdkRetryState.AwaitingNextReconnectAttempt -> NativeRetryState.AwaitRetry(state.retryTimestampSeconds)
74
- SdkRetryState.RetryInProgress -> NativeRetryState.InProgress
75
- }
76
-
77
- NativeReconnecting(state = retryState)
78
- }
79
- }
80
-
81
- private fun LiveVoicePlayingState.mapToNative() = when (this) {
82
- LiveVoicePlayingState.Stopped -> NativePlayingState.STOPPED
83
- LiveVoicePlayingState.Playing -> NativePlayingState.PLAYING
84
- LiveVoicePlayingState.Connecting, LiveVoicePlayingState.Stopping -> NativePlayingState.TRANSITIONING
85
- }
@@ -1,79 +0,0 @@
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
-
14
- package io.livevoice.react
15
-
16
- import kotlinx.serialization.SerialName
17
- import kotlinx.serialization.Serializable
18
-
19
- @Serializable
20
- @SerialName("channel")
21
- data class NativeChannel(
22
- val id: Long,
23
- val name: String,
24
- val isOnline: Boolean,
25
- val isAudioMuted: Boolean,
26
- val isAiSpeaker: Boolean,
27
- /** State of the channel reflecting the local playback */
28
- val playingState: NativePlayingState,
29
- val hasSubtitles: Boolean,
30
- val hasAudio: Boolean,
31
- )
32
-
33
- @Serializable
34
- data class NativeClaims(
35
- val hideBranding: Boolean,
36
- val allowCustomUi: Boolean,
37
- )
38
-
39
- @Serializable
40
- @SerialName("playingState")
41
- enum class NativePlayingState {
42
- STOPPED, TRANSITIONING, PLAYING;
43
- }
44
-
45
- @Serializable
46
- @SerialName("ready")
47
- data class NativeReady(
48
- val channels: List<NativeChannel>,
49
- ) : NativeUiState
50
-
51
- @Serializable
52
- @SerialName("nativeUiState")
53
- sealed interface NativeUiState
54
-
55
- @Serializable
56
- @SerialName("loading")
57
- data object NativeLoading : NativeUiState
58
-
59
- @Serializable
60
- @SerialName("error")
61
- data class NativeError(
62
- val message: String,
63
- val canBeRetried: Boolean,
64
- ) : NativeUiState
65
-
66
- @Serializable
67
- @SerialName("reconnecting")
68
- data class NativeReconnecting(val state: NativeRetryState) : NativeUiState
69
-
70
- @Serializable
71
- sealed interface NativeRetryState {
72
- @Serializable
73
- @SerialName("inProgress")
74
- data object InProgress : NativeRetryState
75
-
76
- @Serializable
77
- @SerialName("awaitingRetry")
78
- data class AwaitRetry(val atTimestamp: Long) : NativeRetryState
79
- }