mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Implement quiet public as a default post visibility option
Update code to handle the additional .unlisted post visibility option. And make sure to fetch full account info, which includes any custom privacy settings. Fixes #1395 [BUG] Implement Quit Public post privacy like the Android app
This commit is contained in:
parent
87522825f5
commit
44ac523f33
@ -873,10 +873,7 @@
|
||||
"custom": "Custom"
|
||||
},
|
||||
"default_post_visibility": {
|
||||
"title": "Default Post Visibility",
|
||||
"public": "Public",
|
||||
"followers_only": "Followers Only",
|
||||
"only_people_mentioned": "Only People Mentioned"
|
||||
"title": "Default Post Visibility"
|
||||
},
|
||||
"manually_approve_follow_requests": "Manually Approve Follow Requests",
|
||||
"show_followers_and_following": "Show Followers & Following",
|
||||
|
@ -25,13 +25,13 @@ class PrivacySafetyViewModel: ObservableObject, PrivacySafetySettingApplicable {
|
||||
var title: String {
|
||||
switch self {
|
||||
case .public:
|
||||
return L10n.Scene.Settings.PrivacySafety.DefaultPostVisibility.public
|
||||
return L10n.Scene.Compose.Visibility.public
|
||||
case .unlisted:
|
||||
return L10n.Scene.Settings.PrivacySafety.DefaultPostVisibility.unlisted
|
||||
return L10n.Scene.Compose.Visibility.unlisted
|
||||
case .followersOnly:
|
||||
return L10n.Scene.Settings.PrivacySafety.DefaultPostVisibility.followersOnly
|
||||
return L10n.Scene.Compose.Visibility.private
|
||||
case .onlyPeopleMentioned:
|
||||
return L10n.Scene.Settings.PrivacySafety.DefaultPostVisibility.onlyPeopleMentioned
|
||||
return L10n.Scene.Compose.Visibility.direct
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,7 @@ import MastodonSDK
|
||||
extension APIService {
|
||||
public func accountInfo(_ authenticationBox: MastodonAuthenticationBox
|
||||
) async throws -> Mastodon.Entity.Account {
|
||||
let account = try await Mastodon.API.Account.accountInfo(
|
||||
session: session,
|
||||
domain: authenticationBox.domain,
|
||||
userID: authenticationBox.userID,
|
||||
authorization: authenticationBox.userAuthorization
|
||||
).singleOutput().value
|
||||
let account = try await Mastodon.API.Account.verifyCredentials(session: session, domain: authenticationBox.domain, authorization: authenticationBox.userAuthorization)
|
||||
|
||||
PersistenceManager.shared.cacheAccount(account, forUserID: authenticationBox.authentication.userIdentifier())
|
||||
|
||||
|
@ -1717,12 +1717,6 @@ public enum L10n {
|
||||
/// Privacy & Safety
|
||||
public static let title = L10n.tr("Localizable", "Scene.Settings.PrivacySafety.Title", fallback: "Privacy & Safety")
|
||||
public enum DefaultPostVisibility {
|
||||
/// Followers Only
|
||||
public static let followersOnly = L10n.tr("Localizable", "Scene.Settings.PrivacySafety.DefaultPostVisibility.FollowersOnly", fallback: "Followers Only")
|
||||
/// Only People Mentioned
|
||||
public static let onlyPeopleMentioned = L10n.tr("Localizable", "Scene.Settings.PrivacySafety.DefaultPostVisibility.OnlyPeopleMentioned", fallback: "Only People Mentioned")
|
||||
/// Public
|
||||
public static let `public` = L10n.tr("Localizable", "Scene.Settings.PrivacySafety.DefaultPostVisibility.Public", fallback: "Public")
|
||||
/// Default Post Visibility
|
||||
public static let title = L10n.tr("Localizable", "Scene.Settings.PrivacySafety.DefaultPostVisibility.Title", fallback: "Default Post Visibility")
|
||||
}
|
||||
|
@ -598,9 +598,6 @@ If you disagree with the policy for **%@**, you can go back and pick a different
|
||||
"Scene.Settings.Overview.SupportMastodon" = "Donate to Mastodon";
|
||||
"Scene.Settings.Overview.Title" = "Settings";
|
||||
"Scene.Settings.PrivacySafety.AppearInSearchEngines" = "Appear in Search Engines";
|
||||
"Scene.Settings.PrivacySafety.DefaultPostVisibility.FollowersOnly" = "Followers Only";
|
||||
"Scene.Settings.PrivacySafety.DefaultPostVisibility.OnlyPeopleMentioned" = "Only People Mentioned";
|
||||
"Scene.Settings.PrivacySafety.DefaultPostVisibility.Public" = "Public";
|
||||
"Scene.Settings.PrivacySafety.DefaultPostVisibility.Title" = "Default Post Visibility";
|
||||
"Scene.Settings.PrivacySafety.ManuallyApproveFollowRequests" = "Manually Approve Follow Requests";
|
||||
"Scene.Settings.PrivacySafety.Preset.Custom" = "Custom";
|
||||
|
@ -362,6 +362,7 @@ extension ComposeContentViewController {
|
||||
viewModel.$recentLanguages.assign(to: &composeContentToolbarViewModel.$recentLanguages)
|
||||
|
||||
// bind back to source due to visibility not update via delegate
|
||||
composeContentToolbarViewModel.visibility = viewModel.visibility
|
||||
composeContentToolbarViewModel.$visibility
|
||||
.dropFirst()
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
@ -156,7 +156,11 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
||||
guard let author = authenticationBox.cachedAccount else {
|
||||
return .public
|
||||
}
|
||||
return author.locked ? .private : .public
|
||||
if let defaultPrivacy = author.source?.privacy, let statusPrivacy = Mastodon.Entity.Status.Visibility(rawValue: defaultPrivacy.rawValue) {
|
||||
return statusPrivacy
|
||||
} else {
|
||||
return author.locked ? .private : .public
|
||||
}
|
||||
}()
|
||||
// set visibility for reply post
|
||||
if case .reply(let record) = destination {
|
||||
|
Loading…
x
Reference in New Issue
Block a user