forked from shadowfacts/Tusker
parent
b6a5a60066
commit
24fb0e0e7b
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue