branch_io_cli 0.3.0 → 0.3.1
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/README.md +2 -2
- data/lib/branch_io_cli/cli.rb +2 -2
- data/lib/branch_io_cli/helper/configuration_helper.rb +22 -13
- data/lib/branch_io_cli/helper/ios_helper.rb +43 -7
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9adda8f92100e01cd272fa97fe2bf8b71db6b664
|
4
|
+
data.tar.gz: c91ec03d311711ea448aec62ffa1db6f1f401e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce717958b072775a9fbd789c249c23a80972ba8fe45cd2a546074d03b2b019d9fa6fdc2a580539193abe289579470617db34d7a46e8d7a396b30c4d6cbe7325
|
7
|
+
data.tar.gz: 84a1f6ef67c575e34c31c9306eeb62aea5858bf3005d7990769d5eba1bc8e4adbcdaa3561aca91cf4324b008a3d0114cefc049b9693e0ba704b649320cc054ab
|
data/README.md
CHANGED
@@ -46,8 +46,8 @@ the project location using the `--xcodeproj` option.
|
|
46
46
|
If a Podfile or Cartfile is detected, the Branch SDK will be added to the relevant
|
47
47
|
configuration file and the dependencies updated to include the Branch framework.
|
48
48
|
This behavior may be suppressed using `--no_add_sdk`. If no Podfile or Cartfile
|
49
|
-
is found,
|
50
|
-
|
49
|
+
is found, and Branch.framework is not already among the project's dependencies,
|
50
|
+
you will be prompted for a number of choices.
|
51
51
|
|
52
52
|
By default, all supplied Universal Link domains are validated. If validation passes,
|
53
53
|
the setup continues. If validation fails, no further action is taken. Suppress
|
data/lib/branch_io_cli/cli.rb
CHANGED
@@ -25,8 +25,8 @@ the project location using the <%= color('--xcodeproj', BOLD) %> option.
|
|
25
25
|
If a Podfile or Cartfile is detected, the Branch SDK will be added to the relevant
|
26
26
|
configuration file and the dependencies updated to include the Branch framework.
|
27
27
|
This behavior may be suppressed using <%= color('--no_add_sdk', BOLD) %>. If no Podfile or Cartfile
|
28
|
-
is found,
|
29
|
-
|
28
|
+
is found, and Branch.framework is not already among the project's dependencies,
|
29
|
+
you will be prompted for a number of choices.
|
30
30
|
|
31
31
|
By default, all supplied Universal Link domains are validated. If validation passes,
|
32
32
|
the setup continues. If validation fails, no further action is taken. Suppress
|
@@ -189,20 +189,18 @@ module BranchIOCLI
|
|
189
189
|
@podfile_path = File.expand_path "../Podfile", @xcodeproj_path
|
190
190
|
target = BranchHelper.target_from_project @xcodeproj, options.target
|
191
191
|
|
192
|
-
|
193
|
-
|
194
|
-
platform :ios, "#{target.deployment_target}"
|
195
|
-
|
196
|
-
pod "Branch"
|
197
|
-
|
198
|
-
#{@xcodeproj.targets.map { |t| "target \"#{t.name}\"" }.join("\n")}
|
199
|
-
EOF
|
200
|
-
end
|
201
|
-
|
202
|
-
command = "pod install"
|
203
|
-
command += " --repo-update" unless options.no_pod_repo_update
|
192
|
+
install_command = "pod install"
|
193
|
+
install_command += " --repo-update" unless options.no_pod_repo_update
|
204
194
|
Dir.chdir(File.dirname(@podfile_path)) do
|
205
|
-
system
|
195
|
+
system "pod init"
|
196
|
+
BranchHelper.apply_patch(
|
197
|
+
files: @podfile_path,
|
198
|
+
regexp: /^(\s*)# Pods for #{target.name}$/,
|
199
|
+
mode: :append,
|
200
|
+
text: "\n\\1pod \"Branch\"",
|
201
|
+
global: false
|
202
|
+
)
|
203
|
+
system install_command
|
206
204
|
end
|
207
205
|
|
208
206
|
BranchHelper.add_change @podfile_path
|
@@ -309,6 +307,17 @@ EOF
|
|
309
307
|
framework = frameworks_group.new_file "Branch.framework"
|
310
308
|
target = BranchHelper.target_from_project @xcodeproj, options.target
|
311
309
|
target.frameworks_build_phase.add_file_reference framework, true
|
310
|
+
|
311
|
+
# Make sure this is in the FRAMEWORK_SEARCH_PATHS
|
312
|
+
@xcodeproj.build_configurations.each do |config|
|
313
|
+
setting = config.build_settings["FRAMEWORK_SEARCH_PATHS"] || []
|
314
|
+
setting = [setting] if setting.kind_of? String
|
315
|
+
next if setting.any? { |p| p == "$(SRCROOT)" }
|
316
|
+
|
317
|
+
setting << "$(SRCROOT)"
|
318
|
+
config.build_settings["FRAMEWORK_SEARCH_PATHS"] = setting
|
319
|
+
end
|
320
|
+
|
312
321
|
@xcodeproj.save
|
313
322
|
|
314
323
|
BranchHelper.add_change File.expand_path "Branch.framework"
|
@@ -357,12 +357,14 @@ module BranchIOCLI
|
|
357
357
|
mode: :prepend
|
358
358
|
)
|
359
359
|
|
360
|
-
|
361
|
-
init_session_text = <<-EOF
|
360
|
+
init_session_text = ConfigurationHelper.keys.count <= 1 ? "" : <<EOF
|
362
361
|
#if DEBUG
|
363
362
|
Branch.setUseTestBranchKey(true)
|
364
363
|
#endif
|
365
364
|
|
365
|
+
EOF
|
366
|
+
|
367
|
+
init_session_text += <<-EOF
|
366
368
|
Branch.getInstance().initSession(launchOptions: launchOptions) {
|
367
369
|
universalObject, linkProperties, error in
|
368
370
|
|
@@ -377,13 +379,29 @@ module BranchIOCLI
|
|
377
379
|
mode: :append
|
378
380
|
)
|
379
381
|
|
380
|
-
|
382
|
+
if app_delegate =~ /application:.*continue userActivity:.*restorationHandler:/
|
383
|
+
# Add something to the top of the method
|
384
|
+
continue_user_activity_text = <<-EOF
|
385
|
+
// TODO: Adjust your method as you see fit.
|
386
|
+
if Branch.getInstance.continue(userActivity) {
|
387
|
+
return true
|
388
|
+
}
|
389
|
+
|
390
|
+
EOF
|
391
|
+
|
392
|
+
apply_patch(
|
393
|
+
files: app_delegate_swift_path,
|
394
|
+
regexp: /application:.*continue userActivity:.*restorationHandler:.*?\{.*?\n/m,
|
395
|
+
text: continue_user_activity_text,
|
396
|
+
mode: :append
|
397
|
+
)
|
398
|
+
else
|
381
399
|
# Add the application:continueUserActivity:restorationHandler method if it does not exist
|
382
400
|
continue_user_activity_text = <<-EOF
|
383
401
|
|
384
402
|
|
385
|
-
func application(_
|
386
|
-
|
403
|
+
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
|
404
|
+
return Branch.getInstance().continue(userActivity)
|
387
405
|
}
|
388
406
|
EOF
|
389
407
|
|
@@ -417,11 +435,14 @@ module BranchIOCLI
|
|
417
435
|
mode: :prepend
|
418
436
|
)
|
419
437
|
|
420
|
-
init_session_text =
|
438
|
+
init_session_text = ConfigurationHelper.keys.count <= 1 ? "" : <<EOF
|
421
439
|
#ifdef DEBUG
|
422
440
|
[Branch setUseTestBranchKey:YES];
|
423
441
|
#endif // DEBUG
|
424
442
|
|
443
|
+
EOF
|
444
|
+
|
445
|
+
init_session_text += <<-EOF
|
425
446
|
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions
|
426
447
|
andRegisterDeepLinkHandlerUsingBranchUniversalObject:^(BranchUniversalObject *universalObject, BranchLinkProperties *linkProperties, NSError *error){
|
427
448
|
// TODO: Route Branch links
|
@@ -435,7 +456,22 @@ module BranchIOCLI
|
|
435
456
|
mode: :append
|
436
457
|
)
|
437
458
|
|
438
|
-
|
459
|
+
if app_delegate =~ /application:.*continueUserActivity:.*restorationHandler:/
|
460
|
+
continue_user_activity_text = <<-EOF
|
461
|
+
// TODO: Adjust your method as you see fit.
|
462
|
+
if ([[Branch getInstance] continueUserActivity:userActivity]) {
|
463
|
+
return YES;
|
464
|
+
}
|
465
|
+
|
466
|
+
EOF
|
467
|
+
|
468
|
+
apply_patch(
|
469
|
+
files: app_delegate_objc_path,
|
470
|
+
regexp: /application:.*continueUserActivity:.*restorationHandler:.*?\{.*?\n/m,
|
471
|
+
text: continue_user_activity_text,
|
472
|
+
mode: :append
|
473
|
+
)
|
474
|
+
else
|
439
475
|
# Add the application:continueUserActivity:restorationHandler method if it does not exist
|
440
476
|
continue_user_activity_text = <<-EOF
|
441
477
|
|