mmine 0.9.5 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 405a52d98e4702d1036467797ff10e3744660aa817059c7d5c51b0d186af94de
4
- data.tar.gz: 0b4bd052c74edfe002c0dac01493df6ca442256f12380f007bba5d7527f918a7
3
+ metadata.gz: cdd2da8bbe98ba3e12f896877783e2d66a3c65189e626ca2f91e1c9701cbb87f
4
+ data.tar.gz: 62536d99142467ad563846ad3a669f486ad0f89623de6970c1c106794ae5a558
5
5
  SHA512:
6
- metadata.gz: db7f77d620c59e9ea1aa2592b0133622a6583bdeb446c6daf5d5758c5485f7ed8dfd4c86fa201e71c372324a9b0dd0e06681af82626a666bf045e3ac7069e2bf
7
- data.tar.gz: 571c5a83fad2c049a6d677fdeca72ce4853fc2e17c54868ce8c08e07dab62c45582203d40fec55f2bb62c8f1790ae7f923e37fdca7532468122383589fe1ad27
6
+ metadata.gz: 2d1ea2afc7248f1e211b7a9f20a84f78fa5dcdc6cd3a78bba172fdad1cfc01514ac13240e3e566002f28125922b54f3a7386384364ccf52e0615a4f3789542d1
7
+ data.tar.gz: b9d8c6d40e423c64df0340874e4513367ca781b4b563bd64b4fa06a24f91c7c35f95b33980304a363f85196db47d95c0eba8363e100313cf0cac671247bdd379
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
@@ -68,14 +72,15 @@ class NotificationExtensionIntegrator
68
72
  setup_product_name
69
73
  setup_extension_build_number
70
74
  setup_run_path_search_paths
75
+ erease_bridging_header
71
76
 
72
77
  if @cordova
73
- setup_entitlements(resolve_absolute_paths(["$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Debug.plist"]),
74
- resolve_absolute_paths(["$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Release.plist"]),
78
+ setup_entitlements(nil,
75
79
  nil,
76
- @main_build_settings_debug,
77
- @main_build_settings_release)
78
- 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
79
84
  setup_framework_search_paths
80
85
  unless @xcframework
81
86
  setup_copy_framework_script
@@ -98,6 +103,31 @@ class NotificationExtensionIntegrator
98
103
  puts "🏁 Integration has been finished successfully!"
99
104
  end
100
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
+
101
131
  def create_notification_extension_target
102
132
  @extension_target_name = 'MobileMessagingNotificationExtension'
103
133
  @extension_source_name_filepath = File.join(Mmine.root, 'resources', 'NotificationService.swift')
@@ -264,8 +294,8 @@ class NotificationExtensionIntegrator
264
294
  end
265
295
 
266
296
  def setup_entitlements(entitlements_debug_file_paths, entitlements_release_file_paths, target_name, _build_settings_debug, _build_settings_release)
267
- entitlements_debug_file_paths = entitlements_debug_file_paths.compact
268
- 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
269
299
  @logger.debug("setup_entitlements #{entitlements_debug_file_paths} #{entitlements_release_file_paths} #{target_name} #{_build_settings_debug} #{_build_settings_release}")
270
300
  code_sign_entitlements_key = 'CODE_SIGN_ENTITLEMENTS'
271
301
  aps_env_key = 'aps-environment'
@@ -291,7 +321,11 @@ class NotificationExtensionIntegrator
291
321
  @logger.info("\tEntitlements settings are equal for debug and release schemes.")
292
322
 
293
323
  put_key_array_element("com.apple.security.application-groups", @app_group, entitlements_debug_file_paths)
294
- 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
295
329
  else
296
330
  if (entitlements_debug_file_paths == nil or entitlements_debug_file_paths.empty?) and target_name != nil
297
331
  @logger.error("\tEntitlements debug settings are not set, creating entitlements file")
@@ -312,8 +346,12 @@ class NotificationExtensionIntegrator
312
346
  end
313
347
 
314
348
  put_key_array_element("com.apple.security.application-groups", @app_group, entitlements_debug_file_paths + entitlements_release_file_paths)
315
- put_string_value_into_xml(aps_env_key, development, entitlements_debug_file_paths)
316
- 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
317
355
  end
318
356
  end
319
357
 
@@ -344,8 +382,12 @@ class NotificationExtensionIntegrator
344
382
  end
345
383
  end
346
384
 
385
+ def erease_bridging_header
386
+ set_notification_extension_build_settings('SWIFT_OBJC_BRIDGING_HEADER', '')
387
+ end
388
+
347
389
  def setup_framework_search_paths
348
- set_notification_extension_build_settings('FRAMEWORK_SEARCH_PATHS', '$SRCROOT/$PROJECT/Plugins/com-infobip-plugins-mobilemessaging')
390
+ set_notification_extension_build_settings('FRAMEWORK_SEARCH_PATHS', '$SRCROOT/$PROJECT/Plugins/com-infobip-plugins-mobilemessaging/**')
349
391
  end
350
392
 
351
393
  def setup_run_path_search_paths
@@ -405,11 +447,16 @@ class NotificationExtensionIntegrator
405
447
  remove_embed_framework_phase
406
448
  end
407
449
 
408
- def setup_target_capabilities(target_uuid)
409
- unless @project.root_object.attributes["TargetAttributes"]
410
- @project.root_object.attributes["TargetAttributes"] = Hash.new
411
- end
412
- 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
413
460
  mobile_messaging_capabilities = {"SystemCapabilities" =>
414
461
  {
415
462
  "com.apple.ApplicationGroups.iOS" => {"enabled" => 1},
@@ -417,12 +464,20 @@ class NotificationExtensionIntegrator
417
464
  "com.apple.BackgroundModes" => {"enabled" => 1}
418
465
  }
419
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]
420
475
  if existing_capabilities == nil
421
- @logger.info("\tSetting TargetAttributes #{mobile_messaging_capabilities} for target #{target_uuid}")
422
- @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
423
478
  else
424
- @logger.info("\tMerging TargetAttributes #{mobile_messaging_capabilities} for target #{target_uuid}")
425
- @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)
426
481
  end
427
482
  end
428
483
 
data/lib/mmine/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mmine
2
- VERSION = "0.9.5"
3
- end
2
+ VERSION = "0.9.9"
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.5
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Kadochnikov