Compare commits
No commits in common. "f7421d83efaa41f6d173160b5a3f4fd9fd106ae0" and "11f9642cba0cd41a7bd81162f68744eabf7940b6" have entirely different histories.
f7421d83ef
...
11f9642cba
|
@ -44,9 +44,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
|
|
||||||
self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility)
|
self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility)
|
||||||
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
|
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.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
||||||
self.mentionReblogger = try container.decode(Bool.self, forKey: .mentionReblogger)
|
self.requireAttachmentDescriptions = try container.decode(Bool.self, forKey: .requireAttachmentDescriptions)
|
||||||
self.blurAllMedia = try container.decode(Bool.self, forKey: .blurAllMedia)
|
self.blurAllMedia = try container.decode(Bool.self, forKey: .blurAllMedia)
|
||||||
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
||||||
self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari)
|
self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari)
|
||||||
|
@ -69,9 +68,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
|
|
||||||
try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility)
|
try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility)
|
||||||
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
||||||
try container.encode(requireAttachmentDescriptions, forKey: .requireAttachmentDescriptions)
|
|
||||||
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
||||||
try container.encode(mentionReblogger, forKey: .mentionReblogger)
|
try container.encode(requireAttachmentDescriptions, forKey: .requireAttachmentDescriptions)
|
||||||
try container.encode(blurAllMedia, forKey: .blurAllMedia)
|
try container.encode(blurAllMedia, forKey: .blurAllMedia)
|
||||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||||
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
||||||
|
@ -93,9 +91,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
// MARK: - Behavior
|
// MARK: - Behavior
|
||||||
@Published var defaultPostVisibility = Status.Visibility.public
|
@Published var defaultPostVisibility = Status.Visibility.public
|
||||||
@Published var automaticallySaveDrafts = true
|
@Published var automaticallySaveDrafts = true
|
||||||
@Published var requireAttachmentDescriptions = false
|
|
||||||
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
||||||
@Published var mentionReblogger = false
|
@Published var requireAttachmentDescriptions = false
|
||||||
@Published var blurAllMedia = false
|
@Published var blurAllMedia = false
|
||||||
@Published var openLinksInApps = true
|
@Published var openLinksInApps = true
|
||||||
@Published var useInAppSafari = true
|
@Published var useInAppSafari = true
|
||||||
|
@ -117,9 +114,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
|
|
||||||
case defaultPostVisibility
|
case defaultPostVisibility
|
||||||
case automaticallySaveDrafts
|
case automaticallySaveDrafts
|
||||||
case requireAttachmentDescriptions
|
|
||||||
case contentWarningCopyMode
|
case contentWarningCopyMode
|
||||||
case mentionReblogger
|
case requireAttachmentDescriptions
|
||||||
case blurAllMedia
|
case blurAllMedia
|
||||||
case openLinksInApps
|
case openLinksInApps
|
||||||
case useInAppSafari
|
case useInAppSafari
|
||||||
|
|
|
@ -13,7 +13,7 @@ import Intents
|
||||||
class ComposeViewController: UIViewController {
|
class ComposeViewController: UIViewController {
|
||||||
|
|
||||||
var inReplyToID: String?
|
var inReplyToID: String?
|
||||||
var accountsToMention = [String]()
|
var accountsToMention: [String]
|
||||||
var initialText: String?
|
var initialText: String?
|
||||||
var contentWarningEnabled = false {
|
var contentWarningEnabled = false {
|
||||||
didSet {
|
didSet {
|
||||||
|
@ -74,12 +74,11 @@ class ComposeViewController: UIViewController {
|
||||||
self.inReplyToID = inReplyToID
|
self.inReplyToID = inReplyToID
|
||||||
if let inReplyToID = inReplyToID, let inReplyTo = MastodonCache.status(for: inReplyToID) {
|
if let inReplyToID = inReplyToID, let inReplyTo = MastodonCache.status(for: inReplyToID) {
|
||||||
accountsToMention = [inReplyTo.account.acct] + inReplyTo.mentions.map { $0.acct }
|
accountsToMention = [inReplyTo.account.acct] + inReplyTo.mentions.map { $0.acct }
|
||||||
|
} else if let mentioningAcct = mentioningAcct {
|
||||||
|
accountsToMention = [mentioningAcct]
|
||||||
} else {
|
} else {
|
||||||
accountsToMention = []
|
accountsToMention = []
|
||||||
}
|
}
|
||||||
if let mentioningAcct = mentioningAcct {
|
|
||||||
accountsToMention.append(mentioningAcct)
|
|
||||||
}
|
|
||||||
if let ownAccount = MastodonController.account {
|
if let ownAccount = MastodonController.account {
|
||||||
accountsToMention.removeAll(where: { acct in ownAccount.acct == acct })
|
accountsToMention.removeAll(where: { acct in ownAccount.acct == acct })
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,14 @@ struct BehaviorPrefsView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
composingSection
|
section1
|
||||||
replyingSection
|
section2
|
||||||
readingSection
|
section3
|
||||||
linksSection
|
|
||||||
}.listStyle(GroupedListStyle())
|
}.listStyle(GroupedListStyle())
|
||||||
.navigationBarTitle(Text("Behavior"))
|
.navigationBarTitle(Text("Behavior"))
|
||||||
}
|
}
|
||||||
|
|
||||||
var composingSection: some View {
|
var section1: some View {
|
||||||
Section(header: Text("COMPOSING")) {
|
Section(header: Text("COMPOSING")) {
|
||||||
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
||||||
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
||||||
|
@ -36,26 +35,18 @@ struct BehaviorPrefsView: View {
|
||||||
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
||||||
Text("Automatically Save Drafts")
|
Text("Automatically Save Drafts")
|
||||||
}
|
}
|
||||||
|
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) {
|
||||||
|
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
||||||
|
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
||||||
|
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
||||||
|
}
|
||||||
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
|
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
|
||||||
Text("Require Attachment Descriptions")
|
Text("Require Attachment Descriptions")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var replyingSection: some View {
|
var section2: some View {
|
||||||
Section(header: Text("REPLYING")) {
|
|
||||||
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) {
|
|
||||||
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
|
||||||
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
|
||||||
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
|
||||||
}
|
|
||||||
Toggle(isOn: $preferences.mentionReblogger) {
|
|
||||||
Text("Mention Reblogger")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var readingSection: some View {
|
|
||||||
Section(header: Text("READING")) {
|
Section(header: Text("READING")) {
|
||||||
Toggle(isOn: $preferences.blurAllMedia) {
|
Toggle(isOn: $preferences.blurAllMedia) {
|
||||||
Text("Blur All Media")
|
Text("Blur All Media")
|
||||||
|
@ -63,7 +54,7 @@ struct BehaviorPrefsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var linksSection: some View {
|
var section3: some View {
|
||||||
Section(header: Text("LINKS")) {
|
Section(header: Text("LINKS")) {
|
||||||
Toggle(isOn: $preferences.openLinksInApps) {
|
Toggle(isOn: $preferences.openLinksInApps) {
|
||||||
Text("Open Links in Apps")
|
Text("Open Links in Apps")
|
||||||
|
|
|
@ -32,8 +32,6 @@ protocol TuskerNavigationDelegate {
|
||||||
|
|
||||||
func reply(to statusID: String)
|
func reply(to statusID: String)
|
||||||
|
|
||||||
func reply(to statusID: String, mentioningAcct: String?)
|
|
||||||
|
|
||||||
func largeImage(_ image: UIImage, description: String?, sourceView: UIImageView) -> LargeImageViewController
|
func largeImage(_ image: UIImage, description: String?, sourceView: UIImageView) -> LargeImageViewController
|
||||||
|
|
||||||
func largeImage(gifData: Data, description: String?, sourceView: UIImageView) -> LargeImageViewController
|
func largeImage(gifData: Data, description: String?, sourceView: UIImageView) -> LargeImageViewController
|
||||||
|
@ -127,19 +125,15 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
||||||
compose(mentioning: nil)
|
compose(mentioning: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func compose(mentioning: String?) {
|
func compose(mentioning: String? = nil) {
|
||||||
let compose = ComposeViewController(mentioningAcct: mentioning)
|
let compose = ComposeViewController( mentioningAcct: mentioning)
|
||||||
let vc = UINavigationController(rootViewController: compose)
|
let vc = UINavigationController(rootViewController: compose)
|
||||||
vc.presentationController?.delegate = compose
|
vc.presentationController?.delegate = compose
|
||||||
present(vc, animated: true)
|
present(vc, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func reply(to statusID: String) {
|
func reply(to statusID: String) {
|
||||||
reply(to: statusID, mentioningAcct: nil)
|
let compose = ComposeViewController(inReplyTo: statusID)
|
||||||
}
|
|
||||||
|
|
||||||
func reply(to statusID: String, mentioningAcct: String?) {
|
|
||||||
let compose = ComposeViewController(inReplyTo: statusID, mentioningAcct: mentioningAcct)
|
|
||||||
let vc = UINavigationController(rootViewController: compose)
|
let vc = UINavigationController(rootViewController: compose)
|
||||||
vc.presentationController?.delegate = compose
|
vc.presentationController?.delegate = compose
|
||||||
present(vc, animated: true)
|
present(vc, animated: true)
|
||||||
|
|
|
@ -112,16 +112,6 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func reply() {
|
|
||||||
if Preferences.shared.mentionReblogger,
|
|
||||||
let rebloggerID = rebloggerID,
|
|
||||||
let rebloggerAccount = MastodonCache.account(for: rebloggerID) {
|
|
||||||
delegate?.reply(to: statusID, mentioningAcct: rebloggerAccount.acct)
|
|
||||||
} else {
|
|
||||||
delegate?.reply(to: statusID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
updateTimestampWorkItem?.cancel()
|
updateTimestampWorkItem?.cancel()
|
||||||
|
@ -134,10 +124,6 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
delegate?.selected(account: rebloggerID)
|
delegate?.selected(account: rebloggerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func replyPressed() {
|
|
||||||
reply()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func getStatusCellPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> BaseStatusTableViewCell.PreviewProviders? {
|
override func getStatusCellPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> BaseStatusTableViewCell.PreviewProviders? {
|
||||||
return (
|
return (
|
||||||
content: { ConversationTableViewController(for: self.statusID, state: self.statusState.copy()) },
|
content: { ConversationTableViewController(for: self.statusID, state: self.statusState.copy()) },
|
||||||
|
@ -219,7 +205,7 @@ extension TimelineStatusTableViewCell: TableViewSwipeActionProvider {
|
||||||
func trailingSwipeActionsConfiguration() -> UISwipeActionsConfiguration? {
|
func trailingSwipeActionsConfiguration() -> UISwipeActionsConfiguration? {
|
||||||
let reply = UIContextualAction(style: .normal, title: "Reply") { (action, view, completion) in
|
let reply = UIContextualAction(style: .normal, title: "Reply") { (action, view, completion) in
|
||||||
completion(true)
|
completion(true)
|
||||||
self.reply()
|
self.delegate?.reply(to: self.statusID)
|
||||||
}
|
}
|
||||||
reply.image = UIImage(systemName: "arrowshape.turn.up.left.fill")
|
reply.image = UIImage(systemName: "arrowshape.turn.up.left.fill")
|
||||||
reply.backgroundColor = tintColor
|
reply.backgroundColor = tintColor
|
||||||
|
|
Loading…
Reference in New Issue