Compare commits
No commits in common. "d481ef6c9f0e265969a44701ed77a5b3b3012076" and "bab0dd329406b1734d750c76fb9f460893e0c983" have entirely different histories.
d481ef6c9f
...
bab0dd3294
|
@ -34,16 +34,11 @@ class PollController: ViewController {
|
|||
}
|
||||
|
||||
private func moveOptions(indices: IndexSet, newIndex: Int) {
|
||||
// see AttachmentsListController.moveAttachments
|
||||
var array = poll.pollOptions
|
||||
array.move(fromOffsets: indices, toOffset: newIndex)
|
||||
poll.options = NSMutableOrderedSet(array: array)
|
||||
poll.options.moveObjects(at: indices, to: newIndex)
|
||||
}
|
||||
|
||||
private func removeOption(_ option: PollOption) {
|
||||
var array = poll.pollOptions
|
||||
array.remove(at: poll.options.index(of: option))
|
||||
poll.options = NSMutableOrderedSet(array: array)
|
||||
poll.options.remove(option)
|
||||
}
|
||||
|
||||
private var canAddOption: Bool {
|
||||
|
|
|
@ -52,11 +52,6 @@ struct EmojiTextField: UIViewRepresentable {
|
|||
if text != uiView.text {
|
||||
uiView.text = text
|
||||
}
|
||||
if placeholder != uiView.attributedPlaceholder?.string {
|
||||
uiView.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [
|
||||
.foregroundColor: UIColor.secondaryLabel,
|
||||
])
|
||||
}
|
||||
|
||||
context.coordinator.text = $text
|
||||
context.coordinator.maxLength = maxLength
|
||||
|
|
|
@ -13,11 +13,11 @@ class AccountFollowsViewController: SegmentedPageViewController<AccountFollowsVi
|
|||
let accountID: String
|
||||
let mastodonController: MastodonController
|
||||
|
||||
init(accountID: String, initialPage: Mode = .following, mastodonController: MastodonController) {
|
||||
init(accountID: String, mastodonController: MastodonController) {
|
||||
self.accountID = accountID
|
||||
self.mastodonController = mastodonController
|
||||
|
||||
super.init(pages: [.following, .followers], initialPage: initialPage) { mode in
|
||||
super.init(pages: [.following, .followers]) { mode in
|
||||
AccountFollowsListViewController(accountID: accountID, mastodonController: mastodonController, mode: mode)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIView
|
|||
|
||||
let segmentedControl = ScrollingSegmentedControl<Page>()
|
||||
|
||||
init(pages: [Page], initialPage: Page? = nil, pageProvider: @escaping (Page) -> UIViewController) {
|
||||
init(pages: [Page], pageProvider: @escaping (Page) -> UIViewController) {
|
||||
precondition(!pages.isEmpty)
|
||||
|
||||
self.pageProvider = pageProvider
|
||||
|
||||
self.initialPage = initialPage ?? pages.first!
|
||||
currentPage = self.initialPage
|
||||
initialPage = pages.first!
|
||||
currentPage = pages.first!
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
|
@ -48,7 +48,7 @@ class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIView
|
|||
// the segemented control itself is only focusable when VoiceOver is in Group navigation mode,
|
||||
// so make it clear that to switch tabs the user needs to enter the group
|
||||
segmentedControl.accessibilityHint = "Enter group to select timeline"
|
||||
segmentedControl.setSelectedOption(self.initialPage, animated: false)
|
||||
segmentedControl.setSelectedOption(segmentedControl.options.first!.value, animated: false)
|
||||
navigationItem.titleView = segmentedControl
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,6 @@ class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIView
|
|||
}
|
||||
}
|
||||
|
||||
// Extension point for subclasses
|
||||
func configureViewController(_ viewController: UIViewController) {
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,10 @@ class AccountCollectionViewCell: UICollectionViewListCell {
|
|||
private lazy var vStack = UIStackView(arrangedSubviews: [
|
||||
displayNameLabel,
|
||||
usernameLabel,
|
||||
verifiedFieldHStack,
|
||||
noteLabel,
|
||||
]).configure {
|
||||
$0.axis = .vertical
|
||||
$0.spacing = 2
|
||||
$0.spacing = 4
|
||||
$0.alignment = .leading
|
||||
}
|
||||
|
||||
|
@ -53,29 +52,9 @@ class AccountCollectionViewCell: UICollectionViewListCell {
|
|||
$0.adjustsFontForContentSizeCategory = true
|
||||
}
|
||||
|
||||
private lazy var verifiedFieldHStack = UIStackView(arrangedSubviews: [
|
||||
verifiedFieldLabel,
|
||||
verifiedFieldIcon,
|
||||
]).configure {
|
||||
$0.axis = .horizontal
|
||||
$0.spacing = 4
|
||||
}
|
||||
|
||||
private let verifiedFieldIcon = UIImageView().configure {
|
||||
let image = UIImage(systemName: "checkmark", withConfiguration: UIImage.SymbolConfiguration(scale: .small))
|
||||
$0.image = image
|
||||
$0.tintColor = .systemGreen
|
||||
}
|
||||
|
||||
private let verifiedFieldLabel = UILabel().configure {
|
||||
$0.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold))
|
||||
$0.textColor = .systemGreen
|
||||
$0.adjustsFontForContentSizeCategory = true
|
||||
}
|
||||
|
||||
private let noteLabel = EmojiLabel().configure {
|
||||
$0.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15))
|
||||
$0.adjustsFontForContentSizeCategory = true
|
||||
$0.numberOfLines = 2
|
||||
}
|
||||
|
||||
weak var delegate: (TuskerNavigationDelegate & MenuActionProvider)?
|
||||
|
@ -142,17 +121,6 @@ class AccountCollectionViewCell: UICollectionViewListCell {
|
|||
|
||||
avatarImageView.update(for: account.avatar)
|
||||
usernameLabel.text = "@\(account.acct)"
|
||||
|
||||
if let verifiedField = account.fields.first(where: { $0.verifiedAt != nil }) {
|
||||
noteLabel.numberOfLines = 1
|
||||
verifiedFieldHStack.isHidden = false
|
||||
let converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
|
||||
verifiedFieldLabel.text = converter.convert(html: verifiedField.value)
|
||||
} else {
|
||||
noteLabel.numberOfLines = 2
|
||||
verifiedFieldHStack.isHidden = true
|
||||
}
|
||||
|
||||
updateUIForPreferences(account: account)
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ class ProfileHeaderView: UIView {
|
|||
@IBOutlet weak var relationshipLabel: UILabel!
|
||||
@IBOutlet weak var noteTextView: StatusContentTextView!
|
||||
@IBOutlet weak var fieldsView: ProfileFieldsView!
|
||||
@IBOutlet weak var followingCountButton: UIButton!
|
||||
@IBOutlet weak var followersCountButton: UIButton!
|
||||
@IBOutlet weak var followCountButton: UIButton!
|
||||
private(set) var pagesSegmentedControl: ScrollingSegmentedControl<ProfileViewController.Page>!
|
||||
private var movedOverlayView: ProfileHeaderMovedOverlayView?
|
||||
|
||||
|
@ -160,22 +159,21 @@ class ProfileHeaderView: UIView {
|
|||
|
||||
let (followingAbbr, followingSpelledOut) = formatBigNumber(account.followingCount)
|
||||
let (followersAbbr, followersSpelledOut) = formatBigNumber(account.followersCount)
|
||||
let followingCountTitle = NSMutableAttributedString(string: followingAbbr, attributes: [
|
||||
let followCountTitle = NSMutableAttributedString()
|
||||
followCountTitle.append(NSAttributedString(string: followingAbbr, attributes: [
|
||||
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
||||
])
|
||||
followingCountTitle.append(NSAttributedString(string: " Following", attributes: [
|
||||
]))
|
||||
followCountTitle.append(NSAttributedString(string: " Following, ", attributes: [
|
||||
.foregroundColor: UIColor.secondaryLabel,
|
||||
]))
|
||||
let followersCountTitle = NSMutableAttributedString(string: followersAbbr, attributes: [
|
||||
followCountTitle.append(NSAttributedString(string: followersAbbr, attributes: [
|
||||
.font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!,
|
||||
])
|
||||
followersCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [
|
||||
]))
|
||||
followCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [
|
||||
.foregroundColor: UIColor.secondaryLabel,
|
||||
]))
|
||||
followingCountButton.setAttributedTitle(followingCountTitle, for: .normal)
|
||||
followingCountButton.accessibilityLabel = "\(followingSpelledOut) following"
|
||||
followersCountButton.setAttributedTitle(followersCountTitle, for: .normal)
|
||||
followersCountButton.accessibilityLabel = "\(followersSpelledOut) followers"
|
||||
followCountButton.setAttributedTitle(followCountTitle, for: .normal)
|
||||
followCountButton.accessibilityLabel = "\(followingSpelledOut) following, \(followersSpelledOut) followers"
|
||||
|
||||
if let movedTo = account.movedTo {
|
||||
if let movedOverlayView {
|
||||
|
@ -400,14 +398,9 @@ class ProfileHeaderView: UIView {
|
|||
}
|
||||
}
|
||||
|
||||
@IBAction func followingCountButtonPressed(_ sender: Any) {
|
||||
@IBAction func followCountButtonPressed(_ sender: Any) {
|
||||
guard let accountID else { return }
|
||||
delegate?.show(AccountFollowsViewController(accountID: accountID, initialPage: .following, mastodonController: mastodonController))
|
||||
}
|
||||
|
||||
@IBAction func followersCountButtonPressed(_ sender: Any) {
|
||||
guard let accountID else { return }
|
||||
delegate?.show(AccountFollowsViewController(accountID: accountID, initialPage: .followers, mastodonController: mastodonController))
|
||||
delegate?.show(AccountFollowsViewController(accountID: accountID, mastodonController: mastodonController))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
|
@ -71,53 +71,36 @@
|
|||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" horizontalHuggingPriority="249" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1O8-2P-Gbf" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="427.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="259.5"/>
|
||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||
<color key="textColor" systemColor="labelColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vKC-m1-Sbs" customClass="ProfileFieldsView" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="431.5" width="382" height="128"/>
|
||||
<rect key="frame" x="0.0" y="263.5" width="382" height="128"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="128" placeholder="YES" id="xbR-M6-H0I"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ood-3e-sSu" userLabel="Spacer">
|
||||
<rect key="frame" x="0.0" y="563.5" width="240" height="8"/>
|
||||
<rect key="frame" x="0.0" y="395.5" width="240" height="8"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="8" id="5ri-vD-wXe"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="udp-EN-wtc">
|
||||
<rect key="frame" x="0.0" y="575.5" width="218.5" height="20.5"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5w9-LA-8kc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="104" height="20.5"/>
|
||||
<state key="normal" title="Button"/>
|
||||
<buttonConfiguration key="configuration" style="plain" title="123 Following">
|
||||
<fontDescription key="titleFontDescription" style="UICTFontTextStyleBody"/>
|
||||
<directionalEdgeInsets key="contentInsets" top="0.0" leading="0.0" bottom="0.0" trailing="0.0"/>
|
||||
</buttonConfiguration>
|
||||
<connections>
|
||||
<action selector="followingCountButtonPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="QOO-zK-pfu"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" id="XCX-Y3-cG5">
|
||||
<rect key="frame" x="112" y="0.0" width="106.5" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Button"/>
|
||||
<buttonConfiguration key="configuration" style="plain" title="1.2k Followers">
|
||||
<fontDescription key="titleFontDescription" style="UICTFontTextStyleBody"/>
|
||||
<directionalEdgeInsets key="contentInsets" top="0.0" leading="0.0" bottom="0.0" trailing="0.0"/>
|
||||
</buttonConfiguration>
|
||||
<connections>
|
||||
<action selector="followersCountButtonPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="LCU-Gy-Dtt"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5w9-LA-8kc">
|
||||
<rect key="frame" x="0.0" y="407.5" width="219" height="188.5"/>
|
||||
<state key="normal" title="Button"/>
|
||||
<buttonConfiguration key="configuration" style="plain" title="123 Following, 1.2k Followers">
|
||||
<fontDescription key="titleFontDescription" style="UICTFontTextStyleBody"/>
|
||||
<directionalEdgeInsets key="contentInsets" top="0.0" leading="0.0" bottom="0.0" trailing="0.0"/>
|
||||
</buttonConfiguration>
|
||||
<connections>
|
||||
<action selector="followCountButtonPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="QOO-zK-pfu"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="vKC-m1-Sbs" firstAttribute="width" secondItem="u4P-3i-gEq" secondAttribute="width" id="0dI-ax-7eI"/>
|
||||
|
@ -173,8 +156,7 @@
|
|||
<outlet property="displayNameLabel" destination="vcl-Gl-kXl" id="64n-a9-my0"/>
|
||||
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
||||
<outlet property="followButton" destination="cr8-p9-xkc" id="E1n-gh-mCl"/>
|
||||
<outlet property="followersCountButton" destination="XCX-Y3-cG5" id="PS4-0R-6Pw"/>
|
||||
<outlet property="followingCountButton" destination="5w9-LA-8kc" id="umN-5g-q8N"/>
|
||||
<outlet property="followCountButton" destination="5w9-LA-8kc" id="umN-5g-q8N"/>
|
||||
<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="vFa-g3-xIP" id="dEX-1a-PHF"/>
|
||||
|
|
Loading…
Reference in New Issue