mmine 0.6.10 → 0.7.5
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 +5 -5
- data/lib/mmine/notification_extension_integrator.rb +46 -111
- data/lib/mmine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '067639c9e8125d67e9385f760218f5157bc00692'
|
4
|
+
data.tar.gz: 75b4b96d6e3e5903ddc1fec0ab31868aa4e05598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 368bc89e02e79061374c25d3fdc031446607073e8b89e061de852181ed435fa9aa3b38ec83cf6ef8b2459fee95a849a0c064a09ee21e08c22369719a3b38b74c
|
7
|
+
data.tar.gz: 2a6e089e40329a2f76781935a8c785682a1b1217967895850197228d2b39a5ef176e20bb6289f8ea36c4def5ef4bedf37c9d25a83406a01f2ab488eadbbedcb0
|
@@ -24,6 +24,7 @@ class NotificationExtensionIntegrator
|
|
24
24
|
|
25
25
|
@project_dir = Pathname.new(@project_file_path).parent.to_s
|
26
26
|
@project = Xcodeproj::Project.open(@project_file_path)
|
27
|
+
@project_name = @project.root_object.name
|
27
28
|
@ne_target_name = 'MobileMessagingNotificationExtension'
|
28
29
|
@framework_file_name = "MobileMessaging.framework"
|
29
30
|
@extension_source_name_filepath = File.join(Mmine.root, 'resources','NotificationService.swift')
|
@@ -59,12 +60,13 @@ class NotificationExtensionIntegrator
|
|
59
60
|
setupDeploymentTarget()
|
60
61
|
setupNotificationExtensionInfoPlist()
|
61
62
|
setupNotificationExtensionBundleId()
|
62
|
-
|
63
|
-
|
64
|
-
setupAppGroupPlistValue()
|
63
|
+
setupCommonEntitlementsFiles()
|
64
|
+
setupUserAppGroupValue()
|
65
65
|
setupBackgroundModesPlistValue()
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
setupTargetCapabilities(@ne_target.uuid)
|
68
|
+
setupTargetCapabilities(@main_target.uuid)
|
69
|
+
|
68
70
|
setupEmbedExtensionAction()
|
69
71
|
setupMainTargetDependency()
|
70
72
|
setupSwiftVersion()
|
@@ -169,26 +171,39 @@ class NotificationExtensionIntegrator
|
|
169
171
|
end
|
170
172
|
end
|
171
173
|
|
172
|
-
def
|
173
|
-
|
174
|
-
|
174
|
+
def setupCommonEntitlementsFiles
|
175
|
+
entitlements_debug_filepath = resolveAbsolutePath("$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Debug.plist") #todo
|
176
|
+
entitlements_release_filepath = resolveAbsolutePath("$(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-Release.plist") #todo
|
175
177
|
|
176
|
-
|
177
|
-
|
178
|
-
if
|
179
|
-
|
178
|
+
key = 'CODE_SIGN_ENTITLEMENTS'
|
179
|
+
|
180
|
+
if entitlements_debug_filepath == entitlements_release_filepath
|
181
|
+
@logger.info("\tEntitlements settings are equal for debug and release schemes.")
|
182
|
+
|
183
|
+
putKeyArrayElement("com.apple.security.application-groups", @app_group, entitlements_debug_filepath)
|
184
|
+
putStringValueIntoXML("aps-environment", "development", entitlements_debug_filepath)
|
180
185
|
else
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
186
|
+
if entitlements_debug_filepath != nil
|
187
|
+
@logger.info("\tEntitlements debug settings already set, updating settings...")
|
188
|
+
putKeyArrayElement("com.apple.security.application-groups", @app_group, entitlements_debug_filepath)
|
189
|
+
putStringValueIntoXML("aps-environment", "development", entitlements_debug_filepath)
|
190
|
+
else
|
191
|
+
@logger.error("\tEntitlements debug settings are not set")
|
192
|
+
# stop here
|
193
|
+
end
|
185
194
|
|
186
|
-
|
187
|
-
|
188
|
-
|
195
|
+
if entitlements_release_filepath != nil
|
196
|
+
@logger.info("\tEntitlements release settings already set, updating settings...")
|
197
|
+
putKeyArrayElement("com.apple.security.application-groups", @app_group, entitlements_release_filepath)
|
198
|
+
putStringValueIntoXML("aps-environment", "production", entitlements_release_filepath)
|
199
|
+
else
|
200
|
+
@logger.error("\tEntitlements debug settings are not set")
|
201
|
+
# stop here
|
202
|
+
end
|
203
|
+
end
|
189
204
|
end
|
190
205
|
|
191
|
-
def
|
206
|
+
def setupUserAppGroupValue
|
192
207
|
putStringValueIntoXML("com.mobilemessaging.app_group", @app_group, @main_target_debug_plist)
|
193
208
|
putStringValueIntoXML("com.mobilemessaging.app_group", @app_group, @main_target_release_plist)
|
194
209
|
end
|
@@ -278,75 +293,11 @@ class NotificationExtensionIntegrator
|
|
278
293
|
removeEmbedFrameworkPhase()
|
279
294
|
end
|
280
295
|
|
281
|
-
def
|
282
|
-
entitlements_debug_filepath = _build_settings_debug['CODE_SIGN_ENTITLEMENTS'] != nil ? resolveAbsolutePath(_build_settings_debug['CODE_SIGN_ENTITLEMENTS']) : nil
|
283
|
-
entitlements_release_filepath = _build_settings_release['CODE_SIGN_ENTITLEMENTS'] != nil ? resolveAbsolutePath(_build_settings_release['CODE_SIGN_ENTITLEMENTS']) : nil
|
284
|
-
key = 'CODE_SIGN_ENTITLEMENTS'
|
285
|
-
if entitlements_debug_filepath == nil and entitlements_release_filepath == nil
|
286
|
-
@logger.info("\tEntitlements are not set for both release and debug schemes, setting up...")
|
287
|
-
entitlements_destination_filepath = createAppGroupEntitlements("#{target_name}.entitlements")
|
288
|
-
entitlements_destination_filepath = resolveXcodePath(entitlements_destination_filepath)
|
289
|
-
|
290
|
-
@logger.info("\tSetting build settings:\n\t\tdebug: \t#{key}\t#{entitlements_destination_filepath}\n\t\trelease:\t#{key}\t#{entitlements_destination_filepath}")
|
291
|
-
|
292
|
-
_build_settings_debug[key] = entitlements_destination_filepath
|
293
|
-
_build_settings_release[key] = entitlements_destination_filepath
|
294
|
-
else
|
295
|
-
if entitlements_debug_filepath == entitlements_release_filepath
|
296
|
-
@logger.info("\tEntitlements settings are equal for debug and release schemes.")
|
297
|
-
putAppGroupEntitlement(entitlements_debug_filepath)
|
298
|
-
else
|
299
|
-
if entitlements_debug_filepath != nil
|
300
|
-
@logger.info("\tEntitlements debug settings already set, updating settings...")
|
301
|
-
putAppGroupEntitlement(entitlements_debug_filepath)
|
302
|
-
else
|
303
|
-
@logger.info("\tEntitlements debug settings are not set, setting up...")
|
304
|
-
entitlements_destination_filepath = createAppGroupEntitlements("#{target_name}_debug.entitlements")
|
305
|
-
entitlements_destination_filepath = resolveXcodePath(entitlements_destination_filepath)
|
306
|
-
|
307
|
-
@logger.info("\tSetting build settings:\n\tdebug:\t#{key}\t#{entitlements_destination_filepath}")
|
308
|
-
_build_settings_debug[key] = entitlements_destination_filepath
|
309
|
-
end
|
310
|
-
|
311
|
-
if entitlements_release_filepath != nil
|
312
|
-
@logger.info("\tEntitlements release settings already set, updating settings...")
|
313
|
-
putAppGroupEntitlement(entitlements_release_filepath)
|
314
|
-
else
|
315
|
-
@logger.info("\tEntitlements release settings are not set, setting up...")
|
316
|
-
entitlements_destination_filepath = createAppGroupEntitlements("#{target_name}_release.entitlements")
|
317
|
-
entitlements_destination_filepath = resolveXcodePath(entitlements_destination_filepath)
|
318
|
-
|
319
|
-
@logger.info("\tSetting build settings:\n\trelease:\t#{key}\t#{entitlements_destination_filepath}")
|
320
|
-
_build_settings_release[key] = entitlements_destination_filepath
|
321
|
-
end
|
322
|
-
end
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
def setupExtensionTargetCapabilities
|
296
|
+
def setupTargetCapabilities(target_uuid)
|
327
297
|
unless @project.root_object.attributes["TargetAttributes"]
|
328
298
|
@project.root_object.attributes["TargetAttributes"] = Hash.new
|
329
299
|
end
|
330
|
-
exitsting_capabilities = @project.root_object.attributes["TargetAttributes"][
|
331
|
-
mobilemessaging_capabilities = { "SystemCapabilities" =>
|
332
|
-
{
|
333
|
-
"com.apple.ApplicationGroups.iOS" => { "enabled" => 1 }
|
334
|
-
}
|
335
|
-
}
|
336
|
-
if exitsting_capabilities == nil
|
337
|
-
@logger.info("\tSetting TargetAttributes #{mobilemessaging_capabilities} for extension")
|
338
|
-
@project.root_object.attributes["TargetAttributes"][@ne_target.uuid] = mobilemessaging_capabilities
|
339
|
-
else
|
340
|
-
@logger.info("\tMerging TargetAttributes #{mobilemessaging_capabilities} for extension")
|
341
|
-
@project.root_object.attributes["TargetAttributes"][@ne_target.uuid] = exitsting_capabilities.merge(mobilemessaging_capabilities)
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
def setupMainTargetCapabilities
|
346
|
-
unless @project.root_object.attributes["TargetAttributes"]
|
347
|
-
@project.root_object.attributes["TargetAttributes"] = Hash.new
|
348
|
-
end
|
349
|
-
exitsting_capabilities = @project.root_object.attributes["TargetAttributes"][@main_target.uuid]
|
300
|
+
exitsting_capabilities = @project.root_object.attributes["TargetAttributes"][target_uuid]
|
350
301
|
mobilemessaging_capabilities = { "SystemCapabilities" =>
|
351
302
|
{
|
352
303
|
"com.apple.ApplicationGroups.iOS" => { "enabled" => 1 },
|
@@ -355,15 +306,14 @@ class NotificationExtensionIntegrator
|
|
355
306
|
}
|
356
307
|
}
|
357
308
|
if exitsting_capabilities == nil
|
358
|
-
@logger.info("\tSetting TargetAttributes #{mobilemessaging_capabilities} for
|
359
|
-
@project.root_object.attributes["TargetAttributes"][
|
309
|
+
@logger.info("\tSetting TargetAttributes #{mobilemessaging_capabilities} for target #{target_uuid}")
|
310
|
+
@project.root_object.attributes["TargetAttributes"][target_uuid] = mobilemessaging_capabilities
|
360
311
|
else
|
361
|
-
@logger.info("\tMerging TargetAttributes #{mobilemessaging_capabilities} for
|
362
|
-
@project.root_object.attributes["TargetAttributes"][
|
312
|
+
@logger.info("\tMerging TargetAttributes #{mobilemessaging_capabilities} for target #{target_uuid}")
|
313
|
+
@project.root_object.attributes["TargetAttributes"][target_uuid] = exitsting_capabilities.merge(mobilemessaging_capabilities)
|
363
314
|
end
|
364
315
|
end
|
365
316
|
|
366
|
-
|
367
317
|
def removeEmbedFrameworkPhase
|
368
318
|
@logger.info("Setting up embed framework script")
|
369
319
|
emb_fs = @main_target.copy_files_build_phases
|
@@ -398,29 +348,18 @@ class NotificationExtensionIntegrator
|
|
398
348
|
return group_reference
|
399
349
|
end
|
400
350
|
|
401
|
-
def createAppGroupEntitlements(_entitlements_name)
|
402
|
-
entitlements_destination_filepath = File.join(@project_dir, _entitlements_name)
|
403
|
-
entitlements_source_filepath = File.join(Mmine.root, 'resources', "MobileMessagingNotificationExtension.entitlements")
|
404
|
-
unless File.exist?(entitlements_destination_filepath)
|
405
|
-
@logger.info("\tCopying entitlemenst file to path: #{entitlements_destination_filepath}")
|
406
|
-
FileUtils.cp(entitlements_source_filepath, entitlements_destination_filepath)
|
407
|
-
ref = @project.main_group.new_reference(entitlements_destination_filepath)
|
408
|
-
ref.last_known_file_type = "text.xml"
|
409
|
-
else
|
410
|
-
@logger.info("\tEntitlements file already exists on path: #{entitlements_destination_filepath}")
|
411
|
-
end
|
412
|
-
putAppGroupEntitlement(entitlements_destination_filepath)
|
413
|
-
return entitlements_destination_filepath
|
414
|
-
end
|
415
|
-
|
416
351
|
def resolveAbsolutePath(path)
|
417
352
|
ret = path
|
418
353
|
["$(PROJECT_DIR)", "$PROJECT_DIR"].each do |proj_dir|
|
419
354
|
ret = ret.sub(proj_dir, @project_dir)
|
420
355
|
end
|
421
356
|
|
357
|
+
["$(PROJECT_NAME)", "$PROJECT_NAME"].each do |proj_name|
|
358
|
+
ret = ret.sub(proj_name, @project_name)
|
359
|
+
end
|
360
|
+
|
422
361
|
if ret.include?("$")
|
423
|
-
puts "Could not resolve absolute path for #{path}.
|
362
|
+
puts "Could not resolve absolute path for #{path}. Make sure you don't misuse Xcode paths variables, contact Infobip Mobile Messaging support via email Push.Support@infobip.com"
|
424
363
|
exit
|
425
364
|
end
|
426
365
|
|
@@ -520,8 +459,4 @@ class NotificationExtensionIntegrator
|
|
520
459
|
file.puts Nokogiri::XML(doc.to_xml) { |x| x.noblanks }
|
521
460
|
end
|
522
461
|
end
|
523
|
-
|
524
|
-
def putAppGroupEntitlement(filepath)
|
525
|
-
putKeyArrayElement("com.apple.security.application-groups", @app_group, filepath)
|
526
|
-
end
|
527
462
|
end
|
data/lib/mmine/version.rb
CHANGED
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.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Kadochnikov
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.5.2.3
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Mobile Messaging iOS Notification Extension Integration Tool made at Infobip
|