Remove automatically save drafts preference

Closes #369
This commit is contained in:
Shadowfacts 2023-05-04 21:40:59 -04:00
parent b6a5a60066
commit 24fb0e0e7b
6 changed files with 4 additions and 19 deletions

View File

@ -26,7 +26,6 @@ public struct ComposeUIConfig {
// Preferences
public var useTwitterKeyboard = false
public var contentType = StatusContentType.plain
public var automaticallySaveDrafts = false
public var requireAttachmentDescriptions = false
// Host callbacks

View File

@ -148,15 +148,11 @@ public final class ComposeController: ViewController {
@MainActor
func cancel() {
if config.automaticallySaveDrafts {
config.dismiss(.cancel)
if draft.hasContent {
isShowingSaveDraftSheet = true
} else {
if draft.hasContent {
isShowingSaveDraftSheet = true
} else {
deleteDraftOnDisappear = true
config.dismiss(.cancel)
}
deleteDraftOnDisappear = true
config.dismiss(.cancel)
}
}

View File

@ -63,7 +63,6 @@ public class Preferences: Codable, ObservableObject {
self.defaultPostVisibility = try container.decode(Visibility.self, forKey: .defaultPostVisibility)
self.defaultReplyVisibility = try container.decodeIfPresent(ReplyVisibility.self, forKey: .defaultReplyVisibility) ?? .sameAsPost
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
self.requireAttachmentDescriptions = try container.decode(Bool.self, forKey: .requireAttachmentDescriptions)
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
self.mentionReblogger = try container.decode(Bool.self, forKey: .mentionReblogger)
@ -120,7 +119,6 @@ public class Preferences: Codable, ObservableObject {
try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility)
try container.encode(defaultReplyVisibility, forKey: .defaultReplyVisibility)
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
try container.encode(requireAttachmentDescriptions, forKey: .requireAttachmentDescriptions)
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
try container.encode(mentionReblogger, forKey: .mentionReblogger)
@ -172,7 +170,6 @@ public class Preferences: Codable, ObservableObject {
// MARK: Composing
@Published public var defaultPostVisibility = Visibility.public
@Published public var defaultReplyVisibility = ReplyVisibility.sameAsPost
@Published public var automaticallySaveDrafts = true
@Published public var requireAttachmentDescriptions = false
@Published public var contentWarningCopyMode = ContentWarningCopyMode.asIs
@Published public var mentionReblogger = false
@ -236,7 +233,6 @@ public class Preferences: Codable, ObservableObject {
case defaultPostVisibility
case defaultReplyVisibility
case automaticallySaveDrafts
case requireAttachmentDescriptions
case contentWarningCopyMode
case mentionReblogger

View File

@ -74,8 +74,6 @@ class ShareHostingController: UIHostingController<ShareHostingController.View> {
var config = ComposeUIConfig()
config.allowSwitchingDrafts = false
config.textSelectionStartsAtBeginning = true
// note: in the share sheet, we ignore this preference
config.automaticallySaveDrafts = false
config.backgroundColor = Color(uiColor: .appBackground)
config.groupedBackgroundColor = Color(uiColor: .appGroupedBackground)

View File

@ -79,7 +79,6 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
config.useTwitterKeyboard = Preferences.shared.useTwitterKeyboard
config.contentType = Preferences.shared.statusContentType
config.automaticallySaveDrafts = Preferences.shared.automaticallySaveDrafts
config.requireAttachmentDescriptions = Preferences.shared.requireAttachmentDescriptions
config.dismiss = { [unowned self] in self.dismiss(mode: $0) }

View File

@ -58,9 +58,6 @@ struct ComposingPrefsView: View {
var composingSection: some View {
Section(header: Text("Composing")) {
Toggle(isOn: $preferences.automaticallySaveDrafts) {
Text("Automatically Save Drafts")
}
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
Text("Require Attachment Descriptions")
}