Compare commits

..

No commits in common. "6b7904ed52449801b51cc26a8845dbf733916fc7" and "f2a8b917690d78c9da7e8393580e6ef6ad143b96" have entirely different histories.

7 changed files with 47 additions and 68 deletions

View File

@ -45,14 +45,13 @@ class BookmarksTableViewController: EnhancedTableViewController {
let request = Client.getBookmarks() let request = Client.getBookmarks()
mastodonController.run(request) { (response) in mastodonController.run(request) { (response) in
guard case let .success(statuses, pagination) = response else { fatalError() } guard case let .success(statuses, pagination) = response else { fatalError() }
self.mastodonController.persistentContainer.addAll(statuses: statuses) { self.mastodonController.persistentContainer.addAll(statuses: statuses)
self.statuses.append(contentsOf: statuses.map { ($0.id, .unknown) }) self.statuses.append(contentsOf: statuses.map { ($0.id, .unknown) })
self.newer = pagination?.newer self.newer = pagination?.newer
self.older = pagination?.older self.older = pagination?.older
DispatchQueue.main.async { DispatchQueue.main.async {
self.tableView.reloadData() self.tableView.reloadData()
}
} }
} }
@ -88,16 +87,15 @@ class BookmarksTableViewController: EnhancedTableViewController {
mastodonController.run(request) { (response) in mastodonController.run(request) { (response) in
guard case let .success(newStatuses, pagination) = response else { fatalError() } guard case let .success(newStatuses, pagination) = response else { fatalError() }
self.older = pagination?.older self.older = pagination?.older
self.mastodonController.persistentContainer.addAll(statuses: newStatuses) { self.mastodonController.persistentContainer.addAll(statuses: newStatuses)
let newIndexPaths = (self.statuses.count..<(self.statuses.count + newStatuses.count)).map { let newIndexPaths = (self.statuses.count..<(self.statuses.count + newStatuses.count)).map {
IndexPath(row: $0, section: 0) IndexPath(row: $0, section: 0)
} }
self.statuses.append(contentsOf: newStatuses.map { ($0.id, .unknown) }) self.statuses.append(contentsOf: newStatuses.map { ($0.id, .unknown) })
DispatchQueue.main.async { DispatchQueue.main.async {
UIView.performWithoutAnimation { UIView.performWithoutAnimation {
self.tableView.insertRows(at: newIndexPaths, with: .automatic) self.tableView.insertRows(at: newIndexPaths, with: .automatic)
}
} }
} }
} }

View File

@ -10,7 +10,6 @@ import UIKit
import Pachyderm import Pachyderm
import MobileCoreServices import MobileCoreServices
import PencilKit import PencilKit
import Photos
protocol ComposeAttachmentsViewControllerDelegate: class { protocol ComposeAttachmentsViewControllerDelegate: class {
func composeSelectedAttachmentsDidChange() func composeSelectedAttachmentsDidChange()
@ -354,23 +353,18 @@ class ComposeAttachmentsViewController: UITableViewController {
// MARK: Interaction // MARK: Interaction
func addAttachmentPressed() { func addAttachmentPressed() {
PHPhotoLibrary.requestAuthorization { (status) in if traitCollection.horizontalSizeClass == .compact {
guard status == .authorized else { return } let sheetContainer = AssetPickerSheetContainerViewController()
DispatchQueue.main.async { sheetContainer.assetPicker.assetPickerDelegate = self
if self.traitCollection.horizontalSizeClass == .compact { present(sheetContainer, animated: true)
let sheetContainer = AssetPickerSheetContainerViewController() } else {
sheetContainer.assetPicker.assetPickerDelegate = self let picker = AssetPickerViewController()
self.present(sheetContainer, animated: true) picker.assetPickerDelegate = self
} else { picker.overrideUserInterfaceStyle = .dark
let picker = AssetPickerViewController() picker.modalPresentationStyle = .popover
picker.assetPickerDelegate = self present(picker, animated: true)
picker.overrideUserInterfaceStyle = .dark if let presentationController = picker.presentationController as? UIPopoverPresentationController {
picker.modalPresentationStyle = .popover presentationController.sourceView = tableView.cellForRow(at: IndexPath(row: 0, section: 1))
self.present(picker, animated: true)
if let presentationController = picker.presentationController as? UIPopoverPresentationController {
presentationController.sourceView = self.tableView.cellForRow(at: IndexPath(row: 0, section: 1))
}
}
} }
} }
} }

View File

@ -227,9 +227,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
@IBAction func sharePressed(_ sender: Any) { @IBAction func sharePressed(_ sender: Any) {
guard let image = image else { return } guard let image = image else { return }
let activityVC = UIActivityViewController(activityItems: [image], applicationActivities: nil) let activityVC = UIActivityViewController(activityItems: [image], applicationActivities: nil)
if let presentationController = activityVC.presentationController as? UIPopoverPresentationController {
presentationController.sourceView = shareButton
}
present(activityVC, animated: true) present(activityVC, animated: true)
} }

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14845" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14799.2"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@ -48,7 +48,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kHo-B9-R7a"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kHo-B9-R7a">
<rect key="frame" x="0.0" y="0.0" width="375" height="36"/> <rect key="frame" x="0.0" y="0.0" width="375" height="36"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vhp-0u-Q0S"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vhp-0u-Q0S">
<rect key="frame" x="16" y="16" width="20" height="20"/> <rect key="frame" x="16" y="16" width="20" height="20"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="4tF-oL-qXT"/> <constraint firstAttribute="height" constant="20" id="4tF-oL-qXT"/>
@ -60,7 +60,7 @@
<action selector="sharePressed:" destination="-1" eventType="touchUpInside" id="7Oz-zv-m2t"/> <action selector="sharePressed:" destination="-1" eventType="touchUpInside" id="7Oz-zv-m2t"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pnA-ne-k0v"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pnA-ne-k0v">
<rect key="frame" x="339" y="16" width="20" height="20"/> <rect key="frame" x="339" y="16" width="20" height="20"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="20" id="eg0-hN-rda"/> <constraint firstAttribute="width" constant="20" id="eg0-hN-rda"/>
@ -119,7 +119,7 @@
</view> </view>
</objects> </objects>
<resources> <resources>
<image name="square.and.arrow.up" catalog="system" width="115" height="128"/> <image name="square.and.arrow.up" catalog="system" width="56" height="64"/>
<image name="xmark" catalog="system" width="128" height="113"/> <image name="xmark" catalog="system" width="64" height="56"/>
</resources> </resources>
</document> </document>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16092.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16082.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@ -40,7 +40,7 @@
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView> </textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lvf-I9-aV3"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvf-I9-aV3">
<rect key="frame" x="282" y="29" width="22" height="22"/> <rect key="frame" x="282" y="29" width="22" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="22" id="aIh-Ym-ARv"/> <constraint firstAttribute="height" constant="22" id="aIh-Ym-ARv"/>

View File

@ -28,7 +28,7 @@ class ProfileHeaderTableViewCell: UITableViewCell {
@IBOutlet weak var noteTextView: StatusContentTextView! @IBOutlet weak var noteTextView: StatusContentTextView!
@IBOutlet weak var fieldsStackView: UIStackView! @IBOutlet weak var fieldsStackView: UIStackView!
@IBOutlet weak var fieldNamesStackView: UIStackView! @IBOutlet weak var fieldNamesStackView: UIStackView!
@IBOutlet weak var fieldValuesStackView: UIStackView! @IBOutlet weak var fieldValuesStack: UIStackView!
@IBOutlet weak var moreButtonVisualEffectView: UIVisualEffectView! @IBOutlet weak var moreButtonVisualEffectView: UIVisualEffectView!
var accountID: String! var accountID: String!
@ -102,16 +102,13 @@ class ProfileHeaderTableViewCell: UITableViewCell {
fieldsStackView.isHidden = account.fields.isEmpty fieldsStackView.isHidden = account.fields.isEmpty
fieldNamesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } fieldsStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
fieldValuesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
for field in account.fields { for field in account.fields {
let nameLabel = UILabel() let nameLabel = UILabel()
nameLabel.text = field.name nameLabel.text = field.name
nameLabel.font = .boldSystemFont(ofSize: 17) nameLabel.font = .boldSystemFont(ofSize: 17)
nameLabel.textAlignment = .right nameLabel.textAlignment = .right
nameLabel.numberOfLines = 0 nameLabel.numberOfLines = 0
nameLabel.lineBreakMode = .byWordWrapping
nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
fieldNamesStackView.addArrangedSubview(nameLabel) fieldNamesStackView.addArrangedSubview(nameLabel)
let valueTextView = ContentTextView() let valueTextView = ContentTextView()
@ -122,10 +119,7 @@ class ProfileHeaderTableViewCell: UITableViewCell {
valueTextView.textAlignment = .left valueTextView.textAlignment = .left
valueTextView.awakeFromNib() valueTextView.awakeFromNib()
valueTextView.navigationDelegate = delegate valueTextView.navigationDelegate = delegate
valueTextView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) fieldValuesStack.addArrangedSubview(valueTextView)
fieldValuesStackView.addArrangedSubview(valueTextView)
nameLabel.heightAnchor.constraint(equalTo: valueTextView.heightAnchor).isActive = true
} }
if accountUpdater == nil { if accountUpdater == nil {

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16092.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16082.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@ -78,17 +78,13 @@
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="sHU-GU-klv"> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="sHU-GU-klv">
<rect key="frame" x="16" y="238" width="343" height="50"/> <rect key="frame" x="16" y="238" width="343" height="50"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="pV2-Mz-54W"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="pV2-Mz-54W">
<rect key="frame" x="0.0" y="0.0" width="167.5" height="50"/> <rect key="frame" x="0.0" y="0.0" width="147" height="50"/>
</stackView> </stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="oza-9d-8v4"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="oza-9d-8v4">
<rect key="frame" x="175.5" y="0.0" width="167.5" height="50"/> <rect key="frame" x="155" y="0.0" width="188" height="50"/>
</stackView> </stackView>
</subviews> </subviews>
<constraints>
<constraint firstItem="oza-9d-8v4" firstAttribute="width" relation="lessThanOrEqual" secondItem="pV2-Mz-54W" secondAttribute="width" multiplier="2" id="LHm-6k-LyV"/>
<constraint firstItem="oza-9d-8v4" firstAttribute="width" relation="greaterThanOrEqual" secondItem="pV2-Mz-54W" secondAttribute="width" multiplier="0.5" id="Zbr-l3-Lff"/>
</constraints>
</stackView> </stackView>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQY-XN-PfZ"> <visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQY-XN-PfZ">
<rect key="frame" x="335" y="110" width="32" height="32"/> <rect key="frame" x="335" y="110" width="32" height="32"/>
@ -165,7 +161,7 @@
<outlet property="avatarImageView" destination="tH8-sR-DHC" id="6ll-yL-g1o"/> <outlet property="avatarImageView" destination="tH8-sR-DHC" id="6ll-yL-g1o"/>
<outlet property="displayNameLabel" destination="LjK-72-Bez" id="nIU-ey-H1C"/> <outlet property="displayNameLabel" destination="LjK-72-Bez" id="nIU-ey-H1C"/>
<outlet property="fieldNamesStackView" destination="pV2-Mz-54W" id="xfG-60-K0s"/> <outlet property="fieldNamesStackView" destination="pV2-Mz-54W" id="xfG-60-K0s"/>
<outlet property="fieldValuesStackView" destination="oza-9d-8v4" id="UIS-KM-5fR"/> <outlet property="fieldValuesStack" destination="oza-9d-8v4" id="UIS-KM-5fR"/>
<outlet property="fieldsStackView" destination="sHU-GU-klv" id="Gli-Gf-Ubh"/> <outlet property="fieldsStackView" destination="sHU-GU-klv" id="Gli-Gf-Ubh"/>
<outlet property="followsYouLabel" destination="a32-1a-xXZ" id="phY-0L-NnN"/> <outlet property="followsYouLabel" destination="a32-1a-xXZ" id="phY-0L-NnN"/>
<outlet property="headerImageView" destination="Fw7-OL-iy5" id="6sv-E5-D73"/> <outlet property="headerImageView" destination="Fw7-OL-iy5" id="6sv-E5-D73"/>