Minor cleanup (#1138)

This commit is contained in:
Nathan Mattes 2024-01-23 10:40:40 +01:00
parent f9ae531b48
commit 3e200a7703
4 changed files with 7 additions and 15 deletions

View File

@ -284,8 +284,7 @@ extension ComposeViewController {
authContext: viewModel.authContext,
input: .image(image),
sizeLimit: composeContentViewModel.sizeLimit,
delegate: composeContentViewModel,
caption: nil
delegate: composeContentViewModel
)
}
composeContentViewModel.attachmentViewModels += attachmentViewModels

View File

@ -45,7 +45,6 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable
public let authContext: AuthContext
public let input: Input
public let sizeLimit: SizeLimit
let originalCaption: String?
@Published var caption = ""
@Published public private(set) var isCaptionEditable = true
let isEditing: Bool
@ -79,7 +78,7 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable
sizeLimit: SizeLimit,
delegate: AttachmentViewModelDelegate,
isEditing: Bool = false,
caption: String?
caption: String? = nil
) {
self.api = api
self.authContext = authContext
@ -88,7 +87,6 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable
self.delegate = delegate
self.isEditing = isEditing
self.originalCaption = caption
self.caption = caption ?? ""
super.init()

View File

@ -473,8 +473,7 @@ extension ComposeContentViewController: PHPickerViewControllerDelegate {
authContext: viewModel.authContext,
input: .pickerResult(result),
sizeLimit: viewModel.sizeLimit,
delegate: viewModel,
caption: nil
delegate: viewModel
)
}
viewModel.attachmentViewModels += attachmentViewModels
@ -493,8 +492,7 @@ extension ComposeContentViewController: UIImagePickerControllerDelegate & UINavi
authContext: viewModel.authContext,
input: .image(image),
sizeLimit: viewModel.sizeLimit,
delegate: viewModel,
caption: nil
delegate: viewModel
)
viewModel.attachmentViewModels += [attachmentViewModel]
}
@ -514,8 +512,7 @@ extension ComposeContentViewController: UIDocumentPickerDelegate {
authContext: viewModel.authContext,
input: .url(url),
sizeLimit: viewModel.sizeLimit,
delegate: viewModel,
caption: nil
delegate: viewModel
)
viewModel.attachmentViewModels += [attachmentViewModel]
}

View File

@ -260,8 +260,7 @@ extension ShareViewController {
authContext: authContext,
input: .itemProvider(movieProvider),
sizeLimit: .init(image: nil, video: nil),
delegate: composeContentViewModel,
caption: nil
delegate: composeContentViewModel
)
composeContentViewModel.attachmentViewModels.append(attachmentViewModel)
} else if !imageProviders.isEmpty {
@ -271,8 +270,7 @@ extension ShareViewController {
authContext: authContext,
input: .itemProvider(provider),
sizeLimit: .init(image: nil, video: nil),
delegate: composeContentViewModel,
caption: nil
delegate: composeContentViewModel
)
}
composeContentViewModel.attachmentViewModels.append(contentsOf: attachmentViewModels)