Files
EMI-ExpoAPP/Agent.md

5.5 KiB

EMI Expo App Agent Notes

This file summarizes the current /Users/adolforeyna/Projects/EMI/expoApp codebase so future work can start with context.

What This App Is

  • Expo React Native app for EMI Fellowship social network (iOS + Android + limited web support).
  • Main features: auth, feed/posts/comments, profile pages, groups, courses, invite flow, notifications, media playback/upload.
  • Backend is expected to be the EMI API and cookie-authenticated.

Run + Build Basics

  • Install: npm install
  • Start dev server: npm start
  • Device targets: npm run ios, npm run android
  • Expo config: /Users/adolforeyna/Projects/EMI/expoApp/app.json
  • EAS config: /Users/adolforeyna/Projects/EMI/expoApp/eas.json

High-Level Architecture

  • App entry + navigation: /Users/adolforeyna/Projects/EMI/expoApp/App.js
  • API abstraction layer: /Users/adolforeyna/Projects/EMI/expoApp/API.js
  • Global state (Valtio proxy): /Users/adolforeyna/Projects/EMI/expoApp/contexts/GlobalState.js
  • Screen modules: /Users/adolforeyna/Projects/EMI/expoApp/Views/*
  • Reusable UI pieces: /Users/adolforeyna/Projects/EMI/expoApp/components/*

Navigation Shape

  • Root stack (createNativeStackNavigator) contains:
    • MainNavigation (bottom tabs)
    • Details/screens like Profile, SinglePost, Search, Menu, Notifications, ProfileSettings, etc.
  • Bottom tabs (createBottomTabNavigator) inside MainNavigation:
    • Feed, Groups, NewPost, Courses, MyProfile
  • Custom header in App.js provides menu/search/notifications shortcuts globally.

State + Data Flow

  • Server source of truth via API.js.
  • GlobalState.me stores active viewer profile and is refreshed:
    • on Feed load
    • periodically in MainNavigation (30s interval)
    • on profile switch in Menu
  • Local caching with AsyncStorage:
    • feed cache
    • profile post cache
    • courses cache
    • profile/name cache in card/name components
  • API.js has defensive networking:
    • fallback responses on non-OK and invalid JSON
    • request error cooldown logging
    • profile failure cooldown cache to avoid repeated failing calls

API Layer Notes

  • Base URL default in /Users/adolforeyna/Projects/EMI/expoApp/API.js:
    • https://emiapi.reynafamily.com
    • can be overridden with global.baseUrl
  • Uses fetch(..., { credentials: 'include' }), so backend cookie/CORS config must be correct.
  • Covers endpoints for:
    • auth/session
    • posts/comments/reactions/bookmarks
    • profiles/follow/change profile
    • groups/courses
    • invites
    • payments
    • notifications token registration

Feature Map (Key Files)

  • Login/register UI: /Users/adolforeyna/Projects/EMI/expoApp/Views/Login.js, /Users/adolforeyna/Projects/EMI/expoApp/components/Login.js, /Users/adolforeyna/Projects/EMI/expoApp/components/Register.js
  • Feed: /Users/adolforeyna/Projects/EMI/expoApp/Views/Feed.js
  • Post rendering/interactions: /Users/adolforeyna/Projects/EMI/expoApp/components/Post.js
  • Media parser/player/slideshow handoff: /Users/adolforeyna/Projects/EMI/expoApp/components/Media.js
  • Profile page + tagged profile posts: /Users/adolforeyna/Projects/EMI/expoApp/Views/Profile.js
  • Create post + image uploads: /Users/adolforeyna/Projects/EMI/expoApp/Views/NewPost.js
  • Groups + courses browsing: /Users/adolforeyna/Projects/EMI/expoApp/Views/Groups.js, /Users/adolforeyna/Projects/EMI/expoApp/Views/Courses.js
  • Profile settings and invite flow: /Users/adolforeyna/Projects/EMI/expoApp/Views/ProfileSettings.js, /Users/adolforeyna/Projects/EMI/expoApp/Views/Invite.js

Integrations In Use

  • Expo Notifications (expo-notifications) including push token registration.
  • Expo Updates (expo-updates) check/fetch/reload in Feed (disabled in __DEV__).
  • PostHog analytics:
    • setup in /Users/adolforeyna/Projects/EMI/expoApp/PostHog.js
    • provider in /Users/adolforeyna/Projects/EMI/expoApp/App.js
  • Media upload currently points to https://social.emmint.com/upload.php in multiple places.

Known Risks / Footguns (Current Code)

  • Missing imports likely to crash at runtime:
    • AsyncStorage used but not imported in /Users/adolforeyna/Projects/EMI/expoApp/Views/Courses.js
    • Platform used but not imported in /Users/adolforeyna/Projects/EMI/expoApp/Views/ProfileSettings.js
    • Platform used but not imported in /Users/adolforeyna/Projects/EMI/expoApp/components/NewPost.js
  • A few typos are intentionally present in route/prop names and work only because both sides share the typo:
    • intialContent, ceatedAt, skiptOnPress, skiptVideo
  • Store.js appears unused and stale (easy-peasy store not wired into app).
  • Views/NewGroup.js is mostly scaffolded (UI shell, no creation flow yet).

Debugging Checklist (Most Common Production Issues)

  1. Confirm API base URL in /Users/adolforeyna/Projects/EMI/expoApp/API.js (or global.baseUrl) targets intended backend.
  2. Validate backend session cookie/CORS behavior for current environment.
  3. If login/feed fails, verify API.isLoggedIn() response shape and cookie persistence.
  4. For phone testing against local backend, never use localhost; use machine LAN IP.
  5. If feed/profile seems stale, clear AsyncStorage caches and re-open app.
  • Prefer small defensive changes over broad refactors.
  • Preserve API response guards and null-safe rendering patterns.
  • When touching profile/post rendering, test both cached and fresh-network paths.
  • Keep changes isolated by feature screen/component; this code relies on many implicit shared assumptions.