Skip to content

Commit

Permalink
add Expo sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed May 18, 2022
1 parent 8e62ece commit d7b8e5c
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ demos/appsflyer-react-native-app/.DS_Store
demos/appsflyer-react-native-app/node_modules
demos/appsflyer-react-native-app/ios/Podfile.lock
demos/appsflyer-react-native-app/ios/Pods
demos/appsflyer-expo-app/ios
demos/appsflyer-expo-app/android
demos/appsflyer-expo-app/.expo
demos/appsflyer-expo-app/node_modules
demos/appsflyer-expo-app/yarn.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ If you have used 1 of the removed APIs, please check the integration guide for t
- [Advanced APIs](/Docs/AdvancedAPI.md)
- [Testing the integration](/Docs/Testing.md)
- [APIs](/Docs/API.md)
- [React-Native Sample App](/demos/appsflyer-react-native-app)
- [React-Native Sample App](/demos)

50 changes: 50 additions & 0 deletions demos/appsflyer-expo-app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { useEffect, useState } from 'react';
import { StyleSheet, Text, View, ScrollView, Button } from 'react-native';
import appsFlyer from 'react-native-appsflyer';

export default function App() {
const [gcd, setGcd] = useState('No GCD Yet...');
const [oaoa, setOaoa] = useState('No UDL Yet...');

const option = {
isDebug: true,
devKey: 'Us4xXxXxXxQed',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 5,
appId: '7xXxXxXx1',
};
useEffect(() => {
const gcdListener = appsFlyer.onInstallConversionData((res) => setGcd(JSON.stringify(res, null, 5)));
const oaoaListener = appsFlyer.onDeepLink((res) => setOaoa(JSON.stringify(res, null, 5)));
appsFlyer.initSdk(option, null, null);
return () => {};
}, []);
return (
<View style={[{ flex: 1, marginTop: 30 }]}>
<View style={[{ flex: 2 }]}>
<View style={{ backgroundColor: 'grey', alignItems: 'center' }}>
<Text>GCD</Text>
</View>
<ScrollView contentContainerStyle={{ alignItems: 'center' }}>
<Text style={[]}>{gcd}</Text>
</ScrollView>
</View>
<View style={[{ flex: 2 }]}>
<View style={{ backgroundColor: 'grey', alignItems: 'center' }}>
<Text>UDL</Text>
</View>
<ScrollView contentContainerStyle={{ alignItems: 'center' }}>
<Text style={[]}>{oaoa}</Text>
</ScrollView>
</View>
<View style={[{ flex: 1 }]}>
<Button title='Log Event' onPress={() => console.log('la')} />
</View>
</View>
);
}

const styles = StyleSheet.create({
container: {},
});
14 changes: 14 additions & 0 deletions demos/appsflyer-expo-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# AppsFlyer-Expo Shop Sample App

Basic integration example of AppsFlyer React-Native plugin in an Expo app. Please take a look on the example `app.json`
#### First run
In the root folder of the the app (appsflyer-expo-app and **not** appsflyer-react-native-plugin) run:<br>
`yarn install`<br>

#### Generate native folders:
run `expo prebuild`

#### Android:
run `npm run android`
#### iOS:
run `npm run ios`
70 changes: 70 additions & 0 deletions demos/appsflyer-expo-app/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"expo": {
"name": "expoAppsFlyer",
"slug": "expoAppsFlyer",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/atom.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"plugins": [
[
"react-native-appsflyer",
{"shouldUseStrictMode": false}
]
],
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"scheme": "amitkremer",
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.appsflyer.bundleId",
"associatedDomains": ["applinks:appsflyer.onelink.me"]
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.expo.rntest",
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "https",
"host": "appsflyer.onelink.me",
"pathPrefix": "/DvWi"
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
},
{
"action": "VIEW",
"data": [
{
"scheme": "myScheme"
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
]
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Binary file added demos/appsflyer-expo-app/assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/appsflyer-expo-app/assets/atom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/appsflyer-expo-app/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/appsflyer-expo-app/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/appsflyer-expo-app/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions demos/appsflyer-expo-app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
18 changes: 18 additions & 0 deletions demos/appsflyer-expo-app/eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"cli": {
"version": ">= 0.48.2"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
10 changes: 10 additions & 0 deletions demos/appsflyer-expo-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'expo-dev-client';

import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
4 changes: 4 additions & 0 deletions demos/appsflyer-expo-app/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

module.exports = getDefaultConfig(__dirname);
26 changes: 26 additions & 0 deletions demos/appsflyer-expo-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "expoappsflyer",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~45.0.0",
"expo-dev-client": "~0.9.5",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-appsflyer": "6.6.0",
"react-native-web": "0.17.7"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}

0 comments on commit d7b8e5c

Please sign in to comment.