diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj
index 54c682956..83cbb62ac 100644
--- a/Mastodon.xcodeproj/project.pbxproj
+++ b/Mastodon.xcodeproj/project.pbxproj
@@ -115,9 +115,7 @@
DB0009A626AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; settings = {ATTRIBUTES = (no_codegen, ); }; };
DB0009A726AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; };
DB00CA972632DDB600A54956 /* CommonOSLog in Frameworks */ = {isa = PBXBuildFile; productRef = DB00CA962632DDB600A54956 /* CommonOSLog */; };
- DB0140BD25C40D7500F9F3CF /* CommonOSLog in Frameworks */ = {isa = PBXBuildFile; productRef = DB0140BC25C40D7500F9F3CF /* CommonOSLog */; };
DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0140CE25C42AEE00F9F3CF /* OSLog.swift */; };
- DB01E23326A98F0900C3965B /* MastodonMeta in Frameworks */ = {isa = PBXBuildFile; productRef = DB01E23226A98F0900C3965B /* MastodonMeta */; };
DB01E23526A98F0900C3965B /* MetaTextKit in Frameworks */ = {isa = PBXBuildFile; productRef = DB01E23426A98F0900C3965B /* MetaTextKit */; };
DB023D26279FFB0A005AC798 /* ShareActivityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */; };
DB023D2827A0FABD005AC798 /* NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */; };
@@ -130,6 +128,8 @@
DB029E95266A20430062874E /* MastodonAuthenticationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB029E94266A20430062874E /* MastodonAuthenticationController.swift */; };
DB02CDAB26256A9500D0A2AF /* ThreadReplyLoaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB02CDAA26256A9500D0A2AF /* ThreadReplyLoaderTableViewCell.swift */; };
DB02CDBF2625AE5000D0A2AF /* AdaptiveUserInterfaceStyleBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB02CDBE2625AE5000D0A2AF /* AdaptiveUserInterfaceStyleBarButtonItem.swift */; };
+ DB02EA0B280D180D00E751C5 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = DB02EA0A280D180D00E751C5 /* KeychainAccess */; };
+ DB02EA0D280D184B00E751C5 /* CommonOSLog in Frameworks */ = {isa = PBXBuildFile; productRef = DB02EA0C280D184B00E751C5 /* CommonOSLog */; };
DB03A793272A7E5700EE37C5 /* SidebarListHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB03A792272A7E5700EE37C5 /* SidebarListHeaderView.swift */; };
DB03A795272A981400EE37C5 /* ContentSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB03A794272A981400EE37C5 /* ContentSplitViewController.swift */; };
DB03F7F32689AEA3007B274C /* ComposeRepliedToStatusContentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB03F7F22689AEA3007B274C /* ComposeRepliedToStatusContentTableViewCell.swift */; };
@@ -347,7 +347,6 @@
DB6804872637CD4C00430867 /* AppShared.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DB68047F2637CD4C00430867 /* AppShared.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DB6804D12637CE4700430867 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB6804D02637CE4700430867 /* UserDefaults.swift */; };
DB6804FD2637CFEC00430867 /* AppSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB6804FC2637CFEC00430867 /* AppSecret.swift */; };
- DB6805102637D0F800430867 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = DB68050F2637D0F800430867 /* KeychainAccess */; };
DB68586425E619B700F0A850 /* NSKeyValueObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */; };
DB68A04A25E9027700CFDF14 /* AdaptiveStatusBarStyleNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB68A04925E9027700CFDF14 /* AdaptiveStatusBarStyleNavigationController.swift */; };
DB68A05D25E9055900CFDF14 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = DB68A05C25E9055900CFDF14 /* Settings.bundle */; };
@@ -1372,7 +1371,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- DB0140BD25C40D7500F9F3CF /* CommonOSLog in Frameworks */,
DB9A487E2603456B008B817C /* UITextView+Placeholder in Frameworks */,
2D939AC825EE14620076FA61 /* CropViewController in Frameworks */,
DBB525082611EAC0002F1F29 /* Tabman in Frameworks */,
@@ -1382,10 +1380,10 @@
DBAC6483267D0B21007FE9FD /* DifferenceKit in Frameworks */,
DB552D4F26BBD10C00E481F6 /* OrderedCollections in Frameworks */,
2D61336925C18A4F00CAE157 /* AlamofireNetworkActivityIndicator in Frameworks */,
- DB01E23326A98F0900C3965B /* MastodonMeta in Frameworks */,
DBAC64A1267E6D02007FE9FD /* Fuzi in Frameworks */,
DB3D0FF325BAA61700EAA174 /* AlamofireImage in Frameworks */,
DBAC649E267DFE43007FE9FD /* DiffableDataSources in Frameworks */,
+ DB02EA0D280D184B00E751C5 /* CommonOSLog in Frameworks */,
2D5981BA25E4D7F8000FB903 /* ThirdPartyMailer in Frameworks */,
87FFDA5D898A5C42ADCB35E7 /* Pods_Mastodon.framework in Frameworks */,
DBF7A0FC26830C33004176A2 /* FPSIndicator in Frameworks */,
@@ -1415,7 +1413,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- DB6805102637D0F800430867 /* KeychainAccess in Frameworks */,
+ DB02EA0B280D180D00E751C5 /* KeychainAccess in Frameworks */,
EE93E8E8F9E0C39EAAEBD92F /* Pods_AppShared.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3303,7 +3301,6 @@
DB3D0FF225BAA61700EAA174 /* AlamofireImage */,
5D526FE125BE9AC400460CB9 /* MastodonSDK */,
2D61336825C18A4F00CAE157 /* AlamofireNetworkActivityIndicator */,
- DB0140BC25C40D7500F9F3CF /* CommonOSLog */,
2D5981B925E4D7F8000FB903 /* ThirdPartyMailer */,
2D939AC725EE14620076FA61 /* CropViewController */,
DB9A487D2603456B008B817C /* UITextView+Placeholder */,
@@ -3312,10 +3309,10 @@
DBAC649D267DFE43007FE9FD /* DiffableDataSources */,
DBAC64A0267E6D02007FE9FD /* Fuzi */,
DBF7A0FB26830C33004176A2 /* FPSIndicator */,
- DB01E23226A98F0900C3965B /* MastodonMeta */,
DB01E23426A98F0900C3965B /* MetaTextKit */,
DB552D4E26BBD10C00E481F6 /* OrderedCollections */,
DBA5A52E26F07ED800CACBAA /* PanModal */,
+ DB02EA0C280D184B00E751C5 /* CommonOSLog */,
);
productName = Mastodon;
productReference = DB427DD225BAA00100D1B89D /* Mastodon.app */;
@@ -3376,7 +3373,7 @@
);
name = AppShared;
packageProductDependencies = (
- DB68050F2637D0F800430867 /* KeychainAccess */,
+ DB02EA0A280D180D00E751C5 /* KeychainAccess */,
);
productName = AppShared;
productReference = DB68047F2637CD4C00430867 /* AppShared.framework */;
@@ -5421,7 +5418,7 @@
repositoryURL = "https://github.com/TwidereProject/MetaTextKit.git";
requirement = {
kind = exactVersion;
- version = 2.2.1;
+ version = 2.2.2;
};
};
DB0E2D2C26833FF600865C3C /* XCRemoteSwiftPackageReference "Nuke-FLAnimatedImage-Plugin" */ = {
@@ -5539,21 +5536,21 @@
package = DB0140BB25C40D7500F9F3CF /* XCRemoteSwiftPackageReference "CommonOSLog" */;
productName = CommonOSLog;
};
- DB0140BC25C40D7500F9F3CF /* CommonOSLog */ = {
- isa = XCSwiftPackageProductDependency;
- package = DB0140BB25C40D7500F9F3CF /* XCRemoteSwiftPackageReference "CommonOSLog" */;
- productName = CommonOSLog;
- };
- DB01E23226A98F0900C3965B /* MastodonMeta */ = {
- isa = XCSwiftPackageProductDependency;
- package = DB01E23126A98F0900C3965B /* XCRemoteSwiftPackageReference "MetaTextKit" */;
- productName = MastodonMeta;
- };
DB01E23426A98F0900C3965B /* MetaTextKit */ = {
isa = XCSwiftPackageProductDependency;
package = DB01E23126A98F0900C3965B /* XCRemoteSwiftPackageReference "MetaTextKit" */;
productName = MetaTextKit;
};
+ DB02EA0A280D180D00E751C5 /* KeychainAccess */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = DB6804722637CC1200430867 /* XCRemoteSwiftPackageReference "KeychainAccess" */;
+ productName = KeychainAccess;
+ };
+ DB02EA0C280D184B00E751C5 /* CommonOSLog */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = DB0140BB25C40D7500F9F3CF /* XCRemoteSwiftPackageReference "CommonOSLog" */;
+ productName = CommonOSLog;
+ };
DB0C946426A6FD4D0088FB11 /* AlamofireImage */ = {
isa = XCSwiftPackageProductDependency;
package = DB3D0FF125BAA61700EAA174 /* XCRemoteSwiftPackageReference "AlamofireImage" */;
@@ -5573,11 +5570,6 @@
package = DB552D4D26BBD10C00E481F6 /* XCRemoteSwiftPackageReference "swift-collections" */;
productName = OrderedCollections;
};
- DB68050F2637D0F800430867 /* KeychainAccess */ = {
- isa = XCSwiftPackageProductDependency;
- package = DB6804722637CC1200430867 /* XCRemoteSwiftPackageReference "KeychainAccess" */;
- productName = KeychainAccess;
- };
DB6D9F41263527CE008423CD /* AlamofireImage */ = {
isa = XCSwiftPackageProductDependency;
package = DB3D0FF125BAA61700EAA174 /* XCRemoteSwiftPackageReference "AlamofireImage" */;
diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
index e45da3c0d..0d22a2264 100644
--- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -9,7 +9,7 @@
isShown
orderHint
- 4
+ 5
CoreDataStack.xcscheme_^#shared#^_
@@ -19,7 +19,7 @@
Mastodon - RTL.xcscheme_^#shared#^_
orderHint
- 19
+ 20
Mastodon - Release.xcscheme_^#shared#^_
@@ -29,12 +29,12 @@
Mastodon - Snapshot.xcscheme_^#shared#^_
orderHint
- 2
+ 3
Mastodon - ar.xcscheme
orderHint
- 3
+ 4
Mastodon - ar.xcscheme_^#shared#^_
@@ -109,7 +109,7 @@
MastodonIntent.xcscheme_^#shared#^_
orderHint
- 33
+ 26
MastodonIntents.xcscheme_^#shared#^_
@@ -124,12 +124,12 @@
NotificationService.xcscheme_^#shared#^_
orderHint
- 32
+ 23
ShareActionExtension.xcscheme_^#shared#^_
orderHint
- 31
+ 24
SuppressBuildableAutocreation
diff --git a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 11d453883..8dd69150f 100644
--- a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
"state": {
"branch": null,
- "revision": "f82c23a8a7ef8dc1a49a8bfc6a96883e79121864",
- "version": "5.5.0"
+ "revision": "354dda32d89fc8cd4f5c46487f64957d355f53d8",
+ "version": "5.6.1"
}
},
{
@@ -96,8 +96,8 @@
"repositoryURL": "https://github.com/TwidereProject/MetaTextKit.git",
"state": {
"branch": null,
- "revision": "3ea336d3de7938dc112084c596a646e697b0feee",
- "version": "2.2.1"
+ "revision": "8074400b3819ef0395550082e6e8e960ef22e1f3",
+ "version": "2.2.2"
}
},
{
@@ -105,8 +105,8 @@
"repositoryURL": "https://github.com/kean/Nuke.git",
"state": {
"branch": null,
- "revision": "0db18dd34998cca18e9a28bcee136f84518007a0",
- "version": "10.4.1"
+ "revision": "78fa963b8491fc520791d8c2a509f1b8593d8aae",
+ "version": "10.7.1"
}
},
{
@@ -141,8 +141,8 @@
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
"state": {
"branch": null,
- "revision": "2c53f531f1bedd253f55d85105409c28ed4a922c",
- "version": "5.12.3"
+ "revision": "2e63d0061da449ad0ed130768d05dceb1496de44",
+ "version": "5.12.5"
}
},
{
@@ -177,8 +177,8 @@
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git",
"state": {
"branch": null,
- "revision": "2e09be8af614401bc9f87d40093ec19ce56ccaf2",
- "version": "0.1.3"
+ "revision": "f2616860a41f9d9932da412a8978fec79c06fe24",
+ "version": "0.1.4"
}
},
{
diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift
index eab85e95e..36ceb6dd6 100644
--- a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift
+++ b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift
@@ -286,24 +286,8 @@ extension DataSourceFacade {
try await dependency.context.managedObjectContext.perform {
guard let _status = status.object(in: dependency.context.managedObjectContext) else { return }
let status = _status.reblog ?? _status
-
- let allToggled = status.isContentSensitiveToggled && status.isMediaSensitiveToggled
-
- status.update(isContentSensitiveToggled: !allToggled)
- status.update(isMediaSensitiveToggled: !allToggled)
+ status.update(isSensitiveToggled: !status.isSensitiveToggled)
}
}
-// static func responseToToggleMediaSensitiveAction(
-// dependency: NeedsDependency,
-// status: ManagedObjectRecord
-// ) async throws {
-// try await dependency.context.managedObjectContext.perform {
-// guard let _status = status.object(in: dependency.context.managedObjectContext) else { return }
-// let status = _status.reblog ?? _status
-//
-// status.update(isMediaSensitiveToggled: !status.isMediaSensitiveToggled)
-// }
-// }
-
}
diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift
index 0924028ff..f6e58673b 100644
--- a/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift
+++ b/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift
@@ -135,7 +135,7 @@ extension NotificationTableViewCellDelegate where Self: DataSourceProvider & Med
let status = _status.reblog ?? _status
return NotificationMediaTransitionContext(
status: .init(objectID: status.objectID),
- needsToggleMediaSensitive: status.isMediaSensitiveToggled ? !status.sensitive : status.sensitive
+ needsToggleMediaSensitive: status.isSensitiveToggled ? !status.sensitive : status.sensitive
)
}
@@ -187,7 +187,7 @@ extension NotificationTableViewCellDelegate where Self: DataSourceProvider & Med
let status = _status.reblog ?? _status
return NotificationMediaTransitionContext(
status: .init(objectID: status.objectID),
- needsToggleMediaSensitive: status.isMediaSensitiveToggled ? !status.sensitive : status.sensitive
+ needsToggleMediaSensitive: status.isMediaSensitive ? !status.isSensitiveToggled : false
)
}
diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift
index d14b5c346..9e5838e77 100644
--- a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift
+++ b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift
@@ -143,12 +143,7 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & MediaPrev
return
}
- let managedObjectContext = self.context.managedObjectContext
- let needsToggleMediaSensitive: Bool = try await managedObjectContext.perform {
- guard let _status = status.object(in: managedObjectContext) else { return false }
- let status = _status.reblog ?? _status
- return status.isMediaSensitiveToggled ? !status.sensitive : status.sensitive
- }
+ let needsToggleMediaSensitive = await !statusView.viewModel.isMediaReveal
guard !needsToggleMediaSensitive else {
try await DataSourceFacade.responseToToggleSensitiveAction(
diff --git a/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift b/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift
index cba1fcf6d..02f9ad5a4 100644
--- a/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift
+++ b/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift
@@ -62,14 +62,14 @@ extension MediaView {
{
let placeholder = UIImage.placeholder(color: .systemGray6)
let request = URLRequest(url: url)
- ImageDownloader.default.download(request) { response in
+ ImageDownloader.default.download(request, completion: { response in
switch response.result {
case .success(let image):
configuration.previewImage = image
- case .failure(let error):
+ case .failure:
configuration.previewImage = placeholder
}
- }
+ })
}
if let assetURL = configuration.assetURL,
@@ -84,7 +84,7 @@ extension MediaView {
.store(in: &configuration.blurhashImageDisposeBag)
}
- configuration.isReveal = status.sensitive ? status.isMediaSensitiveToggled : true
+ configuration.isReveal = status.isMediaSensitive ? status.isSensitiveToggled : true
return configuration
}
diff --git a/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift b/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift
index 1a90c69af..ab4fea1ab 100644
--- a/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift
+++ b/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift
@@ -156,7 +156,6 @@ extension StatusView {
.map { _ in author.avatarImageURL() }
.assign(to: \.authorAvatarImageURL, on: viewModel)
.store(in: &disposeBag)
-
// author name
Publishers.CombineLatest(
author.publisher(for: \.displayName),
@@ -268,25 +267,19 @@ extension StatusView {
.assign(to: \.visibility, on: viewModel)
.store(in: &disposeBag)
// sensitive
- status.publisher(for: \.isContentSensitiveToggled)
- .assign(to: \.isContentSensitiveToggled, on: viewModel)
+ viewModel.isContentSensitive = status.isContentSensitive
+ status.publisher(for: \.isSensitiveToggled)
+ .assign(to: \.isSensitiveToggled, on: viewModel)
.store(in: &disposeBag)
-
-
-// viewModel.source = status.source
}
private func configureMedia(status: Status) {
let status = status.reblog ?? status
- viewModel.isMediaSensitive = status.sensitive && !status.attachments.isEmpty // some servers set media sensitive even empty attachments
+ viewModel.isMediaSensitive = status.isMediaSensitive
let configurations = MediaView.configuration(status: status)
viewModel.mediaViewConfigurations = configurations
-
- status.publisher(for: \.isMediaSensitiveToggled)
- .assign(to: \.isMediaSensitiveToggled, on: viewModel)
- .store(in: &disposeBag)
}
private func configurePoll(status: Status) {
diff --git a/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift
index a1033f052..a3315211e 100644
--- a/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift
+++ b/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift
@@ -61,7 +61,7 @@ extension StatusTableViewCell {
statusView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16),
containerViewLeadingLayoutConstraint,
containerViewTrailingLayoutConstraint,
- statusView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
+ contentView.bottomAnchor.constraint(equalTo: statusView.bottomAnchor, constant: 10),
])
statusView.setup(style: .inline)
updateContainerViewMarginConstraints()
diff --git a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift
index e27cc2dd3..115175800 100644
--- a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift
+++ b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift
@@ -112,7 +112,7 @@ extension StatusThreadRootTableViewCell {
statusView.statusMetricView
]
- if !statusView.viewModel.isSensitive {
+ if !statusView.viewModel.isMediaSensitive {
elements.removeAll(where: { $0 === statusView.contentSensitiveeToggleButton })
}
diff --git a/MastodonSDK/Package.swift b/MastodonSDK/Package.swift
index dd562f147..ed4a13d55 100644
--- a/MastodonSDK/Package.swift
+++ b/MastodonSDK/Package.swift
@@ -32,7 +32,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-nio.git", from: "1.0.0"),
.package(url: "https://github.com/kean/Nuke.git", from: "10.3.1"),
.package(url: "https://github.com/Flipboard/FLAnimatedImage.git", from: "1.0.0"),
- .package(url: "https://github.com/TwidereProject/MetaTextKit.git", .exact("2.2.1")),
+ .package(url: "https://github.com/TwidereProject/MetaTextKit.git", .exact("2.2.2")),
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.4.0"),
.package(url: "https://github.com/Alamofire/AlamofireImage.git", from: "4.1.0"),
.package(name: "NukeFLAnimatedImagePlugin", url: "https://github.com/kean/Nuke-FLAnimatedImage-Plugin.git", from: "8.0.0"),
@@ -94,7 +94,6 @@ let package = Package(
.product(name: "Alamofire", package: "Alamofire"),
.product(name: "AlamofireImage", package: "AlamofireImage"),
.product(name: "MetaTextKit", package: "MetaTextKit"),
- .product(name: "MastodonMeta", package: "MetaTextKit"),
.product(name: "FLAnimatedImage", package: "FLAnimatedImage"),
]
),
diff --git a/MastodonSDK/Sources/CoreDataStack/CoreData.xcdatamodeld/CoreData 3.xcdatamodel/contents b/MastodonSDK/Sources/CoreDataStack/CoreData.xcdatamodeld/CoreData 3.xcdatamodel/contents
index a6f0ee0ce..16a1c7c84 100644
--- a/MastodonSDK/Sources/CoreDataStack/CoreData.xcdatamodeld/CoreData 3.xcdatamodel/contents
+++ b/MastodonSDK/Sources/CoreDataStack/CoreData.xcdatamodeld/CoreData 3.xcdatamodel/contents
@@ -1,5 +1,5 @@
-
+
@@ -185,8 +185,7 @@
-
-
+
@@ -262,7 +261,7 @@
-
+
diff --git a/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/Status.swift b/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/Status.swift
index d17d1c616..0c7291913 100644
--- a/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/Status.swift
+++ b/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/Status.swift
@@ -42,9 +42,7 @@ public final class Status: NSManagedObject {
@NSManaged public private(set) var spoilerText: String?
// sourcery: autoUpdatableObject
- @NSManaged public private(set) var isContentSensitiveToggled: Bool
- // sourcery: autoUpdatableObject
- @NSManaged public private(set) var isMediaSensitiveToggled: Bool
+ @NSManaged public private(set) var isSensitiveToggled: Bool
@NSManaged public private(set) var application: Application?
@@ -432,14 +430,9 @@ extension Status: AutoUpdatableObject {
self.spoilerText = spoilerText
}
}
- public func update(isContentSensitiveToggled: Bool) {
- if self.isContentSensitiveToggled != isContentSensitiveToggled {
- self.isContentSensitiveToggled = isContentSensitiveToggled
- }
- }
- public func update(isMediaSensitiveToggled: Bool) {
- if self.isMediaSensitiveToggled != isMediaSensitiveToggled {
- self.isMediaSensitiveToggled = isMediaSensitiveToggled
+ public func update(isSensitiveToggled: Bool) {
+ if self.isSensitiveToggled != isSensitiveToggled {
+ self.isSensitiveToggled = isSensitiveToggled
}
}
public func update(reblogsCount: Int64) {
diff --git a/MastodonSDK/Sources/MastodonUI/Extension/CoreDataStack/MastodonStatus.swift b/MastodonSDK/Sources/MastodonUI/Extension/CoreDataStack/MastodonStatus.swift
new file mode 100644
index 000000000..b7d33712f
--- /dev/null
+++ b/MastodonSDK/Sources/MastodonUI/Extension/CoreDataStack/MastodonStatus.swift
@@ -0,0 +1,28 @@
+//
+// MastodonStatus.swift
+//
+//
+// Created by MainasuK on 2022-4-18.
+//
+
+import Foundation
+import CoreDataStack
+
+extension Status {
+
+ // mark content sensitive when status contains spoilerText
+ public var isContentSensitive: Bool {
+ if let spoilerText = spoilerText, !spoilerText.isEmpty {
+ return true
+ } else {
+ return false
+ }
+ }
+
+ // mark media sensitive when `isContentSensitive` or media marked sensitive
+ public var isMediaSensitive: Bool {
+ // some servers set media sensitive even empty attachments
+ return isContentSensitive || (sensitive && !attachments.isEmpty)
+ }
+
+}
diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift
index 67cefa475..ea80a61d8 100644
--- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift
+++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift
@@ -74,11 +74,9 @@ extension StatusView {
// Sensitive
@Published public var isContentSensitive: Bool = false
- @Published public var isContentSensitiveToggled: Bool = false
@Published public var isMediaSensitive: Bool = false
- @Published public var isMediaSensitiveToggled: Bool = false
-
- @Published public var isSensitive: Bool = false // isContentSensitive || isMediaSensitive
+ @Published public var isSensitiveToggled = false
+
@Published public var isContentReveal: Bool = true
@Published public var isMediaReveal: Bool = true
@@ -130,9 +128,8 @@ extension StatusView {
authorAvatarImageURL = nil
isContentSensitive = false
- isContentSensitiveToggled = false
isMediaSensitive = false
- isMediaSensitiveToggled = false
+ isSensitiveToggled = false
activeFilters = []
filterContext = nil
@@ -161,28 +158,18 @@ extension StatusView {
$spoilerContent
.map { $0 != nil }
.assign(to: &$isContentSensitive)
- // isSensitive
- Publishers.CombineLatest(
+ // isReveal
+ Publishers.CombineLatest3(
$isContentSensitive,
- $isMediaSensitive
- )
- .map { $0 || $1 }
- .assign(to: &$isSensitive)
- // $isContentReveal
- Publishers.CombineLatest(
- $isContentSensitive,
- $isContentSensitiveToggled
- )
- .map { $0 ? $1 : true }
- .assign(to: &$isContentReveal)
- // $isMediaReveal
- Publishers.CombineLatest(
$isMediaSensitive,
- $isMediaSensitiveToggled
+ $isSensitiveToggled
)
- .map { $1 ? !$0 : $0 }
- .map { !$0 }
- .assign(to: &$isMediaReveal)
+ .sink { [weak self] isContentSensitive, isMediaSensitive, isSensitiveToggled in
+ guard let self = self else { return }
+ self.isContentReveal = isContentSensitive ? isSensitiveToggled : true
+ self.isMediaReveal = isMediaSensitive ? isSensitiveToggled : true
+ }
+ .store(in: &disposeBag)
}
}
}
@@ -326,29 +313,22 @@ extension StatusView.ViewModel {
}
.store(in: &disposeBag)
- $isSensitive
+ $isMediaSensitive
.sink { isSensitive in
guard isSensitive else { return }
statusView.setContentSensitiveeToggleButtonDisplay()
}
.store(in: &disposeBag)
- // There are 2 conditions:
- // 1. The content may non-sensitive with sensitive media
- // 2. The content and media both senstivie
- Publishers.CombineLatest(
- $isContentSensitiveToggled,
- $isMediaSensitiveToggled
- )
- .map { $0 || $1 }
- .sink { isSensitiveToggled in
- // The button indicator go-to state for button action direction
- // eye: when media is hidden
- // eye-slash: when media display
- let image = isSensitiveToggled ? UIImage(systemName: "eye.slash.fill") : UIImage(systemName: "eye.fill")
- statusView.contentSensitiveeToggleButton.setImage(image, for: .normal)
- }
- .store(in: &disposeBag)
+ $isSensitiveToggled
+ .sink { isSensitiveToggled in
+ // The button indicator go-to state for button action direction
+ // eye: when media is hidden
+ // eye-slash: when media display
+ let image = isSensitiveToggled ? UIImage(systemName: "eye.slash.fill") : UIImage(systemName: "eye.fill")
+ statusView.contentSensitiveeToggleButton.setImage(image, for: .normal)
+ }
+ .store(in: &disposeBag)
}
private func bindMedia(statusView: StatusView) {
diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift
index eb3a69354..7b96fe0b5 100644
--- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift
+++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift
@@ -508,6 +508,7 @@ extension StatusView.Style {
// status content
statusView.contentContainer.addArrangedSubview(statusView.contentMetaText.textView)
+ statusView.containerStackView.setCustomSpacing(16, after: statusView.contentMetaText.textView)
statusView.spoilerOverlayView.translatesAutoresizingMaskIntoConstraints = false
statusView.containerStackView.addSubview(statusView.spoilerOverlayView)
diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift b/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift
index 449254d20..c3a9b96f3 100644
--- a/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift
+++ b/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift
@@ -114,7 +114,7 @@ extension ActionToolbarContainer {
container.addArrangedSubview(favoriteButton)
container.addArrangedSubview(shareButton)
NSLayoutConstraint.activate([
- replyButton.heightAnchor.constraint(equalToConstant: 44).priority(.defaultHigh),
+ replyButton.heightAnchor.constraint(equalToConstant: 36).priority(.defaultHigh),
replyButton.heightAnchor.constraint(equalTo: reblogButton.heightAnchor).priority(.defaultHigh),
replyButton.heightAnchor.constraint(equalTo: favoriteButton.heightAnchor).priority(.defaultHigh),
replyButton.heightAnchor.constraint(equalTo: shareButton.heightAnchor).priority(.defaultHigh),
diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift b/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift
index 320c1e903..a45e8ef6a 100644
--- a/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift
+++ b/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift
@@ -75,9 +75,9 @@ extension ProfileStatusDashboardView {
tapGestureRecognizer.addTarget(self, action: #selector(ProfileStatusDashboardView.tapGestureRecognizerHandler(_:)))
meterView.addGestureRecognizer(tapGestureRecognizer)
}
-
- followingDashboardMeterView.accessibilityHint = "Double tap to open the list" // TODO: i18n
- followersDashboardMeterView.accessibilityHint = "Double tap to open the list"
+
+ followingDashboardMeterView.accessibilityHint = L10n.Scene.Profile.Accessibility.doubleTapToOpenTheList
+ followersDashboardMeterView.accessibilityHint = L10n.Scene.Profile.Accessibility.doubleTapToOpenTheList
}
}