mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-01 22:29:44 +08:00
feat(ios): add share to support (#15340)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added iOS sharing for URLs, text, web pages, and images. * Shared content can be reviewed, titled, and saved to an AFFiNE workspace. * Choose destinations including workspaces, tags, and collections. * Added previews, attachment handling, import status, retry support, and success/error feedback. * Pending shares are processed when AFFiNE opens or returns to the foreground. * **Bug Fixes** * Improved workspace profile handling across different workspace types. * Onboarding completion is now recorded immediately after successful sign-in verification. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import Foundation
|
||||
|
||||
struct ShareInboxAttachment: Codable, Equatable {
|
||||
var fileName: String
|
||||
var mimeType: String
|
||||
var relativePath: String
|
||||
}
|
||||
|
||||
enum ShareInboxContentKind: String, Codable {
|
||||
case url
|
||||
case text
|
||||
case image
|
||||
}
|
||||
|
||||
struct ShareInboxContent: Codable, Equatable {
|
||||
var kind: ShareInboxContentKind
|
||||
var url: String?
|
||||
var text: String?
|
||||
}
|
||||
|
||||
struct ShareInboxTarget: Codable, Equatable {
|
||||
var workspaceId: String
|
||||
var workspaceFlavour: String
|
||||
var tagIds: [String]
|
||||
var collectionId: String?
|
||||
}
|
||||
|
||||
struct ShareInboxResult: Codable, Equatable {
|
||||
var docId: String
|
||||
var committedAt: Date
|
||||
}
|
||||
|
||||
struct ShareInboxItem: Codable, Equatable, Identifiable {
|
||||
var id: String
|
||||
var documentId: String
|
||||
var createdAt: Date
|
||||
var title: String
|
||||
var content: ShareInboxContent
|
||||
var target: ShareInboxTarget?
|
||||
var previewText: String?
|
||||
var attachments: [ShareInboxAttachment]
|
||||
var result: ShareInboxResult?
|
||||
var lastError: String?
|
||||
|
||||
init(
|
||||
id: String = UUID().uuidString,
|
||||
documentId: String = UUID().uuidString,
|
||||
createdAt: Date = Date(),
|
||||
title: String,
|
||||
content: ShareInboxContent,
|
||||
target: ShareInboxTarget? = nil,
|
||||
previewText: String? = nil,
|
||||
attachments: [ShareInboxAttachment] = [],
|
||||
result: ShareInboxResult? = nil,
|
||||
lastError: String? = nil
|
||||
) {
|
||||
self.id = id
|
||||
self.documentId = documentId
|
||||
self.createdAt = createdAt
|
||||
self.title = title
|
||||
self.content = content
|
||||
self.target = target
|
||||
self.previewText = previewText
|
||||
self.attachments = attachments
|
||||
self.result = result
|
||||
self.lastError = lastError
|
||||
}
|
||||
}
|
||||
|
||||
struct SharePayloadFile: Equatable {
|
||||
var data: Data
|
||||
var mimeType: String
|
||||
var fileName: String
|
||||
}
|
||||
|
||||
struct SharePayloadDraft: Equatable {
|
||||
var title: String
|
||||
var content: ShareInboxContent?
|
||||
var previewText: String
|
||||
var file: SharePayloadFile?
|
||||
var errorMessage: String?
|
||||
}
|
||||
Reference in New Issue
Block a user