-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVoiceShortcut.js
executable file
·101 lines (72 loc) · 1.64 KB
/
VoiceShortcut.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
import React, { Component } from "react";
import {
StyleSheet,
Text,
ScrollView,
Button,
SafeAreaView,
View,
Image,
} from "react-native";
import {
SiriShortcutsEvent,
donateShortcut,
suggestShortcuts,
clearAllShortcuts,
clearShortcutsWithIdentifiers,
presentShortcut,
getShortcuts,
ShortcutOptions,
ShortcutData,
} from "react-native-siri-shortcut";
const onstage = {
activityType: "nl.wbroek.reactvoice.openapp",
title: "On stage",
userInfo: {
who: "wouter",
},
keywords: ["wbroek"],
persistentIdentifier: "nl.wbroek.reactvoice.openapp",
suggestedInvocationPhrase: "Who is on stage?",
needsSave: true
};
export default class Shortcut extends Component {
componentDidMount() {
suggestShortcuts([onstage]);
donateShortcut(onstage);
SiriShortcutsEvent.addListener(
"SiriShortcutListener",
this.handleSiriShortcut.bind(this)
);
}
handleSiriShortcut({ userInfo, activityType }) {
this.setState({
shortcutInfo: userInfo,
shortcutActivityType: activityType
});
}
render() {
return (
<View style={ styles.container }>
<Image style={{flex: 1}} resizeMode="cover" source={require('./screen.png')} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#F5FCFF"
},
});
const cool = {
activityType: "nl.wbroek.reactvoice.openapp",
title: "Coolest person",
userInfo: {
who: "victoria",
},
keywords: ["wbroek"],
persistentIdentifier: "nl.wbroek.reactvoice.openapp.cool",
suggestedInvocationPhrase: "The coolest person in the room?",
needsSave: true
};