2024-07-10 17:49:36 +00:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
enum SharingCameraMediaType: Stateable {
|
|
|
|
case video
|
|
|
|
case photo
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SharingGalleryItem: Stateable, Identifiable {
|
|
|
|
var id: String
|
|
|
|
var type: SharingCameraMediaType
|
|
|
|
var thumbnail: Data?
|
|
|
|
var duration: String?
|
|
|
|
}
|
|
|
|
|
2024-07-10 14:13:47 +00:00
|
|
|
struct SharingState: Stateable {
|
|
|
|
var sharingShown: Bool
|
2024-07-10 17:49:36 +00:00
|
|
|
var isCameraAccessGranted: Bool
|
|
|
|
var isGalleryAccessGranted: Bool
|
|
|
|
|
|
|
|
var cameraCapturedMedia: Data
|
|
|
|
var cameraCapturedMediaType: SharingCameraMediaType
|
|
|
|
|
|
|
|
var galleryItems: [SharingGalleryItem]
|
2024-07-10 14:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: Init
|
|
|
|
extension SharingState {
|
|
|
|
init() {
|
|
|
|
sharingShown = false
|
2024-07-10 17:49:36 +00:00
|
|
|
isCameraAccessGranted = false
|
|
|
|
isGalleryAccessGranted = false
|
|
|
|
|
|
|
|
cameraCapturedMedia = Data()
|
|
|
|
cameraCapturedMediaType = .photo
|
|
|
|
|
|
|
|
galleryItems = []
|
2024-07-10 14:13:47 +00:00
|
|
|
}
|
|
|
|
}
|