Skip to content

XIP0030 Implement Share to XerahS on iOS and Android using Avalonia #86

@McoreD

Description

@McoreD

XIP0030: Implement Share to XerahS on iOS and Android using Avalonia

Status: Ready for Implementation
Area: Mobile / Cross-Platform
Goal: Let users share screenshots or files to XerahS on mobile, then upload using existing XerahS pipeline.


Overview

Implement a Share to XerahS feature for mobile. Users explicitly share content from other apps (Photos, Files, etc.) to XerahS, which then uploads via the existing TaskManager and providers.

Why not automatic monitoring?

  • Battery/permission friendly
  • Privacy first (user explicitly chooses what to share)
  • Follows platform conventions (share sheets)

Key Principles:

  • Zero duplicate upload logic
  • Reuse existing pipeline end-to-end
  • Platform-specific code only handles receiving shared files

Implementation Plan

Phase 1: Study Existing Pipeline

Study WatchFolderManager pattern, TaskManager.StartFileTask, WorkerTask upload flow, and provider system (AmazonS3Provider, CustomUploaderProvider).

Phase 2: Create ShareImportService in XerahS.Core

Add platform-neutral service that:

  • Accepts local file paths
  • Waits for file readiness
  • Clones TaskSettings
  • Invokes TaskManager.Instance.StartFileTask()
  • Returns UploadResult URLs

Phase 3: Android Share Intent Handling

  • Register ACTION_SEND and ACTION_SEND_MULTIPLE intent filters
  • Extract content URIs from share intent
  • Copy to app-owned storage (CacheDir)
  • Pass local paths to ShareImportService

Phase 4: iOS Share Extension

  • Create App Group: group.com.sharexteam.xerahs
  • Create XerahS.ShareExtension.iOS project
  • Accept shared items via NSItemProvider
  • Copy to App Group container
  • Write handoff manifest JSON
  • Signal main app to process

Phase 5: iOS Main App Handoff Processing

  • Enumerate pending manifests on launch/resume
  • Resolve file paths from App Group
  • Call ShareImportService.ImportAndUploadAsync()
  • Display results in UI
  • Clean up processed files

Phase 6: Avalonia UI for Results

  • ShareImportResultsWindow to show upload status per file
  • Copy URL button
  • Share URL button (mobile)
  • Error display for failed items

Key Files

Core Service:

  • src/XerahS.Core/Services/ShareImportService.cs

Settings:

  • src/XerahS.Core/Models/ShareImportSettings.cs

Android:

  • src/XerahS.App/Platforms/Android/MainActivity.cs (intent handling)

iOS Extension:

  • src/XerahS.ShareExtension.iOS/ShareViewController.cs

iOS Main:

  • src/XerahS.App/Platforms/iOS/HandoffProcessor.cs

UI:

  • src/XerahS.App/Views/ShareImportResultsView.axaml
  • src/XerahS.App/ViewModels/ShareImportResultsViewModel.cs

Non-Negotiable Rules

  • Do not create a second upload pipeline
  • Do not call Amazon S3 or CustomUploader directly from mobile heads
  • Do not duplicate TaskSettings cloning logic
  • Ensure every upload goes through TaskManager
  • Keep platform-specific code isolated

Deliverables

  1. ShareImportService in XerahS.Core
  2. Settings additions for workflow selection
  3. Android share intent handling
  4. iOS Share Extension with App Group handoff
  5. iOS main app manifest processing
  6. Avalonia UI for showing results
  7. Documentation under docs/

Affected Components

  • XerahS.Core: ShareImportService, ShareImportSettings
  • XerahS.App: Android MainActivity, iOS HandoffProcessor
  • XerahS.ShareExtension.iOS: New project
  • XerahS.App.UI: ShareImportResultsView

End State

User shares a screenshot to XerahS, XerahS uploads using configured workflow, User receives URL inside XerahS UI

Metadata

Metadata

Assignees

No one assigned

    Labels

    xipXerahS Improvement Proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions