How jakayus/straytoots works
• The companion iPhone app—for logging in, settings, and token setup.
• The Apple Watch app—for displaying user timelines and allowing simple interactions with “Toots” (such as Favourite, Boost, and Bookmark).
Main Components
a. Companions (Mobile Clients):
• iPhone App: Handles user authentication, token configuration (using the Tokens.plist) and initial login tasks.
• Apple Watch App: Provides the UI for viewing timelines and performing Toot interactions.
b. Shared Logic & Networking:
• MastodonNetworking.swift: Contains the logic for API calls to Mastodon.
• Config.swift: Likely provides configuration details such as the base URL of the Mastodon instance.
c. External Service:
• Mastodon API servers: The external API endpoints that this client communicates with for operations like verifying credentials and performing Toot actions.
d. Configuration Data:
• TokensExample.plist (and its renamed counterpart Tokens.plist): Stores access tokens and related secret information needed for authentication.
Relationships and Data Flow
• The iPhone app first handles authentication:
– It collects user credentials and uses the provided networking component to exchange the credentials for an access token.
• Once the token is configured (in Tokens.plist), both the iPhone and Watch apps can leverage it.
• The Watch app then uses MastodonNetworking.swift to fetch timelines and perform interactions (Favourite, Boost, Bookmark) using the Mastodon API.
• The configuration settings (potentially stored or referenced in Config.swift) determine the Mastodon instance that should be contacted.
• Data flows from the user (via the Watch or iPhone interface) to the networking layer, then to the Mastodon API, with responses updating the interface accordingly.
Architectural Patterns & Design Principles
• Separation of Concerns: The design clearly separates user interface logic (in separate apps for iPhone and Watch) from networking/configuration logic (centralized in networking files).
• Modularity: The division of functionality into different files and app targets ensures that each part can be updated or improved independently.
• Dependency on External APIs: The system is built to interact with external services (Mastodon API), so error handling and response parsing are crucial parts of the networking module.
Relevant Technologies & Frameworks
• Swift and SwiftUI: For building the user interfaces on both iPhone and Watch.
• WatchKit: To support the Watch App.
• iOS frameworks for networking (likely URLSession or similar in MastodonNetworking.swift).
• Xcode project configuration (as seen in the .xcodeproj structure).