pindo 4.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/pindo +35 -0
- data/lib/pindo/base/aeshelper.rb +31 -0
- data/lib/pindo/base/deviceinfo.rb +90 -0
- data/lib/pindo/base/executable.rb +224 -0
- data/lib/pindo/base/githelper.rb +489 -0
- data/lib/pindo/base/hashhelper.rb +134 -0
- data/lib/pindo/base/plaininformative.rb +15 -0
- data/lib/pindo/base/plistbuddyexecutable.rb +121 -0
- data/lib/pindo/base/standarderror.rb +14 -0
- data/lib/pindo/client/applovinclient.rb +156 -0
- data/lib/pindo/client/aws3sclient.rb +183 -0
- data/lib/pindo/client/bossclient.rb +229 -0
- data/lib/pindo/client/bossconfigclient.rb +175 -0
- data/lib/pindo/client/giteeclient.rb +65 -0
- data/lib/pindo/client/httpclient.rb +40 -0
- data/lib/pindo/client/pgyerclient.rb +439 -0
- data/lib/pindo/client/tgateclient.rb +103 -0
- data/lib/pindo/command.rb +101 -0
- data/lib/pindo/config/pindoconfig.rb +439 -0
- data/lib/pindo/config/pindouserlocalconfig.rb +81 -0
- data/lib/pindo/deploy/Fastfile +233 -0
- data/lib/pindo/deploy/build.rb +167 -0
- data/lib/pindo/deploy/bundleid.rb +245 -0
- data/lib/pindo/deploy/cert.rb +508 -0
- data/lib/pindo/deploy/check.rb +79 -0
- data/lib/pindo/deploy/configproj.rb +89 -0
- data/lib/pindo/deploy/confusecode.rb +248 -0
- data/lib/pindo/deploy/confuseproj.rb +112 -0
- data/lib/pindo/deploy/fabric.rb +58 -0
- data/lib/pindo/deploy/getitcinfo.rb +248 -0
- data/lib/pindo/deploy/iap.rb +796 -0
- data/lib/pindo/deploy/initconfig.rb +128 -0
- data/lib/pindo/deploy/itcapp.rb +147 -0
- data/lib/pindo/deploy/itcinfo.rb +369 -0
- data/lib/pindo/deploy/pem.rb +55 -0
- data/lib/pindo/deploy/pullconfig.rb +46 -0
- data/lib/pindo/deploy/pushconfig.rb +83 -0
- data/lib/pindo/deploy/quswark.rb +146 -0
- data/lib/pindo/deploy/quswauth.rb +67 -0
- data/lib/pindo/deploy/reportbug.rb +135 -0
- data/lib/pindo/deploy/resign.rb +338 -0
- data/lib/pindo/deploy/tag.rb +108 -0
- data/lib/pindo/deploy/updateconfig.rb +129 -0
- data/lib/pindo/deploy/uploadipa.rb +63 -0
- data/lib/pindo/deploy.rb +44 -0
- data/lib/pindo/dev/autobuild.rb +204 -0
- data/lib/pindo/dev/autoresign.rb +186 -0
- data/lib/pindo/dev/confusecode.rb +127 -0
- data/lib/pindo/dev/confuseproj.rb +111 -0
- data/lib/pindo/dev/createbuild.rb +159 -0
- data/lib/pindo/dev/debug.rb +141 -0
- data/lib/pindo/dev/pub.rb +171 -0
- data/lib/pindo/dev/renewcert.rb +142 -0
- data/lib/pindo/dev.rb +23 -0
- data/lib/pindo/env/dreamstudio.rb +53 -0
- data/lib/pindo/env/flutter.rb +59 -0
- data/lib/pindo/env/flutter.sh +116 -0
- data/lib/pindo/env/quarkenv.rb +58 -0
- data/lib/pindo/env/swarkenv.rb +62 -0
- data/lib/pindo/env/workhard.rb +56 -0
- data/lib/pindo/env.rb +17 -0
- data/lib/pindo/ipa/autoresign.rb +188 -0
- data/lib/pindo/ipa/import.rb +261 -0
- data/lib/pindo/ipa/output.rb +396 -0
- data/lib/pindo/ipa.rb +22 -0
- data/lib/pindo/lib/forcepush.rb +159 -0
- data/lib/pindo/lib/lint.rb +115 -0
- data/lib/pindo/lib/push.rb +143 -0
- data/lib/pindo/lib/update.rb +75 -0
- data/lib/pindo/lib.rb +18 -0
- data/lib/pindo/module/appselect.rb +200 -0
- data/lib/pindo/module/appstore_in_app_purchase.rb +1803 -0
- data/lib/pindo/module/appstore_metadata_connect_api_helper.rb +12 -0
- data/lib/pindo/module/appstore_metadata_fastlane_helper.rb +922 -0
- data/lib/pindo/module/buildconfighelper.rb +13 -0
- data/lib/pindo/module/buildhelper.rb +76 -0
- data/lib/pindo/module/commonconfuseproj.rb +271 -0
- data/lib/pindo/module/config_project.sh +143 -0
- data/lib/pindo/module/configprojhelper.rb +631 -0
- data/lib/pindo/module/iap_tier.json +813 -0
- data/lib/pindo/module/icon_contents.json +116 -0
- data/lib/pindo/module/imessage_icon.json +91 -0
- data/lib/pindo/module/imgset_contents.json +21 -0
- data/lib/pindo/module/launchimg_contents.json +21 -0
- data/lib/pindo/module/pemcreate.rb +63 -0
- data/lib/pindo/module/pgyerhelper.rb +339 -0
- data/lib/pindo/module/xcodebuildpre.rb +258 -0
- data/lib/pindo/module/xcodehelper.rb +521 -0
- data/lib/pindo/options/appconfigoptions.rb +23 -0
- data/lib/pindo/options/deployoptions.rb +363 -0
- data/lib/pindo/pgyer/apptest.rb +104 -0
- data/lib/pindo/pgyer/comment.rb +95 -0
- data/lib/pindo/pgyer/download.rb +105 -0
- data/lib/pindo/pgyer/login.rb +61 -0
- data/lib/pindo/pgyer/upload.rb +234 -0
- data/lib/pindo/pgyer.rb +17 -0
- data/lib/pindo/repo/clone.rb +78 -0
- data/lib/pindo/repo/create.rb +55 -0
- data/lib/pindo/repo/login.rb +64 -0
- data/lib/pindo/repo/search.rb +60 -0
- data/lib/pindo/repo.rb +16 -0
- data/lib/pindo/setup.rb +60 -0
- data/lib/pindo/upgrade.rb +56 -0
- data/lib/pindo/utils/applovin.rb +213 -0
- data/lib/pindo/utils/boss.rb +209 -0
- data/lib/pindo/utils/clearcert.rb +60 -0
- data/lib/pindo/utils/device.rb +279 -0
- data/lib/pindo/utils/icon.rb +91 -0
- data/lib/pindo/utils/icon.sh +133 -0
- data/lib/pindo/utils/podindex.rb +56 -0
- data/lib/pindo/utils/podindex.sh +30 -0
- data/lib/pindo/utils/renewproj.rb +146 -0
- data/lib/pindo/utils/tgate.rb +159 -0
- data/lib/pindo/utils/xcassets.rb +46 -0
- data/lib/pindo/utils/xcassets.sh +88 -0
- data/lib/pindo/utils.rb +29 -0
- data/lib/pindo/version.rb +110 -0
- data/lib/pindo.rb +34 -0
- metadata +364 -0
@@ -0,0 +1,922 @@
|
|
1
|
+
|
2
|
+
require 'fileutils'
|
3
|
+
require 'faraday'
|
4
|
+
|
5
|
+
module Pindo
|
6
|
+
|
7
|
+
module AppstoreMetadataConnectApiHelper
|
8
|
+
|
9
|
+
def all_languages
|
10
|
+
lang_array = %w[ar-SA ca cs da de-DE el en-AU en-CA en-GB en-US es-ES es-MX fi fr-CA fr-FR he hi hr hu id it ja ko ms nl-NL no pl pt-BR pt-PT ro ru sk sv th tr uk vi zh-Hans zh-Hant]
|
11
|
+
|
12
|
+
return lang_array
|
13
|
+
end
|
14
|
+
|
15
|
+
def display_type_dir_name
|
16
|
+
|
17
|
+
array = {
|
18
|
+
"APP_IPHONE_35" => "iphone_3.5_",
|
19
|
+
"APP_IPHONE_40" => "iphone_4.0_",
|
20
|
+
"APP_IPHONE_47" => "iphone_4.7_",
|
21
|
+
"APP_IPHONE_55" => "iphone_5.5_",
|
22
|
+
"APP_IPHONE_58" => "iphone_5.8_",
|
23
|
+
"APP_IPHONE_65" => "iphone_6.5_",
|
24
|
+
"APP_IPHONE_67" => "iphone_6.7_",
|
25
|
+
"APP_IPAD_97" => "ipad_97_",
|
26
|
+
"APP_IPAD_105" => "ipad_105_",
|
27
|
+
"APP_IPAD_PRO_129" => "ipad_",
|
28
|
+
"APP_IPAD_PRO_3GEN_11" => "ipad_11_",
|
29
|
+
"APP_IPAD_PRO_3GEN_129" => "ipadPro129_",
|
30
|
+
"APP_IPAD_PRO_6GEN_129" => "ipadPro129_",
|
31
|
+
|
32
|
+
"IMESSAGE_APP_IPHONE_40" => "im_4.0_",
|
33
|
+
"IMESSAGE_APP_IPHONE_47" => "im_4.7_",
|
34
|
+
"IMESSAGE_APP_IPHONE_55" => "im_5.5_",
|
35
|
+
"IMESSAGE_APP_IPHONE_58" => "im_5.8_",
|
36
|
+
"IMESSAGE_APP_IPHONE_61" => "im_6.1_",
|
37
|
+
"IMESSAGE_APP_IPHONE_65" => "im_6.5_",
|
38
|
+
"IMESSAGE_APP_IPHONE_67" => "im_6.7_",
|
39
|
+
"IMESSAGE_APP_IPAD_97" => "im_ipad_",
|
40
|
+
"IMESSAGE_APP_IPAD_105" => "im_ipad_",
|
41
|
+
"IMESSAGE_APP_IPAD_PRO_129" => "im_ipad_",
|
42
|
+
"IMESSAGE_APP_IPAD_PRO_3GEN_129" => "im_ipadPro129_",
|
43
|
+
"IMESSAGE_APP_IPAD_PRO_3GEN_11" => "im_ipadPro129_",
|
44
|
+
"IMESSAGE_APP_IPAD_PRO_6GEN_129" => "im_ipadPro129_",
|
45
|
+
|
46
|
+
"APP_WATCH_SERIES_3" => "watch_3_",
|
47
|
+
"APP_WATCH_SERIES_4" => "watch_4_",
|
48
|
+
"APP_WATCH_SERIES_7" => "watch_7_",
|
49
|
+
"APP_WATCH_ULTRA" => "watch_ul_",
|
50
|
+
|
51
|
+
"APP_DESKTO" => "desktop_"
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
return array
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def camel_case_lower(string: nil)
|
61
|
+
string.split('_').inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
def check_attributes(attributes: nil)
|
66
|
+
attributes = attributes || {}
|
67
|
+
new_attributes = {}
|
68
|
+
attributes.each do |key, value|
|
69
|
+
if !value.nil? && !value.to_s.empty?
|
70
|
+
new_attributes[key] = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# puts JSON.pretty_generate(new_attributes)
|
75
|
+
return new_attributes
|
76
|
+
end
|
77
|
+
|
78
|
+
def fastlane_login(apple_id:nil)
|
79
|
+
Spaceship::Tunes.login(apple_id.to_s)
|
80
|
+
Spaceship::Tunes.select_team
|
81
|
+
end
|
82
|
+
|
83
|
+
def fastlane_update_app_version_info_metadata(app: nil, platform:nil, app_itunes_json:nil)
|
84
|
+
|
85
|
+
|
86
|
+
begin
|
87
|
+
puts "\n\n更新 Version ..."
|
88
|
+
app_version = app_itunes_json["app_edit_version_info"][platform]["version_string"]
|
89
|
+
app.ensure_version!(app_version)
|
90
|
+
puts "更新 Version 成功 !!!"
|
91
|
+
rescue => error
|
92
|
+
puts "更新 Version 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
93
|
+
puts error
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
app_edit_version_info = app.get_edit_app_store_version(platform: platform, includes: 'appStoreVersionSubmission,build,appStoreVersionPhasedRelease,appStoreVersionLocalizations')
|
98
|
+
app_live_version_info = app.get_live_app_store_version(platform: platform)
|
99
|
+
|
100
|
+
if !app_itunes_json["app_edit_version_info"][platform]['app_version_info_localization'].nil?
|
101
|
+
begin
|
102
|
+
puts
|
103
|
+
puts "更新 App Version Localizations..."
|
104
|
+
version_info_localization_attributes = app_itunes_json["app_edit_version_info"][platform]['app_version_info_localization']
|
105
|
+
version_info_localizations = verify_app_version_info_localizations(app_version_info:app_edit_version_info, version_info_localization_attributes:version_info_localization_attributes)
|
106
|
+
update_version_info_localizations(version_info_localizations:version_info_localizations, version_info_localization_attributes:version_info_localization_attributes, app_live_version_info:app_live_version_info)
|
107
|
+
puts "更新App Version Localizations 成功 !!!"
|
108
|
+
rescue => error
|
109
|
+
puts "更新App Version Localizations 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
110
|
+
puts error
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
if !app_itunes_json["app_edit_version_info"][platform]['copyright'].nil?
|
117
|
+
begin
|
118
|
+
puts "\n\n更新 Copy Right..."
|
119
|
+
app_edit_version_info.update(attributes: { "copyright": app_itunes_json["app_edit_version_info"][platform]['copyright']} )
|
120
|
+
puts "更新 Copy Right 成功 !!!"
|
121
|
+
rescue => error
|
122
|
+
puts "更新 Copy Right 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
123
|
+
puts error
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
if !app_itunes_json["app_edit_version_info"][platform]['release_type'].nil?
|
128
|
+
begin
|
129
|
+
puts "\n\n更新 ReleaseType ..."
|
130
|
+
app_edit_version_info.update(attributes: { "releaseType": app_itunes_json["app_edit_version_info"][platform]['release_type'] })
|
131
|
+
puts "更新 ReleaseType 成功 !!!"
|
132
|
+
rescue => error
|
133
|
+
puts "更新 ReleaseType 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
134
|
+
puts error
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
if !app_itunes_json["app_edit_version_info"][platform]['app_review_info'].nil?
|
139
|
+
begin
|
140
|
+
puts "\n\n更新 Review Info ..."
|
141
|
+
notes_file = "app_" + platform + "_review_notes.txt"
|
142
|
+
app_review_attributes = {}
|
143
|
+
app_review_data = app_itunes_json["app_edit_version_info"][platform]['app_review_info']
|
144
|
+
app_review_data.each do |key, value|
|
145
|
+
attributes_key = camel_case_lower(string:key)
|
146
|
+
app_review_attributes[attributes_key] = value
|
147
|
+
end
|
148
|
+
update_review_info(app_version_info:app_edit_version_info, app_review_attributes:app_review_attributes)
|
149
|
+
puts "更新 Review Info 成功 !!!"
|
150
|
+
rescue => error
|
151
|
+
puts "更新 Review Info 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
152
|
+
puts error
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
def fastlane_update_app_metadata(app: nil, app_itunes_json:nil)
|
160
|
+
|
161
|
+
begin
|
162
|
+
puts "\n\n更新 app价格 ..."
|
163
|
+
attributes = {}
|
164
|
+
attributes[:availableInNewTerritories] = true
|
165
|
+
territory_ids = Spaceship::ConnectAPI::Territory.all.map(&:id)
|
166
|
+
price_tier = "0"
|
167
|
+
app.update(attributes: attributes, app_price_tier_id: price_tier, territory_ids: territory_ids)
|
168
|
+
puts "更新 app价格 成功 !!!"
|
169
|
+
rescue => error
|
170
|
+
puts "更新 app价格 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
171
|
+
puts error
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
if !app_itunes_json['content_rights_declaration'].nil?
|
177
|
+
begin
|
178
|
+
puts "\n\n更新 Third Content ..."
|
179
|
+
app.update(attributes:{"contentRightsDeclaration": app_itunes_json['content_rights_declaration']})
|
180
|
+
puts "更新 Third Content 成功 !!!"
|
181
|
+
rescue => error
|
182
|
+
puts "更新 Third Content 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
183
|
+
puts error
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
if !app_itunes_json['primary_locale'].nil?
|
188
|
+
begin
|
189
|
+
puts "\n\n更新 Primary Language ..."
|
190
|
+
app.update(attributes:{"primaryLocale": app_itunes_json['primary_locale']})
|
191
|
+
puts "更新 Primary Language 成功 !!!"
|
192
|
+
rescue => error
|
193
|
+
puts "更新 Primary Language 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
194
|
+
puts error
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
if !app_itunes_json['privacy_data'].nil?
|
200
|
+
# begin
|
201
|
+
puts "\n\n更新 Privacy Usage Data ..."
|
202
|
+
app_privacy_data = app_itunes_json['privacy_data']
|
203
|
+
update_privacy_useagedata(app: app, app_privacy_data:app_privacy_data)
|
204
|
+
|
205
|
+
# rescue => error
|
206
|
+
# puts "更新 Privacy Usage Data 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
207
|
+
# puts error
|
208
|
+
# end
|
209
|
+
end
|
210
|
+
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
|
215
|
+
def fastlane_update_app_info_metadata(app: nil, app_itunes_json:nil)
|
216
|
+
|
217
|
+
|
218
|
+
app_info = app.fetch_edit_app_info
|
219
|
+
|
220
|
+
begin
|
221
|
+
puts "\n\n更新 Category ..."
|
222
|
+
update_app_categories(app_info:app_info, app_info_data:app_itunes_json["app_info"])
|
223
|
+
puts "更新 Category 成功 !!!"
|
224
|
+
rescue => error
|
225
|
+
puts "更新 Category 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
226
|
+
puts error
|
227
|
+
end
|
228
|
+
|
229
|
+
if !app_age_rating_attributes = app_itunes_json["app_info"]["app_age_rating"].nil?
|
230
|
+
begin
|
231
|
+
puts "\n\n更新 Age Rating ..."
|
232
|
+
app_age_rating_attributes = app_itunes_json["app_info"]["app_age_rating"]
|
233
|
+
update_age_rating(app_info:app_info, age_rate_config:app_age_rating_attributes)
|
234
|
+
puts "更新 Age Rating 成功 !!!"
|
235
|
+
rescue => error
|
236
|
+
puts "更新 Age Rating 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
237
|
+
puts error
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
def fastlane_update_app_info_localizations(app: nil, app_itunes_json:nil)
|
245
|
+
|
246
|
+
app_info = app.fetch_edit_app_info
|
247
|
+
|
248
|
+
sleep(3)
|
249
|
+
|
250
|
+
begin
|
251
|
+
puts
|
252
|
+
puts "更新 App Info Localizations..."
|
253
|
+
app_info_localization_attributes = app_itunes_json['app_info']["app_info_localization"]
|
254
|
+
app_info_localizations = verify_app_info_localizations(app_info:app_info, app_info_localization_attributes:app_info_localization_attributes)
|
255
|
+
update_app_info_localizations(app_info_localizations:app_info_localizations, app_info_localization_attributes:app_info_localization_attributes)
|
256
|
+
update_app_info_localizations(app_info_localizations:app_info_localizations, app_info_localization_attributes:app_info_localization_attributes)
|
257
|
+
puts "更新App Info Localizations 成功 !!!"
|
258
|
+
rescue => error
|
259
|
+
puts "更新App Info Localizations 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
|
260
|
+
puts error
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
def update_privacy_useagedata(app: nil, app_privacy_data:nil)
|
270
|
+
all_usages = Spaceship::ConnectAPI::AppDataUsage.all(app_id: app.id, includes: "category,grouping,purpose,dataProtection", limit: 500)
|
271
|
+
|
272
|
+
begin
|
273
|
+
all_usages.each(&:delete!)
|
274
|
+
rescue => error
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
# old_usages_config = {}
|
279
|
+
# if !all_usages.nil? && all_usages.size > 0
|
280
|
+
# all_usages.each do |privacy_usage|
|
281
|
+
# if !privacy_usage.category.nil?
|
282
|
+
# category= privacy_usage.category.id
|
283
|
+
# all_usages_config[category] = all_usages_config[category] || {}
|
284
|
+
# all_usages_config[category]["category"] = category
|
285
|
+
# if !privacy_usage.purpose.nil?
|
286
|
+
# all_usages_config[category]["purposes"] = all_usages_config[category]["purposes"] || []
|
287
|
+
# all_usages_config[category]["purposes"] << privacy_usage.purpose.id
|
288
|
+
|
289
|
+
# end
|
290
|
+
# if !privacy_usage.data_protection.nil?
|
291
|
+
# all_usages_config[category]["data_protections"] = all_usages_config[category]["data_protections"] || []
|
292
|
+
# all_usages_config[category]["data_protections"] << privacy_usage.data_protection.id
|
293
|
+
# end
|
294
|
+
# end
|
295
|
+
# end
|
296
|
+
# puts old_usages_config
|
297
|
+
# end
|
298
|
+
|
299
|
+
# new_usages_config = {}
|
300
|
+
# app_privacy_data.each do |usage_config|
|
301
|
+
# category = usage_config["category"]
|
302
|
+
# if category && !category.nil?
|
303
|
+
# new_usages_config[category] = usage_config
|
304
|
+
# end
|
305
|
+
# end
|
306
|
+
|
307
|
+
begin
|
308
|
+
publish_state = Spaceship::ConnectAPI::AppDataUsagesPublishState.get(app_id: app.id)
|
309
|
+
publish_state.publish!
|
310
|
+
rescue => error
|
311
|
+
puts error
|
312
|
+
end
|
313
|
+
|
314
|
+
|
315
|
+
app_privacy_data.each do |usage_config|
|
316
|
+
category = usage_config["category"]
|
317
|
+
purposes = usage_config["purposes"] || []
|
318
|
+
data_protections = usage_config["data_protections"] || []
|
319
|
+
purposes = [nil] if purposes.empty?
|
320
|
+
|
321
|
+
purposes.each do |purpose|
|
322
|
+
data_protections.each do |data_protection|
|
323
|
+
begin
|
324
|
+
Spaceship::ConnectAPI::AppDataUsage.create(
|
325
|
+
app_id: app.id,
|
326
|
+
app_data_usage_category_id: category,
|
327
|
+
app_data_usage_protection_id: data_protection,
|
328
|
+
app_data_usage_purpose_id: purpose
|
329
|
+
)
|
330
|
+
rescue => error
|
331
|
+
|
332
|
+
end
|
333
|
+
|
334
|
+
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
begin
|
342
|
+
|
343
|
+
publish_state = Spaceship::ConnectAPI::AppDataUsagesPublishState.get(app_id: app.id)
|
344
|
+
publish_state.publish!
|
345
|
+
rescue => error
|
346
|
+
puts error
|
347
|
+
end
|
348
|
+
|
349
|
+
|
350
|
+
end
|
351
|
+
|
352
|
+
|
353
|
+
def update_app_categories(app_info:nil, app_info_data:nil)
|
354
|
+
|
355
|
+
|
356
|
+
if !app_info_data.nil?
|
357
|
+
category_id_map = {}
|
358
|
+
|
359
|
+
if !app_info_data["primary_category"].nil?
|
360
|
+
category_id_map[:primary_category_id] = app_info_data["primary_category"]
|
361
|
+
|
362
|
+
if app_info_data["primary_category"].eql?("STICKERS") || app_info_data["primary_category"].eql?("GAMES")
|
363
|
+
category_id_map[:primary_subcategory_one_id] = app_info_data["primary_subcategory_one"]
|
364
|
+
category_id_map[:primary_subcategory_two_id] = app_info_data["primary_subcategory_two"]
|
365
|
+
|
366
|
+
else
|
367
|
+
category_id_map[:primary_subcategory_one_id] = nil
|
368
|
+
category_id_map[:primary_subcategory_two_id] = nil
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
if !app_info_data["secondary_category"].nil? && !app_info_data["primary_category"].eql?("STICKERS") && !app_info_data["primary_category"].eql?("GAMES")
|
375
|
+
category_id_map[:secondary_category_id] = app_info_data["secondary_category"]
|
376
|
+
if app_info_data["secondary_category"].eql?("STICKERS") || app_info_data["secondary_category"].eql?("GAMES")
|
377
|
+
category_id_map[:secondary_subcategory_one_id] = app_info_data["secondary_subcategory_one"]
|
378
|
+
category_id_map[:secondary_subcategory_two_id] = app_info_data["secondary_subcategory_two"]
|
379
|
+
else
|
380
|
+
category_id_map[:secondary_subcategory_one_id] = nil
|
381
|
+
category_id_map[:secondary_subcategory_two_id] = nil
|
382
|
+
end
|
383
|
+
else
|
384
|
+
category_id_map[:secondary_category_id] = nil
|
385
|
+
category_id_map[:secondary_subcategory_one_id] = nil
|
386
|
+
category_id_map[:secondary_subcategory_two_id] = nil
|
387
|
+
end
|
388
|
+
|
389
|
+
app_info.update_categories(category_id_map: category_id_map)
|
390
|
+
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
def update_age_rating(app_info:nil, age_rate_config:nil)
|
398
|
+
declaration = app_info.fetch_age_rating_declaration unless app_info.nil?
|
399
|
+
age_rate_attributes = {}
|
400
|
+
|
401
|
+
age_rate_config.each do |key, value|
|
402
|
+
|
403
|
+
attributes_key = camel_case_lower(string:key)
|
404
|
+
age_rate_attributes[attributes_key] = value
|
405
|
+
end
|
406
|
+
|
407
|
+
declaration.update(attributes: age_rate_attributes)
|
408
|
+
|
409
|
+
end
|
410
|
+
|
411
|
+
def verify_app_info_localizations(app_info:nil, app_info_localization_attributes:nil)
|
412
|
+
|
413
|
+
localizations = app_info.get_app_info_localizations
|
414
|
+
|
415
|
+
languages = []
|
416
|
+
app_info_localization_attributes.each do |lang , attributes |
|
417
|
+
languages << lang
|
418
|
+
end
|
419
|
+
|
420
|
+
puts " 存在多语言 #{localizations.map(&:locale).join(', ')}..."
|
421
|
+
locales_to_enable = languages - localizations.map(&:locale)
|
422
|
+
|
423
|
+
if locales_to_enable.count > 0
|
424
|
+
|
425
|
+
|
426
|
+
puts " 创建多语言 #{locales_to_enable.join(', ')}..."
|
427
|
+
|
428
|
+
locales_to_enable.each do |locale|
|
429
|
+
localization_attributes = app_info_localization_attributes[locale]
|
430
|
+
app_info.create_app_info_localization(attributes: {
|
431
|
+
locale: locale,
|
432
|
+
name:localization_attributes["name"]
|
433
|
+
})
|
434
|
+
end
|
435
|
+
|
436
|
+
localizations = app_info.get_app_info_localizations
|
437
|
+
|
438
|
+
end
|
439
|
+
|
440
|
+
return localizations
|
441
|
+
end
|
442
|
+
|
443
|
+
def update_app_info_localizations(app_info_localizations:nil, app_info_localization_attributes:nil)
|
444
|
+
|
445
|
+
# Update app info localizations
|
446
|
+
app_info_worker = FastlaneCore::QueueWorker.new do |app_info_localization|
|
447
|
+
attributes = app_info_localization_attributes[app_info_localization.locale]
|
448
|
+
|
449
|
+
if attributes
|
450
|
+
puts "Uploading app info localized '#{app_info_localization.locale}'"
|
451
|
+
attributes = check_attributes(attributes:attributes)
|
452
|
+
app_info_localization.update(attributes: attributes)
|
453
|
+
end
|
454
|
+
end
|
455
|
+
app_info_worker.batch_enqueue(app_info_localizations)
|
456
|
+
app_info_worker.start
|
457
|
+
|
458
|
+
end
|
459
|
+
|
460
|
+
|
461
|
+
def verify_app_version_info_localizations(app_version_info:nil, version_info_localization_attributes:nil)
|
462
|
+
|
463
|
+
localizations = app_version_info.get_app_store_version_localizations
|
464
|
+
|
465
|
+
languages = []
|
466
|
+
version_info_localization_attributes.each do |lang , attributes |
|
467
|
+
languages << lang
|
468
|
+
end
|
469
|
+
|
470
|
+
puts " 存在多语言 #{localizations.map(&:locale).join(', ')}..."
|
471
|
+
|
472
|
+
locales_to_enable = languages - localizations.map(&:locale)
|
473
|
+
|
474
|
+
if locales_to_enable.count > 0
|
475
|
+
|
476
|
+
puts " 创建多语言 #{locales_to_enable.join(', ')}..."
|
477
|
+
|
478
|
+
locales_to_enable.each do |locale|
|
479
|
+
localization_attributes = version_info_localization_attributes[locale]
|
480
|
+
app_version_info.create_app_store_version_localization(attributes: {
|
481
|
+
locale: locale
|
482
|
+
})
|
483
|
+
end
|
484
|
+
|
485
|
+
localizations = app_version_info.get_app_store_version_localizations
|
486
|
+
end
|
487
|
+
|
488
|
+
return localizations
|
489
|
+
end
|
490
|
+
|
491
|
+
|
492
|
+
def update_version_info_localizations(version_info_localizations:nil, version_info_localization_attributes:nil, app_live_version_info:nil)
|
493
|
+
# Update app store version localizations
|
494
|
+
store_version_worker = FastlaneCore::QueueWorker.new do |app_store_version_localization|
|
495
|
+
attributes = version_info_localization_attributes[app_store_version_localization.locale]
|
496
|
+
|
497
|
+
if attributes
|
498
|
+
puts "Uploading app version info localized '#{app_store_version_localization.locale}'"
|
499
|
+
attributes = check_attributes(attributes:attributes)
|
500
|
+
if app_live_version_info.nil?
|
501
|
+
attributes.delete("whats_new")
|
502
|
+
end
|
503
|
+
app_store_version_localization.update(attributes: attributes)
|
504
|
+
end
|
505
|
+
end
|
506
|
+
store_version_worker.batch_enqueue(version_info_localizations)
|
507
|
+
store_version_worker.start
|
508
|
+
end
|
509
|
+
|
510
|
+
def update_review_info(app_version_info:nil, app_review_attributes:nil)
|
511
|
+
app_store_review_detail = begin
|
512
|
+
app_version_info.fetch_app_store_review_detail
|
513
|
+
rescue => error
|
514
|
+
puts "no review detail !!!"
|
515
|
+
end # errors if doesn't exist
|
516
|
+
|
517
|
+
if app_store_review_detail
|
518
|
+
puts "更新review info obj"
|
519
|
+
app_store_review_detail.update(attributes: app_review_attributes)
|
520
|
+
else
|
521
|
+
puts "创建review info obj"
|
522
|
+
app_version_info.create_app_store_review_detail(attributes: app_review_attributes)
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
def fastlane_process_lang_screenshots(lang_screenshots_path:nil)
|
527
|
+
|
528
|
+
# puts "正在处理目录:#{lang_screenshots_path}"
|
529
|
+
valid_file_extensions = ['png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG']
|
530
|
+
|
531
|
+
Dir.glob(File.join(lang_screenshots_path, "*")).each do |image_dir_path|
|
532
|
+
image_dir_basename = File.basename(image_dir_path)
|
533
|
+
# puts "处理目录:#{image_dir_path}"
|
534
|
+
# puts "basename:#{image_dir_basename}"
|
535
|
+
if File.directory?(image_dir_path) && ![".", ".."].include?(image_dir_basename)
|
536
|
+
Dir.foreach(image_dir_path) do |file|
|
537
|
+
|
538
|
+
image_full_name = File.join(image_dir_path, file)
|
539
|
+
extname = File.extname(image_full_name).delete('.')
|
540
|
+
extension = File.extname(image_full_name)
|
541
|
+
base_name = File.basename(image_full_name, extension)
|
542
|
+
dest_name = File.join(lang_screenshots_path, file)
|
543
|
+
|
544
|
+
if valid_file_extensions.include?(extname)
|
545
|
+
new_base_name = base_name + extension
|
546
|
+
if base_name.to_s.size < 2
|
547
|
+
new_base_name = "0"+base_name + extension
|
548
|
+
end
|
549
|
+
img_size = FastImage.size(image_full_name)
|
550
|
+
|
551
|
+
|
552
|
+
if lang_screenshots_path.include?("/iMessage/") || lang_screenshots_path.include?("/imessage/") || lang_screenshots_path.include?("/IMESSAGE/")
|
553
|
+
|
554
|
+
all_device_size = Deliver::AppScreenshot.device_messages
|
555
|
+
# puts all_message_device_size
|
556
|
+
|
557
|
+
if all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_IPAD_PRO_MESSAGES].include?(img_size)
|
558
|
+
if image_dir_basename.to_s.downcase.include?("ipadpro3") || image_dir_basename.to_s.downcase.include?("ipadpro129") || image_dir_basename.to_s.downcase.include?("ipad_6gen")
|
559
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPAD_PRO_6GEN_129"] + new_base_name)
|
560
|
+
else
|
561
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPAD_PRO_129"] + new_base_name)
|
562
|
+
end
|
563
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_67_MESSAGES].include?(img_size)
|
564
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_67"] + new_base_name)
|
565
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_65_MESSAGES].include?(img_size)
|
566
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_65"] + new_base_name)
|
567
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_55_MESSAGES].include?(img_size)
|
568
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_55"] + new_base_name)
|
569
|
+
end
|
570
|
+
|
571
|
+
else
|
572
|
+
all_device_size = Deliver::AppScreenshot.devices
|
573
|
+
# puts all_device_size
|
574
|
+
if all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_IPAD_PRO].include?(img_size)
|
575
|
+
if image_dir_basename.to_s.downcase.include?("ipadpro3") || image_dir_basename.to_s.downcase.include?("ipadpro129") || image_dir_basename.to_s.downcase.include?("ipad_6gen")
|
576
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPAD_PRO_6GEN_129"] + new_base_name)
|
577
|
+
else
|
578
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPAD_PRO_129"] + new_base_name)
|
579
|
+
end
|
580
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_67].include?(img_size)
|
581
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_67"] + new_base_name)
|
582
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_65].include?(img_size)
|
583
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_65"] + new_base_name)
|
584
|
+
elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_55].include?(img_size)
|
585
|
+
dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_55"] + new_base_name)
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# if (img_size[0] == 1290 && img_size[1] == 2796) || (img_size[0] == 2796 && img_size[1] == 1290)
|
590
|
+
# dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_67"] + new_base_name)
|
591
|
+
# end
|
592
|
+
# if (img_size[0] == 1242 && img_size[1] == 2688) || (img_size[0] == 2688 && img_size[1] == 1242) || (img_size[0] == 1284 && img_size[1] == 2778) || (img_size[0] == 2778 && img_size[1] == 1284)
|
593
|
+
# dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_65"] + new_base_name)
|
594
|
+
# end
|
595
|
+
|
596
|
+
# if (img_size[0] == 1242 && img_size[1] == 2208) || (img_size[0] == 2208 && img_size[1] == 1242)
|
597
|
+
# dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_55"] + new_base_name)
|
598
|
+
# end
|
599
|
+
|
600
|
+
FileUtils.mv(image_full_name, dest_name, force:true)
|
601
|
+
end
|
602
|
+
|
603
|
+
end
|
604
|
+
|
605
|
+
FileUtils.rm_rf(image_dir_path)
|
606
|
+
end
|
607
|
+
|
608
|
+
end
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
end
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
def fastlane_download_app_info(app: nil, app_itunes_json:nil, app_itunes_dir:nil)
|
619
|
+
|
620
|
+
|
621
|
+
app_info = app.fetch_edit_app_info || app.fetch_live_app_info
|
622
|
+
|
623
|
+
if app_info.primary_category.nil?
|
624
|
+
app_itunes_json["app_info"]["primary_category"] = app_info.primary_category
|
625
|
+
else
|
626
|
+
app_itunes_json["app_info"]["primary_category"] = app_info.primary_category.id
|
627
|
+
end
|
628
|
+
|
629
|
+
if app_info.primary_subcategory_one.nil?
|
630
|
+
app_itunes_json["app_info"]["primary_subcategory_one"] = app_info.primary_subcategory_one
|
631
|
+
else
|
632
|
+
app_itunes_json["app_info"]["primary_subcategory_one"] = app_info.primary_subcategory_one.id
|
633
|
+
end
|
634
|
+
|
635
|
+
if app_info.primary_subcategory_two.nil?
|
636
|
+
app_itunes_json["app_info"]["primary_subcategory_two"] = app_info.primary_subcategory_two
|
637
|
+
else
|
638
|
+
app_itunes_json["app_info"]["primary_subcategory_two"] = app_info.primary_subcategory_two.id
|
639
|
+
end
|
640
|
+
|
641
|
+
if app_info.secondary_category.nil?
|
642
|
+
app_itunes_json["app_info"]["secondary_category"] = app_info.secondary_category
|
643
|
+
else
|
644
|
+
app_itunes_json["app_info"]["secondary_category"] = app_info.secondary_category.id
|
645
|
+
end
|
646
|
+
|
647
|
+
if app_info.secondary_subcategory_one.nil?
|
648
|
+
app_itunes_json["app_info"]["secondary_subcategory_one"] = app_info.secondary_subcategory_one
|
649
|
+
else
|
650
|
+
app_itunes_json["app_info"]["secondary_subcategory_one"] = app_info.secondary_subcategory_one.id
|
651
|
+
end
|
652
|
+
|
653
|
+
if app_info.secondary_subcategory_two.nil?
|
654
|
+
app_itunes_json["app_info"]["secondary_subcategory_two"] = app_info.secondary_subcategory_two
|
655
|
+
else
|
656
|
+
app_itunes_json["app_info"]["secondary_subcategory_two"] = app_info.secondary_subcategory_two.id
|
657
|
+
end
|
658
|
+
|
659
|
+
age_rating_declaration = app_info.fetch_age_rating_declaration
|
660
|
+
if !age_rating_declaration.nil?
|
661
|
+
|
662
|
+
app_itunes_json["app_info"]["app_age_rating"] = app_itunes_json["app_info"]["app_age_rating"] || {}
|
663
|
+
app_itunes_json["app_info"]["app_age_rating"]["alcohol_tobacco_or_drug_use_or_references"] = age_rating_declaration.alcohol_tobacco_or_drug_use_or_references.nil? ? "NONE" : age_rating_declaration.alcohol_tobacco_or_drug_use_or_references
|
664
|
+
app_itunes_json["app_info"]["app_age_rating"]["contests"] = age_rating_declaration.contests.nil? ? "NONE" : age_rating_declaration.contests
|
665
|
+
app_itunes_json["app_info"]["app_age_rating"]["gambling_simulated"] = age_rating_declaration.gambling_simulated.nil? ? "NONE" : age_rating_declaration.gambling_simulated
|
666
|
+
app_itunes_json["app_info"]["app_age_rating"]["medical_or_treatment_information"] = age_rating_declaration.medical_or_treatment_information.nil? ? "NONE" : age_rating_declaration.medical_or_treatment_information
|
667
|
+
app_itunes_json["app_info"]["app_age_rating"]["profanity_or_crude_humor"] = age_rating_declaration.profanity_or_crude_humor.nil? ? "NONE" : age_rating_declaration.profanity_or_crude_humor
|
668
|
+
app_itunes_json["app_info"]["app_age_rating"]["sexual_content_graphic_and_nudity"] = age_rating_declaration.sexual_content_graphic_and_nudity.nil? ? "NONE" : age_rating_declaration.sexual_content_graphic_and_nudity
|
669
|
+
app_itunes_json["app_info"]["app_age_rating"]["sexual_content_or_nudity"] = age_rating_declaration.sexual_content_or_nudity.nil? ? "NONE" : age_rating_declaration.sexual_content_or_nudity
|
670
|
+
app_itunes_json["app_info"]["app_age_rating"]["horror_or_fear_themes"] = age_rating_declaration.horror_or_fear_themes.nil? ? "NONE" : age_rating_declaration.horror_or_fear_themes
|
671
|
+
app_itunes_json["app_info"]["app_age_rating"]["mature_or_suggestive_themes"] = age_rating_declaration.mature_or_suggestive_themes.nil? ? "NONE" : age_rating_declaration.mature_or_suggestive_themes
|
672
|
+
app_itunes_json["app_info"]["app_age_rating"]["violence_cartoon_or_fantasy"] = age_rating_declaration.violence_cartoon_or_fantasy.nil? ? "NONE" : age_rating_declaration.violence_cartoon_or_fantasy
|
673
|
+
app_itunes_json["app_info"]["app_age_rating"]["violence_realistic_prolonged_graphic_or_sadistic"] = age_rating_declaration.violence_realistic_prolonged_graphic_or_sadistic.nil? ? "NONE" : age_rating_declaration.violence_realistic_prolonged_graphic_or_sadistic
|
674
|
+
app_itunes_json["app_info"]["app_age_rating"]["violence_realistic"] = age_rating_declaration.violence_realistic.nil? ? "NONE" : age_rating_declaration.violence_realistic
|
675
|
+
app_itunes_json["app_info"]["app_age_rating"]["gambling"] = age_rating_declaration.gambling.nil? ? false : age_rating_declaration.gambling
|
676
|
+
app_itunes_json["app_info"]["app_age_rating"]["unrestricted_web_access"] = age_rating_declaration.unrestricted_web_access.nil? ? false : age_rating_declaration.unrestricted_web_access
|
677
|
+
app_itunes_json["app_info"]["app_age_rating"]["kids_age_band"] = age_rating_declaration.kids_age_band.nil? ? nil : age_rating_declaration.kids_age_band
|
678
|
+
app_itunes_json["app_info"]["app_age_rating"]["seventeen_plus"] = age_rating_declaration.seventeen_plus.nil? ? false : age_rating_declaration.seventeen_plus
|
679
|
+
end
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
app_info_localizations = app_info.get_app_info_localizations
|
694
|
+
|
695
|
+
if !app_info_localizations.nil?
|
696
|
+
|
697
|
+
locales_to_disable = all_languages - app_info_localizations.map(&:locale)
|
698
|
+
|
699
|
+
locales_to_disable.each do | lang |
|
700
|
+
app_itunes_json["app_info"]["app_info_localization"].delete(lang)
|
701
|
+
end
|
702
|
+
|
703
|
+
|
704
|
+
app_info_localizations.each do |app_info_localization|
|
705
|
+
|
706
|
+
lang = app_info_localization.locale
|
707
|
+
|
708
|
+
app_itunes_json["app_info"]["app_info_localization"][lang] = {}
|
709
|
+
app_info_localization_data = app_itunes_json["app_info"]["app_info_localization"][lang]
|
710
|
+
|
711
|
+
app_info_localization_data["name"] = app_info_localization.name.nil? ? "" : app_info_localization.name
|
712
|
+
app_info_localization_data["subtitle"] = app_info_localization.subtitle.nil? ? "" : app_info_localization.subtitle
|
713
|
+
app_info_localization_data["privacy_policy_url"] = app_info_localization.privacy_policy_url.nil? ? "" : app_info_localization.privacy_policy_url
|
714
|
+
app_info_localization_data["privacy_choices_url"] = app_info_localization.privacy_choices_url.nil? ? "" : app_info_localization.privacy_choices_url
|
715
|
+
app_info_localization_data["privacy_policy_text"] = app_info_localization.privacy_policy_text.nil? ? "" : app_info_localization.privacy_policy_text
|
716
|
+
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
|
721
|
+
end
|
722
|
+
|
723
|
+
def fastlane_download_app_version_info(app_version_info: nil, platform:nil, app_itunes_json:nil, app_itunes_dir:nil)
|
724
|
+
|
725
|
+
metadata_platform_path = File.join(app_itunes_dir, platform.downcase)
|
726
|
+
if !File.exist?(metadata_platform_path)
|
727
|
+
FileUtils.mkdir_p(metadata_platform_path)
|
728
|
+
end
|
729
|
+
app_itunes_json["app_edit_version_info"][platform] = {}
|
730
|
+
app_itunes_json["app_edit_version_info"][platform]["app_review_info"] = {}
|
731
|
+
|
732
|
+
app_itunes_json["app_edit_version_info"][platform]["version_string"] = app_version_info.version_string.nil? ? "" : app_version_info.version_string
|
733
|
+
app_itunes_json["app_edit_version_info"][platform]["copyright"] = app_version_info.copyright.nil? ? "" : app_version_info.copyright
|
734
|
+
app_itunes_json["app_edit_version_info"][platform]["release_type"] = app_version_info.release_type.nil? ? "" : app_version_info.release_type
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
app_store_review_data = app_itunes_json["app_edit_version_info"][platform]["app_review_info"]
|
739
|
+
app_store_review_detail = begin
|
740
|
+
app_version_info.fetch_app_store_review_detail
|
741
|
+
rescue => error
|
742
|
+
puts "no review detail !!!"
|
743
|
+
end # errors if doesn't exist
|
744
|
+
|
745
|
+
if !app_store_review_detail.nil?
|
746
|
+
app_store_review_data["contact_first_name"] = app_store_review_detail.contact_first_name
|
747
|
+
app_store_review_data["contact_last_name"] = app_store_review_detail.contact_last_name
|
748
|
+
app_store_review_data["contact_phone"] = app_store_review_detail.contact_phone
|
749
|
+
app_store_review_data["contact_email"] = app_store_review_detail.contact_email
|
750
|
+
app_store_review_data["demo_account_name"] = app_store_review_detail.demo_account_name
|
751
|
+
app_store_review_data["demo_account_password"] = app_store_review_detail.demo_account_password
|
752
|
+
app_store_review_data["demo_account_required"] = app_store_review_detail.demo_account_required
|
753
|
+
app_store_review_data["notes"] = app_store_review_detail.notes
|
754
|
+
else
|
755
|
+
app_store_review_data["contact_first_name"] = ""
|
756
|
+
app_store_review_data["contact_last_name"] = ""
|
757
|
+
app_store_review_data["contact_phone"] = ""
|
758
|
+
app_store_review_data["contact_email"] = ""
|
759
|
+
app_store_review_data["demo_account_name"] = ""
|
760
|
+
app_store_review_data["demo_account_password"] = ""
|
761
|
+
app_store_review_data["demo_account_required"] = false
|
762
|
+
app_store_review_data["notes"] = ""
|
763
|
+
end
|
764
|
+
|
765
|
+
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"] = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"] || {}
|
766
|
+
|
767
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_screenshots"] = app_itunes_json["app_edit_version_info"][platform]["app_version_screenshots"] || {}
|
768
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_previews"] = app_itunes_json["app_edit_version_info"][platform]["app_version_previews"] || {}
|
769
|
+
|
770
|
+
app_version_info_localizations = app_version_info.get_app_store_version_localizations(includes: 'appPreviewSets,appScreenshotSets')
|
771
|
+
|
772
|
+
locales_to_disable = all_languages - app_version_info_localizations.map(&:locale)
|
773
|
+
|
774
|
+
locales_to_disable.each do | lang |
|
775
|
+
metadata_platform_lang_path = File.join(metadata_platform_path, lang)
|
776
|
+
if File.exist?(metadata_platform_lang_path)
|
777
|
+
FileUtils.rm_rf(metadata_platform_lang_path)
|
778
|
+
end
|
779
|
+
|
780
|
+
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"].delete(lang)
|
781
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_screenshots"].delete(lang)
|
782
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_previews"].delete(lang)
|
783
|
+
end
|
784
|
+
|
785
|
+
if !app_version_info_localizations.nil?
|
786
|
+
|
787
|
+
app_version_info_localizations.each do |app_version_info_localization|
|
788
|
+
|
789
|
+
lang = app_version_info_localization.locale
|
790
|
+
|
791
|
+
lang_txt_path = File.join(metadata_platform_path, lang)
|
792
|
+
|
793
|
+
if !File.exist?(lang_txt_path)
|
794
|
+
FileUtils.mkdir_p(lang_txt_path)
|
795
|
+
end
|
796
|
+
|
797
|
+
app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang] = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang] || {}
|
798
|
+
|
799
|
+
localization_data = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang]
|
800
|
+
|
801
|
+
|
802
|
+
localization_data["description"] = app_version_info_localization.description
|
803
|
+
localization_data["keywords"] = app_version_info_localization.keywords
|
804
|
+
localization_data["support_url"] = app_version_info_localization.support_url
|
805
|
+
localization_data["marketing_url"] = app_version_info_localization.marketing_url
|
806
|
+
localization_data["promotional_text"] = app_version_info_localization.promotional_text
|
807
|
+
localization_data["whats_new"] = app_version_info_localization.whats_new
|
808
|
+
|
809
|
+
|
810
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"description", key_value:localization_data["description"])
|
811
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"keywords", key_value:localization_data["keywords"])
|
812
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"support_url", key_value:localization_data["support_url"])
|
813
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"marketing_url", key_value:localization_data["marketing_url"])
|
814
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"promotional_text", key_value:localization_data["promotional_text"])
|
815
|
+
write_app_version_info_localization_to_txt(lang_txt_path: lang_txt_path, key_name:"whats_new", key_value:localization_data["whats_new"])
|
816
|
+
|
817
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_screenshots"][app_version_info_localization.locale] = app_itunes_json["app_edit_version_info"][platform]["app_version_screenshots"][app_version_info_localization.locale] || []
|
818
|
+
# app_itunes_json["app_edit_version_info"][platform]["app_version_previews"][app_version_info_localization.locale] = app_itunes_json["app_edit_version_info"][platform]["app_version_previews"][app_version_info_localization.locale] || []
|
819
|
+
end
|
820
|
+
|
821
|
+
end
|
822
|
+
|
823
|
+
end
|
824
|
+
|
825
|
+
|
826
|
+
def write_app_version_info_localization_to_txt(lang_txt_path: nil, key_name:nil, key_value:nil)
|
827
|
+
key_name_file = File.join(lang_txt_path, key_name +".txt")
|
828
|
+
File.open(key_name_file, "w") do |file|
|
829
|
+
file.write(key_value)
|
830
|
+
file.close
|
831
|
+
end
|
832
|
+
end
|
833
|
+
|
834
|
+
def fastlane_download_app_screenshots(app_version_info: nil, platform:nil, app_screenshots_dir:nil, over_write:false)
|
835
|
+
|
836
|
+
|
837
|
+
screenshots_platform_path = File.join(app_screenshots_dir, platform.downcase)
|
838
|
+
begin
|
839
|
+
FileUtils.mkdir_p(File.join(screenshots_platform_path))
|
840
|
+
rescue
|
841
|
+
# if it's already there
|
842
|
+
end
|
843
|
+
|
844
|
+
|
845
|
+
app_version_info_localizations = app_version_info.get_app_store_version_localizations
|
846
|
+
|
847
|
+
threads = []
|
848
|
+
app_version_info_localizations.each do |app_version_info_localization|
|
849
|
+
threads << Thread.new do
|
850
|
+
fastlane_download_app_screenshot_exe(screenshots_platform_path, app_version_info_localization, over_write:over_write)
|
851
|
+
end
|
852
|
+
end
|
853
|
+
threads.each(&:join)
|
854
|
+
|
855
|
+
end
|
856
|
+
|
857
|
+
def fastlane_download_app_screenshot_exe(folder_path, localization, over_write:false)
|
858
|
+
language = localization.locale
|
859
|
+
|
860
|
+
screenshot_sets = localization.get_app_screenshot_sets
|
861
|
+
screenshot_sets.each do |screenshot_set|
|
862
|
+
|
863
|
+
# If the screen shot is for an appleTV we need to store it in a way that we'll know it's an appleTV
|
864
|
+
# screen shot later as the screen size is the same as an iPhone 6 Plus in landscape.
|
865
|
+
if screenshot_set.apple_tv?
|
866
|
+
containing_folder = File.join(folder_path, "appleTV", language)
|
867
|
+
else
|
868
|
+
containing_folder = File.join(folder_path, language)
|
869
|
+
end
|
870
|
+
|
871
|
+
if screenshot_set.imessage?
|
872
|
+
containing_folder = File.join(folder_path, "iMessage", language)
|
873
|
+
end
|
874
|
+
|
875
|
+
begin
|
876
|
+
FileUtils.mkdir_p(containing_folder)
|
877
|
+
rescue
|
878
|
+
# if it's already there
|
879
|
+
end
|
880
|
+
|
881
|
+
puts "======== #{screenshot_set.screenshot_display_type}"
|
882
|
+
dir_name = display_type_dir_name[screenshot_set.screenshot_display_type]
|
883
|
+
|
884
|
+
|
885
|
+
screenshot_set.app_screenshots.each_with_index do |screenshot, index|
|
886
|
+
name_index = index
|
887
|
+
if index < 10
|
888
|
+
name_index = "0" + index.to_s
|
889
|
+
end
|
890
|
+
file_name = [dir_name, name_index].join()
|
891
|
+
|
892
|
+
|
893
|
+
original_file_extension = File.extname(screenshot.file_name).strip.downcase[1..-1]
|
894
|
+
file_name += "." + original_file_extension
|
895
|
+
|
896
|
+
url = screenshot.image_asset_url(type: original_file_extension)
|
897
|
+
next if url.nil?
|
898
|
+
|
899
|
+
|
900
|
+
path = File.join(containing_folder, file_name)
|
901
|
+
download_screenshots_exe(file_name:path, url:url, over_write:over_write)
|
902
|
+
end
|
903
|
+
end
|
904
|
+
end
|
905
|
+
|
906
|
+
def download_screenshots_exe(file_name:nil, url:nil, over_write:nil)
|
907
|
+
|
908
|
+
if !over_write && File.exist?(file_name)
|
909
|
+
puts " Existing screenshot #{file_name}"
|
910
|
+
return
|
911
|
+
end
|
912
|
+
|
913
|
+
puts "Downloading existing screenshot #{file_name}"
|
914
|
+
|
915
|
+
File.binwrite(file_name, FastlaneCore::Helper.open_uri(url).read)
|
916
|
+
|
917
|
+
end
|
918
|
+
|
919
|
+
|
920
|
+
end
|
921
|
+
|
922
|
+
end
|