-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjunk
More file actions
120 lines (99 loc) · 3.88 KB
/
Copy pathjunk
File metadata and controls
120 lines (99 loc) · 3.88 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
<View styleName="fill-parent vertical h-center v-start" paddingTop={50}>
<Title>HabiBuddy</Title>
</View>
<Heading
style={{ paddingBottom: 20, color: "gold", textAlign: "center" }}
>
EXP: {this.state.exp}
</Heading>
<Button
onPress={this._onPressExpUp}
styleName="secondary"
style={{ width: 100 }}
>
<Text>Add EXP</Text>
</Button>
<Button
onPress={this._resetExpDebug}
styleName="secondary"
style={{ width: 200, top: 50 }}
>
<Text>Reset EXP</Text>
</Button>
const pastSessions = [
{
type: "Gaspar Brasserie",
date: "185 Sutter St, San Francisco, CA 94109"
},
{
type: "Chalk Point Kitchen",
date: "527 Broome St, New York, NY 10013"
},
{
type: "Gaspar Brasserie",
date: "185 Sutter St, San Francisco, CA 94109"
}
];
completeSession = async () => {
let parsed = null;
let date = new Date();
try {
let pastSessions = await AsyncStorage.getItem("pastSessions");
parsed = JSON.parse(pastSessions);
if (parsed != null) {
parsed.push({
type: this.state.session,
date: date.toLocaleDateString()
});
} else {
parsed = new Array(1);
parsed[0] = {
type: this.state.session,
date: date.toLocaleDateString()
};
}
} catch (error) {
alert(error);
}
AsyncStorage.setItem("pastSessions", JSON.stringify(parsed));
this.setState({ session: "NONE" });
this.setState({ pastSessions: parsed });
};
style={{
borderRadius: 60,
borderWidth: 2,
textAlign: "center",
borderColor: "#969696"
}}
let result = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (Constants.lisDevice && resut.status === "granted") {
console.log("Notification permissions granted.");
}
import { Notifications, Permissions, Constants } from "expo";
const localNotification = {
title: "test",
body: "hello world", // (string) — body text of the notification.
ios: {
// (optional) (object) — notification configuration specific to iOS.
sound: true // (optional) (boolean) — if true, play a sound. Default: false.
},
// (optional) (object) — notification configuration specific to Android.
android: {
sound: true, // (optional) (boolean) — if true, play a sound. Default: false.
//icon (optional) (string) — URL of icon to display in notification drawer.
//color (optional) (string) — color of the notification icon in notification drawer.
priority: "high", // (optional) (min | low | high | max) — android may present notifications according to the priority, for example a high priority notification will likely to be shown as a heads-up notification.
sticky: false, // (optional) (boolean) — if true, the notification will be sticky and not dismissable by user. The notification must be programmatically dismissed. Default: false.
vibrate: true // (optional) (boolean or array) — if true, vibrate the device. An array can be supplied to specify the vibration pattern, e.g. - [ 0, 500 ].
// link (optional) (string) — external link to open when notification is selected.
}
};
let t = new Date();
t.setSeconds(t.getSeconds() + 10);
const schedulingOptions = {
time: t // (date or number) — A Date object representing when to fire the notification or a number in Unix epoch time. Example: (new Date()).getTime() + 1000 is one second from now.
};
Notifications.scheduleLocalNotificationAsync(
localNotification,
schedulingOptions
);