react-native-beidou 1.0.2 → 1.0.4
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/BeiDouAIDLTestPage.tsx +710 -0
- package/Compass.android.tsx +20 -0
- package/TestPage.ts +6 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +3 -0
- package/android/src/main/AndroidManifest.xml +7 -0
- package/android/src/main/java/com/cmcc_rn_module/BeiDouBluetoothModule.java +343 -101
- package/android/src/main/java/com/cmcc_rn_module/BeiDouBluetoothPackage.java +4 -1
- package/android/src/main/java/com/cmcc_rn_module/ChatDBManager.java +306 -0
- package/android/src/main/java/com/cmcc_rn_module/JsonUtil.java +113 -7
- package/android/src/main/java/com/cmcc_rn_module/view/CompassManager.java +41 -0
- package/android/src/main/java/com/cmcc_rn_module/view/CompassView.java +277 -0
- package/android/src/main/libs/bluetooth-sdk.aar +0 -0
- package/index.ts +188 -10
- package/ios/BDTCompassViewManager.h +15 -0
- package/ios/BDTCompassViewManager.m +24 -0
- package/ios/BeiDouBluetoothModule.h +20 -0
- package/ios/BeiDouBluetoothModule.m +424 -0
- package/ios/BeidouBluetooth.framework/BeidouBluetooth +0 -0
- package/ios/BeidouBluetooth.framework/Headers/BDTBluetoothManager.h +76 -0
- package/ios/BeidouBluetooth.framework/Headers/BDTChatDBManager.h +41 -0
- package/ios/BeidouBluetooth.framework/Headers/BDTDataPacketBuilder.h +62 -0
- package/ios/BeidouBluetooth.framework/Headers/BeidouBluetooth.h +21 -0
- package/ios/BeidouBluetooth.framework/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/Modules/module.modulemap +6 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeResources +177 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/CompassView.h +20 -0
- package/ios/CompassView.m +201 -0
- package/package.json +5 -2
- package/android/.gradle/8.8/checksums/checksums.lock +0 -0
- package/android/.gradle/8.8/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.8/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.8/gc.properties +0 -0
- package/ios/Podfile +0 -79
- package/ios/build_sdk.sh +0 -30
- package/ios/cmcc_rn_module/AppDelegate.h +0 -8
- package/ios/cmcc_rn_module/AppDelegate.mm +0 -108
- package/ios/cmcc_rn_module/CMCCAssetsLoaderModule.h +0 -17
- package/ios/cmcc_rn_module/CMCCAssetsLoaderModule.m +0 -38
- package/ios/cmcc_rn_module/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/ios/cmcc_rn_module/Images.xcassets/Contents.json +0 -6
- package/ios/cmcc_rn_module/Info.plist +0 -62
- package/ios/cmcc_rn_module/LaunchScreen.storyboard +0 -47
- package/ios/cmcc_rn_module/main.m +0 -10
- package/ios/cmcc_rn_module.xcodeproj/project.pbxproj +0 -708
- package/ios/cmcc_rn_module.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/cmcc_rn_module.xcodeproj/xcshareddata/xcschemes/cmcc_rn_module.xcscheme +0 -88
- package/ios/cmcc_rn_module.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/cmcc_rn_module.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/cmcc_rn_moduleTests/Info.plist +0 -24
- package/ios/cmcc_rn_moduleTests/cmcc_rn_moduleTests.m +0 -66
- package/ios/reset_env.sh +0 -24
- package/ios/scripts/RNReanimated.podspec +0 -90
- package/ios/scripts/generate_dynamic_pod.rb +0 -166
- package/ios/scripts/native_modules_dy.rb +0 -317
- package/ios/scripts/react_native_pods_dy.rb +0 -773
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
# This is a function which is used inside your Podfile.
|
|
2
|
-
#
|
|
3
|
-
# It uses `react-native config` to grab a list of dependencies, and pulls out
|
|
4
|
-
# all of the ones which declare themselves to be iOS/macOS dependencies (by
|
|
5
|
-
# virtue of having a Podspec) and automatically imports those into your current
|
|
6
|
-
# target.
|
|
7
|
-
#
|
|
8
|
-
# See the `IOSNativeModulesConfig` interface in `cli-types/src/ios.ts` to
|
|
9
|
-
# understand what the input data should look like. Be sure to update that file
|
|
10
|
-
# in lock-step with additional data being used here.
|
|
11
|
-
|
|
12
|
-
require 'pathname'
|
|
13
|
-
require 'cocoapods'
|
|
14
|
-
|
|
15
|
-
def use_native_modules!(config = nil)
|
|
16
|
-
if (config.is_a? String)
|
|
17
|
-
Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.",
|
|
18
|
-
[
|
|
19
|
-
"CLI detects root of the project automatically. The \"#{config}\" argument was ignored.",
|
|
20
|
-
]);
|
|
21
|
-
config = nil;
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects
|
|
25
|
-
cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}"
|
|
26
|
-
cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip
|
|
27
|
-
|
|
28
|
-
if (!config)
|
|
29
|
-
json = []
|
|
30
|
-
|
|
31
|
-
IO.popen(["node", cli_bin, "config"]) do |data|
|
|
32
|
-
while line = data.gets
|
|
33
|
-
json << line
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
config = JSON.parse(json.join("\n"))
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
project_root = Pathname.new(config["project"]["ios"]["sourceDir"])
|
|
41
|
-
|
|
42
|
-
packages = config["dependencies"]
|
|
43
|
-
found_pods = []
|
|
44
|
-
|
|
45
|
-
# 每次重新pod install 先删除dynamic_pod
|
|
46
|
-
output_file = "rn_dynamic_pod.rb"
|
|
47
|
-
# pod_content = "def react_native_dynamic_pod()\n"
|
|
48
|
-
# pod_names = ""
|
|
49
|
-
if File.exist?(output_file)
|
|
50
|
-
puts "\033[32m旧 [#{output_file}] 删除完成\033[0m"
|
|
51
|
-
File.delete(output_file)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
remove_pod_dir
|
|
55
|
-
|
|
56
|
-
packages.each do |package_name, package|
|
|
57
|
-
next unless package_config = package["platforms"]["ios"]
|
|
58
|
-
|
|
59
|
-
podspec_path = package_config["podspecPath"]
|
|
60
|
-
configurations = package_config["configurations"]
|
|
61
|
-
|
|
62
|
-
# Add a warning to the queue and continue to the next dependency if the podspec_path is nil/empty
|
|
63
|
-
if podspec_path.nil? || podspec_path.empty?
|
|
64
|
-
Pod::UI.warn("use_native_modules! skipped the react-native dependency '#{package["name"]}'. No podspec file was found.",
|
|
65
|
-
[
|
|
66
|
-
"Check to see if there is an updated version that contains the necessary podspec file",
|
|
67
|
-
"Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec",
|
|
68
|
-
"If necessary, you can disable autolinking for the dependency and link it manually. See https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library"
|
|
69
|
-
])
|
|
70
|
-
end
|
|
71
|
-
next if podspec_path.nil? || podspec_path.empty?
|
|
72
|
-
|
|
73
|
-
spec = Pod::Specification.from_file(podspec_path)
|
|
74
|
-
|
|
75
|
-
# Skip pods that do not support the platform of the current target.
|
|
76
|
-
if platform = current_target_definition.platform
|
|
77
|
-
next unless spec.supported_on_platform?(platform.name)
|
|
78
|
-
else
|
|
79
|
-
# TODO: In a future RN version we should update the Podfile template and
|
|
80
|
-
# enable this assertion.
|
|
81
|
-
#
|
|
82
|
-
# raise Pod::Informative, "Cannot invoke `use_native_modules!` before defining the supported `platform`"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# We want to do a look up inside the current CocoaPods target
|
|
86
|
-
# to see if it's already included, this:
|
|
87
|
-
# 1. Gives you the chance to define it beforehand
|
|
88
|
-
# 2. Ensures CocoaPods won't explode if it's included twice
|
|
89
|
-
#
|
|
90
|
-
this_target = current_target_definition
|
|
91
|
-
existing_deps = current_target_definition.dependencies
|
|
92
|
-
|
|
93
|
-
# Skip dependencies that the user already activated themselves.
|
|
94
|
-
next if existing_deps.find do |existing_dep|
|
|
95
|
-
existing_dep.name.split('/').first == spec.name
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
podspec_dir_path = Pathname.new(File.dirname(podspec_path))
|
|
99
|
-
|
|
100
|
-
relative_path = podspec_dir_path.relative_path_from project_root
|
|
101
|
-
pod spec.name, :path => relative_path.to_path, :configurations => configurations
|
|
102
|
-
|
|
103
|
-
# 判断pod configurations
|
|
104
|
-
configurations_str = (configurations.nil? || configurations.empty?) ? "" : ", :configurations => #{configurations}"
|
|
105
|
-
|
|
106
|
-
# 转为字符串
|
|
107
|
-
pod_content = " pod '#{spec.name}', :path => '#{relative_path.to_path}'#{configurations_str}\n"
|
|
108
|
-
|
|
109
|
-
# 将pod库拷贝到sdk下
|
|
110
|
-
copy_pod_to_project_native(relative_path.to_path)
|
|
111
|
-
|
|
112
|
-
# 将../node_modules替换为环境变量路径
|
|
113
|
-
pod_content = replace_pod_path_native!(pod_content)
|
|
114
|
-
|
|
115
|
-
# 生成dynamic podfile
|
|
116
|
-
output_dynamic_pod(output_file, pod_content)
|
|
117
|
-
|
|
118
|
-
if package_config["scriptPhases"] && !this_target.abstract?
|
|
119
|
-
# Can be either an object, or an array of objects
|
|
120
|
-
Array(package_config["scriptPhases"]).each do |phase|
|
|
121
|
-
# see https://www.rubydoc.info/gems/cocoapods-core/Pod/Podfile/DSL#script_phase-instance_method
|
|
122
|
-
# for the full object keys
|
|
123
|
-
Pod::UI.puts "Adding a custom script phase for Pod #{spec.name}: #{phase["name"] || 'No name specified.'}"
|
|
124
|
-
|
|
125
|
-
# Support passing in a path relative to the root of the package
|
|
126
|
-
if phase["path"]
|
|
127
|
-
phase["script"] = File.read(File.expand_path(phase["path"], package["root"]))
|
|
128
|
-
phase.delete("path")
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Support converting the execution position into a symbol
|
|
132
|
-
if phase["execution_position"]
|
|
133
|
-
phase["execution_position"] = phase["execution_position"].to_sym
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
phase = Hash[phase.map { |k, v| [k.to_sym, v] }]
|
|
137
|
-
script_phase phase
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
found_pods.push spec
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
if found_pods.size > 0
|
|
145
|
-
pods = found_pods.map { |p| p.name }.sort.to_sentence
|
|
146
|
-
Pod::UI.puts "Auto-linking React Native #{"module".pluralize(found_pods.size)} for target `#{current_target_definition.name}`: #{pods}"
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
absolute_react_native_path = Pathname.new(config["reactNativePath"])
|
|
150
|
-
|
|
151
|
-
{ :reactNativePath => absolute_react_native_path.relative_path_from(project_root).to_s }
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
$dynamic_pod_path = "#{$dynamic_pod_pre_dir}/dynamic_pod"
|
|
155
|
-
|
|
156
|
-
# 事先删除pod目录
|
|
157
|
-
def remove_pod_dir()
|
|
158
|
-
|
|
159
|
-
# 未开启 || Pod Path为空 直接退出该流程
|
|
160
|
-
if ENV['DYNAMIC_POD_ENABLED'].nil? || ENV['DYNAMIC_POD_ENABLED'] != "true" || ENV['DYNAMIC_POD_PATH'].nil? || ENV['DYNAMIC_POD_PATH'].empty?
|
|
161
|
-
return
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
dir_items = ENV['DYNAMIC_POD_PATH'].split(',')
|
|
165
|
-
|
|
166
|
-
dir_items.each do |item|
|
|
167
|
-
if File.exist?(item)
|
|
168
|
-
|
|
169
|
-
# 拼接目录
|
|
170
|
-
des_dir = File.join(item, $dynamic_pod_path)
|
|
171
|
-
|
|
172
|
-
# 删除目录
|
|
173
|
-
if Dir.exist?(des_dir)
|
|
174
|
-
FileUtils.rm_r(des_dir)
|
|
175
|
-
end
|
|
176
|
-
else
|
|
177
|
-
puts "\033[33m[可忽略][#{item}] 工程目录不存在\033[0m"
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# 将pod库拷贝到工程目录下
|
|
183
|
-
def copy_pod_to_project_native(relative_path)
|
|
184
|
-
|
|
185
|
-
# 未开启 || Pod Path为空 直接退出该流程
|
|
186
|
-
if ENV['DYNAMIC_POD_ENABLED'].nil? || ENV['DYNAMIC_POD_ENABLED'] != "true" || ENV['DYNAMIC_POD_PATH'].nil? || ENV['DYNAMIC_POD_PATH'].empty?
|
|
187
|
-
return
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
dir_items = ENV['DYNAMIC_POD_PATH'].split(',')
|
|
191
|
-
|
|
192
|
-
dir_items.each do |item|
|
|
193
|
-
if File.exist?(item)
|
|
194
|
-
|
|
195
|
-
# 拼接目录
|
|
196
|
-
des_dir = File.join(item, $dynamic_pod_path)
|
|
197
|
-
|
|
198
|
-
# 目录不存在创建
|
|
199
|
-
unless Dir.exist?(des_dir)
|
|
200
|
-
FileUtils.mkdir_p(des_dir)
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
# 替换路径
|
|
204
|
-
des_dir = relative_path.sub('../node_modules', des_dir)
|
|
205
|
-
|
|
206
|
-
unless Dir.exist?(des_dir)
|
|
207
|
-
# 创建目录
|
|
208
|
-
FileUtils.mkdir_p(des_dir)
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
begin
|
|
212
|
-
# 删除已存在目录
|
|
213
|
-
FileUtils.rm_r(des_dir)
|
|
214
|
-
# 拷贝新内容
|
|
215
|
-
FileUtils.cp_r(relative_path, des_dir)
|
|
216
|
-
# merge_directories(relative_path, des_dir)
|
|
217
|
-
puts "\033[32mCopying #{relative_path} >> #{des_dir}\033[0m"
|
|
218
|
-
rescue StandardError => e
|
|
219
|
-
puts "\033[33m[可忽略] Copying fail #{relative_path} >> #{des_dir}\033[0m"
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
else
|
|
223
|
-
puts "\033[33m[可忽略][#{item}] 工程目录不存在\033[0m"
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
# 合并拷贝
|
|
229
|
-
def merge_directories(source, target)
|
|
230
|
-
FileUtils.mkdir_p(target) unless File.exist?(target)
|
|
231
|
-
Dir["#{source}/**/*"].each do |entry|
|
|
232
|
-
next if entry == source || File.basename(entry) == '.'
|
|
233
|
-
target_entry = entry.sub(source, target)
|
|
234
|
-
if File.directory?(entry)
|
|
235
|
-
FileUtils.mkdir_p(target_entry)
|
|
236
|
-
merge_directories(entry, target_entry)
|
|
237
|
-
else
|
|
238
|
-
FileUtils.cp_r(entry, target_entry)
|
|
239
|
-
end
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
# 将../node_modules替换为环境变量路径
|
|
244
|
-
def replace_pod_path_native!(pod_content)
|
|
245
|
-
pod_content = pod_content.sub('../node_modules', $dynamic_pod_path)
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
# 生成dynamic podfile
|
|
249
|
-
def output_dynamic_pod(output_file, pod_content)
|
|
250
|
-
lines = []
|
|
251
|
-
if File.exist?(output_file)
|
|
252
|
-
File.open(output_file, 'r') do |file|
|
|
253
|
-
while line = file.gets
|
|
254
|
-
lines << line unless line == 'end' # 如果不是文件的最后一行,则添加到数组中
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
header_content = "def react_native_dynamic_pod()"
|
|
260
|
-
write_content = true
|
|
261
|
-
if !lines[0].nil? && lines[0].include?(header_content)
|
|
262
|
-
write_content = false
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
# 写入除最后一行之外的所有行到新文件(或覆盖原文件)
|
|
266
|
-
File.open(output_file, 'w') do |file|
|
|
267
|
-
# 写入方法名
|
|
268
|
-
if write_content
|
|
269
|
-
file.write("#{header_content}\n")
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
# 写入之前内容
|
|
273
|
-
lines.each do |line|
|
|
274
|
-
file.write(line)
|
|
275
|
-
end
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
# 追加写入dynamic_pod中
|
|
279
|
-
File.open(output_file, 'a') do |file|
|
|
280
|
-
file.write("#{pod_content}end")
|
|
281
|
-
file.fsync
|
|
282
|
-
puts "\033[32mWirting #{pod_content.gsub("\n","").gsub("\s","")}\033[0m"
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
|
|
286
|
-
# You can run the tests for this file by running:
|
|
287
|
-
# $ yarn jest packages/platform-ios/src/config/__tests__/native_modules.test.ts
|
|
288
|
-
if $0 == __FILE__
|
|
289
|
-
require "json"
|
|
290
|
-
runInput = JSON.parse(ARGF.read)
|
|
291
|
-
|
|
292
|
-
unless runInput["captureStdout"]
|
|
293
|
-
Pod::Config.instance.silent = true
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
return_values = []
|
|
297
|
-
|
|
298
|
-
podfile = Pod::Podfile.new do
|
|
299
|
-
if runInput["podsActivatedByUser"]
|
|
300
|
-
runInput["podsActivatedByUser"].each do |name|
|
|
301
|
-
pod(name)
|
|
302
|
-
end
|
|
303
|
-
end
|
|
304
|
-
target 'iOS Target' do
|
|
305
|
-
platform :ios
|
|
306
|
-
return_values[0] = use_native_modules!(runInput["dependencyConfig"])
|
|
307
|
-
end
|
|
308
|
-
target 'macOS Target' do
|
|
309
|
-
platform :osx
|
|
310
|
-
return_values[1] = use_native_modules!(runInput["dependencyConfig"])
|
|
311
|
-
end
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
unless runInput["captureStdout"]
|
|
315
|
-
puts podfile.to_hash.merge({ "return_values": return_values }).to_json
|
|
316
|
-
end
|
|
317
|
-
end
|