Skip to content

Xavi-PL/WoffuForWatchOS

Repository files navigation

WoffuX - Woffu for Apple Watch

Apple Watch app for Woffu time tracking system.

📁 Project Structure

WoffuX/
├── Views/
│   ├── ContentView.swift              # Main container with TabView
│   ├── MainView.swift                 # Dashboard view (Tab 1)
│   ├── SignSlotsListView.swift        # Slots list view (Tab 2)
│   └── Components/
│       ├── ClockButton.swift          # Clock in/out button
│       ├── WorkingTimeDisplay.swift   # Time display widget
│       ├── TotalTimeCard.swift        # Total time card
│       └── SignSlotCard.swift         # Individual slot card
│
├── Services/
│   └── WoffuAPI.swift                 # API service layer
│
├── Models/
│   └── Models.swift                   # Data models (SignSlot, SignEvent, etc.)
│
├── Utils/
│   └── WorkingHoursCalculator.swift   # Time calculation utilities
│
└── Config/
    ├── WoffuConfig.swift              # Configuration manager
    └── Config.xcconfig.template       # Template for credentials

🔐 Configuration Setup

Using xcconfig (Recommended - More Secure)

  1. Copy the template:

    cp Config/Config.xcconfig.template Config.xcconfig
  2. Edit Config.xcconfig with your credentials:

    WOFFU_COMPANY = your-company-name
    WOFFU_JWT_TOKEN = your-jwt-token-here
    WOFFU_USERNAME = YourName
    
  3. Add to Xcode:

    • Open your project in Xcode
    • Right-click on project → Add Files
    • Select Config.xcconfig
    • Go to Project Settings → Info → Configurations
    • Set Config.xcconfig for Debug and Release
  4. Update Info.plist: Add these keys to your Info.plist:

    <key>WoffuCompany</key>
    <string>$(WOFFU_COMPANY)</string>
    <key>WoffuJWTToken</key>
    <string>$(WOFFU_JWT_TOKEN)</string>
    <key>WoffuUsername</key>
    <string>$(WOFFU_USERNAME)</string>
  5. The credentials are automatically loaded via WoffuConfig.swift

🏗️ Architecture

Views Layer

  • ContentView: Main container managing tab navigation and lifecycle
  • MainView: Dashboard with greeting, time display, and clock button
  • SignSlotsListView: Scrollable list of all sign slots
  • Components: Reusable UI components

Services Layer

  • WoffuAPI: Handles all API communication
    • fetchTodaySlots(): GET slots for today
    • performSignAction(): POST clock in/out

Models Layer

  • SignSlot: Main data structure for time entries
  • SignEvent: Individual sign in/out event
  • SignMotive: Reason/category for the slot

Utils Layer

  • WorkingHoursCalculator: Calculates total working hours from slots

Config Layer

  • WoffuConfig: Manages credentials and configuration
  • Uses xcconfig for sensitive data

🔄 Data Flow

User Action → ContentView → WoffuAPI → Woffu Server
                    ↓              ↓
             Updates @Published  Response
                    ↓              ↓
               View Refresh ← Data Processing

🚀 Features

  • ✅ Clock in/out with single tap
  • ✅ Real-time working hours calculation
  • ✅ View all sign slots for today
  • ✅ Loading indicators with progress spinner
  • ✅ Automatic sync on app activation
  • ✅ Time-based greetings (Buenos días/tardes/noches)
  • ✅ Secure credential management

🔮 Future Roadmap (Next Steps)

  • 🔔 Smart Reminders:
    • Implementation of local alarms and push notifications to remind the user to clock in/out.
  • 📍 Location Awareness:
    • Integration of CoreLocation to send the user's current coordinates during sign actions.
  • 🤖 Automation:
    • Automatic clock-in/out triggered by specific alarms or geofencing (entering/leaving the office).
  • ⌚ Quick Access Widgets:
    • Develop watchOS Complications and Widgets for the "Smart Stack" to allow signing without opening the full app.

📱 Requirements

  • watchOS 26.0+

🛠️ Development

Building

  1. Clone the repository
  2. Set up your configuration (see Configuration Setup above)
  3. Open in Xcode
  4. Build and run on Apple Watch simulator or device

📄 License

Private project - All rights reserved

About

An independent Woffu application for Apple Watch to check-in and check-out

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages