Prevent attempting to add an attachment when the possibility would be

invalid
This commit is contained in:
Shadowfacts 2020-09-07 14:43:39 -04:00
parent fe95cb9e1a
commit 39c8162931
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 3 additions and 3 deletions

View File

@ -95,8 +95,7 @@ struct ComposeAttachmentsList: View {
case .pleroma: case .pleroma:
return true return true
case .mastodon: case .mastodon:
// todo: this technically allows invalid image/video combinations return draft.attachments.count < 4 && draft.attachments.allSatisfy { $0.data.type == .image }
return draft.attachments.count < 4
} }
} }

View File

@ -199,7 +199,8 @@ class ComposeHostingController: UIHostingController<ComposeContainerView> {
case .pleroma: case .pleroma:
return true return true
case .mastodon: case .mastodon:
// todo: this technically allows invalid video/image combinations guard draft.attachments.allSatisfy({ $0.data.type == .image }) else { return false }
// todo: if providers are videos, this technically allows invalid video/image combinations
return itemProviders.count + draft.attachments.count <= 4 return itemProviders.count + draft.attachments.count <= 4
} }
} }