-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
125 lines (117 loc) · 2.87 KB
/
App.js
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
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
// import * as firebase from 'firebase';
import { events, initialize, identify, track } from "./amplitudeApi.js"
// import firebase from 'react-native-firebase';
// import 'firebase/analytics';
console.log("hi")
console.log(events)
// var firebaseConfig = {
// apiKey: "AIzaSyANA5D7me2Pdg4FDq5OK1qNsSNpelzwf-8",
// authDomain: "mobile-app-2a24b.firebaseapp.com",
// databaseURL: "https://mobile-app-2a24b.firebaseio.com",
// projectId: "mobile-app-2a24b",
// storageBucket: "mobile-app-2a24b.appspot.com",
// messagingSenderId: "963950188113",
// appId: "1:963950188113:web:f07f6d9ce9fc52fed60a70",
// measurementId: "G-XHR96JFXR0"
// };
// // Initialize Firebase
// if (!firebase.apps.length) {
// firebase.initializeApp(firebaseConfig);
// }
// firebase.analytics();
async function id() {
var userId = "1"
var properties = {
'color': 'blue',
'age': 20,
'key': 'value'
}
identify(userId, properties)
}
async function log() {
var logEvent = events.USER_LOGGED_IN;
console.log(logEvent)
var properties = {
'color': 'blue',
'age': 20,
'key': 'value'
}
track(logEvent, properties)
}
// async function query() {
// var ref = firebase.database().ref("table1");
// ref.once('value').then(function(snapshot) {
// console.log(snapshot.val())
// });
//
// await firebase.analytics().logEvent('queried', {
// id: '123456789',
// color: 'red',
// via: 'ProductCatalog',
// });
//
// console.log("add event")
// }
//
// async function add(id) {
// var ref = firebase.database().ref('table2/')
// var newItem = ref.push()
// newItem.set({
// timestamp: firebase.database.ServerValue.TIMESTAMP,
// username: "ajay",
// email: "[email protected]"
// }, function(error) {
// if (error) {
// console.log("The write failed...")
// } else {
// console.log("Data saved successfully!")
// }
// });
// }
//
// async function remove(id) {
// firebase.database().ref('table2/' + id).set(null
// , function(error) {
// if (error) {
// console.log("The delete failed...")
// } else {
// console.log("Data deleted successfully!")
// }
// });
// }
export default function App() {
return (
<View style={styles.container}>
<Button
title = "Identify"
onPress = {() => id()}
/>
<Button
title = "Log"
onPress = {() => log()}
/>
</View>
);
}
// <Button
// title = "Query"
// onPress = {() => query()}
// />
// <Button
// title = "Add"
// onPress = {() => add(1)}
// />
// <Button
// title = "Remove"
// onPress = {() => remove(1)}
// />
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});