mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-19 12:14:47 +02:00
fix android notification not working, fix ui bug
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { Tabs } from 'expo-router';
|
||||
import { TabBar, type TabItem } from '@/components/TabBar';
|
||||
import { colors } from '@/theme';
|
||||
|
||||
export default function TabsLayout() {
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{ headerShown: false }}
|
||||
screenOptions={{
|
||||
headerShown: false,
|
||||
sceneStyle: { backgroundColor: colors.bgPrimary },
|
||||
}}
|
||||
tabBar={({ state, navigation }) => {
|
||||
const items: TabItem[] = state.routes.map((route, index) => ({
|
||||
key: route.key,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
getNotificationClickRedirectPath,
|
||||
isNotificationClickPath,
|
||||
} from '@/audio/notificationIntent';
|
||||
|
||||
type RedirectSystemPathEvent = {
|
||||
path: string;
|
||||
initial: boolean;
|
||||
};
|
||||
|
||||
export async function redirectSystemPath({ path }: RedirectSystemPathEvent): Promise<string> {
|
||||
if (!isNotificationClickPath(path)) return path;
|
||||
|
||||
return getNotificationClickRedirectPath();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { useEffect } from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { getNotificationClickRedirectPath } from '@/audio/notificationIntent';
|
||||
import { colors } from '@/theme';
|
||||
|
||||
export default function NotificationClickRoute() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
getNotificationClickRedirectPath()
|
||||
.then((href) => {
|
||||
if (!cancelled) router.replace(href);
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) router.replace('/');
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [router]);
|
||||
|
||||
return <View style={styles.root} />;
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
flex: 1,
|
||||
backgroundColor: colors.bgPrimary,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user