Re upload medias when account is changed in the share sheet

This commit is contained in:
Thomas Ricouard 2023-03-08 19:02:23 +01:00
parent 4c7d0f3386
commit 5c69aa64bc

View File

@ -12,7 +12,14 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
var mode: Mode
var client: Client?
var currentAccount: Account?
var currentAccount: Account? {
didSet {
if let itemsProvider {
mediasImages = []
processItemsProvider(items: itemsProvider)
}
}
}
var theme: Theme?
var preferences: UserPreferences?
var languageConfirmationDialogLanguages: (detected: String, selected: String)?
@ -62,6 +69,8 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
var statusTextCharacterLength: Int {
urlLengthAdjustments - statusText.string.utf16.count - spoilerTextCount
}
private var itemsProvider: [NSItemProvider]?
@Published var backupStatusText: NSAttributedString?
@ -227,6 +236,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
case let .new(visibility):
self.visibility = visibility
case let .shareExtension(items):
itemsProvider = items
visibility = .pub
processItemsProvider(items: items)
case let .replyTo(status):