Skip to content

Commit 7d86cbf

Browse files
committed
chore: improve carplay target setup
1 parent c5f7b64 commit 7d86cbf

File tree

5 files changed

+27
-98
lines changed

5 files changed

+27
-98
lines changed

example/ios/AppDelegateCarPlay.mm

Lines changed: 0 additions & 82 deletions
This file was deleted.

example/ios/Podfile

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,40 @@ setup_permissions([
2424
])
2525

2626
linkage = ENV['USE_FRAMEWORKS']
27-
if linkage != nil
27+
if linkage
2828
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
2929
use_frameworks! :linkage => linkage.to_sym
3030
end
3131

3232
config = use_native_modules!
3333

34-
target 'ReactNativeNavigationSdkExample' do
35-
use_react_native!(
36-
:path => config[:reactNativePath],
34+
def shared_example_target_config(name, config)
35+
target name do
36+
use_react_native!(
37+
:path => config[:reactNativePath],
3738
# An absolute path to your application root.
38-
:app_path => "#{Pod::Config.instance.installation_root}/.."
39-
)
40-
end
39+
:app_path => "#{Pod::Config.instance.installation_root}/..",
40+
)
4141

42-
target 'ReactNativeNavigationSdkExampleCarPlay' do
43-
use_react_native!(
44-
:path => config[:reactNativePath],
45-
# An absolute path to your application root.
46-
:app_path => "#{Pod::Config.instance.installation_root}/.."
47-
)
42+
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
43+
pod 'react-native-navigation-sdk', :path => '../..'
44+
45+
unless name.end_with?("CarPlay")
46+
setup_permissions([
47+
'LocationAccuracy',
48+
'LocationAlways',
49+
'LocationWhenInUse',
50+
'Notifications',
51+
])
52+
end
53+
end
4854
end
4955

50-
# Test target that inherits from the app
56+
shared_example_target_config('ReactNativeNavigationSdkExample', config)
57+
shared_example_target_config('ReactNativeNavigationSdkExampleCarPlay', config)
58+
5159
target 'ReactNativeNavigationSdkExampleTests' do
60+
# Test target that inherits from the app
5261
inherit! :complete
5362
end
5463

@@ -65,4 +74,4 @@ post_install do |installer|
6574
:mac_catalyst_enabled => false,
6675
# :ccache_enabled => true
6776
)
68-
end
77+
end

example/ios/ReactNativeNavigationSdkExample.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
52206E832C8B2FEC00B34D22 /* CarSceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CarSceneDelegate.h; path = ReactNativeNavigationSdkExample/CarSceneDelegate.h; sourceTree = "<group>"; };
6262
52206E842C8B2FEC00B34D22 /* PhoneSceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhoneSceneDelegate.h; path = ReactNativeNavigationSdkExample/PhoneSceneDelegate.h; sourceTree = "<group>"; };
6363
52206E872C8B303700B34D22 /* AppDelegateCarPlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegateCarPlay.h; path = ReactNativeNavigationSdkExample/AppDelegateCarPlay.h; sourceTree = "<group>"; };
64-
524CD7A02DDE052400F56B17 /* AppDelegateCarPlay.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegateCarPlay.mm; sourceTree = "<group>"; };
64+
524CD7A02DDE052400F56B17 /* AppDelegateCarPlay.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegateCarPlay.mm; path = ReactNativeNavigationSdkExample/AppDelegateCarPlay.mm; sourceTree = "<group>"; };
6565
52754A972D9FDD1C00F0A016 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = ReactNativeNavigationSdkExample/AppDelegate.mm; sourceTree = "<group>"; };
6666
52D4271C2C81D3F300C7FB36 /* Keys.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Keys.plist; path = ReactNativeNavigationSdkExample/Keys.plist; sourceTree = "<group>"; };
6767
5709B34CF0A7D63546082F79 /* Pods-ReactNativeNavigationSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeNavigationSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeNavigationSdkExample/Pods-ReactNativeNavigationSdkExample.release.xcconfig"; sourceTree = "<group>"; };

example/ios/ReactNativeNavigationSdkExample/AppDelegateCarPlay.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#import <CarPlay/CarPlay.h>
1919
#import <GoogleMaps/GoogleMaps.h>
2020
#import <React/RCTBundleURLProvider.h>
21+
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
2122
#import <UIKit/UIKit.h>
2223
#import "CarSceneDelegate.h"
2324
#import "PhoneSceneDelegate.h"

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"start": "react-native start",
77
"android": "react-native run-android",
88
"ios": "react-native run-ios",
9+
"ios:carplay": "react-native run-ios --scheme ReactNativeNavigationSdkExampleCarPlay",
910
"test": "jest",
1011
"build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"",
1112
"build:ios": "react-native build-ios --scheme ReactNativeNavigationSdkExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"",

0 commit comments

Comments
 (0)