/
App.tsx
73 lines (62 loc) · 2.27 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import * as React from 'react';
import {Button, SafeAreaView, StyleSheet, View} from 'react-native';
import {
Affise
} from 'affise-attribution-lib';
import {AffiseWidget} from "./affise/AffiseWidget";
import {AffiseApiWidget} from "./affise/AffiseApiWidget";
import {useEffect} from "react";
export default function App() {
const [deeplink, setDeeplink] = React.useState("");
const [hide, setHide] = React.useState(true);
useEffect(() => {
// Initialize https://github.com/affise/sdk-react#initialize
Affise
.settings({
affiseAppId: '129', //Change to your app id
secretKey: '93a40b54-6f12-443f-a250-ebf67c5ee4d2', //Change to your secretId
})
.setProduction(false) //To enable debug methods set Production to false
.start(); // Start Affise SDK
// Deeplinks https://github.com/affise/sdk-react#deeplinks
Affise.registerDeeplinkCallback((url) => {
console.log(`Deeplink: ${url}`);
setDeeplink(`Deeplink: ${url}`);
});
// Debug: network request/response
Affise.debug.network((request, response) =>
{
console.log(`Affise: ${request}`);
console.log(`Affise: ${response}`);
});
// SDK to SDK integrations https://github.com/affise/sdk-react#sdk-to-sdk-integrations
// new AffiseAdRevenue(AffiseAdSource.ADMOB)
// .setRevenue(2.5, "USD")
// .setNetwork("network")
// .setUnit("unit")
// .setPlacement("placement")
// .send();
}, []);
return (
<SafeAreaView style={styles.container}>
<View style={{width: '100%', paddingTop: 8, paddingLeft:8, paddingRight: 8}}>
<Button
title='API / Events'
onPress={() => {
setHide(!hide);
}}
/>
</View>
<View style={{width: '100%', flex: 1}}>
{!hide ? <AffiseWidget/> : <AffiseApiWidget value={deeplink} /> }
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});