Compare commits
No commits in common. "21874b09661eb613cb609706f391ee5ed26d057e" and "cf870916c9b477726c2a4516828c6dc1cbad550f" have entirely different histories.
21874b0966
...
cf870916c9
|
@ -16,7 +16,6 @@ public class Emoji: Codable {
|
|||
public let url: WebURL
|
||||
public let staticURL: WebURL
|
||||
public let visibleInPicker: Bool
|
||||
public let category: String?
|
||||
|
||||
public required init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
@ -25,7 +24,6 @@ public class Emoji: Codable {
|
|||
self.url = try container.decode(WebURL.self, forKey: .url)
|
||||
self.staticURL = try container.decode(WebURL.self, forKey: .staticURL)
|
||||
self.visibleInPicker = try container.decode(Bool.self, forKey: .visibleInPicker)
|
||||
self.category = try container.decodeIfPresent(String.self, forKey: .category)
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
|
@ -33,7 +31,6 @@ public class Emoji: Codable {
|
|||
case url
|
||||
case staticURL = "static_url"
|
||||
case visibleInPicker = "visible_in_picker"
|
||||
case category
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,19 +176,6 @@ struct ComposeAutocompleteEmojisView: View {
|
|||
@State private var emojis: [Emoji] = []
|
||||
@ScaledMetric private var emojiSize = 30
|
||||
|
||||
private var emojisBySection: [String: [Emoji]] {
|
||||
var values: [String: [Emoji]] = [:]
|
||||
for emoji in emojis {
|
||||
let key = emoji.category ?? ""
|
||||
if !values.keys.contains(key) {
|
||||
values[key] = [emoji]
|
||||
} else {
|
||||
values[key]!.append(emoji)
|
||||
}
|
||||
}
|
||||
return values
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
// When exapnded, the toggle button should be at the top. When collapsed, it should be centered.
|
||||
HStack(alignment: expanded ? .top : .center, spacing: 0) {
|
||||
|
@ -227,9 +214,7 @@ struct ComposeAutocompleteEmojisView: View {
|
|||
private var verticalGrid: some View {
|
||||
ScrollView {
|
||||
LazyVGrid(columns: [GridItem(.adaptive(minimum: emojiSize), spacing: 4)]) {
|
||||
ForEach(emojisBySection.keys.sorted(), id: \.self) { section in
|
||||
Section {
|
||||
ForEach(emojisBySection[section]!, id: \.shortcode) { emoji in
|
||||
ForEach(emojis, id: \.shortcode) { (emoji) in
|
||||
Button {
|
||||
uiState.currentInput?.autocomplete(with: ":\(emoji.shortcode):")
|
||||
} label: {
|
||||
|
@ -237,20 +222,6 @@ struct ComposeAutocompleteEmojisView: View {
|
|||
.frame(height: emojiSize)
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
if !section.isEmpty {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(section)
|
||||
.font(.caption)
|
||||
|
||||
Rectangle()
|
||||
.foregroundColor(Color(.separator))
|
||||
.frame(height: 0.5)
|
||||
}
|
||||
.padding(.top, 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.all, 8)
|
||||
}
|
||||
|
|
|
@ -355,17 +355,6 @@ extension MenuActionProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private func handleSuccess(title: String) {
|
||||
if let toastable = self.toastableViewController {
|
||||
var config = ToastConfiguration(title: title)
|
||||
config.systemImageName = "checkmark"
|
||||
config.dismissAutomaticallyAfter = 2
|
||||
DispatchQueue.main.async {
|
||||
toastable.showToast(configuration: config, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func relationshipAction(accountID: String, mastodonController: MastodonController, builder: @escaping @MainActor (RelationshipMO, MastodonController) -> UIMenuElement) -> UIDeferredMenuElement {
|
||||
return UIDeferredMenuElement.uncached({ @MainActor elementHandler in
|
||||
let relationship = Task {
|
||||
|
@ -391,26 +380,14 @@ extension MenuActionProvider {
|
|||
private func followAction(for relationship: RelationshipMO, mastodonController: MastodonController) -> UIMenuElement {
|
||||
let accountID = relationship.accountID
|
||||
let following = relationship.following
|
||||
let requested = relationship.requested
|
||||
let title = following ? "Unfollow" : requested ? "Cancel Request" : "Follow"
|
||||
let imageName = following || requested ? "person.badge.minus" : "person.badge.plus"
|
||||
return createAction(identifier: "follow", title: title, systemImageName: imageName) { [weak self] _ in
|
||||
let request = (following || requested ? Account.unfollow : Account.follow)(accountID)
|
||||
return createAction(identifier: "follow", title: following ? "Unfollow" : "Follow", systemImageName: following ? "person.badge.minus" : "person.badge.plus") { [weak self] _ in
|
||||
let request = (following ? Account.unfollow : Account.follow)(accountID)
|
||||
mastodonController.run(request) { response in
|
||||
switch response {
|
||||
case .failure(let error):
|
||||
self?.handleError(error, title: following ? "Error Unfollowing" : requested ? "Error Cancelinng Request" : "Error Following")
|
||||
self?.handleError(error, title: "Error \(following ? "Unf" : "F")ollowing")
|
||||
case .success(let relationship, _):
|
||||
mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||
if requested { // was requested, now cancelled
|
||||
self?.handleSuccess(title: "Follow Request Cancelled")
|
||||
} else if following { // was following, now unfollowed
|
||||
self?.handleSuccess(title: "Unfollowed")
|
||||
} else if relationship.followRequested { // was not following, now requested
|
||||
self?.handleSuccess(title: "Request Sent")
|
||||
} else { // was not following, not now requested, assume success
|
||||
self?.handleSuccess(title: "Followed")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -430,7 +407,6 @@ extension MenuActionProvider {
|
|||
self?.handleError(error, title: "Error \(block ? "B" : "Unb")locking")
|
||||
case .success(let relationship, _):
|
||||
mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||
self?.handleSuccess(title: "\(block ? "B" : "Unb")locked")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -439,11 +415,8 @@ extension MenuActionProvider {
|
|||
return { [weak self] (_: UIAction) in
|
||||
let req = block ? Client.block(domain: host) : Client.unblock(domain: host)
|
||||
mastodonController.run(req) { response in
|
||||
switch response {
|
||||
case .failure(let error):
|
||||
if case .failure(let error) = response {
|
||||
self?.handleError(error, title: "Error \(block ? "B" : "Unb")locking")
|
||||
case .success(_, _):
|
||||
self?.handleSuccess(title: "Domain \(block ? "B" : "Unb")locked")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +446,6 @@ extension MenuActionProvider {
|
|||
self?.handleError(error, title: "Error Unmuting")
|
||||
case .success(let relationship, _):
|
||||
mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||
self?.handleSuccess(title: "Unmuted")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ class ProfileHeaderView: UIView {
|
|||
@IBOutlet weak var moreButton: VisualEffectImageButton!
|
||||
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
||||
@IBOutlet weak var usernameLabel: UILabel!
|
||||
@IBOutlet weak var lockImageView: UIImageView!
|
||||
@IBOutlet weak var followsYouLabel: UILabel!
|
||||
@IBOutlet weak var noteTextView: StatusContentTextView!
|
||||
@IBOutlet weak var fieldsView: ProfileFieldsView!
|
||||
|
@ -118,7 +117,6 @@ class ProfileHeaderView: UIView {
|
|||
updateUIForPreferences()
|
||||
|
||||
usernameLabel.text = "@\(account.acct)"
|
||||
lockImageView.isHidden = !account.locked
|
||||
|
||||
updateImages(account: account)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vcl-Gl-kXl" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="144" y="206" width="254" height="29"/>
|
||||
<rect key="frame" x="144" y="206" width="254" height="32"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="24"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
@ -108,42 +108,32 @@
|
|||
<constraint firstItem="1O8-2P-Gbf" firstAttribute="width" secondItem="u4P-3i-gEq" secondAttribute="width" constant="-16" id="hnA-3G-B9B"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="jwU-EH-hmC">
|
||||
<rect key="frame" x="144" y="235" width="103.5" height="21"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1C3-Pd-QiL">
|
||||
<rect key="frame" x="0.0" y="1.5" width="81" height="18"/>
|
||||
<rect key="frame" x="144" y="238" width="254" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="15"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" image="lock.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="KNY-GD-beC">
|
||||
<rect key="frame" x="85" y="0.5" width="18.5" height="19.5"/>
|
||||
<color key="tintColor" systemColor="secondaryLabelColor"/>
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="light"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="jwU-EH-hmC" secondAttribute="trailing" constant="16" id="0VP-ri-Io5"/>
|
||||
<constraint firstItem="1C3-Pd-QiL" firstAttribute="leading" secondItem="wT9-2J-uSY" secondAttribute="trailing" constant="8" id="23a-no-Gjj"/>
|
||||
<constraint firstItem="dgG-dR-lSv" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="6Q0-q5-Ju6"/>
|
||||
<constraint firstItem="wT9-2J-uSY" firstAttribute="centerY" secondItem="dgG-dR-lSv" secondAttribute="bottom" id="7gb-T3-Xe7"/>
|
||||
<constraint firstItem="vcl-Gl-kXl" firstAttribute="top" secondItem="dgG-dR-lSv" secondAttribute="bottom" constant="8" symbolic="YES" id="7ss-Mf-YYH"/>
|
||||
<constraint firstItem="vcl-Gl-kXl" firstAttribute="leading" secondItem="wT9-2J-uSY" secondAttribute="trailing" constant="8" id="8ho-WU-MxW"/>
|
||||
<constraint firstItem="jwU-EH-hmC" firstAttribute="top" secondItem="vcl-Gl-kXl" secondAttribute="bottom" id="9lx-Fn-M0U"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="u4P-3i-gEq" secondAttribute="bottom" id="9zc-N2-mfI"/>
|
||||
<constraint firstItem="bRJ-Xf-kc9" firstAttribute="bottom" secondItem="dgG-dR-lSv" secondAttribute="bottom" constant="-8" id="AXS-bG-20Q"/>
|
||||
<constraint firstItem="jwU-EH-hmC" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="TkY-oK-if4" secondAttribute="bottom" id="HBR-rg-RxO"/>
|
||||
<constraint firstItem="1C3-Pd-QiL" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="TkY-oK-if4" secondAttribute="bottom" id="OpB-YM-gyu"/>
|
||||
<constraint firstItem="dgG-dR-lSv" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="VD1-yc-KSa"/>
|
||||
<constraint firstItem="wT9-2J-uSY" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="WNS-AR-ff2"/>
|
||||
<constraint firstItem="bRJ-Xf-kc9" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" constant="-8" id="ZB4-ys-9zP"/>
|
||||
<constraint firstItem="1C3-Pd-QiL" firstAttribute="top" secondItem="vcl-Gl-kXl" secondAttribute="bottom" id="d0z-X6-Sig"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="vcl-Gl-kXl" secondAttribute="trailing" constant="16" id="e38-Od-kPg"/>
|
||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="hgl-UR-o3W"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="dgG-dR-lSv" secondAttribute="trailing" id="j0d-hY-815"/>
|
||||
<constraint firstItem="jwU-EH-hmC" firstAttribute="leading" secondItem="wT9-2J-uSY" secondAttribute="trailing" constant="8" id="oGR-6M-gdd"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="1C3-Pd-QiL" secondAttribute="trailing" constant="16" id="pcH-vi-2zH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="u4P-3i-gEq" secondAttribute="trailing" id="ph6-NT-A02"/>
|
||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" relation="greaterThanOrEqual" secondItem="wT9-2J-uSY" secondAttribute="bottom" constant="8" id="tKQ-6d-Z55"/>
|
||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" relation="greaterThanOrEqual" secondItem="vcl-Gl-kXl" secondAttribute="bottom" constant="8" id="xDD-rx-gC0"/>
|
||||
|
@ -155,7 +145,6 @@
|
|||
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
||||
<outlet property="followsYouLabel" destination="UF8-nI-KVj" id="dTe-DQ-eJV"/>
|
||||
<outlet property="headerImageView" destination="dgG-dR-lSv" id="HXT-v4-2iX"/>
|
||||
<outlet property="lockImageView" destination="KNY-GD-beC" id="9EJ-iM-Eos"/>
|
||||
<outlet property="moreButton" destination="bRJ-Xf-kc9" id="zIN-pz-L7y"/>
|
||||
<outlet property="noteTextView" destination="1O8-2P-Gbf" id="yss-zZ-uQ5"/>
|
||||
<outlet property="pagesSegmentedControl" destination="n1M-vM-Cj0" id="TCU-ku-YZN"/>
|
||||
|
@ -166,7 +155,6 @@
|
|||
</objects>
|
||||
<resources>
|
||||
<image name="ellipsis" catalog="system" width="128" height="37"/>
|
||||
<image name="lock.fill" catalog="system" width="125" height="128"/>
|
||||
<systemColor name="labelColor">
|
||||
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
|
|
|
@ -336,6 +336,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
super.prepareForReuse()
|
||||
|
||||
avatarRequest?.cancel()
|
||||
attachmentsView.attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
||||
showStatusAutomatically = false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue