correct issues

This commit is contained in:
Jaanu423
2025-10-13 14:00:13 +05:30
parent ae35611bdb
commit 848032768c
9 changed files with 105 additions and 105 deletions
+4 -2
View File
@@ -46,12 +46,14 @@ export type RootStackParamList = {
TransactionList: undefined
RandomSelectUserScreen: { groupId: string | number, cycleNumber: number };
Notification: undefined;
NotificationRedirection:{ data: any };
NotificationRedirection: { data: any };
Management:
| { actionTab: "My Groups" }
| { actionTab1: "Joined Groups" }
| { actionTab2: "Requests" }
| { actionTab3: "Your Requests" };
| { actionTab3: "Your Requests" }
| { groupId: string | number; }
};
const Stack = createNativeStackNavigator<RootStackParamList>();
+1
View File
@@ -32,6 +32,7 @@ export type RootStackParamList = {
ManageJoinedGroup: { groupId: string | number };
Invite: { groupId: string | number; code: string | number };
ManagementTabs:any
NotificationRedirection: { data: any };
};
+3 -2
View File
@@ -9,6 +9,7 @@ import {
TouchableOpacity,
Alert,
Image,
ToastAndroid,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { CustomInput } from "../components/common/Custom";
@@ -75,8 +76,8 @@ export default function GroupCreationForm() {
console.log("Reviewing Payload:", payload);
navigation.navigate("GroupReview", { form: payload });
} else {
Alert.alert("Incomplete Form", "Please fill out all required fields correctly.");
setErrors('')
ToastAndroid.show('Please fill out all required fields correctly.', ToastAndroid.SHORT);
setErrors('');
}
};
+3 -3
View File
@@ -12,6 +12,7 @@ import {
ScrollView,
Alert,
RefreshControl,
ToastAndroid,
} from "react-native";
import { FAB } from "react-native-paper";
import { Ionicons } from "@react-native-vector-icons/ionicons";
@@ -176,13 +177,12 @@ export default function GroupScreen() {
console.log("JOIN_GROUP_URL response:", res);
if (res.statusCode === 200) {
Alert.alert("Success", "You requested to join the group.");
ToastAndroid.show('You requested to join the group.', ToastAndroid.SHORT);
} else {
// Alert.alert("Error", res.message || "Failed to join group.");
ToastAndroid.show(res.message || "Failed to join group.", ToastAndroid.SHORT);
}
} catch (error) {
console.error("Join Group Error:", error);
// Alert.alert("Error", "An unexpected error occurred.");
}
};
+1 -5
View File
@@ -18,14 +18,11 @@ const NotificationRedirection: React.FC = () => {
// This effect runs once when the component mounts
if (data) {
console.log('🔄 Processing notification data:', data);
// --- Your Redirection Logic Goes Here ---
// Use the 'data' object to decide where to go.
// For this example, we'll navigate based on 'msgType'.
let destination: keyof RootStackParamList = 'Home'; // Default destination
let params: object | undefined = undefined;
switch (data.msgType) {
case 'JOIN_REQUEST':
destination = 'Home';
@@ -62,10 +59,9 @@ const NotificationRedirection: React.FC = () => {
// Keep the default destination as 'Home'
break;
}
console.log(`➡ Redirecting to ${destination} with params:`, params);
// Use replace to prevent the user from navigating back to this loading screen
navigation.replace(destination, params);
} else {
// If no data is passed for some reason, just go to the home screen
console.warn('⚠ No data found in notification, redirecting to Home.');
+11 -8
View File
@@ -23,6 +23,7 @@ const CustomDropdown = ({ items, selectedValue, onValueChange, placeholder = "Se
const [open, setOpen] = useState(false);
const selectedLabel = items.find((item:any) => item.value === selectedValue)?.label || placeholder;
return (
<View style={styles.dropdownWrapper}>
<TouchableOpacity onPress={() => setOpen(true)} style={styles.dropdownHeader}>
@@ -64,6 +65,8 @@ const CustomDropdown = ({ items, selectedValue, onValueChange, placeholder = "Se
const GroupDetails = () => {
const route = useRoute<any>();
console.log(" route id : ", route)
const [memberData, setMemberData] = useState([]);
const [loading, setLoading] = useState(false);
const [openModal, setOpenModal] = useState(false);
@@ -85,7 +88,7 @@ const GroupDetails = () => {
const getCycleDashboard = async () => {
try {
const response = await apiCall(`${BASE_URL}payments/groups/${group.id}/cycle-dashboard`, "GET") as any;
const response = await apiCall(`${BASE_URL}payments/groups/${group.id || route?.params?.groupId}/cycle-dashboard`, "GET") as any;
const responseData = response.data;
setCycleDashboardData(responseData);
@@ -106,7 +109,7 @@ const GroupDetails = () => {
const fetchGroupDetails = async () => {
try {
const res = await apiCall(`${GROUP_ALL_MEMBER}?groupId=${group.id}`, "GET") as any;
const res = await apiCall(`${GROUP_ALL_MEMBER}?groupId=${group.id || route?.params?.groupId}`, "GET") as any;
console.log("Group Members Response: ", res);
setMemberData(res.data);
} catch (error: any) {
@@ -116,7 +119,7 @@ const GroupDetails = () => {
const handleContribution = async () => {
try {
const res = await apiCall(`${CONTRIBUTE}${group.id}/calculate-contribution`, 'GET') as any;
const res = await apiCall(`${CONTRIBUTE}${group.id || route?.params?.groupId}/calculate-contribution`, 'GET') as any;
setPayable(res.data);
} catch (error) {
console.log("Error in handleContribution: ", error);
@@ -131,13 +134,13 @@ const GroupDetails = () => {
getCycleDashboard()
]);
setLoading(false);
}, [group.id]);
}, [group.id || route?.params?.groupId]);
useEffect(() => {
if (group.id) {
if (group.id || route?.params?.groupId) {
fetchAllData();
}
}, [group.id, fetchAllData]);
}, [group.id || route?.params?.groupId, fetchAllData]);
const onRefresh = useCallback(async () => {
setRefreshing(true);
@@ -169,8 +172,8 @@ const GroupDetails = () => {
}
contentContainerStyle={styles.scrollContent}
>
<Header title={group.name} />
<Text style={styles.description}>{group.description}</Text>
<Header title={group.name || route.name} />
<Text style={styles.description}>{group.description || route.name}</Text>
<View style={styles.statsRow}>
<View style={styles.statBox}>
+11 -10
View File
@@ -44,22 +44,20 @@ const Notification = () => {
dispatch(clearAllNotifications());
};
const handleMarkAsRead = (messageId: string, screen: string) => {
const handleMarkAsRead = (messageId: string, screen: string, groupId: string, cycleNumber: string, contributionId: string) => {
console.log("screen type : ", screen);
handleMarkAsReadAndNavigate(
messageId,
screen,
{
// Pass additional parameters based on notification type
groupId: 'ebc27862-acde-4129-b12c-fd4c2966e858',
cycleNumber: '1',
contributionId: '12345',
actionTab3: 'Your Requests' ,
groupId: groupId,
cycleNumber,
contributionId,
actionTab3: 'Your Requests',
actionTab1: 'Joined Groups',
GroupDetails: {
item: {}
},
// etc.
}
);
};
@@ -240,9 +238,11 @@ const Notification = () => {
keyExtractor={(item) => item.messageId}
showsVerticalScrollIndicator={false}
contentContainerStyle={styles.listContainer}
renderItem={({ item }) => (
renderItem={({ item }) => {
console.log("noti items : ", item)
return (
<TouchableOpacity
onPress={() => handleMarkAsRead(item.messageId, item?.data?.msgType)}
onPress={() => handleMarkAsRead(item.messageId, item?.data?.msgType, item?.data?.groupId, item?.data?.cycleNumber, item?.data?.contributionId)}
activeOpacity={0.7}
>
<LinearGradient
@@ -307,7 +307,8 @@ const Notification = () => {
</View>
</LinearGradient>
</TouchableOpacity>
)}
)
}}
ListEmptyComponent={
<View style={styles.emptyContainer}>
<Ionicons name="notifications-off-outline" size={64} color="#ccc" />
+8 -13
View File
@@ -161,13 +161,13 @@ const Profile = () => {
// Alert.alert("Success", "Profile updated successfully");
// setEditing(false);
// fetchUserProfile();
// if (result.status === "success") {
// Alert.alert("Success", "Profile updated successfully");
// setEditing(false);
// fetchUserProfile(); // reload updated data
// } else {
// Alert.alert("Error", "Failed to update profile");
// }
if (result.status === "success") {
Alert.alert("Success", "Profile updated successfully");
setEditing(false);
fetchUserProfile(); // reload updated data
} else {
Alert.alert("Error", "Failed to update profile");
}
} catch (error) {
console.error("❌ Error updating profile:", error);
// Alert.alert("Error", "Could not update profile");
@@ -309,7 +309,7 @@ const Profile = () => {
return;
}
await deleteFcmToken();
await deleteFcmToken(user?.userId?.toString());
// Clear stored credentials
await Keychain.resetGenericPassword();
@@ -463,11 +463,6 @@ const Profile = () => {
<View>
<Text style={styles.sectionTitle}>Personal Information</Text>
<Text style={{ color: "#64748b", marginBottom: 16 }}>Become Organizer</Text>
{/* <View style={{ marginBottom: 16 }}>
</View> */}
</View>
<View>
<TouchableOpacity onPress={() => navigation.navigate('Transaction')}>
+1
View File
@@ -239,6 +239,7 @@ const processAndAddNotification = (remoteMessage: any) => {
title: title,
additionalProp1: data?.additionalProp1 || '',
additionalProp2: data?.additionalProp2 || '',
groupId: data?.groupId || '',
...data // Spread any additional data
},
from: from || 'unknown',