Skip to content

Commit 2676acb

Browse files
Build test screen for location module
1 parent b434f1d commit 2676acb

12 files changed

Lines changed: 457 additions & 10 deletions

File tree

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22

33
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
5+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
46

57
<application
68
android:name=".MainApplication"

example/android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ edgeToEdgeEnabled=false
4747
# This is useful for testing new features or bug fixes before they are released.
4848
# Set to 'local' to use the local version of the SDK.
4949
# cioSDKVersionAndroid=local
50+
51+
# Enable Customer.io Location module for the example app (used to verify location wiring).
52+
customerio_location_enabled=true

example/ios/Podfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ load "/tmp/override_cio_sdk.rb"
66
# end of internal Customer.io testing code
77
# -------------
88

9-
# Resolve react_native_pods.rb with node to allow for hoisting
10-
require Pod::Executable.execute_command("node", ["-p",
11-
'require.resolve(
12-
"react-native/scripts/react_native_pods.rb",
13-
{paths: [process.argv[1]]},
14-
)', __dir__]).strip
9+
# Resolve scripts with node to allow for hoisting
10+
def node_require(script)
11+
require Pod::Executable.execute_command('node', ['-p',
12+
"require.resolve(
13+
'#{script}',
14+
{paths: [process.argv[1]]},
15+
)", __dir__]).strip
16+
end
17+
18+
node_require('react-native/scripts/react_native_pods.rb')
19+
node_require('react-native-permissions/scripts/setup.rb')
1520

1621
require_relative "../scripts/ios_project_setup_utils.rb"
1722

1823
platform :ios, min_ios_version_supported
1924
prepare_react_native_project!
2025

26+
setup_permissions([
27+
'LocationWhenInUse',
28+
])
29+
2130
push_provider = (ENV["PUSH_PROVIDER"] || "apn").downcase
2231

2332
app_target_name = "SampleApp"
@@ -51,7 +60,7 @@ target app_target_name do
5160
:path => config[:reactNativePath],
5261
:app_path => "#{installation_root}/..",
5362
)
54-
pod "customerio-reactnative/#{push_provider}", :path => cio_package_path
63+
pod "customerio-reactnative", :path => cio_package_path, :subspecs => [push_provider, "location"]
5564
# install_non_production_ios_sdk_local_path(local_path: '~/code/customerio-ios/', is_app_extension: false, push_service: push_provider)
5665
# install_non_production_ios_sdk_git_branch(branch_name: 'feature/wrappers-inline-support', is_app_extension: false, push_service: push_provider)
5766

example/ios/SampleApp/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
</dict>
1414
<key>RCTNewArchEnabled</key>
1515
<true/>
16+
<key>NSLocationWhenInUseUsageDescription</key>
17+
<string>This app uses your location to test the Customer.io location module.</string>
1618
<key>UIViewControllerBasedStatusBarAppearance</key>
1719
<false/>
1820
<key>CFBundleURLTypes</key>

example/package-lock.json

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",
7-
"ios": "sh -c 'args=\"$*\"; sim=${args#*--simulator }; react-native run-ios --simulator=\"$sim\"' _",
7+
"ios": "react-native run-ios",
88
"pods": "bundle exec pod install --project-directory=ios",
99
"lint": "eslint .",
1010
"start": "react-native start",
@@ -18,6 +18,7 @@
1818
"dependencies": {
1919
"@react-native-async-storage/async-storage": "^2.2.0",
2020
"@react-native-clipboard/clipboard": "^1.16.0",
21+
"@react-native-community/geolocation": "^3.4.0",
2122
"@react-navigation/bottom-tabs": "^7.4.7",
2223
"@react-navigation/native": "^7.1.14",
2324
"@react-navigation/native-stack": "^7.3.20",
@@ -27,6 +28,7 @@
2728
"react-native-device-info": "^14.0.4",
2829
"react-native-flash-message": "^0.4.2",
2930
"react-native-get-random-values": "^1.11.0",
31+
"react-native-permissions": "^5.0.0",
3032
"react-native-safe-area-context": "^5.6.0",
3133
"react-native-screens": "^4.11.1",
3234
"react-native-snackbar": "^2.9.0",

example/src/navigation/props.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const CustomDeviceAttrScreenName = 'Device Attributes' as const;
1212
export const InternalSettingsScreenName = 'Internal Settings' as const;
1313
export const InlineExamplesScreenName = 'Inline Examples' as const;
1414
export const InboxMessagesScreenName = 'Inbox Messages' as const;
15+
export const LocationScreenName = 'Location' as const;
1516

1617
export type NavigationStackParamList = {
1718
[SettingsScreenName]: undefined;
@@ -24,6 +25,7 @@ export type NavigationStackParamList = {
2425
[InternalSettingsScreenName]: undefined;
2526
[InlineExamplesScreenName]: undefined;
2627
[InboxMessagesScreenName]: undefined;
28+
[LocationScreenName]: undefined;
2729
};
2830

2931
export type NavigationProps = NavigationProp<NavigationStackParamList>;

example/src/screens/content-navigator.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
InboxMessagesScreenName,
66
InlineExamplesScreenName,
77
InternalSettingsScreenName,
8+
LocationScreenName,
89
LoginScreenName,
910
NavigationCallbackContext,
1011
NavigationStackParamList,
@@ -22,6 +23,7 @@ import {
2223
InboxMessagesScreen,
2324
InlineExamplesScreen,
2425
InternalSettingsScreen,
26+
LocationScreen,
2527
LogingScreen,
2628
SettingsScreen,
2729
TrackScreen,
@@ -128,6 +130,15 @@ export const ContentNavigator = ({ appName }: { appName: string }) => {
128130
headerBackVisible: true,
129131
}}
130132
/>
133+
<Stack.Screen
134+
name={LocationScreenName}
135+
component={LocationScreen}
136+
options={{
137+
title: 'Location Test',
138+
headerBackButtonDisplayMode: 'minimal',
139+
headerBackVisible: true,
140+
}}
141+
/>
131142
</Stack.Navigator>
132143
</ScreensContext.Provider>
133144
);

example/src/screens/home.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
CustomProfileAttrScreenName,
55
InboxMessagesScreenName,
66
InlineExamplesScreenName,
7+
LocationScreenName,
78
NavigationCallbackContext,
89
NavigationScreenProps,
910
} from '@navigation';
@@ -76,6 +77,10 @@ export const HomeScreen = ({
7677
navigation.navigate(InboxMessagesScreenName);
7778
}}
7879
/>
80+
<Button
81+
title="Location (test)"
82+
onPress={() => navigation.navigate(LocationScreenName)}
83+
/>
7984
</View>
8085
</ScrollView>
8186
<View style={styles.spacer}>

example/src/screens/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from './home';
44
export * from './inbox-messages';
55
export * from './inline-examples';
66
export * from './internal-settings';
7+
export * from './location';
78
export * from './login';
89
export * from './settings';
910
export * from './track';

0 commit comments

Comments
 (0)