mmine 1.0.0 → 2.0.0
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 +4 -4
- data/bin/mmine +2 -11
- data/lib/mmine/notification_extension_integrator.rb +117 -119
- data/lib/mmine/version.rb +9 -1
- data/lib/mmine.rb +8 -0
- data/resources/MobileMessagingNotificationServiceExtension.plist +1 -1
- data/resources/NotificationService.swift +13 -9
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad8f25390166cad5b75342b7d040e6294d2d0b55f82e0e7f11853246de8b988b
|
|
4
|
+
data.tar.gz: 621d61b79f53dbeba9e550be7182f80e4927e4a093c703e99636fc8215eb304a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 006d0d996da454e4363377c7762095cda71678b7e130f7023739ea48777dc19abc722e6e37a39ff0a8136c01cf43a936df68dc968f1dd90f8c5564aa00c55ca7
|
|
7
|
+
data.tar.gz: 85b4a3cb619becdcfa244c59b5f4a481d9bef2632cf5721aaba0280e6f2a7d9ad35d81ac0c403a35a5dd00f68f3a2468aca698bb1bc3ece2ec1660833d782215
|
data/bin/mmine
CHANGED
|
@@ -23,21 +23,12 @@ integrate_parse = OptionParser.new do |opts|
|
|
|
23
23
|
opts.on("-c", "--cordova", "Provide Cordova project specific settings.") do |cordova|
|
|
24
24
|
options[:cordova] = cordova
|
|
25
25
|
end
|
|
26
|
-
opts.on("-x", "--xcframework", "Should Cordova project use xcframework or framework.") do |xcframework|
|
|
27
|
-
options[:xcframework] = xcframework
|
|
28
|
-
end
|
|
29
26
|
opts.on("--swift-version", "--swift-version SWIFT_VER", "Provide Swift Language version for notification extension (by default 5)") do |ver|
|
|
30
27
|
options[:"swift-version"] = ver
|
|
31
28
|
end
|
|
32
|
-
opts.on("-s", "--override-signing", "Override parameters for
|
|
29
|
+
opts.on("-s", "--override-signing", "Override parameters for MobileMessagingNotificationServiceExtension signing using build flags") do |override|
|
|
33
30
|
options[:"override-signing"] = override
|
|
34
31
|
end
|
|
35
|
-
opts.on("-l", "--static-linkage", "If cocoapods static linkage used for MobileMessaging pods") do |static_linkage|
|
|
36
|
-
options[:"static-linkage"] = static_linkage
|
|
37
|
-
end
|
|
38
|
-
opts.on("-r", "--react-native", "Provide React-Native specific settings") do |react_native|
|
|
39
|
-
options[:"react-native"] = react_native
|
|
40
|
-
end
|
|
41
32
|
opts.on("--spm", "--spm", "If MobileMessaging is integrated using Swift Package Manager") do |spm|
|
|
42
33
|
options[:"spm"] = spm
|
|
43
34
|
end
|
|
@@ -56,7 +47,7 @@ when "integrate"
|
|
|
56
47
|
unless missing.empty?
|
|
57
48
|
raise OptionParser::MissingArgument.new(missing.join(', '))
|
|
58
49
|
end
|
|
59
|
-
integrator = NotificationExtensionIntegrator.new(options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:
|
|
50
|
+
integrator = NotificationExtensionIntegrator.new(options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:"swift-version"] || "5", options[:"override-signing"] || false, options[:"spm"] || false)
|
|
60
51
|
integrator.logger = Logger.new(STDOUT)
|
|
61
52
|
integrator.logger.formatter = proc do |severity, datetime, progname, msg|
|
|
62
53
|
"#{severity}: #{msg}\n"
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#
|
|
2
|
+
# notification_extension_integrator.rb
|
|
3
|
+
# mobile-messaging-mmine
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2016-2025 Infobip Limited
|
|
6
|
+
# Licensed under the Apache License, Version 2.0
|
|
7
|
+
#
|
|
8
|
+
|
|
1
9
|
require 'xcodeproj'
|
|
2
10
|
require 'fileutils'
|
|
3
11
|
require 'pathname'
|
|
@@ -14,24 +22,19 @@ module Mmine
|
|
|
14
22
|
end
|
|
15
23
|
|
|
16
24
|
class NotificationExtensionIntegrator
|
|
17
|
-
def initialize(project_file_path, app_group, main_target_name, cordova = false,
|
|
25
|
+
def initialize(project_file_path, app_group, main_target_name, cordova = false, swift_ver, override_signing, spm)
|
|
18
26
|
@project_file_path = project_file_path
|
|
19
27
|
@app_group = app_group
|
|
20
28
|
@main_target_name = main_target_name
|
|
21
29
|
@logger = nil
|
|
22
30
|
@cordova = cordova
|
|
23
|
-
@xcframework = xcframework
|
|
24
31
|
@swift_version = swift_ver
|
|
25
32
|
@override_signing = override_signing
|
|
26
|
-
@static_linkage = static_linkage
|
|
27
|
-
@react_native = react_native
|
|
28
33
|
@spm = spm
|
|
29
34
|
|
|
30
35
|
@project_dir = Pathname.new(@project_file_path).parent.to_s
|
|
31
36
|
@project = Xcodeproj::Project.open(@project_file_path)
|
|
32
37
|
@project_name = @project.root_object.name
|
|
33
|
-
@framework_file_name = "MobileMessaging.framework"
|
|
34
|
-
|
|
35
38
|
@main_target = @project.native_targets.select { |target| target.name == @main_target_name }.first
|
|
36
39
|
@main_build_configurations_debug = @main_target.build_configurations.select { |config| config.type == :debug }
|
|
37
40
|
@main_build_configurations_release = @main_target.build_configurations.select { |config| config.type == :release }
|
|
@@ -50,7 +53,7 @@ class NotificationExtensionIntegrator
|
|
|
50
53
|
|
|
51
54
|
def setup_notification_extension
|
|
52
55
|
puts "🏎 Integration starting... ver. #{Mmine::VERSION}"
|
|
53
|
-
@logger.debug("Integration with parameters: \n project_file_path: #{@project_file_path} \n app_group: #{@app_group} \n main_target_name: #{@main_target_name} \n cordova: #{@cordova} \n
|
|
56
|
+
@logger.debug("Integration with parameters: \n project_file_path: #{@project_file_path} \n app_group: #{@app_group} \n main_target_name: #{@main_target_name} \n cordova: #{@cordova} \n swift_ver: #{@swift_ver} \n override_signing: #{@override_signing} \n spm: #{@spm}")
|
|
54
57
|
@logger.debug("\n@main_target_build_configurations_debug #{@main_build_configurations_debug}\n@main_target_build_configurations_release #{@main_build_configurations_release}")
|
|
55
58
|
@logger.debug("\n@main_target_build_configurations_debug #{JSON.pretty_generate(@main_build_settings_debug)}\n@main_target_build_configurations_release #{JSON.pretty_generate(@main_build_settings_release)}")
|
|
56
59
|
create_notification_extension_target
|
|
@@ -75,7 +78,6 @@ class NotificationExtensionIntegrator
|
|
|
75
78
|
setup_swift_version
|
|
76
79
|
setup_product_name
|
|
77
80
|
setup_extension_build_number
|
|
78
|
-
setup_run_path_search_paths
|
|
79
81
|
erease_bridging_header
|
|
80
82
|
|
|
81
83
|
if @cordova
|
|
@@ -84,10 +86,6 @@ class NotificationExtensionIntegrator
|
|
|
84
86
|
@extension_target_name,
|
|
85
87
|
@extension_build_settings_debug,
|
|
86
88
|
@extension_build_settings_release)
|
|
87
|
-
#setup_extension_lib_cordova_link
|
|
88
|
-
if @xcframework
|
|
89
|
-
setup_framework_search_paths
|
|
90
|
-
end
|
|
91
89
|
else
|
|
92
90
|
setup_entitlements(@main_build_configurations_debug.map { |config| config.build_settings['CODE_SIGN_ENTITLEMENTS'] },
|
|
93
91
|
@main_build_configurations_release.map { |config| config.build_settings['CODE_SIGN_ENTITLEMENTS'] },
|
|
@@ -102,46 +100,89 @@ class NotificationExtensionIntegrator
|
|
|
102
100
|
@extension_build_settings_release)
|
|
103
101
|
end
|
|
104
102
|
|
|
105
|
-
if @static_linkage
|
|
106
|
-
setup_extension_lib_link('libMobileMessaging.a')
|
|
107
|
-
unless @react_native
|
|
108
|
-
setup_extension_lib_link('libCocoaLumberjack.a')
|
|
109
|
-
end
|
|
110
|
-
setup_library_search_paths
|
|
111
|
-
end
|
|
112
|
-
|
|
113
103
|
if @spm
|
|
114
|
-
setup_extension_spm_dependency('
|
|
104
|
+
setup_extension_spm_dependency('MobileMessagingNotificationExtension')
|
|
105
|
+
elsif !@cordova
|
|
106
|
+
setup_podfile_extension_target
|
|
115
107
|
end
|
|
116
108
|
|
|
117
109
|
@project.save
|
|
118
110
|
puts "🏁 Integration has been finished successfully!"
|
|
119
111
|
end
|
|
120
112
|
|
|
121
|
-
def setup_library_search_paths
|
|
122
|
-
@logger.debug("Setup library search path")
|
|
123
|
-
set_notification_extension_build_settings('LIBRARY_SEARCH_PATHS', '"${BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/CocoaLumberjack" "${BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/MobileMessaging"')
|
|
124
|
-
end
|
|
125
|
-
|
|
126
113
|
def setup_extension_spm_dependency(name)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
@logger.info("Setting up SPM dependency '#{name}' for extension target")
|
|
115
|
+
|
|
116
|
+
# Check if extension already has the dependency (in packageProductDependencies or frameworks build phase)
|
|
117
|
+
if @extension_target.package_product_dependencies.any? { |ref| ref.product_name == name }
|
|
118
|
+
@logger.info("Extension target already has SPM dependency '#{name}' in packageProductDependencies, skipping")
|
|
119
|
+
return
|
|
120
|
+
end
|
|
121
|
+
if @extension_target.frameworks_build_phase.files.any? { |f| f.product_ref && f.product_ref.product_name == name }
|
|
122
|
+
@logger.info("Extension target already has SPM dependency '#{name}' in frameworks build phase, skipping")
|
|
123
|
+
return
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Find MobileMessaging dependency to get the package reference.
|
|
127
|
+
# Strategy 1: check packageProductDependencies on main target (older Xcode format)
|
|
128
|
+
mm_dep = @main_target.package_product_dependencies.find { |ref| ref.product_name == 'MobileMessaging' }
|
|
129
|
+
if mm_dep
|
|
130
|
+
@logger.info("Found MobileMessaging in main target packageProductDependencies")
|
|
131
|
+
else
|
|
132
|
+
# Strategy 2: scan frameworks build phase for PBXBuildFile with productRef (newer Xcode format)
|
|
133
|
+
@logger.info("MobileMessaging not found in packageProductDependencies, scanning frameworks build phase")
|
|
134
|
+
mm_build_file = @main_target.frameworks_build_phase.files.find { |f| f.product_ref && f.product_ref.product_name == 'MobileMessaging' }
|
|
135
|
+
mm_dep = mm_build_file.product_ref if mm_build_file
|
|
136
|
+
if mm_dep
|
|
137
|
+
@logger.info("Found MobileMessaging in main target frameworks build phase")
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
unless mm_dep
|
|
142
|
+
raise "Could not find MobileMessaging SPM product dependency on main target. Make sure the SDK is added as an SPM dependency."
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
package_ref = mm_dep.package
|
|
146
|
+
unless package_ref
|
|
147
|
+
raise "MobileMessaging dependency has no package reference. Cannot add extension dependency."
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Create the new XCSwiftPackageProductDependency
|
|
151
|
+
new_dep = @project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
152
|
+
new_dep.product_name = name
|
|
153
|
+
new_dep.package = package_ref
|
|
154
|
+
|
|
155
|
+
# Add to packageProductDependencies on the extension target
|
|
156
|
+
@extension_target.package_product_dependencies << new_dep
|
|
157
|
+
@logger.info("Added SPM dependency '#{name}' to extension target packageProductDependencies")
|
|
158
|
+
|
|
159
|
+
# Also add a PBXBuildFile with productRef to the extension's frameworks build phase
|
|
160
|
+
build_file = @project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
|
161
|
+
build_file.product_ref = new_dep
|
|
162
|
+
@extension_target.frameworks_build_phase.files << build_file
|
|
163
|
+
@logger.info("Added SPM dependency '#{name}' to extension target frameworks build phase")
|
|
131
164
|
end
|
|
132
165
|
|
|
133
|
-
def
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
166
|
+
def setup_podfile_extension_target
|
|
167
|
+
podfile_path = File.join(@project_dir, 'Podfile')
|
|
168
|
+
unless File.exist?(podfile_path)
|
|
169
|
+
@logger.info("No Podfile found at #{podfile_path}, skipping Podfile modification")
|
|
170
|
+
return
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
podfile_content = File.read(podfile_path)
|
|
174
|
+
extension_pod_name = 'MobileMessagingNotificationExtension'
|
|
175
|
+
|
|
176
|
+
if podfile_content.include?("target '#{@extension_target_name}'")
|
|
177
|
+
@logger.info("Podfile already contains target '#{@extension_target_name}', skipping")
|
|
178
|
+
return
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@logger.info("Adding extension target '#{@extension_target_name}' with pod '#{extension_pod_name}' to Podfile")
|
|
182
|
+
podfile_entry = "\ntarget '#{@extension_target_name}' do\n pod '#{extension_pod_name}'\nend\n"
|
|
183
|
+
File.open(podfile_path, 'a') do |file|
|
|
184
|
+
file.write(podfile_entry)
|
|
185
|
+
end
|
|
145
186
|
end
|
|
146
187
|
|
|
147
188
|
def setup_extension_target_signing(override_signing)
|
|
@@ -170,12 +211,12 @@ class NotificationExtensionIntegrator
|
|
|
170
211
|
end
|
|
171
212
|
|
|
172
213
|
def create_notification_extension_target
|
|
173
|
-
@extension_target_name = '
|
|
214
|
+
@extension_target_name = 'MobileMessagingNotificationServiceExtension'
|
|
174
215
|
@extension_source_name_filepath = File.join(Mmine.root, 'resources', 'NotificationService.swift')
|
|
175
|
-
@extension_dir_name = '
|
|
216
|
+
@extension_dir_name = 'NotificationServiceExtension'
|
|
176
217
|
@extension_destination_dir = File.join(@project_dir, @extension_dir_name)
|
|
177
218
|
@extension_code_destination_filepath = File.join(@extension_destination_dir, 'NotificationService.swift')
|
|
178
|
-
@extension_group_name = '
|
|
219
|
+
@extension_group_name = 'NotificationServiceExtensionGroup'
|
|
179
220
|
@extension_plist_name = 'MobileMessagingNotificationServiceExtension.plist'
|
|
180
221
|
@extension_plist_source_filepath = File.join(Mmine.root, 'resources', @extension_plist_name)
|
|
181
222
|
@extension_info_plist_path = File.join(@project_dir, @extension_dir_name, @extension_plist_name)
|
|
@@ -192,10 +233,6 @@ class NotificationExtensionIntegrator
|
|
|
192
233
|
@extension_build_settings_debug = @extension_build_configurations_debug.map(&:build_settings)
|
|
193
234
|
@extension_build_settings_release = @extension_build_configurations_release.map(&:build_settings)
|
|
194
235
|
|
|
195
|
-
@extension_target.frameworks_build_phase.files_references.each { |ref|
|
|
196
|
-
@extension_target.frameworks_build_phase.remove_file_reference(ref)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
236
|
unless @main_target.build_configurations.any? { |config| config.name == "Release"}
|
|
200
237
|
@extension_target.build_configuration_list.build_configurations.delete_if { |config| config.name == "Release"}
|
|
201
238
|
end
|
|
@@ -230,10 +267,22 @@ class NotificationExtensionIntegrator
|
|
|
230
267
|
def setup_development_team
|
|
231
268
|
align_notification_extension_build_settings('DEVELOPMENT_TEAM',
|
|
232
269
|
@main_target.build_configurations)
|
|
270
|
+
align_notification_extension_build_settings('CODE_SIGN_STYLE',
|
|
271
|
+
@main_target.build_configurations)
|
|
272
|
+
align_notification_extension_build_settings('CODE_SIGN_IDENTITY',
|
|
273
|
+
@main_target.build_configurations)
|
|
233
274
|
end
|
|
234
275
|
|
|
235
276
|
def setup_deployment_target
|
|
236
|
-
|
|
277
|
+
min_version = "15.0"
|
|
278
|
+
@main_target.build_configurations.each do |config|
|
|
279
|
+
main_target_version = config.resolve_build_setting('IPHONEOS_DEPLOYMENT_TARGET')
|
|
280
|
+
if main_target_version && Gem::Version.new(main_target_version) > Gem::Version.new(min_version)
|
|
281
|
+
min_version = main_target_version
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
@logger.info("Setting extension deployment target to #{min_version} (floor: 15.0, main target aligned)")
|
|
285
|
+
set_notification_extension_build_settings('IPHONEOS_DEPLOYMENT_TARGET', min_version)
|
|
237
286
|
end
|
|
238
287
|
|
|
239
288
|
def setup_notification_extension_info_plist
|
|
@@ -397,11 +446,18 @@ class NotificationExtensionIntegrator
|
|
|
397
446
|
|
|
398
447
|
def setup_embed_extension_action
|
|
399
448
|
phase_name = 'Embed App Extensions'
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
449
|
+
phase = @main_target.copy_files_build_phases.select { |p| p.name == phase_name }.first
|
|
450
|
+
if phase == nil
|
|
451
|
+
@logger.info("Creating copy files build phase: #{phase_name}")
|
|
452
|
+
phase = @main_target.new_copy_files_build_phase(phase_name)
|
|
453
|
+
phase.dst_subfolder_spec = '13'
|
|
454
|
+
end
|
|
455
|
+
already_embedded = phase.files.any? { |f| f.file_ref == @extension_target.product_reference }
|
|
456
|
+
if already_embedded
|
|
457
|
+
@logger.info("Extension product already embedded in '#{phase_name}', skipping")
|
|
458
|
+
else
|
|
459
|
+
@logger.info("Adding extension product to '#{phase_name}' phase")
|
|
460
|
+
phase.add_file_reference(@extension_target.product_reference)
|
|
405
461
|
end
|
|
406
462
|
end
|
|
407
463
|
|
|
@@ -416,14 +472,6 @@ class NotificationExtensionIntegrator
|
|
|
416
472
|
set_notification_extension_build_settings('SWIFT_OBJC_BRIDGING_HEADER', '')
|
|
417
473
|
end
|
|
418
474
|
|
|
419
|
-
def setup_framework_search_paths
|
|
420
|
-
set_notification_extension_build_settings('FRAMEWORK_SEARCH_PATHS', '$SRCROOT/$PROJECT/Plugins/com-infobip-plugins-mobilemessaging/**')
|
|
421
|
-
end
|
|
422
|
-
|
|
423
|
-
def setup_run_path_search_paths
|
|
424
|
-
set_notification_extension_build_settings('LD_RUNPATH_SEARCH_PATHS', '@executable_path/../../Frameworks')
|
|
425
|
-
end
|
|
426
|
-
|
|
427
475
|
def setup_swift_version
|
|
428
476
|
set_notification_extension_build_settings('SWIFT_VERSION', @swift_version)
|
|
429
477
|
end
|
|
@@ -439,44 +487,6 @@ class NotificationExtensionIntegrator
|
|
|
439
487
|
put_string_value_into_xml(build_key, '1', [@extension_info_plist_path])
|
|
440
488
|
end
|
|
441
489
|
|
|
442
|
-
def setup_extension_lib_cordova_link
|
|
443
|
-
lib_cordova_name = 'libCordova.a'
|
|
444
|
-
if @extension_target.frameworks_build_phase.files_references.select { |ref| ref.path == lib_cordova_name }.first
|
|
445
|
-
@logger.info("Notification Extension target already has libCordova.a linked.")
|
|
446
|
-
else
|
|
447
|
-
@logger.info("Adding libCordova.a to Notification Extension target...")
|
|
448
|
-
ref = @main_target.frameworks_build_phase.files_references.select { |ref| ref.path == lib_cordova_name }.first
|
|
449
|
-
if ref
|
|
450
|
-
@extension_target.frameworks_build_phase.add_file_reference(ref)
|
|
451
|
-
else
|
|
452
|
-
@logger.error("Main target has no libCordova.a as a linked library. Unable to add libCordova.a to Notification Extension target!")
|
|
453
|
-
end
|
|
454
|
-
end
|
|
455
|
-
end
|
|
456
|
-
|
|
457
|
-
def setup_copy_framework_script
|
|
458
|
-
phase_name = "Copy Frameworks"
|
|
459
|
-
shell_script = "/usr/local/bin/carthage copy-frameworks"
|
|
460
|
-
input_path = "$SRCROOT/$PROJECT/Plugins/com-infobip-plugins-mobilemessaging/#{@framework_file_name}"
|
|
461
|
-
output_path = "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/#{@framework_file_name}"
|
|
462
|
-
existing_phase = @main_target.shell_script_build_phases.select { |phase| phase.shell_script.include? shell_script }.first
|
|
463
|
-
|
|
464
|
-
if existing_phase
|
|
465
|
-
existing_phase.input_paths |= [input_path]
|
|
466
|
-
existing_phase.output_paths |= [output_path]
|
|
467
|
-
@logger.info("Main target already has #{phase_name} shell script set up")
|
|
468
|
-
else
|
|
469
|
-
@logger.info("Setting up #{phase_name} shell script for main target")
|
|
470
|
-
new_phase = @main_target.new_shell_script_build_phase(phase_name)
|
|
471
|
-
new_phase.shell_path = "/bin/sh"
|
|
472
|
-
new_phase.shell_script = shell_script
|
|
473
|
-
new_phase.input_paths << input_path
|
|
474
|
-
new_phase.output_paths << output_path
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
remove_embed_framework_phase
|
|
478
|
-
end
|
|
479
|
-
|
|
480
490
|
def setup_target_capabilities_for_extension_target
|
|
481
491
|
mobile_messaging_capabilities = {"SystemCapabilities" =>
|
|
482
492
|
{
|
|
@@ -511,22 +521,6 @@ class NotificationExtensionIntegrator
|
|
|
511
521
|
end
|
|
512
522
|
end
|
|
513
523
|
|
|
514
|
-
def remove_embed_framework_phase
|
|
515
|
-
@logger.info("Setting up embed framework script")
|
|
516
|
-
@main_target.copy_files_build_phases
|
|
517
|
-
.select { |phase|
|
|
518
|
-
phase.dst_subfolder_spec == '10'
|
|
519
|
-
}
|
|
520
|
-
.each { |phase|
|
|
521
|
-
phase.files.select { |file|
|
|
522
|
-
file.display_name == @framework_file_name
|
|
523
|
-
}.each { |file|
|
|
524
|
-
@logger.info("\tRemoving embeddin #{@framework_file_name} from phase #{phase.display_name}")
|
|
525
|
-
phase.remove_build_file(file)
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
end
|
|
529
|
-
|
|
530
524
|
def resolve_xcode_path(path)
|
|
531
525
|
return path.sub(@project_dir, '$(PROJECT_DIR)')
|
|
532
526
|
end
|
|
@@ -539,8 +533,12 @@ class NotificationExtensionIntegrator
|
|
|
539
533
|
def align_notification_extension_build_settings(key, main_configurations)
|
|
540
534
|
main_configurations.each do |config|
|
|
541
535
|
value = config.resolve_build_setting(key)
|
|
542
|
-
|
|
543
|
-
|
|
536
|
+
if value.nil? || value.empty?
|
|
537
|
+
@logger.info("\tSkipping extension build setting (not set on main target):\n\t\t#{config.name}: \t#{key}")
|
|
538
|
+
else
|
|
539
|
+
@logger.info("\tSetting extension build settings:\n\t\t#{config.name}: \t#{key}\t#{value}")
|
|
540
|
+
@extension_target.build_configuration_list[config.name].build_settings[key] = value
|
|
541
|
+
end
|
|
544
542
|
end
|
|
545
543
|
end
|
|
546
544
|
|
data/lib/mmine/version.rb
CHANGED
data/lib/mmine.rb
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<key>CFBundleDevelopmentRegion</key>
|
|
6
6
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
7
|
<key>CFBundleDisplayName</key>
|
|
8
|
-
<string>
|
|
8
|
+
<string>MobileMessagingNotificationServiceExtension</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
10
10
|
<string>$(EXECUTABLE_NAME)</string>
|
|
11
11
|
<key>CFBundleIdentifier</key>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
//
|
|
1
2
|
// NotificationService.swift
|
|
3
|
+
// mobile-messaging-mmine
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2016-2026 Infobip Limited
|
|
6
|
+
// Licensed under the Apache License, Version 2.0
|
|
7
|
+
//
|
|
2
8
|
|
|
3
9
|
import UserNotifications
|
|
4
|
-
import
|
|
10
|
+
import MobileMessagingNotificationExtension
|
|
5
11
|
|
|
6
|
-
@available(iOS 10.0, *)
|
|
7
12
|
class NotificationService: UNNotificationServiceExtension {
|
|
8
13
|
|
|
9
14
|
var contentHandler: ((UNNotificationContent) -> Void)?
|
|
@@ -13,13 +18,12 @@ class NotificationService: UNNotificationServiceExtension {
|
|
|
13
18
|
self.contentHandler = contentHandler
|
|
14
19
|
self.originalContent = request.content
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
21
|
+
if MobileMessagingNotificationServiceExtension.isCorrectPayload(request.content.userInfo as? [String: Any] ?? [:]) {
|
|
22
|
+
MobileMessagingNotificationServiceExtension.didReceive(request, withContentHandler: contentHandler)
|
|
23
|
+
} else {
|
|
24
|
+
// handling by another push provider different than Infobip's
|
|
25
|
+
contentHandler(request.content)
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
override func serviceExtensionTimeWillExpire() {
|
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:
|
|
4
|
+
version: 2.0.0
|
|
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.
|
|
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
|