diff --git a/Packages/Pachyderm/Sources/Pachyderm/Model/Preferences.swift b/Packages/Pachyderm/Sources/Pachyderm/Model/Preferences.swift
index 14e1e87d..c93701e8 100644
--- a/Packages/Pachyderm/Sources/Pachyderm/Model/Preferences.swift
+++ b/Packages/Pachyderm/Sources/Pachyderm/Model/Preferences.swift
@@ -11,6 +11,8 @@ public struct Preferences: Codable, Sendable {
public let postingDefaultVisibility: Visibility
public let postingDefaultSensitive: Bool
public let postingDefaultLanguage: String
+ // Whether posts federate or not (local-only) on Hometown
+ public let postingDefaultFederation: Bool?
public let readingExpandMedia: ExpandMedia
public let readingExpandSpoilers: Bool
public let readingAutoplayGifs: Bool
@@ -19,6 +21,7 @@ public struct Preferences: Codable, Sendable {
case postingDefaultVisibility = "posting:default:visibility"
case postingDefaultSensitive = "posting:default:sensitive"
case postingDefaultLanguage = "posting:default:language"
+ case postingDefaultFederation = "posting:default:federation"
case readingExpandMedia = "reading:expand:media"
case readingExpandSpoilers = "reading:expand:spoilers"
case readingAutoplayGifs = "reading:autoplay:gifs"
diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift
index f79f0613..8deb9778 100644
--- a/ShareExtension/ShareViewController.swift
+++ b/ShareExtension/ShareViewController.swift
@@ -64,7 +64,7 @@ class ShareViewController: UIViewController {
inReplyToID: nil,
visibility: visibility,
language: serverPrefs?.postingDefaultLanguage,
- localOnly: false
+ localOnly: !(serverPrefs?.postingDefaultFederation ?? true)
)
for attachment in await attachments {
diff --git a/Tusker/API/MastodonController.swift b/Tusker/API/MastodonController.swift
index 66f9c4a8..e3bd73c8 100644
--- a/Tusker/API/MastodonController.swift
+++ b/Tusker/API/MastodonController.swift
@@ -370,6 +370,7 @@ class MastodonController: ObservableObject {
}
accountPreferences!.serverDefaultLanguage = prefs.postingDefaultLanguage
accountPreferences!.serverDefaultVisibility = prefs.postingDefaultVisibility
+ accountPreferences!.serverDefaultFederation = prefs.postingDefaultFederation ?? true
}
private func updateActiveInstance(from instance: Instance) {
@@ -538,7 +539,7 @@ class MastodonController: ObservableObject {
} else {
Preferences.shared.defaultPostVisibility.resolved(withServerDefault: accountPreferences!.serverDefaultVisibility)
}
- var localOnly = false
+ var localOnly = instanceFeatures.localOnlyPosts && !accountPreferences!.serverDefaultFederation
var contentWarning = ""
if let inReplyToID = inReplyToID,
diff --git a/Tusker/CoreData/AccountPreferences.swift b/Tusker/CoreData/AccountPreferences.swift
index 98151be7..306927c0 100644
--- a/Tusker/CoreData/AccountPreferences.swift
+++ b/Tusker/CoreData/AccountPreferences.swift
@@ -24,6 +24,7 @@ public final class AccountPreferences: NSManagedObject {
@NSManaged public var accountID: String
@NSManaged var createdAt: Date
@NSManaged var pinnedTimelinesData: Data?
+ @NSManaged var serverDefaultFederation: Bool
@NSManaged var serverDefaultLanguage: String?
@NSManaged private var serverDefaultVisibilityString: String?
diff --git a/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents b/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents
index 64963f9f..efa6cd2a 100644
--- a/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents
+++ b/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents
@@ -33,6 +33,7 @@
+
@@ -157,4 +158,4 @@
-
+
\ No newline at end of file