This commit is contained in:
shafi54 2026-01-31 15:57:02 +05:30
parent 88985c9572
commit a16e50c6a5
27 changed files with 8 additions and 79 deletions

View file

@ -184,8 +184,6 @@ function Login() {
const mobile = data.mobile.trim(); const mobile = data.mobile.trim();
// Validate mobile number // Validate mobile number
if (!mobile) { if (!mobile) {
console.log('no mobile number found')
setError("mobile", { setError("mobile", {
type: "manual", type: "manual",
message: "Mobile number is required", message: "Mobile number is required",
@ -229,8 +227,6 @@ function Login() {
} }
try { try {
console.log('calling the login function')
const response = await loginMutation.mutateAsync({ const response = await loginMutation.mutateAsync({
identifier: selectedMobile, identifier: selectedMobile,
password: data.password, password: data.password,

View file

@ -17,7 +17,6 @@ function Register() {
await register(formData); await register(formData);
// Auth context will handle navigation on successful registration // Auth context will handle navigation on successful registration
} catch (error: any) { } catch (error: any) {
console.error('Registration error:', error);
Alert.alert( Alert.alert(
'Registration Failed', 'Registration Failed',
error.message || 'Failed to create account. Please try again.' error.message || 'Failed to create account. Please try again.'

View file

@ -7,7 +7,7 @@ import FontAwesome5 from '@expo/vector-icons/FontAwesome5';
export default function About() { export default function About() {
const openLink = (url: string) => { const openLink = (url: string) => {
Linking.openURL(url).catch((err) => console.error("Couldn't load page", err)); Linking.openURL(url).catch((err) => {});
}; };
return ( return (

View file

@ -130,9 +130,6 @@ export default function Coupons() {
refetch(); refetch();
}); });
console.log({data, error})
if (isLoading) { if (isLoading) {
return ( return (
<AppContainer> <AppContainer>

View file

@ -32,8 +32,6 @@ function EditProfile() {
// Navigate back to profile/me page // Navigate back to profile/me page
router.replace('/(drawer)/(tabs)/me'); router.replace('/(drawer)/(tabs)/me');
} catch (error) { } catch (error) {
JSON.stringify(error);
console.error('Update profile error:', error);
throw error; throw error;
} }
}; };

View file

@ -17,7 +17,6 @@ export default function Me() {
useFocusEffect(() => { useFocusEffect(() => {
const target = getNavigationTarget(); const target = getNavigationTarget();
console.log({target})
if (target) { if (target) {
router.replace(target as any); router.replace(target as any);

View file

@ -50,8 +50,6 @@ export default function OrderDetails() {
Alert.alert('Success', 'Order cancelled successfully'); Alert.alert('Success', 'Order cancelled successfully');
}, },
onError: (error: any) => { onError: (error: any) => {
console.log({error})
Alert.alert('Error', error.message || 'Failed to cancel order'); Alert.alert('Error', error.message || 'Failed to cancel order');
}, },
}); });

View file

@ -1,4 +1,3 @@
export async function GET(request:Request) { export async function GET(request:Request) {
console.log('from the get token request')
} }

View file

@ -16,7 +16,5 @@ export default function Index() {
); );
} }
console.log("from the user ui index.tsx - isAuthenticated:", isAuthenticated);
return <Redirect href="/(drawer)/(tabs)/home" />; return <Redirect href="/(drawer)/(tabs)/home" />;
} }

View file

@ -66,7 +66,6 @@ export default function BannerCarousel() {
router.push(`/(drawer)/(tabs)/home/product-detail/${banner.productIds[0]}`); router.push(`/(drawer)/(tabs)/home/product-detail/${banner.productIds[0]}`);
} else if (banner.redirectUrl) { } else if (banner.redirectUrl) {
// Handle external URL - could open in browser or handle deep links // Handle external URL - could open in browser or handle deep links
console.log('Banner redirect URL:', banner.redirectUrl);
} }
// If no productIds or redirectUrl, banner is just for display // If no productIds or redirectUrl, banner is just for display
}; };

View file

@ -49,9 +49,6 @@ const HealthTestWrapper: React.FC<HealthTestWrapperProps> = ({ children }) => {
} }
}, [versionFromBackend]); }, [versionFromBackend]);
// Log app version
console.log('App Version:', Constants.expoConfig?.version);
console.log('Backend Version:', versionFromBackend);
if (isLoading) { if (isLoading) {
return ( return (
<View style={tw`flex-1 justify-center items-center bg-gray-50`}> <View style={tw`flex-1 justify-center items-center bg-gray-50`}>

View file

@ -37,7 +37,6 @@ const isEmulator = (): boolean => {
return false; return false;
} catch (error) { } catch (error) {
// If detection fails, assume it's a real device to be safe // If detection fails, assume it's a real device to be safe
console.warn('Emulator detection failed:', error);
return false; return false;
} }
}; };
@ -73,7 +72,6 @@ const LocationTestWrapper: React.FC<LocationTestWrapperProps> = ({ children }) =
const { status } = await Location.requestForegroundPermissionsAsync(); const { status } = await Location.requestForegroundPermissionsAsync();
if (status === 'granted') { if (status === 'granted') {
const location = await Location.getCurrentPositionAsync({}); const location = await Location.getCurrentPositionAsync({});
console.log('User location:', location.coords);
setUserLocation(location); setUserLocation(location);
} else { } else {
setLocationDialogOpen(true); setLocationDialogOpen(true);

View file

@ -100,8 +100,6 @@ export default function NextOrderGlimpse() {
<TouchableOpacity <TouchableOpacity
style={tw`px-6 mb-4`} style={tw`px-6 mb-4`}
onPress={() => { onPress={() => {
console.log('from next press')
setNavigationTarget(`/(drawer)/(tabs)/me/my-orders/${nextOrder.id}`); setNavigationTarget(`/(drawer)/(tabs)/me/my-orders/${nextOrder.id}`);
router.replace('/(drawer)/(tabs)/me'); router.replace('/(drawer)/(tabs)/me');
}} }}

View file

@ -160,8 +160,6 @@ const PaymentAndOrderComponent: React.FC<PaymentAndOrderProps> = ({
isFlashDelivery: isFlashDelivery, isFlashDelivery: isFlashDelivery,
}; };
console.log({orderData})
placeOrderMutation.mutate(orderData); placeOrderMutation.mutate(orderData);
}; };

View file

@ -159,7 +159,7 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
setHasMore(newHasMore); setHasMore(newHasMore);
setReviewsOffset(reset ? 10 : reviewsOffset + 10); setReviewsOffset(reset ? 10 : reviewsOffset + 10);
} catch (error) { } catch (error) {
console.error('Error loading reviews:', error); // Error loading reviews handled silently
} finally { } finally {
setReviewsLoading(false); setReviewsLoading(false);
} }

View file

@ -354,7 +354,6 @@ export function SlotProducts({ slotId:slotIdParent, storeId:storeIdParent, baseU
const handleAddToCart = (productId: number) => { const handleAddToCart = (productId: number) => {
setIsLoadingDialogOpen(true); setIsLoadingDialogOpen(true);
// console.log({productId})
addToCart(productId, 1, slotId || 0, () => setIsLoadingDialogOpen(false)); addToCart(productId, 1, slotId || 0, () => setIsLoadingDialogOpen(false));
}; };
@ -394,8 +393,6 @@ export function SlotProducts({ slotId:slotIdParent, storeId:storeIdParent, baseU
const filteredProducts: any[] = storeIdNum ? productsQuery?.data?.filter(p => p.store?.id === storeIdNum) || [] : slotQuery.data.products; const filteredProducts: any[] = storeIdNum ? productsQuery?.data?.filter(p => p.store?.id === storeIdNum) || [] : slotQuery.data.products;
console.log({filteredProducts})
return ( return (
<View style={tw`flex-1`}> <View style={tw`flex-1`}>
<MyFlatList <MyFlatList

View file

@ -22,7 +22,7 @@ const UpdateChecker: React.FC<UpdateCheckerProps> = ({ children }) => {
); );
} }
} catch (error) { } catch (error) {
console.log('Update check failed:', error); // Update check failed silently
} }
}; };

View file

@ -31,8 +31,7 @@ const CheckoutPage: React.FC<CheckoutPageProps> = ({ isFlashDelivery = false })
const cartType: "regular" | "flash" = isFlashDelivery ? "flash" : "regular"; const cartType: "regular" | "flash" = isFlashDelivery ? "flash" : "regular";
const { data: cartData, refetch: refetchCart } = useGetCart({}, cartType); const { data: cartData, refetch: refetchCart } = useGetCart({}, cartType);
console.log({cartType})
const { data: addresses, refetch: refetchAddresses } = trpc.user.address.getUserAddresses.useQuery(); const { data: addresses, refetch: refetchAddresses } = trpc.user.address.getUserAddresses.useQuery();
const { data: slotsData, refetch: refetchSlots } = trpc.user.slots.getSlots.useQuery(); const { data: slotsData, refetch: refetchSlots } = trpc.user.slots.getSlots.useQuery();
const { data: constsData } = useGetEssentialConsts(); const { data: constsData } = useGetEssentialConsts();

View file

@ -301,8 +301,6 @@ export function useAddToCart(options?: {
const addToCart = (productId: number, quantity = 1, slotId?: number, onSettled?: (data: any, error: any) => void) => { const addToCart = (productId: number, quantity = 1, slotId?: number, onSettled?: (data: any, error: any) => void) => {
// console.log({productId, quantity, slotId})
if (slotId == null) { if (slotId == null) {
throw new Error('slotId is required for adding to cart'); throw new Error('slotId is required for adding to cart');
} }

View file

@ -40,7 +40,6 @@ export function useAuthenticatedRoute(options: AuthenticatedRouteOptions = {}) {
router.push('/(auth)/login'); router.push('/(auth)/login');
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to store redirect state:', error);
// Still navigate to login even if storage fails // Still navigate to login even if storage fails
router.push('/(auth)/login'); router.push('/(auth)/login');
}); });

View file

@ -50,7 +50,6 @@ const moveDirectories = async (userInput) => {
if (userInput === "y") { if (userInput === "y") {
// Create the app-example directory // Create the app-example directory
await fs.promises.mkdir(exampleDirPath, { recursive: true }); await fs.promises.mkdir(exampleDirPath, { recursive: true });
console.log(`📁 /${exampleDir} directory created.`);
} }
// Move old directories to new app-example directory or delete them // Move old directories to new app-example directory or delete them
@ -60,41 +59,25 @@ const moveDirectories = async (userInput) => {
if (userInput === "y") { if (userInput === "y") {
const newDirPath = path.join(root, exampleDir, dir); const newDirPath = path.join(root, exampleDir, dir);
await fs.promises.rename(oldDirPath, newDirPath); await fs.promises.rename(oldDirPath, newDirPath);
console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
} else { } else {
await fs.promises.rm(oldDirPath, { recursive: true, force: true }); await fs.promises.rm(oldDirPath, { recursive: true, force: true });
console.log(`❌ /${dir} deleted.`);
} }
} else {
console.log(`➡️ /${dir} does not exist, skipping.`);
} }
} }
// Create new /app directory // Create new /app directory
const newAppDirPath = path.join(root, newAppDir); const newAppDirPath = path.join(root, newAppDir);
await fs.promises.mkdir(newAppDirPath, { recursive: true }); await fs.promises.mkdir(newAppDirPath, { recursive: true });
console.log("\n📁 New /app directory created.");
// Create index.tsx // Create index.tsx
const indexPath = path.join(newAppDirPath, "index.tsx"); const indexPath = path.join(newAppDirPath, "index.tsx");
await fs.promises.writeFile(indexPath, indexContent); await fs.promises.writeFile(indexPath, indexContent);
console.log("📄 app/index.tsx created.");
// Create _layout.tsx // Create _layout.tsx
const layoutPath = path.join(newAppDirPath, "_layout.tsx"); const layoutPath = path.join(newAppDirPath, "_layout.tsx");
await fs.promises.writeFile(layoutPath, layoutContent); await fs.promises.writeFile(layoutPath, layoutContent);
console.log("📄 app/_layout.tsx created.");
console.log("\n✅ Project reset complete. Next steps:");
console.log(
`1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
userInput === "y"
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
: ""
}`
);
} catch (error) { } catch (error) {
console.error(`❌ Error during script execution: ${error.message}`); // Error during script execution
} }
}; };
@ -105,7 +88,6 @@ rl.question(
if (userInput === "y" || userInput === "n") { if (userInput === "y" || userInput === "n") {
moveDirectories(userInput).finally(() => rl.close()); moveDirectories(userInput).finally(() => rl.close());
} else { } else {
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
rl.close(); rl.close();
} }
} }

View file

@ -40,7 +40,6 @@ export async function registerForPushNotificationsAsync() {
projectId, projectId,
}) })
).data; ).data;
console.log(pushTokenString);
return pushTokenString; return pushTokenString;
} catch (e: unknown) { } catch (e: unknown) {
throw new Error(`${e}`); throw new Error(`${e}`);

View file

@ -59,6 +59,6 @@ export const useRegister = () => {
export const useUpdateProfile = () => { export const useUpdateProfile = () => {
return useMutation({ return useMutation({
mutationFn: updateProfileApi, mutationFn: updateProfileApi,
onError: e => console.log(JSON.stringify(e)) onError: () => {}
}); });
}; };

View file

@ -79,7 +79,6 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
setCurrentLocation({ latitude, longitude }); setCurrentLocation({ latitude, longitude });
Alert.alert('Success', 'Location attached successfully'); Alert.alert('Success', 'Location attached successfully');
} catch (error) { } catch (error) {
console.error('Location error:', error);
setLocationError('Unable to fetch location. Please check your GPS settings.'); setLocationError('Unable to fetch location. Please check your GPS settings.');
} finally { } finally {
setLocationLoading(false); setLocationLoading(false);

View file

@ -29,15 +29,6 @@ export default function GoogleSignInPKCE() {
// }); // });
// React.useEffect(() => {
// if (response?.type === "success") {
// const { authentication } = response;
// console.log("Access token:", authentication?.accessToken);
// }
// }, [response]);
return ( return (
<View style={{ marginTop: 100 }}> <View style={{ marginTop: 100 }}>
<Button title="Sign in with Google" onPress={() => {}} /> <Button title="Sign in with Google" onPress={() => {}} />

View file

@ -65,7 +65,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
})); }));
} }
} catch (error) { } catch (error) {
console.error('Auth initialization error:', error);
setAuthState(prev => ({ setAuthState(prev => ({
...prev, ...prev,
userDetails: null, userDetails: null,
@ -105,7 +104,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
isLoading: false, isLoading: false,
})); }));
} else if (selfDataError && authState.isAuthenticated) { } else if (selfDataError && authState.isAuthenticated) {
console.error('Failed to fetch user data:', selfDataError);
// If token is invalid, clear auth state // If token is invalid, clear auth state
// deleteAuthToken(); // deleteAuthToken();
setAuthState({ setAuthState({
@ -122,20 +120,16 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
const handlePostLoginRedirect = async () => { const handlePostLoginRedirect = async () => {
try { try {
const storedData = await StorageServiceCasual.getItem(constants.AUTH_REDIRECT_KEY); const storedData = await StorageServiceCasual.getItem(constants.AUTH_REDIRECT_KEY);
console.log({storedData})
if (storedData) { if (storedData) {
const redirectState: RedirectState = JSON.parse(storedData); const redirectState: RedirectState = JSON.parse(storedData);
console.log({redirectState})
// Clear the stored state // Clear the stored state
await StorageServiceCasual.removeItem(constants.AUTH_REDIRECT_KEY); await StorageServiceCasual.removeItem(constants.AUTH_REDIRECT_KEY);
// Check if the redirect state is not too old (24 hours) // Check if the redirect state is not too old (24 hours)
const isExpired = Date.now() - redirectState.timestamp > 24 * 60 * 60 * 1000; const isExpired = Date.now() - redirectState.timestamp > 24 * 60 * 60 * 1000;
if (isExpired) { if (isExpired) {
console.warn('Redirect state expired, navigating to home');
// router.replace('/'); // router.replace('/');
router.back(); router.back();
return; return;
@ -164,7 +158,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
router.back(); router.back();
} }
} catch (error) { } catch (error) {
console.error('Error handling post-login redirect:', error);
// Fallback to home on error // Fallback to home on error
router.replace('/'); router.replace('/');
} }
@ -195,7 +188,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
// Handle post-login redirect after auth state is set // Handle post-login redirect after auth state is set
handlePostLoginRedirect(); handlePostLoginRedirect();
} catch (error) { } catch (error) {
console.error('Login with token error:', error);
setAuthState(prev => ({ ...prev, isLoading: false })); setAuthState(prev => ({ ...prev, isLoading: false }));
throw error; throw error;
} }
@ -280,7 +272,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
token: null, token: null,
}); });
} catch (error) { } catch (error) {
console.error('Logout error:', error);
// Still clear local state even if deleteJWT fails // Still clear local state even if deleteJWT fails
setAuthState({ setAuthState({
user: null, user: null,

View file

@ -63,8 +63,8 @@ const isDevMode = Constants.executionEnvironment !== "standalone";
// const BASE_API_URL = API_URL; // const BASE_API_URL = API_URL;
// const BASE_API_URL = 'http://10.0.2.2:4000'; // const BASE_API_URL = 'http://10.0.2.2:4000';
// const BASE_API_URL = 'http://192.168.100.101:4000'; // const BASE_API_URL = 'http://192.168.100.101:4000';
// const BASE_API_URL = 'http://192.168.1.14:4000'; const BASE_API_URL = 'http://192.168.1.7:4000';
let BASE_API_URL = "https://mf.freshyo.in"; // let BASE_API_URL = "https://mf.freshyo.in";
// let BASE_API_URL = 'http://192.168.100.103:4000'; // let BASE_API_URL = 'http://192.168.100.103:4000';
// let BASE_API_URL = 'http://192.168.29.176:4000'; // let BASE_API_URL = 'http://192.168.29.176:4000';