-
Notifications
You must be signed in to change notification settings - Fork 1
Bug - Patch Fixes Part 3 #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…xecução entre os ambientes de Dev e Prod. Quando estivermos no ExpoGo utilizaremos o IP do nosso PC atual e no ambiente de produção o URL do Vercel que será utilizado. (IP do computador deve ser configurado no arquivo .env.local do dispositivo, assim as informações não serão vazadas no GitHub).
…m uma nova regra de gerar ao mínimo 3 itens de passeio por dia, mas caso isso falhe foi implementada a possibilidade de adicionar uma nova atividade e consequentemente iniciar uma nova timeline para aquele dia em específico.
… DEV. Revisado e corrigido implementação e variáveis essenciais para o funcionamento do ADMob. Implementados anúncios em alguns novos botões sem prejudicar gravemente a UX do usuário e melhorando o potencial de receita da aplicação.
…ando debug, visualização dos locais na UI/UX. Atualização no SlideUpPlaces para deixar melhor visuavelmente a exibição dos cards de locais sem fugir muito do que já é proposto.
…ace do usuário. Atualizado o texto de exibição de itinerários e implementadas funcionalidades para carregamento de anúncios. Ajustes no tratamento de informações do usuário e melhorias no sistema de cache.
…de vazamento de key no docker compose devido a um teste rápido que tinha sido feito anteriormente.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements comprehensive fixes and improvements across environment detection, surprise itinerary generation, AdMob integration, Google Places API handling, and UI/UX enhancements. The changes introduce automatic dev/prod environment switching, improved AI-generated itinerary logic with minimum activity requirements, and enhanced error handling throughout the application.
Key Changes:
- Automatic environment detection with dynamic API URL switching between local development and production Vercel deployment
- Two-step surprise itinerary generation with AI-driven destination selection and minimum 3 activities per day requirement
- Refactored AdMob integration with rewarded ads for export, edit, and delete actions, plus ExpoGo simulation support
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| expo-app/src/config.ts | New environment detection system with dev/prod API URL switching |
| nextjs-api/pages/api/googlePlacesApi.ts | Enhanced error handling, photo URL processing, and debugging capabilities |
| nextjs-api/pages/api/chat.ts | Simplified AI assistant prompt (removed voice-specific constraints) |
| expo-app/src/screens/Itinerary/ItineraryMapMenu.tsx | Two-step surprise itinerary with destination selection and minimum activities enforcement |
| expo-app/src/screens/Itinerary/GenerateItineraryMenu.tsx | Updated AdMob environment variable naming and removed SimulatedAd component |
| expo-app/src/screens/UserProfile/UserPreferences.tsx | Added surprise mode visa check bypass logic |
| expo-app/src/screens/AIChat/AIChat.tsx | Enhanced user info handling, keyboard behavior, and loading indicators |
| expo-app/src/screens/HomePage/Home.tsx | Improved nearby places display with photo loading states and error handling |
| expo-app/src/components/Dialogs/ItineraryActionsDialog.tsx | Added rewarded ads before edit/delete actions |
| expo-app/package.json | Added react-native-indicators dependency and version update |
| expo-app/babel.config.js | Configured react-native-dotenv for environment variable handling |
| SETUP_LOCAL.md | Comprehensive local development setup documentation |
| expo-app/@types/*.ts | New type definitions for environment and updated types for places/itinerary |
Files not reviewed (1)
- expo-app/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| behavior={ Platform.OS === "ios" ? "padding" : undefined } | ||
| keyboardVerticalOffset={ Platform.OS === "ios" ? 0 : 0 } |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The KeyboardAvoidingView behavior was changed from "height" to undefined for Android. While this might fix some keyboard issues, setting it to undefined means the keyboard will not be handled automatically on Android. Consider using "padding" or testing thoroughly on Android devices to ensure the keyboard doesn't obscure input fields.
| behavior={ Platform.OS === "ios" ? "padding" : undefined } | |
| keyboardVerticalOffset={ Platform.OS === "ios" ? 0 : 0 } | |
| behavior="padding" | |
| keyboardVerticalOffset={0} |
| setLoadingMessage("Personalizando anúncios para você..."); | ||
|
|
||
| if (!isExpoGo && mobileAds) { |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appPreloader service was removed from the import and its usage was deleted. If this service is no longer needed, ensure that any files defining it are also removed from the codebase to avoid dead code. If it's still used elsewhere, this could break functionality.
| setLoadingMessage("Personalizando anúncios para você..."); | |
| if (!isExpoGo && mobileAds) { | |
| if (!isExpoGo && mobileAds) { | |
| setLoadingMessage("Personalizando anúncios para você..."); |
| <DotIndicator | ||
| color="#FFFFFF" | ||
| size={6} | ||
| count={3} | ||
| /> | ||
| </View> |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The loading indicator now uses a specific package (react-native-indicators). While this adds a visual improvement, ensure that the package is well-maintained and doesn't significantly increase the bundle size. Consider whether the built-in ActivityIndicator component could achieve a similar effect with less dependency overhead.
| res.status(200).json({ results: processedResults }); | ||
| } catch (error: any) { | ||
| console.error('Failed to fetch nearby places:', error.message); | ||
| res.status(500).json({ error: 'Failed to fetch nearby places', details: error.message }); |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling improvement is good, but the error response includes details: error.message which could potentially expose sensitive internal error information (stack traces, file paths, etc.) to clients. Consider sanitizing the error message or only including it in development mode.
| res.status(500).json({ error: 'Failed to fetch nearby places', details: error.message }); | |
| if (process.env.NODE_ENV === 'development') { | |
| res.status(500).json({ error: 'Failed to fetch nearby places', details: error.message }); | |
| } else { | |
| res.status(500).json({ error: 'Failed to fetch nearby places' }); | |
| } |
|
|
||
| const generateDetailed = async () => { | ||
| const prompt = `Gere um itinerário turístico completo e detalhado para uma viagem. Para cada dia, use EXATAMENTE este formato: ${ answerPattern }. Use apenas os dados fornecidos do usuário: ${ preferencesAllDefinedText }. Retorne apenas o texto no formato mostrado, sem explicações extras. Seja específico nos nomes dos locais. Cada dia deve ter entre 5-8 atividades no TIMELINE. Retorne descrições ricas em detalhes com no mínimo 10 palavras. As opções de categorias são (retorne apenas 1): ${ possibleCategoriesOptionsTogether() }`; | ||
| const prompt = `Gere um itinerário turístico completo e detalhado para uma viagem. Para cada dia, use EXATAMENTE este formato: ${ answerPattern }. Use apenas os dados fornecidos do usuário: ${ preferencesAllDefinedText }. Retorne apenas o texto no formato mostrado, sem explicações extras. Seja específico nos nomes dos locais. IMPORTANTE: Cada dia DEVE ter NO MÍNIMO 3 atividades e NO MÁXIMO 8 atividades no TIMELINE. NUNCA gere menos de 3 atividades por dia. Retorne descrições ricas em detalhes com no mínimo 10 palavras. As opções de categorias são (retorne apenas 1): ${ possibleCategoriesOptionsTogether() }`; |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimum activities requirement was added to the prompt, but there's no validation or fallback mechanism in the actual parsing logic to handle cases where the AI still generates fewer than 3 activities. Consider adding validation after parsing the itinerary to ensure each day has at least 3 activities, and if not, either retry the generation or add placeholder activities.
| // Adiciona o prefixo se não estiver no cache | ||
| promptText = `apenas responda a pergunta a seguir se ela for estritamente relacionada a turismo, caso nao seja, diga que nao pode responde-la por nao ser de turismo, e nao de mais informacoes: ${messageToSend}`; | ||
| console.log("Mensagem para a IA (com prefixo):", promptText); | ||
| promptText = `Apenas responda a pergunta a seguir se ela for minimamente relacionada a turismo ou uma sugestão de algo a se fazer em algum lugar, caso não seja, diga que não pode respondê-la por não ser de turismo. Não seja tão restrito também. ${messageToSend}`; |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The prompt was modified to be less restrictive ("Não seja tão restrito também"), which could allow the AI to respond to questions that are not strictly related to tourism. This might lead to responses outside the intended scope of the travel assistant. Consider providing clearer guidelines on what constitutes a tourism-related question to maintain consistent behavior.
| promptText = `Apenas responda a pergunta a seguir se ela for minimamente relacionada a turismo ou uma sugestão de algo a se fazer em algum lugar, caso não seja, diga que não pode respondê-la por não ser de turismo. Não seja tão restrito também. ${messageToSend}`; | |
| promptText = `Responda apenas se a pergunta for relacionada a turismo, viagens, atrações, atividades, dicas de lugares para visitar, ou informações úteis para viajantes. Caso contrário, informe que só pode responder perguntas relacionadas a turismo. ${messageToSend}`; |
| /** | ||
| * URL da API configurada automaticamente baseada no ambiente | ||
| * @deprecated Use Environment.getApiUrl() para melhor rastreabilidade | ||
| */ | ||
| export const API_URL = getApiUrl(); | ||
|
|
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecation comment suggests using Environment.getApiUrl() for better traceability, but the deprecated API_URL constant is still being used throughout the codebase (in multiple files). Consider either removing the deprecation notice if backward compatibility is needed, or actually migrating all usages to the new Environment.getApiUrl() method.
| /** | |
| * URL da API configurada automaticamente baseada no ambiente | |
| * @deprecated Use Environment.getApiUrl() para melhor rastreabilidade | |
| */ | |
| export const API_URL = getApiUrl(); |
| return process.env.EXPO_PUBLIC_ADMOB_ANDROID_APP_ID; | ||
| } | ||
| return process.env.ADMOB_IOS_APP_ID; | ||
| return process.env.EXPO_PUBLIC_ADMOB_IOS_APP_ID; |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable names were changed from ADMOB_ANDROID_APP_ID to EXPO_PUBLIC_ADMOB_ANDROID_APP_ID, which follows Expo's convention for exposing environment variables to the client. However, the code is using process.env.EXPO_PUBLIC_ADMOB_ANDROID_APP_ID which won't work in React Native - it should be accessed via the @env module import instead (like how DEV_API_URL is imported in config.ts).
| return process.env.EXPO_PUBLIC_ADMOB_ANDROID_APP_ID; | ||
| } | ||
| return process.env.EXPO_PUBLIC_ADMOB_IOS_APP_ID; |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same environment variable access issue - these should be imported from @env module instead of accessing via process.env.
| const isIconFallback = hasNoPhoto && item.iconFallback; | ||
|
|
||
| const [imageLoading, setImageLoading] = useState(!hasNoPhoto); | ||
| const [imageError, setImageError] = useState(false); |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable imageError.
Ajustes de Ambientes DEV e Produção, Roteiros Surpresa, ADMob, Google Places, UI/UX e Documentação
Description
Este Pull Request introduz melhorias significativas na lógica de detecção de ambiente, ajuste de roteiros gerados por IA, otimizações em anúncios, correções na integração com Google Places, melhorias visuais na experiência do usuário, ajustes internos de infraestrutura e documentação do setup local.
Main Changes
.env.locale URL oficial do Vercel em produção.Details of the Changes
How to Test
.env.local.Related Issues
Nenhuma issue mencionada.