pindo 5.10.0 → 5.10.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cdc8a89f4c819c3b2fb36d8f6ef7a09ab3ff847a9d326afb7fbfaad146f81c4b
|
|
4
|
+
data.tar.gz: 79f7efef8bfa4a2dda00e02f545f52496c770a50f6e99174080f89fb056724e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b571d2e04fe5c1819d0f514c26fb8b0cb0d42f3a08b0543cde030a26cd47e67bd526e3737812d96b31128aeaa61da788982933af09c6f7a52b29411bad7e5dc
|
|
7
|
+
data.tar.gz: 527c09daf610e695b3794c58f723d881a8ef6b7d4d1353a498c6d35d0fe49ab2ca5005174b385b8b015b23e738ceba0d843507e714df1d52ff0fb2aff6ee461e
|
|
@@ -177,6 +177,15 @@ module Pindo
|
|
|
177
177
|
|
|
178
178
|
Pindo::Command::Deploy::Cert::run(args_temp)
|
|
179
179
|
|
|
180
|
+
# 根据证书配置后的实际 Bundle ID 重新更新 URL Schemes
|
|
181
|
+
# 因为 Cert::run 可能会修改 PRODUCT_BUNDLE_IDENTIFIER
|
|
182
|
+
if @args_upload_flag && workflow_info && workflow_info[:package_name]
|
|
183
|
+
Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
|
|
184
|
+
project_dir: project_dir,
|
|
185
|
+
package_name: workflow_info[:package_name]
|
|
186
|
+
)
|
|
187
|
+
end
|
|
188
|
+
|
|
180
189
|
Dir.chdir(project_dir)
|
|
181
190
|
Pindo::Command::Deploy::Build::run(args_temp)
|
|
182
191
|
|
|
@@ -268,6 +268,13 @@ module Pindo
|
|
|
268
268
|
|
|
269
269
|
Pindo::Command::Deploy::Cert::run(args_temp)
|
|
270
270
|
|
|
271
|
+
# 根据证书配置后的实际 Bundle ID 重新更新 URL Schemes
|
|
272
|
+
# 因为 Cert::run 可能会修改 PRODUCT_BUNDLE_IDENTIFIER
|
|
273
|
+
Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
|
|
274
|
+
project_dir: pindo_project_dir,
|
|
275
|
+
package_name: package_name
|
|
276
|
+
)
|
|
277
|
+
|
|
271
278
|
Dir.chdir(pindo_project_dir)
|
|
272
279
|
Pindo::Command::Deploy::Build::run(args_temp)
|
|
273
280
|
|
|
@@ -135,6 +135,12 @@ module Pindo
|
|
|
135
135
|
package_name: package_name,
|
|
136
136
|
project_id: project_id
|
|
137
137
|
)
|
|
138
|
+
|
|
139
|
+
# 根据实际的 Bundle ID 更新 URL Schemes
|
|
140
|
+
Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
|
|
141
|
+
project_dir: pindo_project_dir,
|
|
142
|
+
package_name: package_name
|
|
143
|
+
)
|
|
138
144
|
else
|
|
139
145
|
raise Informative, "未获取到工作流信息"
|
|
140
146
|
end
|
data/lib/pindo/command/ios.rb
CHANGED
|
@@ -8,8 +8,10 @@ module Pindo
|
|
|
8
8
|
|
|
9
9
|
class XcodeBuildConfig
|
|
10
10
|
|
|
11
|
-
# 使用package_name一次性更新Display Name、Bundle ID和URL Schemes
|
|
11
|
+
# 使用package_name一次性更新Display Name、Bundle ID和URL Schemes(基于package_name)
|
|
12
12
|
# 优化版本:只读写一次plist文件,提高性能
|
|
13
|
+
# 注意:此函数只添加基于package_name的URL Scheme,基于实际Bundle ID的URL Scheme
|
|
14
|
+
# 将在update_url_schemes_with_bundleid函数中统一添加(在证书配置之后)
|
|
13
15
|
# @param project_dir [String] iOS项目目录路径
|
|
14
16
|
# @param package_name [String] 工作流的package_name(如:"Test Demo")
|
|
15
17
|
# @param project_id [String] JPS项目ID(可选,用于添加快捷操作)
|
|
@@ -23,7 +25,6 @@ module Pindo
|
|
|
23
25
|
bundle_id_suffix = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
|
|
24
26
|
final_bundle_id = "com.heroneverdie101.#{bundle_id_suffix}"
|
|
25
27
|
package_scheme = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
|
|
26
|
-
bundle_scheme = final_bundle_id.gsub(/[^a-zA-Z0-9]/, '').downcase
|
|
27
28
|
|
|
28
29
|
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
|
29
30
|
return false if project_fullname.nil?
|
|
@@ -58,15 +59,11 @@ module Pindo
|
|
|
58
59
|
info_plist_dict["CFBundleURLTypes"] ||= []
|
|
59
60
|
|
|
60
61
|
# 添加基于 package_name 的 URL Scheme
|
|
62
|
+
# 注意:基于 Bundle ID 的 URL Scheme 将在 update_url_schemes_with_bundleid 函数中统一添加
|
|
61
63
|
if add_single_scheme(info_plist_dict, package_scheme)
|
|
62
64
|
puts " ✓ 已添加URL Scheme: #{package_scheme} (基于 Package Name)"
|
|
63
65
|
end
|
|
64
66
|
|
|
65
|
-
# 添加基于 Bundle ID 的 URL Scheme
|
|
66
|
-
if add_single_scheme(info_plist_dict, bundle_scheme)
|
|
67
|
-
puts " ✓ 已添加URL Scheme: #{bundle_scheme} (基于 Bundle ID)"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
67
|
# 4. 添加 JPS 快捷操作(UIApplicationShortcutItems)
|
|
71
68
|
if project_id && !project_id.to_s.empty?
|
|
72
69
|
# 创建或获取 UIApplicationShortcutItems 数组
|
|
@@ -74,22 +71,33 @@ module Pindo
|
|
|
74
71
|
|
|
75
72
|
# 构建快捷操作类型
|
|
76
73
|
shortcut_type = "jps_project?#{project_id}"
|
|
74
|
+
jps_title = "访问 JPS 详情"
|
|
77
75
|
|
|
78
|
-
#
|
|
76
|
+
# 先查找是否存在标题为"访问 JPS 详情"的快捷操作(无论其 type 是什么)
|
|
79
77
|
existing_shortcut = info_plist_dict["UIApplicationShortcutItems"].find do |item|
|
|
80
|
-
item["
|
|
78
|
+
item["UIApplicationShortcutItemTitle"] == jps_title
|
|
81
79
|
end
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
if existing_shortcut
|
|
82
|
+
# 如果存在,检查 type 是否一致
|
|
83
|
+
if existing_shortcut["UIApplicationShortcutItemType"] == shortcut_type
|
|
84
|
+
puts " ✓ JPS 快捷操作已存在: #{shortcut_type}"
|
|
85
|
+
else
|
|
86
|
+
# type 不一致,更新为新的 type
|
|
87
|
+
old_type = existing_shortcut["UIApplicationShortcutItemType"]
|
|
88
|
+
existing_shortcut["UIApplicationShortcutItemType"] = shortcut_type
|
|
89
|
+
existing_shortcut["UIApplicationShortcutItemIconType"] = "UIApplicationShortcutIconTypeBookmark"
|
|
90
|
+
puts " ✓ 已更新 JPS 快捷操作: #{old_type} -> #{shortcut_type}"
|
|
91
|
+
end
|
|
92
|
+
else
|
|
93
|
+
# 不存在,添加新的快捷操作
|
|
84
94
|
jps_shortcut = {
|
|
85
95
|
"UIApplicationShortcutItemType" => shortcut_type,
|
|
86
|
-
"UIApplicationShortcutItemTitle" =>
|
|
96
|
+
"UIApplicationShortcutItemTitle" => jps_title,
|
|
87
97
|
"UIApplicationShortcutItemIconType" => "UIApplicationShortcutIconTypeBookmark"
|
|
88
98
|
}
|
|
89
99
|
info_plist_dict["UIApplicationShortcutItems"] << jps_shortcut
|
|
90
100
|
puts " ✓ 已添加 JPS 快捷操作: #{shortcut_type}"
|
|
91
|
-
else
|
|
92
|
-
puts " ✓ JPS 快捷操作已存在: #{shortcut_type}"
|
|
93
101
|
end
|
|
94
102
|
end
|
|
95
103
|
|
|
@@ -109,6 +117,76 @@ module Pindo
|
|
|
109
117
|
return true
|
|
110
118
|
end
|
|
111
119
|
|
|
120
|
+
# 根据当前项目中的实际 Bundle ID 重新更新 URL Schemes
|
|
121
|
+
# 此函数用于在证书配置后更新 URL Schemes,确保与最终的 Bundle ID 匹配
|
|
122
|
+
# @param project_dir [String] iOS项目目录路径
|
|
123
|
+
# @param package_name [String] 工作流的package_name(如:"Test Demo")
|
|
124
|
+
# @return [Boolean] 是否成功更新
|
|
125
|
+
def self.update_url_schemes_with_bundleid(project_dir: nil, package_name: nil)
|
|
126
|
+
raise ArgumentError, "项目目录不能为空" if project_dir.nil?
|
|
127
|
+
|
|
128
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
|
129
|
+
return false if project_fullname.nil?
|
|
130
|
+
|
|
131
|
+
info_plist_path = nil
|
|
132
|
+
current_bundle_id = nil
|
|
133
|
+
|
|
134
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
|
135
|
+
project_obj.targets.each do |target|
|
|
136
|
+
if target.product_type.to_s.eql?("com.apple.product-type.application")
|
|
137
|
+
temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
|
|
138
|
+
if temp_info_file && !temp_info_file.empty?
|
|
139
|
+
info_plist_path = File.join(project_dir, temp_info_file)
|
|
140
|
+
end
|
|
141
|
+
# 获取当前实际的 Bundle ID
|
|
142
|
+
current_bundle_id = target.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
|
143
|
+
break # 找到第一个application target即可
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
return false unless info_plist_path && File.exist?(info_plist_path)
|
|
148
|
+
return false unless current_bundle_id && !current_bundle_id.empty?
|
|
149
|
+
|
|
150
|
+
puts "\n根据更新后的 Bundle ID 重新配置 URL Schemes:"
|
|
151
|
+
puts " 当前 Bundle ID: #{current_bundle_id}"
|
|
152
|
+
|
|
153
|
+
# 读取 plist
|
|
154
|
+
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
|
155
|
+
info_plist_dict["CFBundleURLTypes"] ||= []
|
|
156
|
+
|
|
157
|
+
# 生成 schemes
|
|
158
|
+
package_scheme = package_name ? package_name.gsub(/[^a-zA-Z0-9]/, '').downcase : nil
|
|
159
|
+
bundle_scheme = current_bundle_id.gsub(/[^a-zA-Z0-9]/, '').downcase
|
|
160
|
+
|
|
161
|
+
schemes_updated = []
|
|
162
|
+
|
|
163
|
+
# 添加基于 package_name 的 URL Scheme(如果提供了 package_name)
|
|
164
|
+
if package_scheme && !package_scheme.empty?
|
|
165
|
+
if add_single_scheme(info_plist_dict, package_scheme)
|
|
166
|
+
schemes_updated << package_scheme
|
|
167
|
+
puts " ✓ 已更新 URL Scheme: #{package_scheme} (基于 Package Name)"
|
|
168
|
+
else
|
|
169
|
+
puts " ✓ URL Scheme 已存在: #{package_scheme} (基于 Package Name)"
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# 添加基于实际 Bundle ID 的 URL Scheme
|
|
174
|
+
if add_single_scheme(info_plist_dict, bundle_scheme)
|
|
175
|
+
schemes_updated << bundle_scheme
|
|
176
|
+
puts " ✓ 已更新 URL Scheme: #{bundle_scheme} (基于更新后的 Bundle ID)"
|
|
177
|
+
else
|
|
178
|
+
puts " ✓ URL Scheme 已存在: #{bundle_scheme} (基于更新后的 Bundle ID)"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# 写入 plist
|
|
182
|
+
if schemes_updated.any?
|
|
183
|
+
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
|
184
|
+
puts " ✓ URL Schemes 更新完成"
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
return true
|
|
188
|
+
end
|
|
189
|
+
|
|
112
190
|
# 添加URL Schemes到iOS工程的Info.plist
|
|
113
191
|
# @param project_dir [String] iOS项目目录路径
|
|
114
192
|
# @param scheme_name [String] 要添加的scheme名称(可选)
|
data/lib/pindo/version.rb
CHANGED