-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
15,270 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BUNDLE_PATH: "vendor/bundle" | ||
BUNDLE_FORCE_RUBY_PLATFORM: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** @type {Detox.DetoxConfig} */ | ||
module.exports = { | ||
testRunner: { | ||
args: { | ||
'$0': 'jest', | ||
config: 'e2e/jest.config.js' | ||
}, | ||
jest: { | ||
setupTimeout: 120000 | ||
} | ||
}, | ||
behavior: { | ||
init: { | ||
reinstallApp: true, | ||
exposeGlobals: false | ||
}, | ||
launchApp: "auto", | ||
cleanup: { | ||
shutdownDevice: false | ||
} | ||
}, | ||
apps: { | ||
'ios.debug': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/AnalyticsReactNativeE2E.app', | ||
build: 'xcodebuild -workspace ios/AnalyticsReactNativeE2E.xcworkspace -scheme AnalyticsReactNativeE2E -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'ios.release': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/AnalyticsReactNativeE2E.app', | ||
build: 'xcodebuild -workspace ios/AnalyticsReactNativeE2E.xcworkspace -scheme AnalyticsReactNativeE2E -configuration Release -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'android.debug': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk', | ||
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug', | ||
reversePorts: [ | ||
8081 | ||
] | ||
}, | ||
'android.release': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk', | ||
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release' | ||
} | ||
}, | ||
devices: { | ||
simulator: { | ||
type: 'ios.simulator', | ||
device: { | ||
type: 'iPhone 14' | ||
} | ||
}, | ||
attached: { | ||
type: 'android.attached', | ||
device: { | ||
adbName: '.*' | ||
} | ||
}, | ||
emulator: { | ||
type: 'android.emulator', | ||
device: { | ||
avdName: 'Pixel_3a_API_32' | ||
} | ||
} | ||
}, | ||
configurations: { | ||
'ios.sim.debug': { | ||
device: 'simulator', | ||
app: 'ios.debug' | ||
}, | ||
'ios.sim.release': { | ||
device: 'simulator', | ||
app: 'ios.release' | ||
}, | ||
'android.att.debug': { | ||
device: 'attached', | ||
app: 'android.debug' | ||
}, | ||
'android.att.release': { | ||
device: 'attached', | ||
app: 'android.release' | ||
}, | ||
'android.emu.debug': { | ||
device: 'emulator', | ||
app: 'android.debug' | ||
}, | ||
'android.emu.release': { | ||
device: 'emulator', | ||
app: 'android.release' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
ios/.xcode.env.local | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
*.hprof | ||
.cxx/ | ||
*.keystore | ||
!debug.keystore | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/ | ||
|
||
**/fastlane/report.xml | ||
**/fastlane/Preview.html | ||
**/fastlane/screenshots | ||
**/fastlane/test_output | ||
|
||
# Bundle artifact | ||
*.jsbundle | ||
|
||
# Ruby / CocoaPods | ||
/ios/Pods/ | ||
/vendor/bundle/ | ||
|
||
# Temporary files created by Metro to check the health of the file watcher | ||
.metro-health-check* | ||
|
||
# testing | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
arrowParens: 'avoid', | ||
bracketSameLine: true, | ||
bracketSpacing: false, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[tools] | ||
java = "zulu-17" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import 'react-native-gesture-handler'; | ||
import * as React from 'react'; | ||
// import RNBootSplash from 'react-native-bootsplash'; | ||
import { | ||
NavigationContainer, | ||
NavigationState, | ||
PartialState, | ||
} from '@react-navigation/native'; | ||
import {createStackNavigator} from '@react-navigation/stack'; | ||
import { | ||
createClient, | ||
AnalyticsProvider, | ||
CountFlushPolicy, | ||
// @ts-ignore unused for e2e tests | ||
// StartupFlushPolicy, | ||
// @ts-ignore unused for e2e tests | ||
// TimerFlushPolicy, | ||
} from '@segment/analytics-react-native'; | ||
import Home from './Home'; | ||
import SecondPage from './SecondPage'; | ||
import Modal from './Modal'; | ||
import {useState} from 'react'; | ||
import {Logger} from './plugins/Logger'; | ||
import {Platform} from 'react-native'; | ||
|
||
// import {AmplitudeSessionPlugin} from '@segment/analytics-react-native-plugin-amplitude-session'; | ||
// import { ConsentManager } from './plugins/ConsentManager'; | ||
// import { FirebasePlugin } from '@segment/analytics-react-native-plugin-firebase'; | ||
// import { FacebookAppEventsPlugin } from '@segment/analytics-react-native-plugin-facebook-app-events'; | ||
// import { IdfaPlugin } from '@segment/analytics-react-native-plugin-idfa'; | ||
// import { AdvertisingIdPlugin } from '@segment/analytics-react-native-plugin-advertising-id'; | ||
// import { ClevertapPlugin } from '@segment/analytics-react-native-plugin-clevertap'; | ||
// import { BrazePlugin } from '@segment/analytics-react-native-plugin-braze'; | ||
|
||
const segmentClient = createClient({ | ||
writeKey: 'yup', | ||
maxBatchSize: 1000, | ||
trackDeepLinks: true, | ||
trackAppLifecycleEvents: true, | ||
autoAddSegmentDestination: true, | ||
collectDeviceId: true, | ||
debug: true, | ||
flushPolicies: [ | ||
new CountFlushPolicy(5), | ||
// These are disabled for E2E tests | ||
// new TimerFlushPolicy(1000), | ||
// new StartupFlushPolicy(), | ||
], | ||
proxy: Platform.select({ | ||
ios: 'http://localhost:9091/events', | ||
android: 'http://10.0.2.2:9091/events', | ||
}), | ||
cdnProxy: Platform.select({ | ||
ios: 'http://localhost:9091/settings', | ||
android: 'http://10.0.2.2:9091/settings', | ||
}), | ||
}); | ||
|
||
const LoggerPlugin = new Logger(); | ||
|
||
segmentClient.add({plugin: LoggerPlugin}); | ||
|
||
// To see an example Consent Manager uncomment the following | ||
// const ConsentManagerPlugin = new ConsentManager(); | ||
// segmentClient.add({ plugin: ConsentManagerPlugin }); | ||
|
||
// To test the Firebase plugin make sure to add your own API_KEY in example/ios/GoogleService-Info.plist | ||
// segmentClient.add({ plugin: new FirebasePlugin() }); | ||
|
||
// To test the Facebook App Events plugin make sure to add your Facebook App Id to Info.plist | ||
// segmentClient.add({ plugin: new FacebookAppEventsPlugin() }); | ||
// const idfaPlugin = new IdfaPlugin(); | ||
// segmentClient.add({ plugin: idfaPlugin }); | ||
|
||
// segmentClient.add({plugin: new AmplitudeSessionPlugin()}); | ||
|
||
// segmentClient.add({ plugin: new BrazePlugin() }); | ||
|
||
// segmentClient.add({ plugin: new ClevertapPlugin() }); | ||
|
||
// segmentClient.add({ | ||
// plugin: new AdvertisingIdPlugin(), | ||
// }); | ||
|
||
const MainStack = createStackNavigator(); | ||
const RootStack = createStackNavigator(); | ||
function MainStackScreen() { | ||
return ( | ||
<MainStack.Navigator | ||
screenOptions={{ | ||
headerStyle: { | ||
backgroundColor: '#262e4f', | ||
}, | ||
headerTintColor: '#fff', | ||
headerTitleStyle: { | ||
fontWeight: 'bold', | ||
}, | ||
}}> | ||
<MainStack.Screen | ||
name="Home" | ||
component={Home} | ||
options={{headerShown: false}} | ||
/> | ||
<MainStack.Screen | ||
name="SecondPage" | ||
component={SecondPage} | ||
options={{title: 'Second Page'}} | ||
/> | ||
</MainStack.Navigator> | ||
); | ||
} | ||
|
||
const getActiveRouteName = ( | ||
state: NavigationState | PartialState<NavigationState> | undefined, | ||
): string => { | ||
if (!state || typeof state.index !== 'number') { | ||
return 'Unknown'; | ||
} | ||
|
||
const route = state.routes[state.index]; | ||
|
||
if (route.state) { | ||
return getActiveRouteName(route.state); | ||
} | ||
|
||
return route.name; | ||
}; | ||
|
||
const App = () => { | ||
// React.useEffect(() => { | ||
// void RNBootSplash.hide(); | ||
// }, []); | ||
|
||
const [routeName, setRouteName] = useState('Unknown'); | ||
|
||
return ( | ||
<AnalyticsProvider client={segmentClient}> | ||
<NavigationContainer | ||
onStateChange={state => { | ||
const newRouteName = getActiveRouteName(state); | ||
|
||
if (routeName !== newRouteName) { | ||
void segmentClient.screen(newRouteName); | ||
|
||
setRouteName(newRouteName); | ||
} | ||
}}> | ||
<RootStack.Navigator | ||
screenOptions={{ | ||
headerStyle: { | ||
backgroundColor: '#262e4f', | ||
}, | ||
headerTintColor: '#fff', | ||
headerTitleStyle: { | ||
fontWeight: 'bold', | ||
}, | ||
presentation: 'modal', | ||
}}> | ||
<RootStack.Screen | ||
name="Main" | ||
component={MainStackScreen} | ||
options={{headerShown: false}} | ||
/> | ||
<RootStack.Screen | ||
name="Modal" | ||
component={Modal} | ||
options={{headerBackTitle: 'Go back'}} | ||
/> | ||
</RootStack.Navigator> | ||
</NavigationContainer> | ||
</AnalyticsProvider> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source 'https://rubygems.org' | ||
|
||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
ruby ">= 2.6.10" | ||
|
||
gem 'cocoapods', '~> 1.13' | ||
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0' |
Oops, something went wrong.