mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-10 23:33:29 +01:00
Fixes peek & pop deprecation warnings
This commit is contained in:
@@ -13,7 +13,7 @@ import Roxas
|
||||
|
||||
import Nuke
|
||||
|
||||
class BrowseViewController: UICollectionViewController
|
||||
class BrowseViewController: UICollectionViewController, PeekPopPreviewing
|
||||
{
|
||||
private lazy var dataSource = self.makeDataSource()
|
||||
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
||||
@@ -46,7 +46,7 @@ class BrowseViewController: UICollectionViewController
|
||||
self.collectionView.dataSource = self.dataSource
|
||||
self.collectionView.prefetchDataSource = self.dataSource
|
||||
|
||||
self.registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
|
||||
self.update()
|
||||
}
|
||||
@@ -374,6 +374,7 @@ extension BrowseViewController: UICollectionViewDelegateFlowLayout
|
||||
|
||||
extension BrowseViewController: UIViewControllerPreviewingDelegate
|
||||
{
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?
|
||||
{
|
||||
guard
|
||||
@@ -389,6 +390,7 @@ extension BrowseViewController: UIViewControllerPreviewingDelegate
|
||||
return appViewController
|
||||
}
|
||||
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController)
|
||||
{
|
||||
self.navigationController?.pushViewController(viewControllerToCommit, animated: true)
|
||||
|
||||
@@ -31,7 +31,7 @@ extension MyAppsViewController
|
||||
}
|
||||
}
|
||||
|
||||
class MyAppsViewController: UICollectionViewController
|
||||
class MyAppsViewController: UICollectionViewController, PeekPopPreviewing
|
||||
{
|
||||
private let coordinator = NSFileCoordinator()
|
||||
private let operationQueue = OperationQueue()
|
||||
@@ -114,11 +114,7 @@ class MyAppsViewController: UICollectionViewController
|
||||
self.sideloadingProgressView.bottomAnchor.constraint(equalTo: navigationBar.bottomAnchor)])
|
||||
}
|
||||
|
||||
if #available(iOS 13, *) {}
|
||||
else
|
||||
{
|
||||
self.registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
}
|
||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool)
|
||||
@@ -2243,6 +2239,7 @@ extension MyAppsViewController: UIDocumentPickerDelegate
|
||||
|
||||
extension MyAppsViewController: UIViewControllerPreviewingDelegate
|
||||
{
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?
|
||||
{
|
||||
guard
|
||||
@@ -2266,6 +2263,7 @@ extension MyAppsViewController: UIViewControllerPreviewingDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController)
|
||||
{
|
||||
let point = CGPoint(x: previewingContext.sourceRect.midX, y: previewingContext.sourceRect.midY)
|
||||
|
||||
@@ -41,7 +41,7 @@ private class AppBannerFooterView: UICollectionReusableView
|
||||
}
|
||||
}
|
||||
|
||||
class NewsViewController: UICollectionViewController
|
||||
class NewsViewController: UICollectionViewController, PeekPopPreviewing
|
||||
{
|
||||
private lazy var dataSource = self.makeDataSource()
|
||||
private lazy var placeholderView = RSTPlaceholderView(frame: .zero)
|
||||
@@ -77,7 +77,7 @@ class NewsViewController: UICollectionViewController
|
||||
self.collectionView.register(NewsCollectionViewCell.nib, forCellWithReuseIdentifier: RSTCellContentGenericCellIdentifier)
|
||||
self.collectionView.register(AppBannerFooterView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "AppBanner")
|
||||
|
||||
self.registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
(self as PeekPopPreviewing).registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||
|
||||
self.update()
|
||||
}
|
||||
@@ -490,6 +490,7 @@ extension NewsViewController: UICollectionViewDelegateFlowLayout
|
||||
|
||||
extension NewsViewController: UIViewControllerPreviewingDelegate
|
||||
{
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?
|
||||
{
|
||||
if let indexPath = self.collectionView.indexPathForItem(at: location), let cell = self.collectionView.cellForItem(at: indexPath)
|
||||
@@ -536,6 +537,7 @@ extension NewsViewController: UIViewControllerPreviewingDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS, deprecated: 13.0)
|
||||
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController)
|
||||
{
|
||||
if let safariViewController = viewControllerToCommit as? SFSafariViewController
|
||||
|
||||
16
AltStore/Types/PeekPopPreviewing.swift
Normal file
16
AltStore/Types/PeekPopPreviewing.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// PeekPopPreviewing.swift
|
||||
// AltStore
|
||||
//
|
||||
// Created by Riley Testut on 3/2/23.
|
||||
// Copyright © 2023 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
// Conforming UIViewControllers to PeekPopPreviewing allows us to call deprecated registerForPreviewing(with:sourceView:) without warnings.
|
||||
protocol PeekPopPreviewing
|
||||
{
|
||||
@discardableResult
|
||||
func registerForPreviewing(with delegate: UIViewControllerPreviewingDelegate, sourceView: UIView) -> UIViewControllerPreviewing
|
||||
}
|
||||
Reference in New Issue
Block a user