pindo 4.8.2 → 4.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,7 +55,7 @@ module Pindo
55
55
  return array
56
56
 
57
57
  end
58
-
58
+
59
59
 
60
60
  def camel_case_lower(string: nil)
61
61
  string.split('_').inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
@@ -75,7 +75,7 @@ module Pindo
75
75
  return new_attributes
76
76
  end
77
77
 
78
- def fastlane_login(apple_id:nil)
78
+ def fastlane_login(apple_id:nil)
79
79
  Spaceship::Tunes.login(apple_id.to_s)
80
80
  Spaceship::Tunes.select_team
81
81
  end
@@ -91,8 +91,8 @@ module Pindo
91
91
  rescue => error
92
92
  puts "更新 Version 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
93
93
  puts error
94
- end
95
-
94
+ end
95
+
96
96
 
97
97
  app_edit_version_info = app.get_edit_app_store_version(platform: platform, includes: 'appStoreVersionSubmission,build,appStoreVersionPhasedRelease,appStoreVersionLocalizations')
98
98
  app_live_version_info = app.get_live_app_store_version(platform: platform)
@@ -108,7 +108,7 @@ module Pindo
108
108
  rescue => error
109
109
  puts "更新App Version Localizations 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
110
110
  puts error
111
- end
111
+ end
112
112
  end
113
113
 
114
114
 
@@ -121,7 +121,7 @@ module Pindo
121
121
  rescue => error
122
122
  puts "更新 Copy Right 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
123
123
  puts error
124
- end
124
+ end
125
125
  end
126
126
 
127
127
  if !app_itunes_json["app_edit_version_info"][platform]['release_type'].nil?
@@ -132,7 +132,7 @@ module Pindo
132
132
  rescue => error
133
133
  puts "更新 ReleaseType 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
134
134
  puts error
135
- end
135
+ end
136
136
  end
137
137
 
138
138
  if !app_itunes_json["app_edit_version_info"][platform]['app_review_info'].nil?
@@ -150,9 +150,9 @@ module Pindo
150
150
  rescue => error
151
151
  puts "更新 Review Info 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
152
152
  puts error
153
- end
153
+ end
154
154
  end
155
-
155
+
156
156
 
157
157
  end
158
158
 
@@ -169,10 +169,10 @@ module Pindo
169
169
  rescue => error
170
170
  puts "更新 app价格 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
171
171
  puts error
172
- end
172
+ end
173
+
173
174
 
174
175
 
175
-
176
176
  if !app_itunes_json['content_rights_declaration'].nil?
177
177
  begin
178
178
  puts "\n\n更新 Third Content ..."
@@ -181,9 +181,9 @@ module Pindo
181
181
  rescue => error
182
182
  puts "更新 Third Content 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
183
183
  puts error
184
- end
184
+ end
185
185
  end
186
-
186
+
187
187
  if !app_itunes_json['primary_locale'].nil?
188
188
  begin
189
189
  puts "\n\n更新 Primary Language ..."
@@ -192,20 +192,20 @@ module Pindo
192
192
  rescue => error
193
193
  puts "更新 Primary Language 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
194
194
  puts error
195
- end
195
+ end
196
196
  end
197
197
 
198
-
198
+
199
199
  if !app_itunes_json['privacy_data'].nil?
200
200
  # begin
201
201
  puts "\n\n更新 Privacy Usage Data ..."
202
202
  app_privacy_data = app_itunes_json['privacy_data']
203
203
  update_privacy_useagedata(app: app, app_privacy_data:app_privacy_data)
204
-
204
+
205
205
  # rescue => error
206
206
  # puts "更新 Privacy Usage Data 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
207
207
  # puts error
208
- # end
208
+ # end
209
209
  end
210
210
 
211
211
 
@@ -213,10 +213,10 @@ module Pindo
213
213
 
214
214
 
215
215
  def fastlane_update_app_info_metadata(app: nil, app_itunes_json:nil)
216
-
216
+
217
217
 
218
218
  app_info = app.fetch_edit_app_info
219
-
219
+
220
220
  begin
221
221
  puts "\n\n更新 Category ..."
222
222
  update_app_categories(app_info:app_info, app_info_data:app_itunes_json["app_info"])
@@ -224,7 +224,7 @@ module Pindo
224
224
  rescue => error
225
225
  puts "更新 Category 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
226
226
  puts error
227
- end
227
+ end
228
228
 
229
229
  if !app_age_rating_attributes = app_itunes_json["app_info"]["app_age_rating"].nil?
230
230
  begin
@@ -235,7 +235,7 @@ module Pindo
235
235
  rescue => error
236
236
  puts "更新 Age Rating 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
237
237
  puts error
238
- end
238
+ end
239
239
  end
240
240
 
241
241
  end
@@ -244,11 +244,11 @@ module Pindo
244
244
  def fastlane_update_app_info_localizations(app: nil, app_itunes_json:nil)
245
245
 
246
246
  app_info = app.fetch_edit_app_info
247
-
247
+
248
248
  sleep(3)
249
-
249
+
250
250
  begin
251
- puts
251
+ puts
252
252
  puts "更新 App Info Localizations..."
253
253
  app_info_localization_attributes = app_itunes_json['app_info']["app_info_localization"]
254
254
  app_info_localizations = verify_app_info_localizations(app_info:app_info, app_info_localization_attributes:app_info_localization_attributes)
@@ -258,7 +258,7 @@ module Pindo
258
258
  rescue => error
259
259
  puts "更新App Info Localizations 失败 !!! ===============+++++++============= 失败 !!!失败 !!!"
260
260
  puts error
261
- end
261
+ end
262
262
 
263
263
 
264
264
  end
@@ -268,27 +268,27 @@ module Pindo
268
268
 
269
269
  def update_privacy_useagedata(app: nil, app_privacy_data:nil)
270
270
  all_usages = Spaceship::ConnectAPI::AppDataUsage.all(app_id: app.id, includes: "category,grouping,purpose,dataProtection", limit: 500)
271
-
271
+
272
272
  begin
273
273
  all_usages.each(&:delete!)
274
274
  rescue => error
275
-
276
- end
275
+
276
+ end
277
277
 
278
278
  # old_usages_config = {}
279
- # if !all_usages.nil? && all_usages.size > 0
279
+ # if !all_usages.nil? && all_usages.size > 0
280
280
  # all_usages.each do |privacy_usage|
281
- # if !privacy_usage.category.nil?
281
+ # if !privacy_usage.category.nil?
282
282
  # category= privacy_usage.category.id
283
283
  # all_usages_config[category] = all_usages_config[category] || {}
284
284
  # all_usages_config[category]["category"] = category
285
- # if !privacy_usage.purpose.nil?
286
- # all_usages_config[category]["purposes"] = all_usages_config[category]["purposes"] || []
285
+ # if !privacy_usage.purpose.nil?
286
+ # all_usages_config[category]["purposes"] = all_usages_config[category]["purposes"] || []
287
287
  # all_usages_config[category]["purposes"] << privacy_usage.purpose.id
288
288
 
289
289
  # end
290
290
  # if !privacy_usage.data_protection.nil?
291
- # all_usages_config[category]["data_protections"] = all_usages_config[category]["data_protections"] || []
291
+ # all_usages_config[category]["data_protections"] = all_usages_config[category]["data_protections"] || []
292
292
  # all_usages_config[category]["data_protections"] << privacy_usage.data_protection.id
293
293
  # end
294
294
  # end
@@ -309,7 +309,7 @@ module Pindo
309
309
  publish_state.publish!
310
310
  rescue => error
311
311
  puts error
312
- end
312
+ end
313
313
 
314
314
 
315
315
  app_privacy_data.each do |usage_config|
@@ -328,23 +328,23 @@ module Pindo
328
328
  app_data_usage_purpose_id: purpose
329
329
  )
330
330
  rescue => error
331
-
332
- end
331
+
332
+ end
333
333
 
334
334
 
335
335
  end
336
336
  end
337
337
  end
338
-
339
338
 
340
339
 
341
- begin
342
-
340
+
341
+ begin
342
+
343
343
  publish_state = Spaceship::ConnectAPI::AppDataUsagesPublishState.get(app_id: app.id)
344
344
  publish_state.publish!
345
345
  rescue => error
346
346
  puts error
347
- end
347
+ end
348
348
 
349
349
 
350
350
  end
@@ -352,30 +352,30 @@ module Pindo
352
352
 
353
353
  def update_app_categories(app_info:nil, app_info_data:nil)
354
354
 
355
-
355
+
356
356
  if !app_info_data.nil?
357
357
  category_id_map = {}
358
358
 
359
359
  if !app_info_data["primary_category"].nil?
360
- category_id_map[:primary_category_id] = app_info_data["primary_category"]
360
+ category_id_map[:primary_category_id] = app_info_data["primary_category"]
361
361
 
362
362
  if app_info_data["primary_category"].eql?("STICKERS") || app_info_data["primary_category"].eql?("GAMES")
363
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"]
364
+ category_id_map[:primary_subcategory_two_id] = app_info_data["primary_subcategory_two"]
365
365
 
366
366
  else
367
367
  category_id_map[:primary_subcategory_one_id] = nil
368
368
  category_id_map[:primary_subcategory_two_id] = nil
369
- end
369
+ end
370
370
  end
371
-
371
+
372
372
 
373
373
 
374
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"]
375
+ category_id_map[:secondary_category_id] = app_info_data["secondary_category"]
376
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"]
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
379
  else
380
380
  category_id_map[:secondary_subcategory_one_id] = nil
381
381
  category_id_map[:secondary_subcategory_two_id] = nil
@@ -403,9 +403,9 @@ module Pindo
403
403
  attributes_key = camel_case_lower(string:key)
404
404
  age_rate_attributes[attributes_key] = value
405
405
  end
406
-
406
+
407
407
  declaration.update(attributes: age_rate_attributes)
408
-
408
+
409
409
  end
410
410
 
411
411
  def verify_app_info_localizations(app_info:nil, app_info_localization_attributes:nil)
@@ -454,7 +454,7 @@ module Pindo
454
454
  end
455
455
  app_info_worker.batch_enqueue(app_info_localizations)
456
456
  app_info_worker.start
457
-
457
+
458
458
  end
459
459
 
460
460
 
@@ -472,7 +472,7 @@ module Pindo
472
472
  locales_to_enable = languages - localizations.map(&:locale)
473
473
 
474
474
  if locales_to_enable.count > 0
475
-
475
+
476
476
  puts " 创建多语言 #{locales_to_enable.join(', ')}..."
477
477
 
478
478
  locales_to_enable.each do |locale|
@@ -493,11 +493,11 @@ module Pindo
493
493
  # Update app store version localizations
494
494
  store_version_worker = FastlaneCore::QueueWorker.new do |app_store_version_localization|
495
495
  attributes = version_info_localization_attributes[app_store_version_localization.locale]
496
-
496
+
497
497
  if attributes
498
498
  puts "Uploading app version info localized '#{app_store_version_localization.locale}'"
499
499
  attributes = check_attributes(attributes:attributes)
500
- if app_live_version_info.nil?
500
+ if app_live_version_info.nil?
501
501
  attributes.delete("whats_new")
502
502
  end
503
503
  app_store_version_localization.update(attributes: attributes)
@@ -525,9 +525,46 @@ module Pindo
525
525
 
526
526
  def fastlane_process_lang_screenshots(lang_screenshots_path:nil)
527
527
 
528
- # puts "正在处理目录:#{lang_screenshots_path}"
529
528
  valid_file_extensions = ['png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG']
530
529
 
530
+
531
+ #检查是否区分iPad 2和iPad Pro
532
+ ipad_dir_array= []
533
+ all_device_size = Deliver::AppScreenshot.devices
534
+ Dir.glob(File.join(lang_screenshots_path, "*")).each do |image_dir_path|
535
+ image_dir_basename = File.basename(image_dir_path)
536
+ # puts "image_dir_basename:#{image_dir_basename}"
537
+ if File.directory?(image_dir_path) && ![".", ".."].include?(image_dir_basename)
538
+ valide_pic_num = 0
539
+ Dir.foreach(image_dir_path) do |file|
540
+ image_full_name = File.join(image_dir_path, file)
541
+ extname = File.extname(image_full_name).delete('.')
542
+ if valid_file_extensions.include?(extname)
543
+ img_size = FastImage.size(image_full_name)
544
+ if all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_IPAD_PRO].include?(img_size)
545
+ valide_pic_num = valide_pic_num + 1
546
+ end
547
+
548
+ if valide_pic_num >=1
549
+ ipad_dir_array << image_dir_basename.to_s.downcase
550
+ break;
551
+ end
552
+ end
553
+ end
554
+
555
+
556
+ end
557
+ end
558
+ if ipad_dir_array.include?("ipadpro3") || ipad_dir_array.include?("ipadpro129") || ipad_dir_array.include?("ipad_6gen")
559
+ # puts "找到ipad pro 3截屏"
560
+ else
561
+ puts lang_screenshots_path
562
+ raise Informative, "iPad 3代截屏没有iPad 2代截屏区分开,请修改iPad截屏目录, iPad 3代截屏目录修改为: ipadpro129"
563
+ end
564
+
565
+
566
+
567
+
531
568
  Dir.glob(File.join(lang_screenshots_path, "*")).each do |image_dir_path|
532
569
  image_dir_basename = File.basename(image_dir_path)
533
570
  # puts "处理目录:#{image_dir_path}"
@@ -535,7 +572,7 @@ module Pindo
535
572
  if File.directory?(image_dir_path) && ![".", ".."].include?(image_dir_basename)
536
573
  Dir.foreach(image_dir_path) do |file|
537
574
 
538
- image_full_name = File.join(image_dir_path, file)
575
+ image_full_name = File.join(image_dir_path, file)
539
576
  extname = File.extname(image_full_name).delete('.')
540
577
  extension = File.extname(image_full_name)
541
578
  base_name = File.basename(image_full_name, extension)
@@ -549,7 +586,7 @@ module Pindo
549
586
  img_size = FastImage.size(image_full_name)
550
587
 
551
588
 
552
- if lang_screenshots_path.include?("/iMessage/") || lang_screenshots_path.include?("/imessage/") || lang_screenshots_path.include?("/IMESSAGE/")
589
+ if lang_screenshots_path.include?("/iMessage/") || lang_screenshots_path.include?("/imessage/") || lang_screenshots_path.include?("/IMESSAGE/")
553
590
 
554
591
  all_device_size = Deliver::AppScreenshot.device_messages
555
592
  # puts all_message_device_size
@@ -563,9 +600,9 @@ module Pindo
563
600
  elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_67_MESSAGES].include?(img_size)
564
601
  dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_67"] + new_base_name)
565
602
  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)
603
+ dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_65"] + new_base_name)
567
604
  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)
605
+ dest_name = File.join(lang_screenshots_path, display_type_dir_name["IMESSAGE_APP_IPHONE_55"] + new_base_name)
569
606
  end
570
607
 
571
608
  else
@@ -580,32 +617,32 @@ module Pindo
580
617
  elsif all_device_size[Deliver::AppScreenshot::ScreenSize::IOS_67].include?(img_size)
581
618
  dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_67"] + new_base_name)
582
619
  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)
620
+ dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_65"] + new_base_name)
584
621
  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)
622
+ dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_55"] + new_base_name)
586
623
  end
587
624
  end
588
-
589
- # if (img_size[0] == 1290 && img_size[1] == 2796) || (img_size[0] == 2796 && img_size[1] == 1290)
625
+
626
+ # if (img_size[0] == 1290 && img_size[1] == 2796) || (img_size[0] == 2796 && img_size[1] == 1290)
590
627
  # 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)
628
+ # end
629
+ # 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)
630
+ # dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_65"] + new_base_name)
594
631
  # end
595
632
 
596
633
  # 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)
634
+ # dest_name = File.join(lang_screenshots_path, display_type_dir_name["APP_IPHONE_55"] + new_base_name)
598
635
  # end
599
-
636
+
600
637
  FileUtils.mv(image_full_name, dest_name, force:true)
601
638
  end
602
-
603
- end
639
+
640
+ end
604
641
 
605
642
  FileUtils.rm_rf(image_dir_path)
606
643
  end
607
644
 
608
- end
645
+ end
609
646
 
610
647
 
611
648
 
@@ -616,41 +653,41 @@ module Pindo
616
653
 
617
654
 
618
655
  def fastlane_download_app_info(app: nil, app_itunes_json:nil, app_itunes_dir:nil)
619
-
656
+
620
657
 
621
658
  app_info = app.fetch_edit_app_info || app.fetch_live_app_info
622
659
 
623
- if app_info.primary_category.nil?
660
+ if app_info.primary_category.nil?
624
661
  app_itunes_json["app_info"]["primary_category"] = app_info.primary_category
625
662
  else
626
663
  app_itunes_json["app_info"]["primary_category"] = app_info.primary_category.id
627
664
  end
628
665
 
629
- if app_info.primary_subcategory_one.nil?
666
+ if app_info.primary_subcategory_one.nil?
630
667
  app_itunes_json["app_info"]["primary_subcategory_one"] = app_info.primary_subcategory_one
631
668
  else
632
669
  app_itunes_json["app_info"]["primary_subcategory_one"] = app_info.primary_subcategory_one.id
633
670
  end
634
671
 
635
- if app_info.primary_subcategory_two.nil?
672
+ if app_info.primary_subcategory_two.nil?
636
673
  app_itunes_json["app_info"]["primary_subcategory_two"] = app_info.primary_subcategory_two
637
674
  else
638
675
  app_itunes_json["app_info"]["primary_subcategory_two"] = app_info.primary_subcategory_two.id
639
676
  end
640
677
 
641
- if app_info.secondary_category.nil?
678
+ if app_info.secondary_category.nil?
642
679
  app_itunes_json["app_info"]["secondary_category"] = app_info.secondary_category
643
680
  else
644
681
  app_itunes_json["app_info"]["secondary_category"] = app_info.secondary_category.id
645
682
  end
646
683
 
647
- if app_info.secondary_subcategory_one.nil?
684
+ if app_info.secondary_subcategory_one.nil?
648
685
  app_itunes_json["app_info"]["secondary_subcategory_one"] = app_info.secondary_subcategory_one
649
686
  else
650
687
  app_itunes_json["app_info"]["secondary_subcategory_one"] = app_info.secondary_subcategory_one.id
651
688
  end
652
689
 
653
- if app_info.secondary_subcategory_two.nil?
690
+ if app_info.secondary_subcategory_two.nil?
654
691
  app_itunes_json["app_info"]["secondary_subcategory_two"] = app_info.secondary_subcategory_two
655
692
  else
656
693
  app_itunes_json["app_info"]["secondary_subcategory_two"] = app_info.secondary_subcategory_two.id
@@ -679,19 +716,19 @@ module Pindo
679
716
  end
680
717
 
681
718
 
682
-
683
719
 
684
720
 
685
721
 
686
722
 
687
723
 
688
724
 
689
-
725
+
726
+
690
727
 
691
728
 
692
729
 
693
730
  app_info_localizations = app_info.get_app_info_localizations
694
-
731
+
695
732
  if !app_info_localizations.nil?
696
733
 
697
734
  locales_to_disable = all_languages - app_info_localizations.map(&:locale)
@@ -726,14 +763,14 @@ module Pindo
726
763
  if !File.exist?(metadata_platform_path)
727
764
  FileUtils.mkdir_p(metadata_platform_path)
728
765
  end
729
- app_itunes_json["app_edit_version_info"][platform] = {}
766
+ app_itunes_json["app_edit_version_info"][platform] = {}
730
767
  app_itunes_json["app_edit_version_info"][platform]["app_review_info"] = {}
731
-
768
+
732
769
  app_itunes_json["app_edit_version_info"][platform]["version_string"] = app_version_info.version_string.nil? ? "" : app_version_info.version_string
733
770
  app_itunes_json["app_edit_version_info"][platform]["copyright"] = app_version_info.copyright.nil? ? "" : app_version_info.copyright
734
771
  app_itunes_json["app_edit_version_info"][platform]["release_type"] = app_version_info.release_type.nil? ? "" : app_version_info.release_type
735
772
 
736
-
773
+
737
774
 
738
775
  app_store_review_data = app_itunes_json["app_edit_version_info"][platform]["app_review_info"]
739
776
  app_store_review_detail = begin
@@ -797,7 +834,7 @@ module Pindo
797
834
  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
835
 
799
836
  localization_data = app_itunes_json["app_edit_version_info"][platform]["app_version_info_localization"][lang]
800
-
837
+
801
838
 
802
839
  localization_data["description"] = app_version_info_localization.description
803
840
  localization_data["keywords"] = app_version_info_localization.keywords
@@ -817,7 +854,7 @@ module Pindo
817
854
  # 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
855
  # 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
856
  end
820
-
857
+
821
858
  end
822
859
 
823
860
  end
@@ -840,7 +877,7 @@ module Pindo
840
877
  rescue
841
878
  # if it's already there
842
879
  end
843
-
880
+
844
881
 
845
882
  app_version_info_localizations = app_version_info.get_app_store_version_localizations
846
883
 
@@ -877,7 +914,7 @@ module Pindo
877
914
  rescue
878
915
  # if it's already there
879
916
  end
880
-
917
+
881
918
  puts "======== #{screenshot_set.screenshot_display_type}"
882
919
  dir_name = display_type_dir_name[screenshot_set.screenshot_display_type]
883
920
 
@@ -898,7 +935,7 @@ module Pindo
898
935
 
899
936
 
900
937
  path = File.join(containing_folder, file_name)
901
- download_screenshots_exe(file_name:path, url:url, over_write:over_write)
938
+ download_screenshots_exe(file_name:path, url:url, over_write:over_write)
902
939
  end
903
940
  end
904
941
  end
@@ -907,16 +944,72 @@ module Pindo
907
944
 
908
945
  if !over_write && File.exist?(file_name)
909
946
  puts " Existing screenshot #{file_name}"
910
- return
947
+ return
911
948
  end
912
949
 
913
950
  puts "Downloading existing screenshot #{file_name}"
914
951
 
915
- File.binwrite(file_name, FastlaneCore::Helper.open_uri(url).read)
916
-
952
+ File.binwrite(file_name, URI.open(url).read)
953
+ # File.binwrite(file_name, FastlaneCore::Helper.open_uri(url).read)
954
+
917
955
  end
918
956
 
919
957
 
958
+
959
+ def change_img_sort(lang_screenshots_path:nil)
960
+
961
+ new_sort_index = [0,1, 2, 8, 9, 7, 3, 4, 5, 6]
962
+
963
+ bacK_lang_screenshots_path = lang_screenshots_path + "_bak"
964
+ FileUtils.rm_rf(bacK_lang_screenshots_path) if Dir.exist?(bacK_lang_screenshots_path)
965
+ FileUtils.mv(lang_screenshots_path, bacK_lang_screenshots_path, force:true)
966
+
967
+ all_lang_file_obj = {}
968
+ Dir.glob(File.join(bacK_lang_screenshots_path, "*")).each do |bak_image_full_name|
969
+ image_dir_basename = File.basename(bak_image_full_name)
970
+ extname = File.extname(bak_image_full_name).delete('.')
971
+ # puts "bak_image_full_name:#{bak_image_full_name}"
972
+ if File.file?(bak_image_full_name) && valid_file_extensions.include?(extname)
973
+ # puts "bak_image_full_name:#{bak_image_full_name}"
974
+ extension = File.extname(bak_image_full_name)
975
+ base_name = File.basename(bak_image_full_name, extension)
976
+ deveice_name = base_name.slice(0...-3)
977
+ # puts "deveice_name:#{deveice_name}"
978
+ all_lang_file_obj[deveice_name] = all_lang_file_obj[deveice_name] || []
979
+ all_lang_file_obj[deveice_name].push(bak_image_full_name)
980
+
981
+ end
982
+ end
983
+
984
+ # puts JSON.pretty_generate(all_lang_file_obj)
985
+
986
+ FileUtils.mkdir_p(lang_screenshots_path)
987
+ all_lang_file_obj.each do |deveice_name, bak_file_array|
988
+
989
+ for i in 0..new_sort_index.length-1 do
990
+ old_index = new_sort_index[i]
991
+ if bak_file_array.size > old_index
992
+ src_imag_file_name = bak_file_array[old_index]
993
+ extension = File.extname(src_imag_file_name)
994
+ new_name = i.to_s
995
+ if new_name.to_s.size < 2
996
+ new_name = "0" + new_name
997
+ end
998
+
999
+ new_des_file_name = File.join(lang_screenshots_path, deveice_name + "_" + new_name + extension)
1000
+ puts new_des_file_name
1001
+ FileUtils.mv(src_imag_file_name, new_des_file_name, force:true)
1002
+ end
1003
+ end
1004
+ end
1005
+
1006
+ FileUtils.rm_rf(bacK_lang_screenshots_path) if Dir.exist?(bacK_lang_screenshots_path)
1007
+
1008
+
1009
+ end
1010
+
1011
+
1012
+
920
1013
  end
921
1014
 
922
1015
  end