@zelloptt/react-native-zello-sdk 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -21
- package/app.plugin.js +97 -0
- package/lib/commonjs/docs/assets/highlight.css +16 -9
- package/lib/commonjs/docs/classes/sdk.Zello.html +49 -49
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +10 -10
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +4 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +4 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +11 -11
- package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +13 -13
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +9 -9
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloTranscription.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloTranslation.html +4 -4
- package/lib/commonjs/docs/classes/types.ZelloUser.html +10 -10
- package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +3 -3
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +46 -46
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +4 -4
- package/lib/commonjs/docs/enums/types.ZelloChannelType.html +5 -5
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +4 -4
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +5 -5
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +5 -5
- package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +5 -5
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +6 -6
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +6 -6
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/commonjs/docs/index.html +55 -24
- package/lib/commonjs/docs/interfaces/specs_NativeZelloSdk.Spec.html +31 -31
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +9 -9
- package/lib/commonjs/docs/types/types.ZelloConfig.html +3 -3
- package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +7 -7
- package/lib/commonjs/docs/types/types.ZelloContact.html +4 -4
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +4 -4
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +6 -6
- package/lib/commonjs/docs/types/types.ZelloMessage.html +5 -5
- package/lib/commonjs/docs/variables/specs_NativeZelloSdk.default.html +1 -1
- package/lib/module/docs/assets/highlight.css +16 -9
- package/lib/module/docs/classes/sdk.Zello.html +49 -49
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloChannel.html +10 -10
- package/lib/module/docs/classes/types.ZelloChannelUser.html +4 -4
- package/lib/module/docs/classes/types.ZelloDispatchCall.html +4 -4
- package/lib/module/docs/classes/types.ZelloDispatchChannel.html +11 -11
- package/lib/module/docs/classes/types.ZelloGroupConversation.html +13 -13
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +9 -9
- package/lib/module/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/module/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloTranscription.html +7 -7
- package/lib/module/docs/classes/types.ZelloTranslation.html +4 -4
- package/lib/module/docs/classes/types.ZelloUser.html +10 -10
- package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +3 -3
- package/lib/module/docs/enums/events.ZelloEvent.html +46 -46
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +4 -4
- package/lib/module/docs/enums/types.ZelloChannelType.html +5 -5
- package/lib/module/docs/enums/types.ZelloConnectionError.html +4 -4
- package/lib/module/docs/enums/types.ZelloConnectionState.html +5 -5
- package/lib/module/docs/enums/types.ZelloContactType.html +5 -5
- package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +5 -5
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +3 -3
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +6 -6
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +6 -6
- package/lib/module/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/module/docs/index.html +55 -24
- package/lib/module/docs/interfaces/specs_NativeZelloSdk.Spec.html +31 -31
- package/lib/module/docs/types/types.ZelloChannelOptions.html +9 -9
- package/lib/module/docs/types/types.ZelloConfig.html +3 -3
- package/lib/module/docs/types/types.ZelloConsoleSettings.html +7 -7
- package/lib/module/docs/types/types.ZelloContact.html +4 -4
- package/lib/module/docs/types/types.ZelloCredentials.html +4 -4
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +6 -6
- package/lib/module/docs/types/types.ZelloMessage.html +5 -5
- package/lib/module/docs/variables/specs_NativeZelloSdk.default.html +1 -1
- package/package.json +23 -2
- package/react-native-zello-sdk.podspec +21 -47
- package/scripts/podfile-transform.js +416 -0
- package/scripts/setup-ios.js +248 -0
- package/scripts/zello_pods.rb +128 -0
- package/scripts/zello_sdk_requirement.rb +12 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# CocoaPods helper for @zelloptt/react-native-zello-sdk.
|
|
2
|
+
#
|
|
3
|
+
# The native ZelloSDK is consumed through Swift Package Manager (product `ZelloSDKUmbrella`).
|
|
4
|
+
# `spm_dependency` in the podspec only wires the package into the bridge pod inside
|
|
5
|
+
# Pods.xcodeproj; the app (and its extensions) must also link the dynamic product, and the
|
|
6
|
+
# app must embed it. `zello_post_install` does that in the user's Xcode project.
|
|
7
|
+
#
|
|
8
|
+
# require Pod::Executable.execute_command('node', ['-p',
|
|
9
|
+
# "require.resolve('@zelloptt/react-native-zello-sdk/scripts/zello_pods.rb', {paths: [process.argv[1]]})",
|
|
10
|
+
# __dir__]).strip
|
|
11
|
+
#
|
|
12
|
+
# post_install do |installer|
|
|
13
|
+
# zello_post_install(installer, app_target: 'MyApp', extension_targets: ['NotificationServiceExtension'])
|
|
14
|
+
# react_native_post_install(...)
|
|
15
|
+
# end
|
|
16
|
+
require 'xcodeproj'
|
|
17
|
+
require_relative 'zello_sdk_requirement'
|
|
18
|
+
|
|
19
|
+
ZELLO_EXTENSION_RUNPATH = '@executable_path/../../Frameworks'
|
|
20
|
+
|
|
21
|
+
def zello_post_install(installer, app_target:, extension_targets: [])
|
|
22
|
+
leftover = installer.pod_targets.select { |t| t.pod_name == 'ZelloSDK' }
|
|
23
|
+
unless leftover.empty?
|
|
24
|
+
raise "[react-native-zello-sdk] Pod target(s) #{leftover.map(&:name).join(', ')} found: the native ZelloSDK now comes " \
|
|
25
|
+
"from Swift Package Manager. Remove `pod 'ZelloSDK'` from your Podfile (`npx @zelloptt/react-native-zello-sdk setup-ios` does it for you)."
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
aggregate = installer.aggregate_targets.find { |t| t.user_targets.map(&:name).include?(app_target) }
|
|
29
|
+
user_project = aggregate&.user_project
|
|
30
|
+
raise "[react-native-zello-sdk] App target '#{app_target}' not found in any project integrated by your Podfile." unless user_project
|
|
31
|
+
|
|
32
|
+
app = user_project.targets.find { |t| t.name == app_target }
|
|
33
|
+
extensions = Array(extension_targets).map do |name|
|
|
34
|
+
user_project.targets.find { |t| t.name == name } ||
|
|
35
|
+
raise("[react-native-zello-sdk] Extension target '#{name}' not found in #{File.basename(user_project.path)}.")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
([app] + extensions).each { |t| zello_check_deployment_target!(t) }
|
|
39
|
+
|
|
40
|
+
package = zello_ensure_package_reference(user_project)
|
|
41
|
+
zello_link_product(user_project, app, package, embed: true)
|
|
42
|
+
extensions.each do |ext|
|
|
43
|
+
zello_link_product(user_project, ext, package, embed: false)
|
|
44
|
+
zello_ensure_extension_runpath(ext)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# CocoaPods only saves the user project for targets it integrates, so a no-op install would not persist this.
|
|
48
|
+
user_project.save
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def zello_check_deployment_target!(target)
|
|
52
|
+
minimum = Gem::Version.new(ZELLO_MIN_IOS_VERSION)
|
|
53
|
+
target.resolved_build_setting('IPHONEOS_DEPLOYMENT_TARGET', true).each do |config, value|
|
|
54
|
+
next if value.nil?
|
|
55
|
+
|
|
56
|
+
version = begin
|
|
57
|
+
Gem::Version.new(value.to_s)
|
|
58
|
+
rescue ArgumentError
|
|
59
|
+
next
|
|
60
|
+
end
|
|
61
|
+
next if version >= minimum
|
|
62
|
+
|
|
63
|
+
raise "[react-native-zello-sdk] Target '#{target.name}' (#{config}) has IPHONEOS_DEPLOYMENT_TARGET #{value}; " \
|
|
64
|
+
"ZelloSDK requires iOS #{ZELLO_MIN_IOS_VERSION} or later."
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def zello_ensure_package_reference(project)
|
|
69
|
+
klass = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
|
|
70
|
+
package = project.root_object.package_references.find { |r| r.is_a?(klass) && r.repositoryURL == ZELLO_SDK_URL }
|
|
71
|
+
unless package
|
|
72
|
+
package = project.new(klass)
|
|
73
|
+
package.repositoryURL = ZELLO_SDK_URL
|
|
74
|
+
project.root_object.package_references << package
|
|
75
|
+
end
|
|
76
|
+
package.requirement = ZELLO_SDK_REQUIREMENT.dup if zello_replace_requirement?(package.requirement)
|
|
77
|
+
package
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Keeps an app's own requirement unless it is missing or an `upToNextMajorVersion` below ours.
|
|
81
|
+
def zello_replace_requirement?(current)
|
|
82
|
+
return true if current.nil? || current.empty?
|
|
83
|
+
return false unless current['kind'] == ZELLO_SDK_REQUIREMENT['kind']
|
|
84
|
+
|
|
85
|
+
Gem::Version.new(current['minimumVersion'].to_s) < Gem::Version.new(ZELLO_SDK_REQUIREMENT['minimumVersion'])
|
|
86
|
+
rescue ArgumentError
|
|
87
|
+
false
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def zello_link_product(project, target, package, embed:)
|
|
91
|
+
dependency = target.package_product_dependencies.find { |d| d.product_name == ZELLO_SDK_PRODUCT && d.package == package }
|
|
92
|
+
unless dependency
|
|
93
|
+
dependency = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
94
|
+
dependency.product_name = ZELLO_SDK_PRODUCT
|
|
95
|
+
dependency.package = package
|
|
96
|
+
target.package_product_dependencies << dependency
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
unless target.frameworks_build_phase.files.any? { |f| f.product_ref == dependency }
|
|
100
|
+
build_file = project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
|
101
|
+
build_file.product_ref = dependency
|
|
102
|
+
target.frameworks_build_phase.files << build_file
|
|
103
|
+
end
|
|
104
|
+
return unless embed
|
|
105
|
+
|
|
106
|
+
phase = target.copy_files_build_phases.find { |p| p.name == 'Embed Frameworks' && p.dst_subfolder_spec == '10' }
|
|
107
|
+
unless phase
|
|
108
|
+
phase = target.new_copy_files_build_phase('Embed Frameworks')
|
|
109
|
+
phase.dst_subfolder_spec = '10'
|
|
110
|
+
end
|
|
111
|
+
return if phase.files.any? { |f| f.product_ref == dependency }
|
|
112
|
+
|
|
113
|
+
build_file = project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
|
114
|
+
build_file.product_ref = dependency
|
|
115
|
+
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] }
|
|
116
|
+
phase.files << build_file
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Extensions link the product but do not embed it; it is loaded from the host app's Frameworks directory.
|
|
120
|
+
def zello_ensure_extension_runpath(target)
|
|
121
|
+
target.build_configurations.each do |config|
|
|
122
|
+
paths = config.build_settings['LD_RUNPATH_SEARCH_PATHS'] || ['$(inherited)']
|
|
123
|
+
next if Array(paths.is_a?(String) ? paths.split : paths).include?(ZELLO_EXTENSION_RUNPATH)
|
|
124
|
+
|
|
125
|
+
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] =
|
|
126
|
+
paths.is_a?(String) ? "#{paths} #{ZELLO_EXTENSION_RUNPATH}" : paths + [ZELLO_EXTENSION_RUNPATH]
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Single source of truth for the native ZelloSDK Swift package requirement.
|
|
2
|
+
# Loaded by both the podspec (Pods.xcodeproj) and scripts/zello_pods.rb (app
|
|
3
|
+
# project); the URL must be byte-identical in both projects, otherwise Xcode
|
|
4
|
+
# reports "package is required using two different URLs".
|
|
5
|
+
#
|
|
6
|
+
# The podspec is evaluated more than once per process, hence the guards.
|
|
7
|
+
ZELLO_SDK_URL = 'https://github.com/zelloptt/ios-mobile-sdk' unless defined?(ZELLO_SDK_URL)
|
|
8
|
+
ZELLO_SDK_PRODUCT = 'ZelloSDKUmbrella' unless defined?(ZELLO_SDK_PRODUCT)
|
|
9
|
+
unless defined?(ZELLO_SDK_REQUIREMENT)
|
|
10
|
+
ZELLO_SDK_REQUIREMENT = { 'kind' => 'upToNextMajorVersion', 'minimumVersion' => '3.3.2' }.freeze
|
|
11
|
+
end
|
|
12
|
+
ZELLO_MIN_IOS_VERSION = '17.0' unless defined?(ZELLO_MIN_IOS_VERSION)
|