@trycourier/courier-react-native 5.6.17 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -135
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/courierreactnative/CourierClientModule.kt +1 -0
- package/android/src/main/java/com/courierreactnative/CourierInboxViewManager.kt +2 -0
- package/android/src/main/java/com/courierreactnative/CourierPreferencesViewManager.kt +2 -0
- package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +3 -0
- package/android/src/main/java/com/courierreactnative/Utils.kt +11 -1
- package/courier-react-native.podspec +1 -1
- package/ios/CourierClientModule.swift +1 -0
- package/ios/CourierInboxReactNativeManager.swift +8 -0
- package/ios/CourierPreferencesReactNativeManager.swift +8 -0
- package/ios/CourierReactNativeDelegate.m +1 -1
- package/ios/CourierReactNativeEventEmitter.swift +1 -1
- package/ios/CourierReactNativeModule.m +1 -0
- package/ios/CourierSharedModule.swift +10 -3
- package/ios/Utils.swift +10 -0
- package/lib/commonjs/Broadcaster.js +5 -5
- package/lib/commonjs/Broadcaster.js.map +1 -1
- package/lib/commonjs/CourierApiUrls.js +29 -0
- package/lib/commonjs/CourierApiUrls.js.map +1 -0
- package/lib/commonjs/Modules.js.map +1 -1
- package/lib/commonjs/client/BrandClient.js.map +1 -1
- package/lib/commonjs/client/ClientModule.js.map +1 -1
- package/lib/commonjs/client/CourierClient.js +4 -1
- package/lib/commonjs/client/CourierClient.js.map +1 -1
- package/lib/commonjs/client/InboxClient.js.map +1 -1
- package/lib/commonjs/client/PreferenceClient.js.map +1 -1
- package/lib/commonjs/client/TokenClient.js.map +1 -1
- package/lib/commonjs/client/TrackingClient.js.map +1 -1
- package/lib/commonjs/index.js +22 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/CourierAuthenticationListener.js.map +1 -1
- package/lib/commonjs/models/CourierPushListener.js.map +1 -1
- package/lib/commonjs/models/CourierUserPreferences.js +13 -13
- package/lib/commonjs/models/CourierUserPreferences.js.map +1 -1
- package/lib/commonjs/models/InboxAction.js.map +1 -1
- package/lib/commonjs/models/InboxMessage.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/views/CourierInboxView.js +13 -13
- package/lib/commonjs/views/CourierInboxView.js.map +1 -1
- package/lib/commonjs/views/CourierPreferencesView.js +4 -4
- package/lib/commonjs/views/CourierPreferencesView.js.map +1 -1
- package/lib/module/Broadcaster.js +7 -7
- package/lib/module/Broadcaster.js.map +1 -1
- package/lib/module/CourierApiUrls.js +20 -0
- package/lib/module/CourierApiUrls.js.map +1 -0
- package/lib/module/Modules.js +1 -1
- package/lib/module/Modules.js.map +1 -1
- package/lib/module/client/BrandClient.js +1 -1
- package/lib/module/client/BrandClient.js.map +1 -1
- package/lib/module/client/ClientModule.js +1 -1
- package/lib/module/client/ClientModule.js.map +1 -1
- package/lib/module/client/CourierClient.js +10 -7
- package/lib/module/client/CourierClient.js.map +1 -1
- package/lib/module/client/InboxClient.js +1 -1
- package/lib/module/client/InboxClient.js.map +1 -1
- package/lib/module/client/PreferenceClient.js +1 -1
- package/lib/module/client/PreferenceClient.js.map +1 -1
- package/lib/module/client/TokenClient.js +1 -1
- package/lib/module/client/TokenClient.js.map +1 -1
- package/lib/module/client/TrackingClient.js +1 -1
- package/lib/module/client/TrackingClient.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/CourierAuthenticationListener.js +1 -1
- package/lib/module/models/CourierAuthenticationListener.js.map +1 -1
- package/lib/module/models/CourierInboxListener.js +1 -1
- package/lib/module/models/CourierPushListener.js.map +1 -1
- package/lib/module/models/CourierUserPreferences.js +13 -13
- package/lib/module/models/CourierUserPreferences.js.map +1 -1
- package/lib/module/models/InboxAction.js.map +1 -1
- package/lib/module/models/InboxMessage.js +1 -1
- package/lib/module/models/InboxMessage.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/views/CourierInboxView.js +18 -18
- package/lib/module/views/CourierInboxView.js.map +1 -1
- package/lib/module/views/CourierPreferencesView.js +7 -7
- package/lib/module/views/CourierPreferencesView.js.map +1 -1
- package/lib/typescript/src/Broadcaster.d.ts +7 -7
- package/lib/typescript/src/Broadcaster.d.ts.map +1 -1
- package/lib/typescript/src/CourierApiUrls.d.ts +11 -0
- package/lib/typescript/src/CourierApiUrls.d.ts.map +1 -0
- package/lib/typescript/src/Modules.d.ts.map +1 -1
- package/lib/typescript/src/client/BrandClient.d.ts +1 -1
- package/lib/typescript/src/client/BrandClient.d.ts.map +1 -1
- package/lib/typescript/src/client/ClientModule.d.ts +1 -1
- package/lib/typescript/src/client/ClientModule.d.ts.map +1 -1
- package/lib/typescript/src/client/CourierClient.d.ts +9 -6
- package/lib/typescript/src/client/CourierClient.d.ts.map +1 -1
- package/lib/typescript/src/client/InboxClient.d.ts +1 -1
- package/lib/typescript/src/client/InboxClient.d.ts.map +1 -1
- package/lib/typescript/src/client/PreferenceClient.d.ts +1 -1
- package/lib/typescript/src/client/PreferenceClient.d.ts.map +1 -1
- package/lib/typescript/src/client/TokenClient.d.ts +1 -1
- package/lib/typescript/src/client/TokenClient.d.ts.map +1 -1
- package/lib/typescript/src/client/TrackingClient.d.ts +1 -1
- package/lib/typescript/src/client/TrackingClient.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/models/Android_CourierSheet.d.ts +1 -1
- package/lib/typescript/src/models/Android_CourierSheet.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierAuthenticationListener.d.ts +1 -1
- package/lib/typescript/src/models/CourierAuthenticationListener.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierBrand.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierButton.d.ts +1 -1
- package/lib/typescript/src/models/CourierButton.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierFont.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierInboxListener.d.ts +1 -1
- package/lib/typescript/src/models/CourierInboxMessages.d.ts +1 -1
- package/lib/typescript/src/models/CourierInboxTheme.d.ts +4 -3
- package/lib/typescript/src/models/CourierInboxTheme.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierInfoViewStyle.d.ts +2 -2
- package/lib/typescript/src/models/CourierInfoViewStyle.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierPreferencesTheme.d.ts +7 -6
- package/lib/typescript/src/models/CourierPreferencesTheme.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierPushListener.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierUserPreferences.d.ts +1 -1
- package/lib/typescript/src/models/CourierUserPreferences.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxAction.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessage.d.ts +1 -1
- package/lib/typescript/src/models/InboxMessage.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessageEvent.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessageSet.d.ts +1 -1
- package/lib/typescript/src/models/iOS_CourierCell.d.ts.map +1 -1
- package/lib/typescript/src/models/iOS_CourierSheet.d.ts +1 -1
- package/lib/typescript/src/models/iOS_CourierSheet.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierInboxView.d.ts +5 -5
- package/lib/typescript/src/views/CourierInboxView.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierPreferencesView.d.ts +3 -3
- package/lib/typescript/src/views/CourierPreferencesView.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/Broadcaster.tsx +21 -15
- package/src/CourierApiUrls.tsx +30 -0
- package/src/Modules.tsx +22 -13
- package/src/client/BrandClient.tsx +6 -6
- package/src/client/ClientModule.tsx +4 -6
- package/src/client/CourierClient.tsx +20 -13
- package/src/client/InboxClient.tsx +40 -13
- package/src/client/PreferenceClient.tsx +47 -21
- package/src/client/TokenClient.tsx +14 -7
- package/src/client/TrackingClient.tsx +7 -6
- package/src/index.tsx +208 -115
- package/src/models/Android_CourierSheet.tsx +5 -5
- package/src/models/CourierAuthenticationListener.tsx +5 -9
- package/src/models/CourierBrand.tsx +6 -6
- package/src/models/CourierButton.tsx +5 -5
- package/src/models/CourierDevice.tsx +1 -1
- package/src/models/CourierFont.tsx +4 -4
- package/src/models/CourierInboxListener.tsx +3 -3
- package/src/models/CourierInboxMessages.tsx +2 -2
- package/src/models/CourierInboxTheme.tsx +56 -42
- package/src/models/CourierInfoViewStyle.tsx +5 -5
- package/src/models/CourierPaging.tsx +1 -1
- package/src/models/CourierPreferencesTheme.tsx +33 -27
- package/src/models/CourierPushListener.tsx +9 -7
- package/src/models/CourierPushProvider.tsx +1 -1
- package/src/models/CourierTrackingEvent.tsx +6 -6
- package/src/models/CourierUserPreferences.tsx +32 -28
- package/src/models/InboxAction.tsx +2 -6
- package/src/models/InboxMessage.tsx +4 -5
- package/src/models/InboxMessageEvent.tsx +7 -1
- package/src/models/InboxMessageFeed.tsx +1 -1
- package/src/models/InboxMessageSet.tsx +1 -1
- package/src/models/iOS_CourierCell.tsx +10 -5
- package/src/models/iOS_CourierSheet.tsx +4 -4
- package/src/utils.tsx +4 -7
- package/src/views/CourierInboxView.tsx +79 -71
- package/src/views/CourierPreferencesView.tsx +34 -35
- package/lib/example/src/App.js +0 -11
- package/lib/example/src/Emitter.js +0 -11
- package/lib/example/src/Env.js +0 -6
- package/lib/example/src/Home.js +0 -67
- package/lib/example/src/Poke.js +0 -75
- package/lib/example/src/Tabs.js +0 -36
- package/lib/example/src/Utils.js +0 -71
- package/lib/example/src/pages/Auth.js +0 -224
- package/lib/example/src/pages/Inbox.js +0 -38
- package/lib/example/src/pages/Preferences.js +0 -13
- package/lib/example/src/pages/PreferencesStack.js +0 -11
- package/lib/example/src/pages/Push.js +0 -93
- package/lib/example/src/pages/Styles.js +0 -26
- package/lib/example/src/pages/Tests.js +0 -1068
- package/lib/example/src/pages/inbox/InboxCustom.js +0 -141
- package/lib/example/src/pages/inbox/InboxDefault.js +0 -22
- package/lib/example/src/pages/inbox/InboxStyled.js +0 -220
- package/lib/example/src/pages/preferences/PreferencesCustom.js +0 -91
- package/lib/example/src/pages/preferences/PreferencesDefault.js +0 -17
- package/lib/example/src/pages/preferences/PreferencesDetail.js +0 -127
- package/lib/example/src/pages/preferences/PreferencesStyled.js +0 -110
- package/lib/package.json +0 -171
- package/lib/src/Broadcaster.js +0 -24
- package/lib/src/Modules.js +0 -26
- package/lib/src/client/BrandClient.js +0 -17
- package/lib/src/client/ClientModule.js +0 -14
- package/lib/src/client/CourierClient.js +0 -31
- package/lib/src/client/InboxClient.js +0 -99
- package/lib/src/client/PreferenceClient.js +0 -63
- package/lib/src/client/TokenClient.js +0 -27
- package/lib/src/client/TrackingClient.js +0 -17
- package/lib/src/index.js +0 -567
- package/lib/src/models/Android_CourierSheet.js +0 -1
- package/lib/src/models/CourierAuthenticationListener.js +0 -14
- package/lib/src/models/CourierBrand.js +0 -1
- package/lib/src/models/CourierButton.js +0 -1
- package/lib/src/models/CourierDevice.js +0 -1
- package/lib/src/models/CourierFont.js +0 -1
- package/lib/src/models/CourierInboxListener.js +0 -20
- package/lib/src/models/CourierInboxMessages.js +0 -1
- package/lib/src/models/CourierInboxTheme.js +0 -1
- package/lib/src/models/CourierInfoViewStyle.js +0 -1
- package/lib/src/models/CourierPaging.js +0 -1
- package/lib/src/models/CourierPreferencesTheme.js +0 -1
- package/lib/src/models/CourierPushListener.js +0 -14
- package/lib/src/models/CourierPushProvider.js +0 -8
- package/lib/src/models/CourierTrackingEvent.js +0 -8
- package/lib/src/models/CourierUserPreferences.js +0 -51
- package/lib/src/models/InboxAction.js +0 -1
- package/lib/src/models/InboxMessage.js +0 -1
- package/lib/src/models/InboxMessageFeed.js +0 -1
- package/lib/src/models/InboxMessageSet.js +0 -1
- package/lib/src/models/iOS_CourierCell.js +0 -1
- package/lib/src/models/iOS_CourierSheet.js +0 -1
- package/lib/src/utils.js +0 -27
- package/lib/src/views/CourierInboxView.js +0 -75
- package/lib/src/views/CourierPreferencesView.js +0 -33
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import Courier from "@trycourier/courier-react-native";
|
|
2
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { ActivityIndicator, Button, Modal, Platform, StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import Env from "../Env";
|
|
5
|
-
import { ExampleServer } from "../Utils";
|
|
6
|
-
import { usePoke } from '../Poke';
|
|
7
|
-
const Auth = () => {
|
|
8
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
9
|
-
const [userId, setUserId] = useState();
|
|
10
|
-
const [tenantId, setTenantId] = useState();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const initAuth = async () => {
|
|
13
|
-
const authListener = await Courier.shared.addAuthenticationListener({
|
|
14
|
-
onUserChanged: async (userId) => {
|
|
15
|
-
setUserId(userId);
|
|
16
|
-
setTenantId(await Courier.shared.getTenantId());
|
|
17
|
-
console.log(`User changed: ${userId}`);
|
|
18
|
-
console.log(`Tenant changed: ${await Courier.shared.getTenantId()}`);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
const userId = await Courier.shared.getUserId();
|
|
22
|
-
const tenantId = await Courier.shared.getTenantId();
|
|
23
|
-
console.log(`Initial user: ${userId}`);
|
|
24
|
-
console.log(`Initial tenant: ${tenantId}`);
|
|
25
|
-
refreshJWT(userId, tenantId);
|
|
26
|
-
return authListener;
|
|
27
|
-
};
|
|
28
|
-
let listener;
|
|
29
|
-
initAuth().then(result => {
|
|
30
|
-
listener = result;
|
|
31
|
-
});
|
|
32
|
-
return () => {
|
|
33
|
-
if (listener) {
|
|
34
|
-
listener.remove();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
async function refreshJWT(userId, tenantId) {
|
|
39
|
-
console.log('Refreshing JWT');
|
|
40
|
-
if (!userId) {
|
|
41
|
-
console.log(`No user found`);
|
|
42
|
-
setIsLoading(false);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
setIsLoading(true);
|
|
46
|
-
try {
|
|
47
|
-
console.log(`User ID: ${userId}`);
|
|
48
|
-
await Courier.shared.signOut();
|
|
49
|
-
const token = await ExampleServer.generateJwt({
|
|
50
|
-
authKey: Env.authKey,
|
|
51
|
-
userId: userId,
|
|
52
|
-
});
|
|
53
|
-
console.log(`New token: ${token}`);
|
|
54
|
-
await Courier.shared.signIn({
|
|
55
|
-
accessToken: token,
|
|
56
|
-
userId: userId,
|
|
57
|
-
tenantId: tenantId,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.error(e);
|
|
62
|
-
}
|
|
63
|
-
setIsLoading(false);
|
|
64
|
-
}
|
|
65
|
-
async function signIn(userId, tenantId) {
|
|
66
|
-
console.log('Signing User In');
|
|
67
|
-
console.log(`User ID: ${userId}`);
|
|
68
|
-
console.log(`Tenant ID: ${tenantId}`);
|
|
69
|
-
setIsLoading(true);
|
|
70
|
-
try {
|
|
71
|
-
const token = await ExampleServer.generateJwt({
|
|
72
|
-
authKey: Env.authKey,
|
|
73
|
-
userId: userId,
|
|
74
|
-
});
|
|
75
|
-
console.log(`New token: ${token}`);
|
|
76
|
-
await Courier.shared.signIn({
|
|
77
|
-
accessToken: token,
|
|
78
|
-
userId: userId,
|
|
79
|
-
tenantId: tenantId.length ? tenantId : undefined
|
|
80
|
-
});
|
|
81
|
-
setUserId(await Courier.shared.getUserId());
|
|
82
|
-
setTenantId(await Courier.shared.getTenantId());
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.error(e);
|
|
86
|
-
}
|
|
87
|
-
setIsLoading(false);
|
|
88
|
-
}
|
|
89
|
-
async function signOut() {
|
|
90
|
-
await Courier.shared.signOut();
|
|
91
|
-
setUserId(await Courier.shared.getUserId());
|
|
92
|
-
setTenantId(await Courier.shared.getTenantId());
|
|
93
|
-
}
|
|
94
|
-
const styles = StyleSheet.create({
|
|
95
|
-
container: {
|
|
96
|
-
flex: 1,
|
|
97
|
-
justifyContent: 'center',
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
},
|
|
100
|
-
text: {
|
|
101
|
-
marginBottom: 10,
|
|
102
|
-
fontFamily: Platform.select({
|
|
103
|
-
ios: 'Courier',
|
|
104
|
-
android: 'monospace',
|
|
105
|
-
default: 'monospace',
|
|
106
|
-
}),
|
|
107
|
-
fontSize: 16,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
const AuthButton = (props) => {
|
|
111
|
-
const [modalVisible, setModalVisible] = useState(false);
|
|
112
|
-
const [userId, setUserId] = useState('');
|
|
113
|
-
const [tenantId, setTenantId] = useState('');
|
|
114
|
-
const inputRef = useRef(null);
|
|
115
|
-
const styles = StyleSheet.create({
|
|
116
|
-
button: {
|
|
117
|
-
backgroundColor: 'lightgray',
|
|
118
|
-
padding: 10,
|
|
119
|
-
borderRadius: 5,
|
|
120
|
-
},
|
|
121
|
-
buttonText: {
|
|
122
|
-
fontSize: 16,
|
|
123
|
-
fontFamily: Platform.select({
|
|
124
|
-
ios: 'Courier',
|
|
125
|
-
android: 'monospace',
|
|
126
|
-
default: 'monospace',
|
|
127
|
-
}),
|
|
128
|
-
},
|
|
129
|
-
modalContainer: {
|
|
130
|
-
flex: 1,
|
|
131
|
-
justifyContent: 'center',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
134
|
-
},
|
|
135
|
-
modalContent: {
|
|
136
|
-
backgroundColor: 'white',
|
|
137
|
-
padding: 20,
|
|
138
|
-
borderRadius: 5,
|
|
139
|
-
elevation: 5,
|
|
140
|
-
minWidth: 300,
|
|
141
|
-
},
|
|
142
|
-
input: {
|
|
143
|
-
borderWidth: 1,
|
|
144
|
-
borderColor: 'gray',
|
|
145
|
-
borderRadius: 5,
|
|
146
|
-
padding: 10,
|
|
147
|
-
marginBottom: 10,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
if (modalVisible) {
|
|
152
|
-
inputRef.current.focus();
|
|
153
|
-
}
|
|
154
|
-
}, [modalVisible]);
|
|
155
|
-
const handleButtonPress = async () => {
|
|
156
|
-
if (await Courier.shared.getUserId()) {
|
|
157
|
-
await signOut();
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
setModalVisible(true);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
const handleModalClose = () => {
|
|
164
|
-
setModalVisible(false);
|
|
165
|
-
};
|
|
166
|
-
const handleUserIdInputChange = (text) => {
|
|
167
|
-
setUserId(text);
|
|
168
|
-
};
|
|
169
|
-
const handleTenantIdInputChange = (text) => {
|
|
170
|
-
setTenantId(text);
|
|
171
|
-
};
|
|
172
|
-
const handleSaveButtonPress = () => {
|
|
173
|
-
signIn(userId, tenantId);
|
|
174
|
-
setModalVisible(false);
|
|
175
|
-
};
|
|
176
|
-
return (React.createElement(React.Fragment, null,
|
|
177
|
-
React.createElement(Modal, { visible: modalVisible, animationType: "slide", transparent: true },
|
|
178
|
-
React.createElement(View, { style: styles.modalContainer },
|
|
179
|
-
React.createElement(View, { style: styles.modalContent },
|
|
180
|
-
React.createElement(Text, null, "Set Courier User Id:"),
|
|
181
|
-
React.createElement(TextInput, { ref: inputRef, style: styles.input, value: userId, autoCapitalize: "none", autoCorrect: false, onChangeText: handleUserIdInputChange }),
|
|
182
|
-
React.createElement(Text, null, "Set Tenant Id:"),
|
|
183
|
-
React.createElement(TextInput, { style: styles.input, value: tenantId, autoCapitalize: "none", autoCorrect: false, onChangeText: handleTenantIdInputChange }),
|
|
184
|
-
React.createElement(Button, { title: "Sign In", onPress: handleSaveButtonPress }),
|
|
185
|
-
React.createElement(Button, { title: "Cancel", onPress: handleModalClose })))),
|
|
186
|
-
React.createElement(TouchableOpacity, { style: styles.button, onPress: handleButtonPress },
|
|
187
|
-
React.createElement(Text, { style: styles.buttonText }, props.buttonText))));
|
|
188
|
-
};
|
|
189
|
-
const ToggleTouchesButton = () => {
|
|
190
|
-
const styles = StyleSheet.create({
|
|
191
|
-
button: {
|
|
192
|
-
backgroundColor: 'lightgray',
|
|
193
|
-
padding: 10,
|
|
194
|
-
borderRadius: 5,
|
|
195
|
-
marginTop: 10, // Add some space between buttons
|
|
196
|
-
},
|
|
197
|
-
buttonText: {
|
|
198
|
-
fontSize: 16,
|
|
199
|
-
fontFamily: Platform.select({
|
|
200
|
-
ios: 'Courier',
|
|
201
|
-
android: 'monospace',
|
|
202
|
-
default: 'monospace',
|
|
203
|
-
}),
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
const [enabled, setEnabledState] = useState(false);
|
|
207
|
-
const { setEnabled } = usePoke();
|
|
208
|
-
const handleToggle = () => {
|
|
209
|
-
const newEnabled = !enabled;
|
|
210
|
-
setEnabledState(newEnabled);
|
|
211
|
-
setEnabled(newEnabled);
|
|
212
|
-
};
|
|
213
|
-
return (React.createElement(TouchableOpacity, { style: styles.button, onPress: handleToggle },
|
|
214
|
-
React.createElement(Text, { style: styles.buttonText }, enabled ? 'Hide Touches' : 'Show Touches')));
|
|
215
|
-
};
|
|
216
|
-
return (React.createElement(View, { style: styles.container },
|
|
217
|
-
isLoading && (React.createElement(ActivityIndicator, { size: "small" })),
|
|
218
|
-
!isLoading && (React.createElement(React.Fragment, null,
|
|
219
|
-
userId && React.createElement(Text, { style: styles.text }, userId),
|
|
220
|
-
tenantId && React.createElement(Text, { style: styles.text }, tenantId),
|
|
221
|
-
React.createElement(AuthButton, { buttonText: userId ? 'Sign Out' : 'Sign In' }),
|
|
222
|
-
React.createElement(ToggleTouchesButton, null)))));
|
|
223
|
-
};
|
|
224
|
-
export default Auth;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import InboxDefault from './inbox/InboxDefault';
|
|
4
|
-
import InboxStyled from './inbox/InboxStyled';
|
|
5
|
-
import InboxCustom from './inbox/InboxCustom';
|
|
6
|
-
import { TabControl } from '../Tabs';
|
|
7
|
-
const tabs = [
|
|
8
|
-
{ title: 'Default', key: 'Default' },
|
|
9
|
-
{ title: 'Styled', key: 'Styled' },
|
|
10
|
-
{ title: 'Custom', key: 'Custom' },
|
|
11
|
-
];
|
|
12
|
-
const Inbox = () => {
|
|
13
|
-
const [selectedTab, setSelectedTab] = useState('Default');
|
|
14
|
-
const renderContent = () => {
|
|
15
|
-
switch (selectedTab) {
|
|
16
|
-
case 'Default':
|
|
17
|
-
return React.createElement(InboxDefault, null);
|
|
18
|
-
case 'Styled':
|
|
19
|
-
return React.createElement(InboxStyled, null);
|
|
20
|
-
case 'Custom':
|
|
21
|
-
return React.createElement(InboxCustom, null);
|
|
22
|
-
default:
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return (React.createElement(View, { style: styles.container },
|
|
27
|
-
React.createElement(TabControl, { tabs: tabs, selectedTab: selectedTab, setSelectedTab: setSelectedTab }),
|
|
28
|
-
React.createElement(View, { style: styles.content }, renderContent())));
|
|
29
|
-
};
|
|
30
|
-
const styles = StyleSheet.create({
|
|
31
|
-
container: {
|
|
32
|
-
flex: 1,
|
|
33
|
-
},
|
|
34
|
-
content: {
|
|
35
|
-
flex: 1,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
export default Inbox;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
|
3
|
-
import PreferencesCustom from './preferences/PreferencesCustom';
|
|
4
|
-
import PreferencesDefault from './preferences/PreferencesDefault';
|
|
5
|
-
import PreferencesStyled from './preferences/PreferencesStyled';
|
|
6
|
-
const Tab = createMaterialTopTabNavigator();
|
|
7
|
-
const PreferencesTab = () => {
|
|
8
|
-
return (React.createElement(Tab.Navigator, null,
|
|
9
|
-
React.createElement(Tab.Screen, { name: "Default", component: PreferencesDefault }),
|
|
10
|
-
React.createElement(Tab.Screen, { name: "Styled", component: PreferencesStyled }),
|
|
11
|
-
React.createElement(Tab.Screen, { name: "Custom", component: PreferencesCustom })));
|
|
12
|
-
};
|
|
13
|
-
export default PreferencesTab;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createStackNavigator } from '@react-navigation/stack';
|
|
3
|
-
import Preferences from './Preferences';
|
|
4
|
-
import PreferencesDetail from './preferences/PreferencesDetail';
|
|
5
|
-
const Stack = createStackNavigator();
|
|
6
|
-
const PreferencesStack = () => {
|
|
7
|
-
return (React.createElement(Stack.Navigator, null,
|
|
8
|
-
React.createElement(Stack.Screen, { name: "PreferencesTab", component: Preferences }),
|
|
9
|
-
React.createElement(Stack.Screen, { name: "PreferencesDetail", component: PreferencesDetail })));
|
|
10
|
-
};
|
|
11
|
-
export default PreferencesStack;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import Courier, { CourierPushProvider } from '@trycourier/courier-react-native';
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { View, Text, StyleSheet, TouchableOpacity, Clipboard, ActivityIndicator, Platform } from 'react-native';
|
|
4
|
-
const Push = () => {
|
|
5
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
6
|
-
const [tokens, setTokens] = useState(new Map());
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setExampleToken();
|
|
9
|
-
}, []);
|
|
10
|
-
const refreshTokens = async () => {
|
|
11
|
-
const tokensMap = await Courier.shared.getAllTokens();
|
|
12
|
-
setTokens(tokensMap);
|
|
13
|
-
};
|
|
14
|
-
const setExampleToken = async () => {
|
|
15
|
-
setIsLoading(true);
|
|
16
|
-
const requestStatus = await Courier.requestNotificationPermission();
|
|
17
|
-
console.log('Request Notification Status: ' + requestStatus);
|
|
18
|
-
console.log('Get Notification Status: ' + await Courier.getNotificationPermissionStatus());
|
|
19
|
-
// Example of setting an expo token
|
|
20
|
-
await Courier.shared.setTokenForProvider({
|
|
21
|
-
provider: CourierPushProvider.EXPO,
|
|
22
|
-
token: 'example_expo_token'
|
|
23
|
-
});
|
|
24
|
-
setIsLoading(false);
|
|
25
|
-
refreshTokens();
|
|
26
|
-
};
|
|
27
|
-
const styles = StyleSheet.create({
|
|
28
|
-
container: {
|
|
29
|
-
flex: 1,
|
|
30
|
-
gap: 20,
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
padding: 20,
|
|
34
|
-
},
|
|
35
|
-
button: {
|
|
36
|
-
backgroundColor: 'lightgray',
|
|
37
|
-
padding: 10,
|
|
38
|
-
borderRadius: 5,
|
|
39
|
-
},
|
|
40
|
-
buttonText: {
|
|
41
|
-
fontSize: 16,
|
|
42
|
-
fontFamily: Platform.select({
|
|
43
|
-
ios: 'Courier',
|
|
44
|
-
android: 'monospace',
|
|
45
|
-
default: 'monospace',
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
itemContainer: {
|
|
49
|
-
flexDirection: 'row',
|
|
50
|
-
justifyContent: 'space-between',
|
|
51
|
-
alignItems: 'center',
|
|
52
|
-
paddingVertical: 8,
|
|
53
|
-
},
|
|
54
|
-
keyText: {
|
|
55
|
-
flex: 1,
|
|
56
|
-
textAlign: 'left',
|
|
57
|
-
fontFamily: Platform.select({
|
|
58
|
-
ios: 'Courier',
|
|
59
|
-
android: 'monospace',
|
|
60
|
-
default: 'monospace',
|
|
61
|
-
}),
|
|
62
|
-
fontWeight: 'bold',
|
|
63
|
-
fontSize: 16,
|
|
64
|
-
},
|
|
65
|
-
valueText: {
|
|
66
|
-
flex: 1,
|
|
67
|
-
textAlign: 'right',
|
|
68
|
-
fontFamily: Platform.select({
|
|
69
|
-
ios: 'Courier',
|
|
70
|
-
android: 'monospace',
|
|
71
|
-
default: 'monospace',
|
|
72
|
-
}),
|
|
73
|
-
fontSize: 16,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
const handleCopyToClipboard = (value) => {
|
|
77
|
-
Clipboard.setString(value);
|
|
78
|
-
};
|
|
79
|
-
const handleButtonPress = () => {
|
|
80
|
-
Courier.requestNotificationPermission();
|
|
81
|
-
};
|
|
82
|
-
return (React.createElement(View, { style: styles.container },
|
|
83
|
-
isLoading && (React.createElement(ActivityIndicator, { size: "small" })),
|
|
84
|
-
!isLoading && (React.createElement(React.Fragment, null,
|
|
85
|
-
Array.from(tokens).map(([key, value]) => (React.createElement(TouchableOpacity, { key: key, onPress: () => handleCopyToClipboard(value), style: styles.itemContainer },
|
|
86
|
-
React.createElement(Text, { style: styles.keyText }, key),
|
|
87
|
-
React.createElement(Text, { style: styles.valueText }, value)))),
|
|
88
|
-
React.createElement(TouchableOpacity, { style: styles.button, onPress: refreshTokens },
|
|
89
|
-
React.createElement(Text, { style: styles.buttonText }, "Refresh Tokens")),
|
|
90
|
-
React.createElement(TouchableOpacity, { style: styles.button, onPress: handleButtonPress },
|
|
91
|
-
React.createElement(Text, { style: styles.buttonText }, "Request Permissions"))))));
|
|
92
|
-
};
|
|
93
|
-
export default Push;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Platform } from "react-native";
|
|
2
|
-
export const Styles = (isDark) => {
|
|
3
|
-
return {
|
|
4
|
-
Fonts: {
|
|
5
|
-
heading: Platform.OS === 'ios' ? 'Avenir Medium' : 'fonts/poppins_regular.otf',
|
|
6
|
-
title: Platform.OS === 'ios' ? 'Avenir Medium' : 'fonts/poppins_regular.otf',
|
|
7
|
-
subtitle: Platform.OS === 'ios' ? 'Avenir Medium' : 'fonts/poppins_regular.otf'
|
|
8
|
-
},
|
|
9
|
-
Colors: {
|
|
10
|
-
heading: isDark ? '#9747FF' : '#9747FF',
|
|
11
|
-
title: isDark ? '#FFFFFF' : '#000000',
|
|
12
|
-
subtitle: isDark ? '#9A9A9A' : '#BEBEBE',
|
|
13
|
-
warning: isDark ? '#C32F27' : '#C32F27',
|
|
14
|
-
option: isDark ? '#1F1F1F' : '#F0F0F0',
|
|
15
|
-
action: isDark ? '#9747FF' : '#9747FF',
|
|
16
|
-
},
|
|
17
|
-
TextSizes: {
|
|
18
|
-
heading: 24,
|
|
19
|
-
title: 18,
|
|
20
|
-
subtitle: 16,
|
|
21
|
-
},
|
|
22
|
-
Corners: {
|
|
23
|
-
button: 100
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
};
|