-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathScreen.tsx
More file actions
150 lines (125 loc) · 5.3 KB
/
Copy pathScreen.tsx
File metadata and controls
150 lines (125 loc) · 5.3 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import { Image, Pressable, ScrollView, Text, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import {
DetourAnalytics,
DetourEventNames,
useDetourContext,
} from "@swmansion/react-native-detour";
import { colors, styles } from "./styles";
export const Screen = () => {
const { isLinkProcessed, link } = useDetourContext();
const insets = useSafeAreaInsets();
return (
<View style={{ flex: 1, backgroundColor: colors.background }}>
<View
style={{
backgroundColor: colors.card,
paddingHorizontal: 16,
paddingBottom: 12,
paddingTop: insets.top,
alignItems: "center",
borderBottomWidth: 1,
borderBottomColor: colors.border,
}}
>
<Image
source={require("../assets/detour-logo-transparent.png")}
style={{ width: 32, height: 32 }}
resizeMode="contain"
/>
</View>
<ScrollView contentContainerStyle={styles.screen}>
<View style={styles.card}>
<Text style={styles.title}>Detour Expo Bare Example</Text>
<Text style={styles.subtitle}>
Add credentials from the Detour panel to <Text style={styles.accent}>.env</Text> before
testing.
</Text>
<View style={styles.divider} />
<Text style={styles.sectionHeader}>Deferred Link</Text>
<Text style={styles.bullet}>
Uninstall the app or clear its data, open a Detour link in the mobile browser, then
install and launch — the SDK resolves the link automatically.
</Text>
<Text style={styles.code}>https://<your-org>.godetour.link/<hash>/</Text>
<Text style={styles.sectionHeader}>Universal / App Link</Text>
<Text style={styles.bullet}>
Open in browser or paste into Notes/Messages and tap — iOS/Android will launch the app.
</Text>
<Text style={styles.code}>https://<your-org>.godetour.link/<hash>/</Text>
<View style={styles.divider} />
<Text style={styles.sectionHeader}>Status</Text>
<Text style={styles.label}>
isLinkProcessed:{" "}
<Text style={isLinkProcessed ? styles.accent : styles.subtitle}>
{isLinkProcessed ? "true" : "false"}
</Text>
</Text>
<Text style={styles.label}>
type: <Text style={styles.value}>{link?.type ?? "none"}</Text>
</Text>
<Text style={styles.label}>
url: <Text style={styles.value}>{String(link?.url ?? "none")}</Text>
</Text>
<Text style={styles.label}>
route: <Text style={styles.value}>{link?.route ?? "none"}</Text>
</Text>
{link?.params && <Text style={styles.code}>{JSON.stringify(link.params, null, 2)}</Text>}
<View style={styles.divider} />
<Text style={styles.sectionHeader}>Test Actions</Text>
<Text style={styles.bullet}>
Fire these on demand, then inspect the request body in the RN DevTools Network tab to
confirm idfv/aaid/idfa/install_id/customer_user_id/att_status/consent/session_id/
app_version/build_number/os_version/locale/revenue fields are attached.
</Text>
<Pressable onPress={() => DetourAnalytics.setUserId("test-user-123")}>
<Text style={styles.linkButton}>Set test customer_user_id</Text>
</Pressable>
<Pressable
onPress={() => DetourAnalytics.logEvent(DetourEventNames.Purchase, { test: true })}
>
<Text style={styles.linkButton}>Log test event (purchase)</Text>
</Pressable>
<Pressable
onPress={() =>
DetourAnalytics.logConversion({
revenue: 9.99,
currency: "USD",
productId: "test_sku_1",
quantity: 1,
transactionId: "test-txn-001",
})
}
>
<Text style={styles.linkButton}>Log test conversion (revenue)</Text>
</Pressable>
<Pressable
onPress={() =>
DetourAnalytics.setConsent({ ad: true, analytics: true, tracking: true })
}
>
<Text style={styles.linkButton}>Set consent: all granted</Text>
</Pressable>
<Pressable
onPress={() =>
DetourAnalytics.setConsent({ ad: false, analytics: false, tracking: false })
}
>
<Text style={styles.linkButton}>Set consent: all denied</Text>
</Pressable>
<Pressable
onPress={() => DetourAnalytics.setAdvertisingId("11111111-2222-3333-4444-555555555555")}
>
<Text style={styles.linkButton}>Override advertising id (manual)</Text>
</Pressable>
<Pressable onPress={() => DetourAnalytics.setTrackingAuthorizationStatus("granted")}>
<Text style={styles.linkButton}>Override ATT status: granted</Text>
</Pressable>
<Pressable onPress={() => DetourAnalytics.setTrackingAuthorizationStatus("denied")}>
<Text style={styles.linkButton}>Override ATT status: denied</Text>
</Pressable>
</View>
</ScrollView>
</View>
);
};