mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 23:24:32 +00:00
53 lines
1.7 KiB
Swift
53 lines
1.7 KiB
Swift
import Foundation
|
|
import Defaults
|
|
import AtollExtensionKit
|
|
import SwiftUI
|
|
|
|
struct ExtensionLiveActivityPayload: Identifiable, Hashable {
|
|
let bundleIdentifier: String
|
|
let descriptor: AtollLiveActivityDescriptor
|
|
let receivedAt: Date
|
|
|
|
var id: String { descriptor.id }
|
|
|
|
var priority: AtollLiveActivityPriority { descriptor.priority }
|
|
}
|
|
|
|
struct ExtensionLockScreenWidgetPayload: Identifiable, Hashable {
|
|
let bundleIdentifier: String
|
|
let descriptor: AtollLockScreenWidgetDescriptor
|
|
let receivedAt: Date
|
|
|
|
var id: String { descriptor.id }
|
|
|
|
var priority: AtollLiveActivityPriority { descriptor.priority }
|
|
}
|
|
|
|
enum ExtensionValidationError: LocalizedError, Equatable {
|
|
case featureDisabled
|
|
case unauthorized
|
|
case invalidDescriptor(String)
|
|
case rateLimited
|
|
case exceedsCapacity
|
|
case duplicateIdentifier
|
|
case unsupportedContent
|
|
|
|
var errorDescription: String? {
|
|
switch self {
|
|
case .featureDisabled:
|
|
return "Extensions feature is currently disabled in Atoll."
|
|
case .unauthorized:
|
|
return "Your app is not authorized to post this content."
|
|
case .invalidDescriptor(let reason):
|
|
return "Descriptor validation failed: \(reason)."
|
|
case .rateLimited:
|
|
return "Too many requests in a short period. Please slow down."
|
|
case .exceedsCapacity:
|
|
return "Atoll reached its limit for simultaneous extension content."
|
|
case .duplicateIdentifier:
|
|
return "An item with the same identifier already exists."
|
|
case .unsupportedContent:
|
|
return "Descriptor includes unsupported content for this surface."
|
|
}
|
|
}
|
|
}
|