Compare commits

...

5 Commits

5 changed files with 28 additions and 5 deletions

View File

@ -25,7 +25,14 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
} }
@objc func handleGesture(_ recognizer: UIPanGestureRecognizer) { @objc func handleGesture(_ recognizer: UIPanGestureRecognizer) {
let translation = recognizer.translation(in: recognizer.view!.superview!) guard let recognizerSuperview = recognizer.view?.superview else {
// Assume the gesture has ended b/c we don't have a view/superview anymore.
inProgress = false
direction = nil
cancel()
return
}
let translation = recognizer.translation(in: recognizerSuperview)
var progress = translation.y / 200 var progress = translation.y / 200
if let direction = direction { if let direction = direction {
progress *= direction progress *= direction
@ -63,7 +70,7 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
override func cancel() { override func cancel() {
super.cancel() super.cancel()
viewController.isInteractivelyAnimatingDismissal = false viewController?.isInteractivelyAnimatingDismissal = false
} }
} }

View File

@ -214,6 +214,10 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
if item == sidebar.selectedItem { if item == sidebar.selectedItem {
itemNavStack = secondaryNavController.viewControllers itemNavStack = secondaryNavController.viewControllers
secondaryNavController.viewControllers = [] secondaryNavController.viewControllers = []
// Sometimes removing a VC from the viewControllers array doesn't immediately remove it's view from the hierarchy
for vc in itemNavStack {
vc.viewIfLoaded?.removeFromSuperview()
}
} else { } else {
itemNavStack = navigationStacks[item] ?? [] itemNavStack = navigationStacks[item] ?? []
navigationStacks.removeValue(forKey: item) navigationStacks.removeValue(forKey: item)
@ -339,6 +343,11 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
let viewControllersToMove = navController.viewControllers.dropFirst(skipFirst) let viewControllersToMove = navController.viewControllers.dropFirst(skipFirst)
navController.viewControllers.removeLast(navController.viewControllers.count - skipFirst) navController.viewControllers.removeLast(navController.viewControllers.count - skipFirst)
// Sometimes removing a VC from the viewControllers array doesn't immediately remove it's view from the hierarchy
for vc in viewControllersToMove {
vc.viewIfLoaded?.removeFromSuperview()
}
if let prepend = prepend { if let prepend = prepend {
navigationStacks[item] = [prepend] + viewControllersToMove navigationStacks[item] = [prepend] + viewControllersToMove
} else { } else {

View File

@ -150,7 +150,8 @@ class InstanceSelectorTableViewController: UITableViewController {
private func updateSpecificInstance(domain: String) { private func updateSpecificInstance(domain: String) {
activityIndicator.startAnimating() activityIndicator.startAnimating()
guard let components = parseURLComponents(input: domain) else { guard let components = parseURLComponents(input: domain),
let url = components.url else {
var snapshot = dataSource.snapshot() var snapshot = dataSource.snapshot()
if snapshot.indexOfSection(.selected) != nil { if snapshot.indexOfSection(.selected) != nil {
snapshot.deleteSections([.selected]) snapshot.deleteSections([.selected])
@ -159,7 +160,6 @@ class InstanceSelectorTableViewController: UITableViewController {
activityIndicator.stopAnimating() activityIndicator.stopAnimating()
return return
} }
let url = components.url!
let client = Client(baseURL: url, session: .appDefault) let client = Client(baseURL: url, session: .appDefault)
let request = Client.getInstance() let request = Client.getInstance()

View File

@ -1166,7 +1166,10 @@ extension TimelineViewController {
let addedItems: Bool let addedItems: Bool
let statusItems = snapshot.itemIdentifiers(inSection: .statuses) let statusItems = snapshot.itemIdentifiers(inSection: .statuses)
let gapIndex = statusItems.firstIndex(of: .gap)! guard let gapIndex = statusItems.firstIndex(of: .gap) else {
// Not sure how this is reachable (maybe the gap cell was tapped twice and the requests raced?) but w/e
return
}
switch direction { switch direction {
case .above: case .above:
@ -1293,6 +1296,9 @@ extension TimelineViewController: UICollectionViewDelegate {
selected(status: status.reblog?.id ?? id, state: collapseState.copy()) selected(status: status.reblog?.id ?? id, state: collapseState.copy())
} }
case .gap: case .gap:
guard controller.state == .idle else {
return
}
let cell = collectionView.cellForItem(at: indexPath) as! TimelineGapCollectionViewCell let cell = collectionView.cellForItem(at: indexPath) as! TimelineGapCollectionViewCell
cell.showsIndicator = true cell.showsIndicator = true
Task { Task {

View File

@ -38,6 +38,7 @@ struct AccountDisplayNameView: View {
let matches = emojiRegex.matches(in: account.displayName, options: [], range: fullRange) let matches = emojiRegex.matches(in: account.displayName, options: [], range: fullRange)
guard !matches.isEmpty else { return } guard !matches.isEmpty else { return }
let emojiSize = self.emojiSize
let emojiImages = MultiThreadDictionary<String, Image>() let emojiImages = MultiThreadDictionary<String, Image>()
let group = DispatchGroup() let group = DispatchGroup()