This commit is contained in:
fmodf 2024-07-11 13:24:43 +02:00
parent 5fc5457bf0
commit 32086a28e8
10 changed files with 4 additions and 34 deletions

View file

@ -10,6 +10,5 @@ enum AppAction: Codable {
case rostersAction(_ action: RostersAction) case rostersAction(_ action: RostersAction)
case chatsAction(_ action: ChatsAction) case chatsAction(_ action: ChatsAction)
case conversationAction(_ action: ConversationAction) case conversationAction(_ action: ConversationAction)
case messagesAction(_ action: MessagesAction)
case sharingAction(_ action: SharingAction) case sharingAction(_ action: SharingAction)
} }

View file

@ -1,3 +0,0 @@
enum MessagesAction: Codable {
case dumb
}

View file

@ -6,6 +6,7 @@ enum SharingAction: Stateable {
case shareLocation(lat: Double, lon: Double) case shareLocation(lat: Double, lon: Double)
case shareContact(jid: String) case shareContact(jid: String)
case shareDocuments([Data]) case shareDocuments([Data])
case shareMedia(ids: [String])
case checkCameraAccess case checkCameraAccess
case setCameraAccess(Bool) case setCameraAccess(Bool)

View file

@ -1,12 +0,0 @@
import Combine
final class MessagesMiddleware {
static let shared = MessagesMiddleware()
func middleware(state _: AppState, action: AppAction) -> AnyPublisher<AppAction, Never> {
switch action {
default:
return Empty().eraseToAnyPublisher()
}
}
}

View file

@ -28,9 +28,6 @@ extension AppState {
case .conversationAction(let action): case .conversationAction(let action):
ConversationState.reducer(state: &state.conversationsState, action: action) ConversationState.reducer(state: &state.conversationsState, action: action)
case .messagesAction:
break // messages actions are processed by MessagesMiddleware, and other components
case .sharingAction(let action): case .sharingAction(let action):
SharingState.reducer(state: &state.sharingState, action: action) SharingState.reducer(state: &state.sharingState, action: action)
} }

View file

@ -1,5 +0,0 @@
import Foundation
final class CameraService {
var dumb = false
}

View file

@ -1,5 +0,0 @@
import Foundation
final class GalleryService {
var dumb = false
}

View file

@ -14,7 +14,6 @@ let store = AppStore(
RostersMiddleware.shared.middleware, RostersMiddleware.shared.middleware,
ChatsMiddleware.shared.middleware, ChatsMiddleware.shared.middleware,
ConversationMiddleware.shared.middleware, ConversationMiddleware.shared.middleware,
MessagesMiddleware.shared.middleware,
SharingMiddleware.shared.middleware SharingMiddleware.shared.middleware
] ]
) )

View file

@ -125,8 +125,7 @@ struct AttachmentMediaPickerView: View {
} }
.clipped() .clipped()
.onTapGesture { .onTapGesture {
// let ids = selectedMedia.map { $0.id } store.dispatch(.sharingAction(.shareMedia(ids: selectedItems)))
// sendGalleryMedia(ids: ids)
store.dispatch(.sharingAction(.showSharing(false))) store.dispatch(.sharingAction(.showSharing(false)))
} }
} }
@ -190,9 +189,9 @@ private struct GridViewItem: View {
.onTapGesture { .onTapGesture {
isSelected.toggle() isSelected.toggle()
if isSelected { if isSelected {
selected.removeAll { $0 == item.id }
} else {
selected.append(item.id) selected.append(item.id)
} else {
selected.removeAll { $0 == item.id }
} }
} }
} else { } else {