another.im-ios/ConversationsClassic/AppCore/Reducers/SharingReducer.swift

31 lines
834 B
Swift
Raw Normal View History

2024-07-10 17:49:36 +00:00
import Foundation
2024-07-10 14:13:47 +00:00
extension SharingState {
static func reducer(state: inout SharingState, action: SharingAction) {
switch action {
case .showSharing(let shown):
state.sharingShown = shown
2024-07-10 17:49:36 +00:00
case .setCameraAccess(let granted):
state.isCameraAccessGranted = granted
case .setGalleryAccess(let granted):
state.isGalleryAccessGranted = granted
case .cameraCaptured(let media, let type):
state.cameraCapturedMedia = media
state.cameraCapturedMediaType = type
case .flushCameraCaptured:
state.cameraCapturedMedia = Data()
state.cameraCapturedMediaType = .photo
2024-07-14 13:42:51 +00:00
case .galleryItemsUpdated(let items):
2024-07-10 17:49:36 +00:00
state.galleryItems = items
2024-07-10 14:13:47 +00:00
default:
break
}
}
}