forked from shadowfacts/Tusker
Prevent attempting to add an attachment when the possibility would be
invalid
This commit is contained in:
parent
fe95cb9e1a
commit
39c8162931
|
@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue