diff --git a/app.json b/app.json index 52010be..dff8e57 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,8 @@ "userInterfaceStyle": "automatic", "newArchEnabled": true, "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "com.anonymous.iso-test-app" }, "android": { "adaptiveIcon": { diff --git a/app/+not-found.tsx b/app/+not-found.tsx new file mode 100644 index 0000000..fd108d5 --- /dev/null +++ b/app/+not-found.tsx @@ -0,0 +1,39 @@ +import { Link, Stack } from 'expo-router'; +import React from 'react'; +import { StyleSheet, Text, View } from 'react-native'; + +export default function NotFoundScreen() { + return ( + <> + + + This screen does not exist. + + Go to home screen! + + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + padding: 20, + }, + title: { + fontSize: 20, + fontWeight: 'bold', + marginBottom: 10, + }, + link: { + marginTop: 15, + paddingVertical: 15, + }, + linkText: { + color: '#007AFF', + textDecorationLine: 'underline', + }, +}); diff --git a/app/index.tsx b/app/index.tsx index 59b3a5b..d932d16 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,7 +1,38 @@ -import React from "react"; -import { Text, View } from "react-native"; +import * as Notifications from 'expo-notifications'; +import React, { useEffect } from "react"; +import { Button, Platform, Text, View } from "react-native"; + +async function registerForPushNotificationsAsync() { + const { status: existingStatus } = await Notifications.getPermissionsAsync(); + let finalStatus = existingStatus; + if (existingStatus !== 'granted') { + const { status } = await Notifications.requestPermissionsAsync(); + finalStatus = status; + } + if (finalStatus !== 'granted') { + alert('Permission for notifications not granted!'); + return false; + } + return true; +} + +async function sendNotification() { + await Notifications.scheduleNotificationAsync({ + content: { + title: "Hello!", + body: "Ez egy értesítés példája.", + }, + trigger: Platform.OS === 'android' + ? ({ seconds: 1, repeats: false } as any) + : null, + }); +} export default function Index() { + useEffect(() => { + registerForPushNotificationsAsync(); + }, []); + return ( Edit app/index.tsx to edit this screen. +