Fix saving notification data

This commit is contained in:
Maarten 2024-08-09 13:47:21 +02:00
parent 85dc440fe8
commit ad990ca528
5 changed files with 43 additions and 28 deletions

View file

@ -35,17 +35,17 @@ export default function HomeScreen() {
OneSignal.initialize("6ef15aa7-9dc0-4d8b-b6b1-e2005bcd3dc6");
// Request permission
OneSignal.Notifications.requestPermission(true)
// Retrieve one signal user token
OneSignal.User.pushSubscription.getIdAsync().then((notificationsToken) => {
if (notificationsToken) {
Request.post( 'sessions/update', { token: token, notifications_token: notificationsToken } ).then( (response) => {
if (!response.success) {
Message.error( 'Notificaties zijn uitgeschakeld door een onbekende error' );
}
} );
}
OneSignal.Notifications.requestPermission(true).then(() => {
// Retrieve one signal user token
OneSignal.User.pushSubscription.getIdAsync().then((notificationsToken) => {
if (notificationsToken) {
Request.post( 'sessions/update', { token: token, notifications_token: notificationsToken } ).then( (response) => {
if (!response.success) {
Message.error( 'Notificaties zijn uitgeschakeld door een onbekende error' );
}
} );
}
})
})
// Disable loading again

View file

@ -157,6 +157,7 @@ export default function SettingsScreen() {
</ThemedView>
<TouchableOpacity style={styles.listEdit} onPress={() => router.push( '/(settings)/notifications' )}>
<ThemedText style={styles.listEditText}>Wijzigen</ThemedText>
<Ionicons size={18} name="chevron-forward" style={styles.listEditIcon}/>
</TouchableOpacity>
</ThemedView>