forked from opendriven/react-native-mapbox-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-native-mapbox-navigation.podspec
More file actions
79 lines (64 loc) · 2.81 KB
/
react-native-mapbox-navigation.podspec
File metadata and controls
79 lines (64 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
# TargetsToChangeToDynamic = ['MapboxMobileEvents']
TargetsToChangeToDynamic = []
rnMapboxNavigationDefaultVersion = '~> 2.7.2'
$RNMBNAVVersion = rnMapboxNavigationDefaultVersion unless $RNMBNAVVersion
MapboxNavigationVersion = $RNMBNAVVersion || rnMapboxNavigationDefaultVersion
$RNMBNAV = Object.new
def $RNMBNAV.post_install(installer)
installer.pod_targets.each do |pod|
if TargetsToChangeToDynamic.include?(pod.name)
if pod.send(:build_type) != Pod::BuildType.dynamic_framework
pod.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
puts "* Changed #{pod.name} to `#{pod.send(:build_type)}`"
fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
end
end
end
end
def $RNMBNAV.pre_install(installer)
installer.aggregate_targets.each do |target|
target.pod_targets.select { |p| TargetsToChangeToDynamic.include?(p.name) }.each do |mobile_events_target|
mobile_events_target.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
puts "* Changed #{mobile_events_target.name} to #{mobile_events_target.send(:build_type)}"
fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
end
end
end
## RNMBNAVDownloadToken
# expo does not supports `.netrc`, so we need to patch curl commend used by cocoapods to pass the credentials
if $RNMBNAVDownloadToken
module AddCredentialsToCurlWhenDownloadingMapboxNavigation
def curl!(*args)
mapbox_download = args.flatten.any? { |i| i.to_s.start_with?('https://api.mapbox.com') }
if mapbox_download
arguments = args.flatten
arguments.prepend("-u","mapbox:#{$RNMBNAVDownloadToken}")
super(*arguments)
else
super
end
end
end
class Pod::Downloader::Http
prepend AddCredentialsToCurlWhenDownloadingMapboxNavigation
end
end
Pod::Spec.new do |s|
s.name = "react-native-mapbox-navigation"
s.version = package["version"]
s.summary = package["description"]
s.description = <<-DESC
Smart Mapbox turn-by-turn routing based on real-time traffic for React Native.
DESC
s.homepage = "https://github.com/mikepotvin/react-native-mapbox-navigation.git"
s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "EverDriven" => "support@everdriven" }
s.platforms = { :ios => "11.0" }
s.source = { :git => "https://github.com/mikepotvin/react-native-mapbox-navigation.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,swift}"
s.requires_arc = true
s.dependency "React-Core"
s.dependency "MapboxNavigation", MapboxNavigationVersion
end