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.
Files changed (221) hide show
  1. package/README.md +158 -7
  2. package/android/build.gradle +18 -6
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +247 -145
  7. package/ios/__SDK.h +16 -2
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +71 -50
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +368 -54
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +17 -16
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceSpinner.js +81 -0
  16. package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
  17. package/lib/module/components/LiveVoiceView.js +351 -104
  18. package/lib/module/components/LiveVoiceView.js.map +1 -1
  19. package/lib/module/components/PasswordPrompt.js +165 -0
  20. package/lib/module/components/PasswordPrompt.js.map +1 -0
  21. package/lib/module/components/PlayButtonView.js +192 -254
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +43 -62
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/components/WarningView.js +12 -10
  26. package/lib/module/components/WarningView.js.map +1 -1
  27. package/lib/module/icons/branding-ios.png +0 -0
  28. package/lib/module/icons/camera-off-android.png +0 -0
  29. package/lib/module/icons/camera-off-android@2x.png +0 -0
  30. package/lib/module/icons/camera-off-android@3x.png +0 -0
  31. package/lib/module/icons/cpu-android.png +0 -0
  32. package/lib/module/icons/cpu-android@2x.png +0 -0
  33. package/lib/module/icons/cpu-android@3x.png +0 -0
  34. package/lib/module/icons/cpu-ios.png +0 -0
  35. package/lib/module/icons/cpu-ios@2x.png +0 -0
  36. package/lib/module/icons/cpu-ios@3x.png +0 -0
  37. package/lib/module/icons/lock-android.png +0 -0
  38. package/lib/module/icons/lock-android@2x.png +0 -0
  39. package/lib/module/icons/lock-android@3x.png +0 -0
  40. package/lib/module/icons/lock-ios.png +0 -0
  41. package/lib/module/icons/lock-ios@2x.png +0 -0
  42. package/lib/module/icons/lock-ios@3x.png +0 -0
  43. package/lib/module/icons/mic-off-android.png +0 -0
  44. package/lib/module/icons/mic-off-android@2x.png +0 -0
  45. package/lib/module/icons/mic-off-android@3x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios.png +0 -0
  47. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  48. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  49. package/lib/module/icons/video-slash-ios.png +0 -0
  50. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  51. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  52. package/lib/module/index.js +24 -225
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/sdk/Bridge.js +236 -0
  55. package/lib/module/sdk/Bridge.js.map +1 -0
  56. package/lib/module/sdk/Event.js +160 -0
  57. package/lib/module/sdk/Event.js.map +1 -0
  58. package/lib/module/sdk/Lifecycle.js +331 -0
  59. package/lib/module/sdk/Lifecycle.js.map +1 -0
  60. package/lib/module/sdk/LiveVoiceSdk.js +365 -0
  61. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  62. package/lib/module/sdk/LiveVoiceState.js +234 -0
  63. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  64. package/lib/module/sdk/LogEntries.js +99 -0
  65. package/lib/module/sdk/LogEntries.js.map +1 -0
  66. package/lib/module/sdk/Models.js +2 -0
  67. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  68. package/lib/module/sdk/NativeSdkVersions.js +24 -0
  69. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  70. package/lib/module/sdk/Observables.js +391 -0
  71. package/lib/module/sdk/Observables.js.map +1 -0
  72. package/lib/module/sdk/Passwords.js +298 -0
  73. package/lib/module/sdk/Passwords.js.map +1 -0
  74. package/lib/module/sdk/Playback.js +35 -0
  75. package/lib/module/sdk/Playback.js.map +1 -0
  76. package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
  77. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  78. package/lib/module/util/Colors.js +14 -11
  79. package/lib/module/util/Colors.js.map +1 -1
  80. package/lib/module/util/Translations.js +46 -21
  81. package/lib/module/util/Translations.js.map +1 -1
  82. package/lib/module/util/freeze.js +26 -0
  83. package/lib/module/util/freeze.js.map +1 -0
  84. package/lib/module/util/logger.js +114 -0
  85. package/lib/module/util/logger.js.map +1 -0
  86. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  87. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  88. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  89. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  90. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  91. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  92. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  93. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  94. package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
  95. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  96. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  97. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  98. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  99. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  100. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  101. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  102. package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
  103. package/lib/typescript/src/index.d.ts +15 -144
  104. package/lib/typescript/src/index.d.ts.map +1 -1
  105. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  106. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  108. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  109. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  110. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  111. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
  112. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
  114. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  116. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  118. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  120. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  122. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  123. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  124. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  125. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  126. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  127. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
  128. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  129. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  130. package/lib/typescript/src/util/Translations.d.ts +30 -8
  131. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  132. package/lib/typescript/src/util/freeze.d.ts +6 -0
  133. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  134. package/lib/typescript/src/util/logger.d.ts +33 -0
  135. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  136. package/livevoice-sdk-react-native.podspec +41 -16
  137. package/package.json +26 -14
  138. package/src/components/BrandingView.tsx +55 -66
  139. package/src/components/ChannelView.tsx +342 -48
  140. package/src/components/ErrorView.tsx +21 -22
  141. package/src/components/LiveVoiceSpinner.tsx +87 -0
  142. package/src/components/LiveVoiceView.tsx +360 -151
  143. package/src/components/PasswordPrompt.tsx +144 -0
  144. package/src/components/PlayButtonView.tsx +177 -279
  145. package/src/components/ReconnectingView.tsx +40 -86
  146. package/src/components/WarningView.tsx +12 -10
  147. package/src/icons/branding-ios.png +0 -0
  148. package/src/icons/camera-off-android.png +0 -0
  149. package/src/icons/camera-off-android@2x.png +0 -0
  150. package/src/icons/camera-off-android@3x.png +0 -0
  151. package/src/icons/cpu-android.png +0 -0
  152. package/src/icons/cpu-android@2x.png +0 -0
  153. package/src/icons/cpu-android@3x.png +0 -0
  154. package/src/icons/cpu-ios.png +0 -0
  155. package/src/icons/cpu-ios@2x.png +0 -0
  156. package/src/icons/cpu-ios@3x.png +0 -0
  157. package/src/icons/lock-android.png +0 -0
  158. package/src/icons/lock-android@2x.png +0 -0
  159. package/src/icons/lock-android@3x.png +0 -0
  160. package/src/icons/lock-ios.png +0 -0
  161. package/src/icons/lock-ios@2x.png +0 -0
  162. package/src/icons/lock-ios@3x.png +0 -0
  163. package/src/icons/mic-off-android.png +0 -0
  164. package/src/icons/mic-off-android@2x.png +0 -0
  165. package/src/icons/mic-off-android@3x.png +0 -0
  166. package/src/icons/mic-slash-ios.png +0 -0
  167. package/src/icons/mic-slash-ios@2x.png +0 -0
  168. package/src/icons/mic-slash-ios@3x.png +0 -0
  169. package/src/icons/video-slash-ios.png +0 -0
  170. package/src/icons/video-slash-ios@2x.png +0 -0
  171. package/src/icons/video-slash-ios@3x.png +0 -0
  172. package/src/index.tsx +105 -252
  173. package/src/sdk/Bridge.ts +259 -0
  174. package/src/sdk/Event.ts +187 -0
  175. package/src/sdk/Lifecycle.ts +366 -0
  176. package/src/sdk/LiveVoiceSdk.ts +384 -0
  177. package/src/sdk/LiveVoiceState.ts +259 -0
  178. package/src/sdk/LogEntries.ts +88 -0
  179. package/src/sdk/Models.ts +129 -0
  180. package/src/sdk/NativeSdkVersions.ts +21 -0
  181. package/src/sdk/Observables.ts +414 -0
  182. package/src/sdk/Passwords.ts +286 -0
  183. package/src/sdk/Playback.ts +30 -0
  184. package/src/specs/NativeLiveVoiceSdk.ts +56 -46
  185. package/src/util/Colors.ts +14 -11
  186. package/src/util/Translations.ts +46 -22
  187. package/src/util/freeze.ts +23 -0
  188. package/src/util/logger.ts +119 -0
  189. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
  190. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  191. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  192. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
  193. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
  194. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
  195. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
  196. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  197. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  198. package/lib/module/components/index.js +0 -22
  199. package/lib/module/components/index.js.map +0 -1
  200. package/lib/module/icons/mic.png +0 -0
  201. package/lib/module/util/ForegroundServiceConfig.js +0 -28
  202. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  203. package/lib/module/util/PlayingState.js +0 -21
  204. package/lib/module/util/PlayingState.js.map +0 -1
  205. package/lib/module/util/UIState.js +0 -4
  206. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  207. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  208. package/lib/typescript/src/components/index.d.ts +0 -9
  209. package/lib/typescript/src/components/index.d.ts.map +0 -1
  210. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
  211. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  212. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  213. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  214. package/lib/typescript/src/util/UIState.d.ts +0 -66
  215. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  216. package/src/components/AudioOutputSwitchView.tsx +0 -146
  217. package/src/components/index.tsx +0 -19
  218. package/src/icons/mic.png +0 -0
  219. package/src/util/ForegroundServiceConfig.tsx +0 -32
  220. package/src/util/PlayingState.ts +0 -18
  221. package/src/util/UIState.ts +0 -89
@@ -0,0 +1,202 @@
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
+ # React Native before 0.89 attaches a Swift package from `spm_dependency` to
15
+ # the pod only. Two things then go wrong for a package with dynamic binary
16
+ # frameworks, as the native LiveVoice SDK is:
17
+ #
18
+ # - CocoaPods embeds only the frameworks of pods, so the SDK and WebRTC are
19
+ # linked but never copied into the app, which fails at launch with dyld
20
+ # "Library not loaded".
21
+ # - Xcode writes each binary target's signature both to the shared products
22
+ # dir and to the pod's build dir, and archiving fails on the duplicate.
23
+ #
24
+ # React Native 0.87 and 0.88 add a third: they build the pod straight into the
25
+ # shared products dir and rewrite the app's references to its module map, but
26
+ # name the file after the pod (livevoice-sdk-react-native) instead of its
27
+ # module (livevoice_sdk_react_native), so the app's build cannot find it.
28
+ #
29
+ # React Native 0.89 fixes all three (facebook/react-native#58781). This
30
+ # backports that fix for this pod only, from the podspec, so apps need no
31
+ # Podfile change; with Expo, prebuild would discard one anyway. It does
32
+ # nothing when React Native already has the fix.
33
+
34
+ module LiveVoiceSPMBackport
35
+ EMBED_FUNCTION = 'livevoice_install_spm_framework'
36
+ SIGNATURE_PHASE_NAME = '[LV] Remove duplicate Swift package xcframework signatures'
37
+
38
+ # Taken from React Native 0.89's install_spm_framework: embeds framework $1
39
+ # from where Xcode puts binary targets, if it is a dynamic one.
40
+ EMBED_FUNCTION_SOURCE = <<~'SH'
41
+ livevoice_install_spm_framework()
42
+ {
43
+ local dir
44
+ for dir in "${PODS_CONFIGURATION_BUILD_DIR}" "${PODS_CONFIGURATION_BUILD_DIR}/PackageFrameworks" "${OBJROOT}/UninstalledProducts/${PLATFORM_NAME}"; do
45
+ if [ -d "$dir/$1.framework" ]; then
46
+ if file -b "$dir/$1.framework/$1" | grep -q "dynamically linked"; then
47
+ install_framework "$dir/$1.framework"
48
+ fi
49
+ return
50
+ fi
51
+ done
52
+ }
53
+ SH
54
+
55
+ # The installed React Native embeds Swift package frameworks itself.
56
+ def self.native_support?
57
+ defined?(SPMManager) && SPMManager.const_defined?(:EMBED_FUNCTION)
58
+ end
59
+
60
+ # Hooks into React Native's own post-install step for `pod_name`.
61
+ def self.install(pod_name:, frameworks:, requirement_comment:)
62
+ return if native_support? || !defined?(SPMManager)
63
+
64
+ @pods ||= {}
65
+ @pods[pod_name] = { frameworks: frameworks, comment: requirement_comment }
66
+ SPMManager.prepend(Hook) unless SPMManager.ancestors.include?(Hook)
67
+ end
68
+
69
+ def self.pods
70
+ @pods || {}
71
+ end
72
+
73
+ module Hook
74
+ def apply_on_post_install(installer)
75
+ super
76
+ LiveVoiceSPMBackport.pods.each do |pod_name, info|
77
+ LiveVoiceSPMBackport.embed_frameworks(installer, pod_name, info)
78
+ if LiveVoiceSPMBackport.built_into_products_dir?(installer.pods_project, pod_name)
79
+ # One copy of everything, signatures included: nothing to remove.
80
+ LiveVoiceSPMBackport.fix_modulemap_references(installer, pod_name)
81
+ else
82
+ LiveVoiceSPMBackport.remove_duplicate_signatures(installer.pods_project, pod_name)
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ def self.embed_frameworks(installer, pod_name, info)
89
+ installer.aggregate_targets.each do |aggregate_target|
90
+ next unless aggregate_target.pod_targets.any? { |t| t.name == pod_name }
91
+
92
+ script_path = aggregate_target.embed_frameworks_script_path
93
+ script = File.exist?(script_path) ? File.read(script_path) : nil
94
+ next if script&.include?("#{EMBED_FUNCTION}()")
95
+
96
+ # A project that already gets the frameworks into the app keeps its own
97
+ # way, so nothing is copied twice.
98
+ if embedded_elsewhere?(aggregate_target, script, info[:frameworks])
99
+ ::Pod::UI.puts "[LiveVoice] #{aggregate_target.name} already embeds #{info[:frameworks].join(', ')}"
100
+ next
101
+ end
102
+
103
+ anchor = /^if \[ "\$\{COCOAPODS_PARALLEL_CODE_SIGN\}" == "true" \]; then$/
104
+ unless script&.match?(anchor)
105
+ # Failing here beats an app that installs and then crashes at launch.
106
+ raise ::Pod::Informative, <<~MSG
107
+ [LiveVoice] Cannot embed #{info[:frameworks].join(' and ')} in #{aggregate_target.name}:
108
+ #{script.nil? ? "#{script_path} does not exist" : "#{script_path} does not have the expected CocoaPods layout"}.
109
+ Without them the app fails to launch with dyld "Library not loaded".
110
+ Embed them another way, for example by adding the LiveVoiceSDK Swift package
111
+ product to the app target, or move to React Native 0.89 or later, which embeds
112
+ them itself.
113
+ MSG
114
+ end
115
+
116
+ # The comment names the version, so a version change rewrites this
117
+ # script, an input of the embed phase, and the phase runs again.
118
+ calls = info[:frameworks].map { |name| "#{EMBED_FUNCTION} \"#{name}\"\n" }.join
119
+ File.write(script_path, script.sub(anchor) { "#{EMBED_FUNCTION_SOURCE}# #{info[:comment]}\n#{calls}#{$&}" })
120
+ ::Pod::UI.puts "[LiveVoice] Embedding #{info[:frameworks].join(', ')} in #{aggregate_target.name}"
121
+ end
122
+ end
123
+
124
+ # The app target uses the LiveVoiceSDK package product itself, so Xcode
125
+ # embeds its frameworks, or the embed script already installs them.
126
+ def self.embedded_elsewhere?(aggregate_target, script, frameworks)
127
+ by_package = aggregate_target.user_targets.any? do |target|
128
+ target.respond_to?(:package_product_dependencies) &&
129
+ target.package_product_dependencies.any? { |d| d.product_name == 'LiveVoiceSDK' }
130
+ end
131
+ by_script = !script.nil? && frameworks.all? { |name| script.include?("/#{name}.framework\"") }
132
+ by_package || by_script
133
+ end
134
+
135
+ # React Native 0.87 and later build a static pod with a Swift package
136
+ # straight into the shared products dir.
137
+ def self.built_into_products_dir?(project, pod_name)
138
+ target = project.targets.find { |t| t.name == pod_name }
139
+ !target.nil? && target.build_configurations.all? do |config|
140
+ config.build_settings['CONFIGURATION_BUILD_DIR'] == '${PODS_CONFIGURATION_BUILD_DIR}'
141
+ end
142
+ end
143
+
144
+ # Points the app's -fmodule-map-file flags at the module map where the pod
145
+ # now builds it. Like React Native 0.89, this changes the in-memory xcconfig
146
+ # attributes, because later post-install steps save the same objects again.
147
+ def self.fix_modulemap_references(installer, pod_name)
148
+ pod_target = installer.pod_targets.find { |t| t.name == pod_name }
149
+ return if pod_target.nil?
150
+
151
+ module_name = pod_target.product_module_name
152
+ installer.aggregate_targets.each do |aggregate_target|
153
+ next unless aggregate_target.pod_targets.include?(pod_target)
154
+
155
+ aggregate_target.xcconfigs.each do |config_name, config_file|
156
+ changed = false
157
+ %w[OTHER_CFLAGS OTHER_SWIFT_FLAGS].each do |key|
158
+ value = config_file.attributes[key]
159
+ next unless value
160
+
161
+ updated = value
162
+ .gsub("${PODS_CONFIGURATION_BUILD_DIR}/#{pod_name}/#{module_name}.modulemap",
163
+ "${PODS_CONFIGURATION_BUILD_DIR}/#{module_name}.modulemap")
164
+ .gsub("${PODS_CONFIGURATION_BUILD_DIR}/#{pod_name}.modulemap",
165
+ "${PODS_CONFIGURATION_BUILD_DIR}/#{module_name}.modulemap")
166
+ next if updated == value
167
+
168
+ config_file.attributes[key] = updated
169
+ changed = true
170
+ end
171
+ config_file.save_as(aggregate_target.xcconfig_path(config_name)) if changed
172
+ end
173
+ end
174
+ end
175
+
176
+ def self.remove_duplicate_signatures(project, pod_name)
177
+ target = project.targets.find { |t| t.name == pod_name }
178
+ return if target.nil? || target.shell_script_build_phases.any? { |p| p.name == SIGNATURE_PHASE_NAME }
179
+
180
+ # A fresh UUID that is really unused: Pod::Project's generator skips the
181
+ # check and can collide during post_install (see React Native's spm.rb).
182
+ uuid = project.generate_uuid
183
+ uuid = project.generate_uuid while project.objects_by_uuid.key?(uuid)
184
+ phase = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(project, uuid)
185
+ phase.initialize_defaults
186
+ phase.name = SIGNATURE_PHASE_NAME
187
+ # Removes only copies that also exist in the shared products dir, so the
188
+ # only copy stays if the pod is built there after all (for example by the
189
+ # app's own Podfile, after this ran).
190
+ phase.shell_script = <<~'SH'
191
+ for signature in "${CONFIGURATION_BUILD_DIR}"/*.xcframework-*.signature; do
192
+ [ -e "$signature" ] || continue
193
+ [ "${CONFIGURATION_BUILD_DIR}" != "${PODS_CONFIGURATION_BUILD_DIR}" ] || continue
194
+ if [ -e "${PODS_CONFIGURATION_BUILD_DIR}/$(basename "$signature")" ]; then
195
+ rm -f "$signature"
196
+ fi
197
+ done
198
+ SH
199
+ phase.always_out_of_date = '1'
200
+ target.build_phases << phase
201
+ end
202
+ end
@@ -1,72 +1,93 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  import React from 'react';
15
- import { View, Text, useColorScheme, StyleSheet, Image, Pressable } from 'react-native';
16
- import { COLORS } from "../util/Colors.js";
17
- import { openLiveVoiceWebsite } from 'livevoice-sdk-react-native';
17
+ import { Image, Platform, Pressable, StyleSheet, Text, useColorScheme } from 'react-native';
18
+ import { openLiveVoiceWebsite } from "../sdk/LiveVoiceSdk.js";
19
+ import { Translations } from "../util/Translations.js";
18
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ /**
22
+ * The "Live Audio Streaming by LiveVoice" footer, drawn exactly as the native SDK of the platform
23
+ * draws it: iOS `LogoView`, Android `LiveVoiceSdkBranding`. Change them together.
24
+ */
19
25
  export const BrandingView = props => {
20
- const isDarkMode = props.isDarkMode ?? useColorScheme() === 'dark';
21
- const openLink = async () => {
22
- openLiveVoiceWebsite();
23
- };
24
- return /*#__PURE__*/_jsx(Pressable, {
25
- onPress: openLink,
26
- style: {
27
- width: '100%',
28
- alignItems: 'center'
26
+ const scheme = useColorScheme();
27
+ const isDarkMode = props.isDarkMode ?? scheme === 'dark';
28
+ // Both native footers draw the text and the logo in plain black or white.
29
+ const color = isDarkMode ? '#FFFFFF' : '#000000';
30
+ return /*#__PURE__*/_jsxs(Pressable, {
31
+ onPress: () => {
32
+ openLiveVoiceWebsite();
29
33
  },
30
- children: /*#__PURE__*/_jsxs(View, {
31
- style: styles.container,
32
- children: [/*#__PURE__*/_jsx(Text, {
33
- style: [styles.text, isDarkMode ? styles.darkText : styles.lightText],
34
- children: "Live Audio Streaming by"
35
- }), /*#__PURE__*/_jsx(Image, {
36
- source: require('../icons/branding.png'),
37
- style: [styles.image, {
38
- height: 30,
39
- tintColor: isDarkMode ? COLORS.white : COLORS.black
40
- }],
41
- resizeMode: "contain"
42
- })]
43
- })
34
+ style: styles.container,
35
+ children: [/*#__PURE__*/_jsx(Text, {
36
+ style: [styles.text, {
37
+ color
38
+ }],
39
+ allowFontScaling: Platform.OS !== 'ios',
40
+ children: Translations.streamingByTitle()
41
+ }), /*#__PURE__*/_jsx(Image, {
42
+ source: Platform.OS === 'ios' ? require('../icons/branding-ios.png') : require('../icons/branding.png'),
43
+ style: [styles.logo, {
44
+ tintColor: color
45
+ }],
46
+ resizeMode: "contain"
47
+ })]
44
48
  });
45
49
  };
46
- const styles = StyleSheet.create({
50
+ const styles = StyleSheet.create(Platform.OS === 'ios' ? {
51
+ // iOS: `.padding()` (16 pt) around a 4 pt stack of a fixed 12 pt medium text and the logo
52
+ // set 100 pt wide. The logo artwork keeps the margins of the SDK's SVG (196 × 48).
47
53
  container: {
48
- padding: 12,
54
+ alignSelf: 'center',
49
55
  alignItems: 'center',
50
- justifyContent: 'center',
51
- borderRadius: 8,
52
- width: 250
56
+ padding: 16
53
57
  },
54
58
  text: {
55
59
  textAlign: 'center',
56
- fontSize: 16,
60
+ fontSize: 12,
57
61
  fontWeight: '500',
58
62
  marginBottom: 4
59
63
  },
60
- darkText: {
61
- color: '#fff'
64
+ logo: {
65
+ width: 100,
66
+ height: 100 * 48 / 196
67
+ }
68
+ } : {
69
+ // Android: 8 dp above (from the view), below and at the sides; bodyMedium text and a
70
+ // 92 × 28 dp logo, each inset 8 dp more at the sides.
71
+ container: {
72
+ alignSelf: 'center',
73
+ alignItems: 'center',
74
+ paddingTop: 8,
75
+ paddingBottom: 8,
76
+ paddingHorizontal: 8
62
77
  },
63
- lightText: {
64
- color: '#191919'
78
+ text: {
79
+ textAlign: 'center',
80
+ fontSize: 14,
81
+ lineHeight: 20,
82
+ letterSpacing: 0.25,
83
+ fontWeight: '400',
84
+ includeFontPadding: false,
85
+ marginHorizontal: 8
65
86
  },
66
- image: {
67
- width: '100%',
68
- height: undefined,
69
- aspectRatio: 4
87
+ logo: {
88
+ width: 92,
89
+ height: 28,
90
+ marginHorizontal: 8
70
91
  }
71
92
  });
72
93
  //# sourceMappingURL=BrandingView.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","Text","useColorScheme","StyleSheet","Image","Pressable","COLORS","openLiveVoiceWebsite","jsx","_jsx","jsxs","_jsxs","BrandingView","props","isDarkMode","openLink","onPress","style","width","alignItems","children","styles","container","text","darkText","lightText","source","require","image","height","tintColor","white","black","resizeMode","create","padding","justifyContent","borderRadius","textAlign","fontSize","fontWeight","marginBottom","color","undefined","aspectRatio"],"sourceRoot":"../../../src","sources":["components/BrandingView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,cAAc,EACdC,UAAU,EACVC,KAAK,EACLC,SAAS,QACJ,cAAc;AAErB,SAASC,MAAM,QAAQ,mBAAgB;AACvC,SAASC,oBAAoB,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMlE,OAAO,MAAMC,YAAqC,GAAIC,KAAK,IAAK;EAC9D,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU,IAAIZ,cAAc,CAAC,CAAC,KAAK,MAAM;EAElE,MAAMa,QAAQ,GAAG,MAAAA,CAAA,KAAY;IAAER,oBAAoB,CAAC,CAAC;EAAE,CAAC;EAExD,oBACEE,IAAA,CAACJ,SAAS;IAACW,OAAO,EAAED,QAAS;IAACE,KAAK,EAAE;MAAEC,KAAK,EAAE,MAAM;MAAEC,UAAU,EAAE;IAAS,CAAE;IAAAC,QAAA,eAC3ET,KAAA,CAACX,IAAI;MAACiB,KAAK,EAAEI,MAAM,CAACC,SAAU;MAAAF,QAAA,gBAC5BX,IAAA,CAACR,IAAI;QAACgB,KAAK,EAAE,CAACI,MAAM,CAACE,IAAI,EAAET,UAAU,GAAGO,MAAM,CAACG,QAAQ,GAAGH,MAAM,CAACI,SAAS,CAAE;QAAAL,QAAA,EAAC;MAE7E,CAAM,CAAC,eACPX,IAAA,CAACL,KAAK;QACJsB,MAAM,EAAEC,OAAO,CAAC,uBAAuB,CAAE;QACzCV,KAAK,EAAE,CACLI,MAAM,CAACO,KAAK,EACZ;UACEC,MAAM,EAAE,EAAE;UACVC,SAAS,EAAEhB,UAAU,GAAGR,MAAM,CAACyB,KAAK,GAAGzB,MAAM,CAAC0B;QAChD,CAAC,CACD;QACFC,UAAU,EAAC;MAAS,CACrB,CAAC;IAAA,CACE;EAAC,CACE,CAAC;AAEhB,CAAC;AAED,MAAMZ,MAAM,GAAGlB,UAAU,CAAC+B,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,OAAO,EAAE,EAAE;IACXhB,UAAU,EAAE,QAAQ;IACpBiB,cAAc,EAAE,QAAQ;IACxBC,YAAY,EAAE,CAAC;IACfnB,KAAK,EAAE;EACT,CAAC;EACDK,IAAI,EAAE;IACJe,SAAS,EAAE,QAAQ;IACnBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,YAAY,EAAE;EAChB,CAAC;EACDjB,QAAQ,EAAE;IACRkB,KAAK,EAAE;EACT,CAAC;EACDjB,SAAS,EAAE;IACTiB,KAAK,EAAE;EACT,CAAC;EACDd,KAAK,EAAE;IACLV,KAAK,EAAE,MAAM;IACbW,MAAM,EAAEc,SAAS;IACjBC,WAAW,EAAE;EACf;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Image","Platform","Pressable","StyleSheet","Text","useColorScheme","openLiveVoiceWebsite","Translations","jsx","_jsx","jsxs","_jsxs","BrandingView","props","scheme","isDarkMode","color","onPress","style","styles","container","children","text","allowFontScaling","OS","streamingByTitle","source","require","logo","tintColor","resizeMode","create","alignSelf","alignItems","padding","textAlign","fontSize","fontWeight","marginBottom","width","height","paddingTop","paddingBottom","paddingHorizontal","lineHeight","letterSpacing","includeFontPadding","marginHorizontal"],"sourceRoot":"../../../src","sources":["components/BrandingView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA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