From fe53ad05dd59ac3e28cdefb0254640678f5b25a3 Mon Sep 17 00:00:00 2001 From: Mahmoud Elmorabea Date: Tue, 10 Mar 2026 08:41:30 +0200 Subject: [PATCH] Build test screen for location module --- .../android/app/src/main/AndroidManifest.xml | 2 + example/android/gradle.properties | 3 + example/ios/Podfile | 23 +- example/ios/SampleApp/Info.plist | 2 + example/package-lock.json | 31 ++ example/package.json | 4 +- example/src/navigation/props.ts | 2 + example/src/screens/content-navigator.tsx | 11 + example/src/screens/home.tsx | 5 + example/src/screens/index.ts | 1 + example/src/screens/location.tsx | 376 ++++++++++++++++++ example/src/services/storage.ts | 5 +- 12 files changed, 456 insertions(+), 9 deletions(-) create mode 100644 example/src/screens/location.tsx diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 4e070d87..7771d283 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,8 @@ + + config[:reactNativePath], :app_path => "#{installation_root}/..", ) - pod "customerio-reactnative/#{push_provider}", :path => cio_package_path + pod "customerio-reactnative", :path => cio_package_path, :subspecs => [push_provider, "location"] # install_non_production_ios_sdk_local_path(local_path: '~/code/customerio-ios/', is_app_extension: false, push_service: push_provider) # install_non_production_ios_sdk_git_branch(branch_name: 'feature/wrappers-inline-support', is_app_extension: false, push_service: push_provider) diff --git a/example/ios/SampleApp/Info.plist b/example/ios/SampleApp/Info.plist index 8dacfcab..4b4d69f8 100644 --- a/example/ios/SampleApp/Info.plist +++ b/example/ios/SampleApp/Info.plist @@ -13,6 +13,8 @@ RCTNewArchEnabled + NSLocationWhenInUseUsageDescription + This app uses your location to test the Customer.io location module. UIViewControllerBasedStatusBarAppearance CFBundleURLTypes diff --git a/example/package-lock.json b/example/package-lock.json index f285c498..5c29c355 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@react-native-async-storage/async-storage": "^2.2.0", "@react-native-clipboard/clipboard": "^1.16.0", + "@react-native-community/geolocation": "^3.4.0", "@react-navigation/bottom-tabs": "^7.4.7", "@react-navigation/native": "^7.1.14", "@react-navigation/native-stack": "^7.3.20", @@ -19,6 +20,7 @@ "react-native-device-info": "^14.0.4", "react-native-flash-message": "^0.4.2", "react-native-get-random-values": "^1.11.0", + "react-native-permissions": "^5.0.0", "react-native-safe-area-context": "^5.6.0", "react-native-screens": "^4.11.1", "react-native-snackbar": "^2.9.0", @@ -3015,6 +3017,19 @@ "node": ">=10" } }, + "node_modules/@react-native-community/geolocation": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@react-native-community/geolocation/-/geolocation-3.4.0.tgz", + "integrity": "sha512-bzZH89/cwmpkPMKKveoC72C4JH0yF4St5Ceg/ZM9pA1SqX9MlRIrIrrOGZ/+yi++xAvFDiYfihtn9TvXWU9/rA==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/@react-native/assets-registry": { "version": "0.83.4", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.83.4.tgz", @@ -10422,6 +10437,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/react-native-permissions": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/react-native-permissions/-/react-native-permissions-5.5.1.tgz", + "integrity": "sha512-nTKFoj47b6EXNqbbg+8VFwBWMpxF1/UTbrNBLpXkWpt005pH4BeFv/NwpcC1iNhToKBrxQD+5kI0z6+kTYoYWA==", + "license": "MIT", + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-windows": "*" + }, + "peerDependenciesMeta": { + "react-native-windows": { + "optional": true + } + } + }, "node_modules/react-native-safe-area-context": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.7.0.tgz", diff --git a/example/package.json b/example/package.json index 9bf0ee74..4757ffe5 100644 --- a/example/package.json +++ b/example/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "android": "react-native run-android", - "ios": "sh -c 'args=\"$*\"; sim=${args#*--simulator }; react-native run-ios --simulator=\"$sim\"' _", + "ios": "react-native run-ios", "pods": "bundle exec pod install --project-directory=ios", "lint": "eslint .", "start": "react-native start", @@ -18,6 +18,7 @@ "dependencies": { "@react-native-async-storage/async-storage": "^2.2.0", "@react-native-clipboard/clipboard": "^1.16.0", + "@react-native-community/geolocation": "^3.4.0", "@react-navigation/bottom-tabs": "^7.4.7", "@react-navigation/native": "^7.1.14", "@react-navigation/native-stack": "^7.3.20", @@ -27,6 +28,7 @@ "react-native-device-info": "^14.0.4", "react-native-flash-message": "^0.4.2", "react-native-get-random-values": "^1.11.0", + "react-native-permissions": "^5.0.0", "react-native-safe-area-context": "^5.6.0", "react-native-screens": "^4.11.1", "react-native-snackbar": "^2.9.0", diff --git a/example/src/navigation/props.ts b/example/src/navigation/props.ts index e1a1df45..f7e24907 100644 --- a/example/src/navigation/props.ts +++ b/example/src/navigation/props.ts @@ -12,6 +12,7 @@ export const CustomDeviceAttrScreenName = 'Device Attributes' as const; export const InternalSettingsScreenName = 'Internal Settings' as const; export const InlineExamplesScreenName = 'Inline Examples' as const; export const InboxMessagesScreenName = 'Inbox Messages' as const; +export const LocationScreenName = 'Location' as const; export type NavigationStackParamList = { [SettingsScreenName]: undefined; @@ -24,6 +25,7 @@ export type NavigationStackParamList = { [InternalSettingsScreenName]: undefined; [InlineExamplesScreenName]: undefined; [InboxMessagesScreenName]: undefined; + [LocationScreenName]: undefined; }; export type NavigationProps = NavigationProp; diff --git a/example/src/screens/content-navigator.tsx b/example/src/screens/content-navigator.tsx index 823580c7..7a3b420e 100644 --- a/example/src/screens/content-navigator.tsx +++ b/example/src/screens/content-navigator.tsx @@ -5,6 +5,7 @@ import { InboxMessagesScreenName, InlineExamplesScreenName, InternalSettingsScreenName, + LocationScreenName, LoginScreenName, NavigationCallbackContext, NavigationStackParamList, @@ -22,6 +23,7 @@ import { InboxMessagesScreen, InlineExamplesScreen, InternalSettingsScreen, + LocationScreen, LogingScreen, SettingsScreen, TrackScreen, @@ -128,6 +130,15 @@ export const ContentNavigator = ({ appName }: { appName: string }) => { headerBackVisible: true, }} /> + ); diff --git a/example/src/screens/home.tsx b/example/src/screens/home.tsx index 3ac9b6b2..390be428 100644 --- a/example/src/screens/home.tsx +++ b/example/src/screens/home.tsx @@ -4,6 +4,7 @@ import { CustomProfileAttrScreenName, InboxMessagesScreenName, InlineExamplesScreenName, + LocationScreenName, NavigationCallbackContext, NavigationScreenProps, } from '@navigation'; @@ -76,6 +77,10 @@ export const HomeScreen = ({ navigation.navigate(InboxMessagesScreenName); }} /> +