How silentcoderhere/aihub works
Purpose and principal workflow
AI Hub is an Android app that brings multiple AI websites into a customizable, tabbed WebView experience; the README describes persistent sessions and privacy protections. The initiating actor is the app user: after onboarding, MainActivity loads local service/domain data and displays the app UI. The user can select an AI service to browse its website inside the app. The code sample establishes the activity’s data loading and UI construction, but omits the screen implementation that wires service selection to WebView creation.
Components
App shell and service catalogue
• Main activity — app/src/main/java/com/foss/aihub/MainActivity.kt: Android activity entry point; checks onboarding state, loads service/domain data, and constructs AiHubApp.
• AI Hub workspace — app/src/main/java/com/foss/aihub/ui/screens/AiHubScreen.kt: workspace screen, documented by its presence in the tree; its implementation was not sampled, so its internal navigation and session wiring are uncertain.
• Service catalogue model and loader — app/src/main/java/com/foss/aihub/models/AiService.kt: decodes categorized services from the app-private ais.json file into AiService records.
• Service management UI — app/src/main/java/com/foss/aihub/ui/screens/ManageAiServicesScreen.kt: supports searching/filtering and reordering services; the excerpt shows order changes saved through SettingsManager.
Embedded browsing and downloads
• WebView navigation and security — app/src/main/java/com/foss/aihub/ui/webview/WebViewClient.kt: handles page loading/errors, gates URL connectivity through WebViewSecurity, and injects blob/share interceptors and user CSS/JS after page load.
• WebView browser interactions — app/src/main/java/com/foss/aihub/ui/webview/WebChromeClient.kt: routes file selection and permission requests to MainActivity, handles JavaScript dialogs, and supports popup windows.
• Download handling — app/src/main/java/com/foss/aihub/ui/webview/DownloadHandler.kt: streams downloaded content to Android Downloads/MediaStore; the excerpt also shows a separate blob-URL handling branch.
Configuration, preferences, and remote data
• Persistent settings — app/src/main/java/com/foss/aihub/utils/SettingManager.kt: reads and writes app preferences, including filters, service defaults/order, onboarding status, and remote-data ETags; exposes settings updates through a flow.
• Remote configuration updater — app/src/main/java/com/foss/aihub/utils/CloudDataHandler.kt: uses Ktor with the OkHttp engine to check ETags and download service/domain data into app-private files.
• Configuration state models — app/src/main/java/com/foss/aihub/models/AppSettings.kt: settings data type, documented by the settings manager’s import and use; its fields were not sampled.
• Service chooser UI — app/src/main/java/com/foss/aihub/ui/components/NavigationDrawerContent.kt: displays/filter-selects services and persists selected filters; its callbacks support selecting or reloading a service.
• Settings and customization UI — app/src/main/java/com/foss/aihub/ui/screens/SettingsScreen.kt: settings screen exists in the tree; its implementation was not sampled.
• Onboarding UI — app/src/main/java/com/foss/aihub/ui/screens/OnboardingScreens.kt: onboarding screens exist in the tree; the activity invokes onboarding and marks it complete on callback.
External participants
• App user — null: initiates onboarding and interacts with service selection, settings, and browsing.
• AI service websites — null: external websites loaded by the embedded browser; individual providers and exact navigation wiring are not established by the excerpts.
• AI Hub configuration host — null: external HTTP host serving service/domain configuration; the concrete base URL is defined outside the sampled excerpt.
Relationships
• App user -> Main activity: launches the Android app; MainActivity is the activity entry point.
• Main activity -> Onboarding UI: displays onboarding when completion is absent; invokes the completion callback to persist completion.
• Main activity -> AI Hub workspace: constructs AiHubApp after data is ready; the exact composition and screen wiring are not sampled.
• Main activity -> Service catalogue model and loader: loads service data during startup; the excerpt shows loadAllData, while the loader reads app-private ais.json.
• Main activity -> Remote configuration updater: startup reads local service/domain files, but the sampled code does not establish when remote updates are invoked.
• Remote configuration updater -> AI Hub configuration host: sends HEAD/GET requests to check ETags and fetch changed files.
• Remote configuration updater -> Persistent settings: reads stored ETags and saves returned ETags after updates.
• Remote configuration updater -> app-private configuration files: writes downloaded response bodies; service loading reads ais.json from the same private-files area.
• AI Hub workspace -> Service chooser UI: ownership only; the screen composition was not sampled, so direct runtime wiring is unconfirmed.
• Service chooser UI -> Persistent settings: writes filter changes; selection/reload behavior is exposed through callbacks.
• Service management UI -> Persistent settings: writes the reordered service-name list through updateSettings.
• Service chooser UI -> AI service websites: selection callbacks indicate service selection, but the sampled code does not establish the navigation call.
• AI service websites -> WebView navigation and security: the browser client handles page loads and checks requested URLs; the exact WebView construction site was not sampled.
• WebView navigation and security -> Persistent settings: reads custom CSS/JS from the settings flow before injecting them.
• WebView browser interactions -> Main activity: delegates file chooser and permission requests to activity methods.
• WebView navigation and security -> Download handling: blob interception is installed after page load, but the sampled excerpts do not establish the precise download dispatch path.
• Download handling -> Android Downloads/MediaStore: writes downloaded data through the content resolver or legacy Downloads directory.
Coverage limits
The source sample omits AiHubScreen and the main WebView setup, so tab/session persistence, precise service-selection navigation, and the call site for remote updates cannot be verified. The README documents tracker blocking and persistent conversations, but the sampled excerpts do not establish their implementation or backing storage.
Main entry points: MainActivity.kt Main activity · SettingManager.kt Persistent settings · CloudDataHandler.kt Remote configuration updater · NavigationDrawerContent.kt Service chooser
Components 16
App shell and catalogue
- Main activity
app/src/main/java/com/foss/aihub/MainActivity.kt - AI Hub workspace
app/src/main/java/com/foss/aihub/ui/screens/AiHubScreen.kt - Service catalogue loader
app/src/main/java/com/foss/aihub/models/AiService.kt - Service chooser
app/src/main/java/com/foss/aihub/ui/components/NavigationDrawerContent.kt - Service management
app/src/main/java/com/foss/aihub/ui/screens/ManageAiServicesScreen.kt - Onboarding screens
app/src/main/java/com/foss/aihub/ui/screens/OnboardingScreens.kt
Embedded browsing
- WebView navigation
app/src/main/java/com/foss/aihub/ui/webview/WebViewClient.kt - WebView interactions
app/src/main/java/com/foss/aihub/ui/webview/WebChromeClient.kt - Download handler
app/src/main/java/com/foss/aihub/ui/webview/DownloadHandler.kt
Configuration and preferences
- Persistent settings
app/src/main/java/com/foss/aihub/utils/SettingManager.kt - Remote configuration updater
app/src/main/java/com/foss/aihub/utils/CloudDataHandler.kt - Private configuration files
External participants
- App user
- AI service websites
- AI Hub configuration host
- Android Downloads and MediaStore
Connections 17
- App user → Main activity: launches
- Main activity → Onboarding screens: displays
- Main activity → AI Hub workspace: constructs · Creates AiHubApp; exact screen composition is not sampled.
- Main activity → Service catalogue loader: loads data
- Service catalogue loader → Private configuration files: reads · Reads ais.json from app-private files.
- AI Hub workspace → Service chooser: owns · Screen composition and direct runtime wiring are unconfirmed.
- Service chooser → Persistent settings: updates filters
- Service management → Persistent settings: saves order
- Service chooser → AI service websites: selects service · Selection callbacks exist, but navigation wiring is not established.
- Remote configuration updater → AI Hub configuration host: checks and fetches
- Remote configuration updater → Persistent settings: reads and saves ETags
- Remote configuration updater → Private configuration files: writes updates
- AI service websites → WebView navigation: loads pages
- WebView navigation → Persistent settings: reads custom CSS and JS
- WebView interactions → Main activity: delegates requests · Routes file chooser and permission requests to activity methods.
- WebView navigation → Download handler: intercepts blobs · Blob interception is installed after page load; dispatch details are not established.
- Download handler → Android Downloads and MediaStore: writes downloads