Skip to content

robglnn/pingrrr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pingrrr πŸŒπŸ’¬

A real-time messaging app for international communicators, built with Swift, SwiftUI, and Firebase

Pingrrr is an iOS messaging application designed for seamless cross-language communication. It combines real-time chat functionality with AI-powered features like translation, cultural context, and tone adjustment to break down language barriers.

Platform Swift Firebase

πŸ“‹ Table of Contents

✨ Features

Core Messaging

  • Real-time Chat: Sub-200ms message delivery with Firebase Firestore
  • One-on-One & Group Chat: Support for 2+ users in conversations
  • Offline Support: SwiftData persistence with queued message sends
  • Optimistic UI: Instant message appearance before server confirmation
  • Read Receipts: Track message delivery and read status
  • Typing Indicators: Real-time typing status updates
  • Presence System: Online/offline status with last seen timestamps
  • Push Notifications: Firebase Cloud Messaging for foreground notifications
  • Media Sharing: Image and voice message support

AI-Powered Features (International Communicator)

  1. Auto-Translation: Toggle globe button to translate all messages

    • Single press: Enable/disable auto-translation
    • Long press: Configure native and target languages
    • Translates incoming messages to your native language
    • Translates outgoing messages to target language
    • Recipients only see the translated version
  2. Manual Translation: Long-press any message to translate on-demand

  3. Language Detection: Automatically detects message language

  4. Cultural Context: Provides cultural hints and context for better understanding

  5. Tone Adjustment: Modify message formality (casual, neutral, formal, professional)

  6. Slang Explanation: Get explanations for slang and idioms

  7. Smart Replies: AI-generated context-aware reply suggestions

    • Analyzes conversation history
    • Generates replies in your native language
    • Provides translated version for sending
    • One-tap send button
  8. Message Summarization: Summarize long conversations or message threads

UI/UX

  • Dark Mode Design: Signal/X-inspired interface with black backgrounds
  • 60 FPS Performance: Smooth scrolling and animations
  • Minimalist Interface: Clean, intuitive design with blue accents
  • <2s Cold Launch: Optimized startup time with SwiftData preloading

πŸ— Architecture

High-Level Overview

graph TB
    subgraph "iOS Client"
        A[SwiftUI Views] -->|MVVM| B[ViewModels]
        B --> C[SwiftData]
        B --> D[Firebase SDK]
        B --> E[AIService]
        
        C -->|Local Cache| F[(SwiftData Store)]
        D -->|Network| G[Firebase Services]
        E -->|HTTP| H[Cloud Functions]
    end
    
    subgraph "Firebase Backend"
        G --> I[Firebase Auth]
        G --> J[Firestore]
        G --> K[FCM]
        G --> L[Storage]
        
        H --> M[AI Functions]
        M --> N[OpenAI GPT-4]
        M -->|RAG| J
    end
    
    style A fill:#1f77b4,stroke:#333,stroke-width:2px
    style B fill:#ff7f0e,stroke:#333,stroke-width:2px
    style C fill:#2ca02c,stroke:#333,stroke-width:2px
    style J fill:#e377c2,stroke:#333,stroke-width:2px
    style M fill:#bcbd22,stroke:#333,stroke-width:2px
Loading

Data Flow Architecture

sequenceDiagram
    participant User
    participant SwiftUI
    participant ViewModel
    participant SwiftData
    participant Firebase
    participant CloudFunctions
    participant OpenAI

    User->>SwiftUI: Send Message
    SwiftUI->>ViewModel: Trigger send()
    ViewModel->>SwiftData: Save optimistic message
    ViewModel->>SwiftUI: Update UI (instant)
    
    alt Auto-Translate Enabled
        ViewModel->>CloudFunctions: Request translation
        CloudFunctions->>OpenAI: Translate text
        OpenAI-->>CloudFunctions: Translated text
        CloudFunctions-->>ViewModel: Translation result
        ViewModel->>Firebase: Send translated message
    else No Translation
        ViewModel->>Firebase: Send original message
    end
    
    Firebase-->>ViewModel: Confirmation
    ViewModel->>SwiftData: Update message status
    Firebase->>ViewModel: Realtime listener update
    ViewModel->>SwiftUI: Update delivery status
Loading

Message Flow with Auto-Translation

flowchart LR
    A[User Types Message] --> B{Globe Active?}
    B -->|No| C[Send Original]
    B -->|Yes| D[Translate to Target Language]
    D --> E[Store Original Locally]
    E --> F[Send Only Translation]
    F --> G[Recipients Receive Translation]
    
    H[Receive Message] --> I{Globe Active?}
    I -->|No| J[Display Original]
    I -->|Yes| K{From Me?}
    K -->|Yes| L[Display My Original]
    K -->|No| M[Translate to Native Language]
    M --> N[Display Translation Below]
    
    style D fill:#4CAF50,stroke:#333,stroke-width:2px
    style F fill:#FF9800,stroke:#333,stroke-width:2px
    style M fill:#2196F3,stroke:#333,stroke-width:2px
Loading

Service Architecture

graph TD
    subgraph "ViewModels"
        A[AuthViewModel]
        B[ConversationsViewModel]
        C[ChatViewModel]
    end
    
    subgraph "Services"
        D[AuthService]
        E[ConversationService]
        F[MessageSyncService]
        G[PresenceService]
        H[AIService]
        I[NetworkMonitor]
        J[NotificationService]
        K[ProfileService]
        L[MediaService]
        M[OutgoingMessageQueue]
        N[TypingIndicatorService]
    end
    
    subgraph "Data Layer"
        O[SwiftData Models]
        P[Firebase SDK]
    end
    
    A --> D --> P
    B --> E --> O
    B --> E --> P
    C --> F --> O
    C --> F --> P
    C --> H --> P
    C --> M --> O
    C --> N --> P
    
    D --> G
    E --> G
    I --> B
    I --> C
    J --> P
    K --> P
    L --> P
    
    style C fill:#FF6B6B,stroke:#333,stroke-width:3px
    style F fill:#4ECDC4,stroke:#333,stroke-width:2px
    style H fill:#FFE66D,stroke:#333,stroke-width:2px
Loading

πŸ“¦ Prerequisites

Before setting up Pingrrr, ensure you have the following installed:

Required Software

  • Xcode 15+ (Download)
  • iOS 17+ SDK
  • CocoaPods or Swift Package Manager (SPM recommended)
  • Node.js 18+ and npm (Download)
  • Firebase CLI (npm install -g firebase-tools)
  • Git

Required Accounts

  • Apple Developer Account (for running on physical devices)
  • Firebase Project (Create one)
  • OpenAI API Key (Get one)

Firebase Services Required

  • Firebase Authentication (Email/Password enabled)
  • Cloud Firestore
  • Cloud Functions
  • Cloud Messaging
  • Cloud Storage

πŸš€ Setup Instructions

Step 1: Clone the Repository

git clone https://github.com/yourusername/pingrrr.git
cd pingrrr

Step 2: Firebase Project Setup

  1. Create a Firebase Project

    firebase login
    firebase projects:create pingrrr-your-id
    firebase use pingrrr-your-id
  2. Enable Required Services

    • Go to Firebase Console
    • Select your project
    • Enable Authentication β†’ Email/Password
    • Enable Firestore Database β†’ Start in production mode
    • Enable Cloud Functions
    • Enable Cloud Messaging
    • Enable Cloud Storage
  3. Download iOS Configuration

    • In Firebase Console β†’ Project Settings
    • Add iOS app with bundle ID: com.yourcompany.pingrrr
    • Download GoogleService-Info.plist
    • Place in pingrrr/pingrrr/ directory
  4. Configure Firestore Security Rules

    firebase deploy --only firestore:rules
  5. Configure Storage Security Rules

    firebase deploy --only storage:rules

Step 3: Cloud Functions Setup

  1. Navigate to Functions Directory

    cd functions
  2. Install Dependencies

    npm install
  3. Configure Environment Variables (see Environment Configuration)

  4. Build Functions

    npm run build
  5. Deploy Functions

    npm run deploy
    # OR deploy specific function
    firebase deploy --only functions:aiTranslate

Step 4: iOS Project Setup

  1. Open Xcode Project

    cd ..
    open pingrrr.xcodeproj
    # OR if using workspace
    open pingrrr.xcworkspace
  2. Configure Signing & Capabilities

    • Select pingrrr target
    • Go to "Signing & Capabilities"
    • Select your Team
    • Update Bundle Identifier if needed
  3. Add Required Capabilities

    • Push Notifications
    • Background Modes β†’ Remote notifications
    • Background Modes β†’ Background fetch
  4. Verify Firebase SDK Integration

    • Firebase packages should be auto-resolved via SPM
    • If not, add packages manually:
      • https://github.com/firebase/firebase-ios-sdk
      • Select: FirebaseAuth, FirebaseFirestore, FirebaseFunctions, FirebaseMessaging, FirebaseStorage
  5. Add GoogleService-Info.plist

    • Drag the downloaded GoogleService-Info.plist into pingrrr/pingrrr/ folder in Xcode
    • Ensure "Copy items if needed" is checked
    • Add to pingrrr target

Step 5: Configure Push Notifications

  1. Generate APNs Key

    • Go to Apple Developer Portal
    • Certificates, Identifiers & Profiles β†’ Keys
    • Create new key with APNs enabled
    • Download .p8 key file
  2. Upload to Firebase

    • Firebase Console β†’ Project Settings β†’ Cloud Messaging
    • Upload APNs key with Team ID and Key ID
  3. Update Info.plist

    • Add required notification keys (already configured in project)

Step 6: Database Indexes

Create required Firestore indexes:

firebase deploy --only firestore:indexes

Or manually create in Firebase Console based on firestore.indexes.json.

πŸ” Environment Configuration

Cloud Functions Environment Variables

Create a .env file in the functions/ directory:

# functions/.env
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxx

Set Firebase environment variables:

cd functions
firebase functions:config:set openai.api_key="sk-proj-xxxxxxxxxxxxxxxxxxxxx"

Verify configuration:

firebase functions:config:get

iOS Configuration

No additional environment variables needed. Configuration is handled through:

  • GoogleService-Info.plist (Firebase config)
  • Xcode Build Configuration
  • Info.plist (app metadata)

Environment Variables Template

# Firebase Project
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_API_KEY=your-api-key
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
FIREBASE_STORAGE_BUCKET=your-project.appspot.com

# OpenAI
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxx

# iOS Bundle
BUNDLE_IDENTIFIER=com.yourcompany.pingrrr
TEAM_ID=YOUR_TEAM_ID

# APNs (for push notifications)
APNS_KEY_ID=YOUR_KEY_ID
APNS_TEAM_ID=YOUR_TEAM_ID

πŸƒ Running Locally

Option 1: Xcode Simulator (Recommended for Development)

  1. Select Target Device

    • In Xcode, select "iPhone 15 Pro" (or your preferred simulator)
  2. Build and Run

    # Command line
    xcodebuild -scheme pingrrr -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build
    
    # OR press Cmd+R in Xcode
  3. Create Test Users

    • Run the app on 2+ simulators simultaneously
    • Sign up with different email addresses
    • Start chatting!

Option 2: Physical Device

  1. Connect iPhone via USB or WiFi

  2. Trust Developer Certificate

    • iPhone Settings β†’ General β†’ VPN & Device Management
    • Trust your developer certificate
  3. Select Device in Xcode

    • Choose your iPhone from device list
  4. Build and Run (Cmd+R)

Testing Push Notifications

Push notifications work differently on simulator vs device:

  • Simulator: Only foreground notifications (iOS 16+)
  • Physical Device: Full notification support

To test:

  1. Send message while app is in foreground (toast notification)
  2. Send message while app is in background (push notification)

Running with Firebase Emulators (Optional)

For local development without consuming Firebase quota:

# Start Firebase Emulators
firebase emulators:start

# Update iOS app to use emulators (uncomment in AppDelegate.swift)
# Auth.auth().useEmulator(withHost: "localhost", port: 9099)
# Firestore.firestore().useEmulator(withHost: "localhost", port: 8080)

πŸ“ Project Structure

pingrrr/
β”œβ”€β”€ pingrrr/                          # iOS App
β”‚   β”œβ”€β”€ App/                          # App lifecycle & entry point
β”‚   β”‚   β”œβ”€β”€ AppDelegate.swift         # Firebase initialization
β”‚   β”‚   β”œβ”€β”€ AppMain.swift             # App entry point
β”‚   β”‚   └── RootContainerView.swift   # Root container with auth routing
β”‚   β”‚
β”‚   β”œβ”€β”€ Models/                       # Data models
β”‚   β”‚   β”œβ”€β”€ ChatModels.swift          # SwiftData models (Message, Conversation, etc.)
β”‚   β”‚   └── TranslationLanguage.swift # Translation language definitions
β”‚   β”‚
β”‚   β”œβ”€β”€ Views/                        # SwiftUI Views
β”‚   β”‚   β”œβ”€β”€ AuthenticationFlowView.swift # Login/signup
β”‚   β”‚   β”œβ”€β”€ ConversationsView.swift   # Chat list
β”‚   β”‚   β”œβ”€β”€ ChatView.swift            # Chat interface with AI features
β”‚   β”‚   β”œβ”€β”€ SettingsSheet.swift       # User settings
β”‚   β”‚   └── Components/               # Reusable UI components
β”‚   β”‚
β”‚   β”œβ”€β”€ ViewModels/                   # Business logic
β”‚   β”‚   β”œβ”€β”€ AuthViewModel.swift       # Authentication state
β”‚   β”‚   β”œβ”€β”€ ConversationsViewModel.swift # Conversations list logic
β”‚   β”‚   β”œβ”€β”€ ChatViewModel.swift       # Chat logic & AI features
β”‚   β”‚   └── TypingIndicatorService.swift # Typing indicators
β”‚   β”‚
β”‚   β”œβ”€β”€ Services/                     # Backend integration
β”‚   β”‚   β”œβ”€β”€ AuthService.swift         # Firebase Auth wrapper
β”‚   β”‚   β”œβ”€β”€ ConversationService.swift # Conversation CRUD
β”‚   β”‚   β”œβ”€β”€ ConversationsSyncService.swift # Firestore sync
β”‚   β”‚   β”œβ”€β”€ MessageSyncService.swift  # Message sync & persistence
β”‚   β”‚   β”œβ”€β”€ AIService.swift           # AI features coordinator
β”‚   β”‚   β”œβ”€β”€ PresenceService.swift     # Online/offline status
β”‚   β”‚   β”œβ”€β”€ NotificationService.swift # FCM integration
β”‚   β”‚   β”œβ”€β”€ MediaService.swift        # Image/voice upload
β”‚   β”‚   β”œβ”€β”€ OutgoingMessageQueue.swift # Offline message queue
β”‚   β”‚   β”œβ”€β”€ NetworkMonitor.swift      # Network connectivity
β”‚   β”‚   └── ProfileService.swift      # User profile management
β”‚   β”‚
β”‚   β”œβ”€β”€ Extensions/                   # Swift extensions
β”‚   β”œβ”€β”€ Assets.xcassets/              # Images & icons
β”‚   └── Info.plist                    # App configuration
β”‚
β”œβ”€β”€ functions/                        # Firebase Cloud Functions
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts                  # Functions entry point
β”‚   β”‚   └── ai/                       # AI feature implementations
β”‚   β”‚       β”œβ”€β”€ translate.ts          # Translation
β”‚   β”‚       β”œβ”€β”€ detectLang.ts         # Language detection
β”‚   β”‚       β”œβ”€β”€ culturalHint.ts       # Cultural context
β”‚   β”‚       β”œβ”€β”€ adjustTone.ts         # Tone adjustment
β”‚   β”‚       β”œβ”€β”€ explainSlang.ts       # Slang explanation
β”‚   β”‚       β”œβ”€β”€ smartReplies.ts       # Smart reply generation
β”‚   β”‚       β”œβ”€β”€ summarize.ts          # Conversation summarization
β”‚   β”‚       β”œβ”€β”€ assistant.ts          # AI assistant
β”‚   β”‚       └── common.ts             # Shared utilities
β”‚   β”‚
β”‚   β”œβ”€β”€ package.json                  # Node dependencies
β”‚   └── tsconfig.json                 # TypeScript config
β”‚
β”œβ”€β”€ memory-bank/                      # Project documentation
β”‚   β”œβ”€β”€ projectbrief.md               # Project overview
β”‚   β”œβ”€β”€ PRD.md                        # Product requirements
β”‚   β”œβ”€β”€ techContext.md                # Technical architecture
β”‚   β”œβ”€β”€ systemPatterns.md             # Design patterns
β”‚   β”œβ”€β”€ MVPcriticalrequirements.md    # MVP checklist
β”‚   └── progress.md                   # Development progress
β”‚
β”œβ”€β”€ scripts/                          # Utility scripts
β”‚   β”œβ”€β”€ set_user_tier.sh              # User tier management
β”‚   └── lookup_uid.sh                 # User ID lookup
β”‚
β”œβ”€β”€ firebase.json                     # Firebase configuration
β”œβ”€β”€ firestore.rules                   # Firestore security rules
β”œβ”€β”€ firestore.indexes.json            # Firestore indexes
β”œβ”€β”€ storage.rules                     # Storage security rules
└── README.md                         # This file

πŸ‘¨β€πŸ’» Development Guidelines

Code Style

  • Swift: Follow Swift API Design Guidelines
  • SwiftUI: Use declarative patterns, avoid imperative code
  • Naming: Clear, descriptive names; avoid abbreviations
  • Comments: Document complex logic, algorithms, and public APIs

Architecture Patterns

  1. MVVM (Model-View-ViewModel)

    • Views: Pure SwiftUI, no business logic
    • ViewModels: Business logic, state management, async operations
    • Models: Data structures (SwiftData models)
  2. Service Layer

    • Services handle external dependencies (Firebase, AI)
    • Single responsibility principle
    • Injected into ViewModels
  3. Async/Await

    • Use Swift Concurrency for all async operations
    • Avoid completion handlers
    • Proper error handling with do-catch

State Management

  • @Published: For ViewModel properties that drive UI
  • @State: For local view state
  • @StateObject: For ViewModel initialization
  • @ObservedObject: For passed ViewModels
  • @EnvironmentObject: For app-wide state (AuthViewModel)

Performance Best Practices

  1. SwiftUI Optimization

    • Use LazyVStack for long lists
    • Avoid expensive computations in view body
    • Use @ViewBuilder for conditional views
    • Extract subviews to reduce recomputation
  2. SwiftData

    • Use @Query with predicates for filtering
    • Batch operations when possible
    • Optimize fetch descriptors
  3. Firebase

    • Limit Firestore listener scope
    • Use indexed queries
    • Batch writes for multiple operations
    • Implement pagination for large datasets
  4. AI Features

    • Cache translations for repeated content
    • Debounce user interactions
    • Show loading states
    • Implement timeout handling

Error Handling

// Example: Proper error handling pattern
func sendMessage() async {
    do {
        try await viewModel.send(request: .text(message))
        // Success handling
    } catch NetworkError.offline {
        errorMessage = "No internet connection. Message queued."
    } catch AIError.rateLimitExceeded {
        errorMessage = "AI usage limit reached. Try again later."
    } catch {
        errorMessage = "Failed to send message: \(error.localizedDescription)"
    }
}

Testing Guidelines

  1. Unit Tests: Test ViewModels and Services
  2. Integration Tests: Test Firebase interactions
  3. UI Tests: Test critical user flows
  4. Manual Testing: Test on multiple devices and iOS versions

πŸ§ͺ Testing

Unit Testing

Run unit tests via Xcode:

# Command line
xcodebuild test -scheme pingrrrTests -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

# OR press Cmd+U in Xcode

Integration Testing

Test scenarios to verify:

  1. Real-time Messaging

    • Send message between 2 devices
    • Verify <200ms delivery on good network
  2. Offline Support

    • Enable Airplane Mode
    • Send messages (queued)
    • Disable Airplane Mode
    • Verify messages sync
  3. App Lifecycle

    • Force quit app
    • Reopen
    • Verify messages persisted
  4. Group Chat

    • Create 3+ user conversation
    • Send messages from each user
    • Verify all receive messages
  5. AI Features

    • Test each AI feature (translate, tone, smart reply, etc.)
    • Verify <2s response time
    • Test with various languages
  6. Performance

    • Send 20+ rapid messages
    • Verify smooth scrolling
    • Check memory usage

Manual Testing Checklist

  • Sign up new user
  • Sign in existing user
  • Create conversation
  • Send text message
  • Send image
  • Send voice message
  • Receive message (foreground notification)
  • Receive message (background push)
  • Toggle online status
  • See typing indicator
  • View read receipts
  • Enable auto-translate
  • Configure translation languages
  • Use manual translation
  • Generate smart reply
  • Adjust message tone
  • Explain slang
  • Get cultural context
  • Summarize conversation
  • Test offline β†’ online transition
  • Test poor network conditions

🚒 Deployment

TestFlight Deployment

  1. Archive Build

    • Xcode β†’ Product β†’ Archive
    • Wait for archive to complete
  2. Distribute to App Store Connect

    • Select archive β†’ Distribute App
    • Choose "App Store Connect"
    • Upload build
  3. Configure TestFlight

    • Go to App Store Connect
    • Select your app β†’ TestFlight
    • Add internal testers
    • Create external test group (optional)
  4. Submit for Review (external testing)

    • Add test information
    • Submit for review
    • Wait for approval (~24 hours)

Firebase Deployment

Deploy all Firebase resources:

# Deploy everything
firebase deploy

# Deploy specific services
firebase deploy --only functions
firebase deploy --only firestore:rules
firebase deploy --only storage:rules
firebase deploy --only firestore:indexes

Production Checklist

  • Update version number in Xcode
  • Update build number
  • Test on multiple iOS versions (17, 18)
  • Test on multiple device sizes (iPhone SE, Pro, Pro Max)
  • Verify all Firebase functions deployed
  • Verify Firestore indexes created
  • Test push notifications on physical device
  • Review and update security rules
  • Enable Firebase App Check (recommended)
  • Set up Crashlytics (optional)
  • Configure analytics (optional)
  • Update App Store metadata
  • Prepare screenshots
  • Write release notes

πŸ“š Documentation

Additional Documentation Files

API Documentation

ChatViewModel Public API

// Send message
await viewModel.send(request: .text("Hello"))

// Toggle auto-translate
viewModel.toggleAutoTranslate()

// Update translation languages
viewModel.updateAutoTranslateLanguages(native: .en, target: .es)

// AI Features
await viewModel.translateMessage(for: messageID, to: "es")
await viewModel.generateSmartReply(for: messageID)
await viewModel.adjustTone(for: messageID, to: .formal)
await viewModel.explainSlang(for: messageID)
await viewModel.provideCulturalContext(for: messageID)
await viewModel.summarizeConversation()

AIService Public API

// Translation
let result = try await AIService.shared.translate(text: text, to: targetLang)

// Language detection
let lang = try await AIService.shared.detectLanguage(text: text)

// Smart replies
let replies = try await AIService.shared.smartReplies(history: history, native: lang)

// Cultural context
let context = try await AIService.shared.culturalContext(text: text, lang: lang)

Firestore Data Structure

firestore/
β”œβ”€β”€ users/
β”‚   └── {userId}/
β”‚       β”œβ”€β”€ uid: string
β”‚       β”œβ”€β”€ email: string
β”‚       β”œβ”€β”€ displayName: string
β”‚       β”œβ”€β”€ photoURL: string?
β”‚       β”œβ”€β”€ bio: string?
β”‚       β”œβ”€β”€ onlineStatus: "online" | "offline"
β”‚       β”œβ”€β”€ lastSeen: timestamp
β”‚       β”œβ”€β”€ fcmToken: string?
β”‚       └── aiUsageToday: number
β”‚
β”œβ”€β”€ conversations/
β”‚   └── {conversationId}/
β”‚       β”œβ”€β”€ participantIDs: [string]
β”‚       β”œβ”€β”€ participantNames: {userId: string}
β”‚       β”œβ”€β”€ participantPhotos: {userId: string}
β”‚       β”œβ”€β”€ lastMessageText: string
β”‚       β”œβ”€β”€ lastMessageAt: timestamp
β”‚       β”œβ”€β”€ lastMessageBy: string
β”‚       β”œβ”€β”€ unreadCounts: {userId: number}
β”‚       β”œβ”€β”€ typingUsers: {userId: timestamp}
β”‚       β”œβ”€β”€ translationPreferences: {userId: {enabled, native, target, activatedAt}}
β”‚       └── createdAt: timestamp
β”‚
└── messages/
    └── {messageId}/
        β”œβ”€β”€ conversationID: string
        β”œβ”€β”€ senderID: string
        β”œβ”€β”€ senderName: string
        β”œβ”€β”€ content: string (translated if auto-translate on)
        β”œβ”€β”€ originalContent: string? (sender's original text)
        β”œβ”€β”€ timestamp: timestamp
        β”œβ”€β”€ mediaType: "image" | "voice"?
        β”œβ”€β”€ mediaURL: string?
        β”œβ”€β”€ voiceDuration: number?
        β”œβ”€β”€ status: "sending" | "sent" | "delivered" | "read"
        β”œβ”€β”€ readBy: {userId: timestamp}
        β”œβ”€β”€ translatedContent: string? (manual translation)
        β”œβ”€β”€ autoTranslations: {
        β”‚   "broadcast": {text, targetLanguageCode},
        β”‚   userId: {text, targetLanguageCode}
        β”‚ }
        └── aiInsights: {
            slangExplanation: string?,
            culturalContext: string?,
            summary: string?
          }

πŸ› Troubleshooting

Common Issues

Build Failed: GoogleService-Info.plist not found

  • Download from Firebase Console
  • Drag into Xcode project
  • Ensure added to target

Push Notifications Not Working

  • Verify APNs key uploaded to Firebase
  • Check capabilities enabled in Xcode
  • Test on physical device (not simulator)
  • Verify FCM token registered

Messages Not Syncing

  • Check Firebase rules allow read/write
  • Verify internet connection
  • Check Firestore indexes created
  • Review Firebase Console logs

AI Features Failing

  • Verify OPENAI_API_KEY set in Cloud Functions
  • Check Cloud Functions deployed
  • Review function logs: firebase functions:log
  • Verify usage limits not exceeded

App Crashes on Launch

  • Check Firebase initialized properly
  • Verify GoogleService-Info.plist configuration
  • Review Xcode console for errors
  • Check SwiftData migration issues

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Firebase for backend infrastructure
  • OpenAI for AI capabilities
  • Vercel AI SDK for streamlined AI integration
  • Apple for Swift and SwiftUI
  • Signal and X for UI/UX inspiration

πŸ“ž Support

For issues, questions, or feedback:


Built with ❀️ for international communicators worldwide 🌍

About

messenger app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors