mmine 0.9.7 → 0.9.11

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: d490fc5cefe008e8fe59cd2e69bbb048c088106ce034b3d22a59cbb3c909dcf4
4
- data.tar.gz: 27c17fe2fc5fd5e885b2368d317a0de63feea805d8af3b2172599123de1aea8c
3
+ metadata.gz: 846ed86ca1bf73356fc8537b406e7dcd72cdbde4eee20f2c2a900b7662de81ec
4
+ data.tar.gz: 6cca4fd1ff6d955392d66155aa2ee6ec5c40d6f38c7e2445264c569dcb31bb95
5
5
  SHA512:
6
- metadata.gz: 6c523b146a39987351240e79ec55f6eeff2cb428156c5aef7614296f7675411624e1ada2d1434ab11afe244f9b9e929d5d29afa520d19f5c4c3bf6c1b2228888
7
- data.tar.gz: 41d04924b9700394cd5d67a32eabd7a5d444a74f489f7102f158ee003a9dc00da737dc279a7f9b6bc45f590e5e938d10c4470c98263fcefba237c345770512cf
6
+ metadata.gz: ff1750a7f8f986ea26c3945b31e836311e54daef8c9936bd60a459ca91f4e0910ce03425ee25bc031b033e90df7a74e6313b95e6fc03e0fdb3ec6947028ea31e
7
+ data.tar.gz: 93e728c640cf959abe354da9815534acc08a9131d3b0777d329687c319803075a2f82a4f50770f0499079762c2e017a096eaaaedb1557b32100f1878343c8ff1
data/bin/mmine CHANGED
@@ -32,6 +32,9 @@ integrate_parse = OptionParser.new do |opts|
32
32
  opts.on("--swift-version", "--swift-version SWIFT_VER", "Provide Swift Language version for notification extension (by default 5)") do |ver|
33
33
  options[:"swift-version"] = ver
34
34
  end
35
+ opts.on("-s", "--override-signing", "Override parameters for MobileMessagingNotificationExtension signing using build flags") do |override|
36
+ options[:"override-signing"] = override
37
+ end
35
38
  opts.on("-h", "--help", "Prints this help") do
36
39
  puts opts
37
40
  exit
@@ -46,8 +49,8 @@ when "integrate"
46
49
  missing = mandatory.select{ |param| options[param].nil? }
47
50
  unless missing.empty?
48
51
  raise OptionParser::MissingArgument.new(missing.join(', '))
49
- end
50
- integrator = NotificationExtensionIntegrator.new(options[:"application-code"], options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:xcframework] || false, options[:"swift-version"] || "5")
52
+ end
53
+ integrator = NotificationExtensionIntegrator.new(options[:"application-code"], options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:xcframework] || false, options[:"swift-version"] || "5", options[:"override-signing"] || false)
51
54
  integrator.logger = Logger.new(STDOUT)
52
55
  integrator.logger.formatter = proc do |severity, datetime, progname, msg|
53
56
  "#{severity}: #{msg}\n"
@@ -62,7 +65,7 @@ when "integrate"
62
65
  puts $!.to_s
63
66
  puts integrate_parse
64
67
  exit
65
- end
68
+ end
66
69
  else
67
70
  if first_arg == nil
68
71
  puts "Please specify a command. For example 'mmine integrate'"
@@ -14,7 +14,7 @@ module Mmine
14
14
  end
15
15
 
16
16
  class NotificationExtensionIntegrator
17
- def initialize(application_code, project_file_path, app_group, main_target_name, cordova = false, xcframework = false, swift_ver)
17
+ def initialize(application_code, project_file_path, app_group, main_target_name, cordova = false, xcframework = false, swift_ver, override_signing)
18
18
  @project_file_path = project_file_path
19
19
  @app_group = app_group
20
20
  @main_target_name = main_target_name
@@ -23,6 +23,7 @@ class NotificationExtensionIntegrator
23
23
  @xcframework = xcframework
24
24
  @swift_version = swift_ver
25
25
  @application_code = application_code
26
+ @override_signing = override_signing
26
27
 
27
28
  @project_dir = Pathname.new(@project_file_path).parent.to_s
28
29
  @project = Xcodeproj::Project.open(@project_file_path)
@@ -51,7 +52,10 @@ class NotificationExtensionIntegrator
51
52
  create_notification_extension_target
52
53
  create_notification_extension_dir
53
54
  add_notification_extension_source_code
54
- setup_development_team
55
+ setup_extension_target_signing(@override_signing)
56
+ if @override_signing == false
57
+ setup_development_team
58
+ end
55
59
  setup_deployment_target
56
60
  setup_notification_extension_info_plist
57
61
  setup_notification_extension_bundle_id
@@ -59,8 +63,8 @@ class NotificationExtensionIntegrator
59
63
  setup_user_app_group_value
60
64
  setup_background_modes_plist_value
61
65
 
62
- setup_target_capabilities(@extension_target.uuid)
63
- setup_target_capabilities(@main_target.uuid)
66
+ setup_target_capabilities_for_extension_target
67
+ setup_target_capabilities_for_main_target
64
68
 
65
69
  setup_embed_extension_action
66
70
  setup_main_target_dependency
@@ -71,12 +75,12 @@ class NotificationExtensionIntegrator
71
75
  erease_bridging_header
72
76
 
73
77
  if @cordova
74
- setup_entitlements(resolve_absolute_paths(["$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Debug.plist"]),
75
- resolve_absolute_paths(["$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Release.plist"]),
78
+ setup_entitlements(nil,
76
79
  nil,
77
- @main_build_settings_debug,
78
- @main_build_settings_release)
79
- setup_extension_lib_cordova_link
80
+ @extension_target_name,
81
+ @extension_build_settings_debug,
82
+ @extension_build_settings_release)
83
+ #setup_extension_lib_cordova_link
80
84
  setup_framework_search_paths
81
85
  unless @xcframework
82
86
  setup_copy_framework_script
@@ -99,6 +103,31 @@ class NotificationExtensionIntegrator
99
103
  puts "🏁 Integration has been finished successfully!"
100
104
  end
101
105
 
106
+ def setup_extension_target_signing(override_signing)
107
+ @logger.info("Overriding extension target signing: #{override_signing}")
108
+
109
+ signing_settings = {
110
+ 'DEVELOPMENT_TEAM' => '$MM_EXTENSION_DEVELOPMENT_TEAM',
111
+ 'CODE_SIGN_IDENTITY' => '$MM_EXTENSION_CODE_SIGN_IDENTITY',
112
+ }
113
+
114
+ signing_settings.keys.each do |key|
115
+ value = signing_settings[key]
116
+ @logger.info("Checking extension signing for key: #{key} value: #{value}")
117
+ if override_signing
118
+ set_notification_extension_build_settings(key, value)
119
+ else
120
+ # Delete setting if it was previously overridden
121
+ @extension_target.build_configurations.each do |config|
122
+ if config.resolve_build_setting(key) == value
123
+ @logger.info("Deletes extension setting for key: #{key} value: #{value}")
124
+ config.build_settings[key] = ''
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+
102
131
  def create_notification_extension_target
103
132
  @extension_target_name = 'MobileMessagingNotificationExtension'
104
133
  @extension_source_name_filepath = File.join(Mmine.root, 'resources', 'NotificationService.swift')
@@ -265,8 +294,8 @@ class NotificationExtensionIntegrator
265
294
  end
266
295
 
267
296
  def setup_entitlements(entitlements_debug_file_paths, entitlements_release_file_paths, target_name, _build_settings_debug, _build_settings_release)
268
- entitlements_debug_file_paths = entitlements_debug_file_paths.compact
269
- entitlements_release_file_paths = entitlements_release_file_paths.compact
297
+ entitlements_debug_file_paths = entitlements_debug_file_paths ? entitlements_debug_file_paths.compact : nil
298
+ entitlements_release_file_paths = entitlements_release_file_paths ? entitlements_release_file_paths.compact : nil
270
299
  @logger.debug("setup_entitlements #{entitlements_debug_file_paths} #{entitlements_release_file_paths} #{target_name} #{_build_settings_debug} #{_build_settings_release}")
271
300
  code_sign_entitlements_key = 'CODE_SIGN_ENTITLEMENTS'
272
301
  aps_env_key = 'aps-environment'
@@ -292,7 +321,11 @@ class NotificationExtensionIntegrator
292
321
  @logger.info("\tEntitlements settings are equal for debug and release schemes.")
293
322
 
294
323
  put_key_array_element("com.apple.security.application-groups", @app_group, entitlements_debug_file_paths)
295
- put_string_value_into_xml(aps_env_key, development, entitlements_debug_file_paths)
324
+
325
+ #aps env should be set only for main target
326
+ if (target_name != @extension_target_name)
327
+ put_string_value_into_xml(aps_env_key, development, entitlements_debug_file_paths)
328
+ end
296
329
  else
297
330
  if (entitlements_debug_file_paths == nil or entitlements_debug_file_paths.empty?) and target_name != nil
298
331
  @logger.error("\tEntitlements debug settings are not set, creating entitlements file")
@@ -313,8 +346,12 @@ class NotificationExtensionIntegrator
313
346
  end
314
347
 
315
348
  put_key_array_element("com.apple.security.application-groups", @app_group, entitlements_debug_file_paths + entitlements_release_file_paths)
316
- put_string_value_into_xml(aps_env_key, development, entitlements_debug_file_paths)
317
- put_string_value_into_xml(aps_env_key, production, entitlements_release_file_paths)
349
+
350
+ #aps env should be set only for main target
351
+ if (target_name != @extension_target_name)
352
+ put_string_value_into_xml(aps_env_key, development, entitlements_debug_file_paths)
353
+ put_string_value_into_xml(aps_env_key, production, entitlements_release_file_paths)
354
+ end
318
355
  end
319
356
  end
320
357
 
@@ -410,11 +447,16 @@ class NotificationExtensionIntegrator
410
447
  remove_embed_framework_phase
411
448
  end
412
449
 
413
- def setup_target_capabilities(target_uuid)
414
- unless @project.root_object.attributes["TargetAttributes"]
415
- @project.root_object.attributes["TargetAttributes"] = Hash.new
416
- end
417
- existing_capabilities = @project.root_object.attributes["TargetAttributes"][target_uuid]
450
+ def setup_target_capabilities_for_extension_target
451
+ mobile_messaging_capabilities = {"SystemCapabilities" =>
452
+ {
453
+ "com.apple.ApplicationGroups.iOS" => {"enabled" => 1},
454
+ }
455
+ }
456
+ setup_target_capabilities(@extension_target.uuid, mobile_messaging_capabilities)
457
+ end
458
+
459
+ def setup_target_capabilities_for_main_target
418
460
  mobile_messaging_capabilities = {"SystemCapabilities" =>
419
461
  {
420
462
  "com.apple.ApplicationGroups.iOS" => {"enabled" => 1},
@@ -422,12 +464,20 @@ class NotificationExtensionIntegrator
422
464
  "com.apple.BackgroundModes" => {"enabled" => 1}
423
465
  }
424
466
  }
467
+ setup_target_capabilities(@main_target.uuid, mobile_messaging_capabilities)
468
+ end
469
+
470
+ def setup_target_capabilities(target_uuid, capabilities)
471
+ unless @project.root_object.attributes["TargetAttributes"]
472
+ @project.root_object.attributes["TargetAttributes"] = Hash.new
473
+ end
474
+ existing_capabilities = @project.root_object.attributes["TargetAttributes"][target_uuid]
425
475
  if existing_capabilities == nil
426
- @logger.info("\tSetting TargetAttributes #{mobile_messaging_capabilities} for target #{target_uuid}")
427
- @project.root_object.attributes["TargetAttributes"][target_uuid] = mobile_messaging_capabilities
476
+ @logger.info("\tSetting TargetAttributes #{capabilities} for target #{target_uuid}")
477
+ @project.root_object.attributes["TargetAttributes"][target_uuid] = capabilities
428
478
  else
429
- @logger.info("\tMerging TargetAttributes #{mobile_messaging_capabilities} for target #{target_uuid}")
430
- @project.root_object.attributes["TargetAttributes"][target_uuid] = existing_capabilities.merge(mobile_messaging_capabilities)
479
+ @logger.info("\tMerging TargetAttributes #{capabilities} for target #{target_uuid}")
480
+ @project.root_object.attributes["TargetAttributes"][target_uuid] = existing_capabilities.merge(capabilities)
431
481
  end
432
482
  end
433
483
 
data/lib/mmine/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mmine
2
- VERSION = "0.9.7"
3
- end
2
+ VERSION = "0.9.11"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Kadochnikov
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.0.8
76
+ rubygems_version: 3.1.6
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Mobile Messaging iOS Notification Extension Integration Tool made at Infobip