mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-18 19:23:43 +01:00
Presents app page when tapping updates
This commit is contained in:
@@ -828,6 +828,9 @@ World</string>
|
|||||||
</connections>
|
</connections>
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
</navigationItem>
|
</navigationItem>
|
||||||
|
<connections>
|
||||||
|
<segue destination="0V6-N4-hTO" kind="show" identifier="showUpdate" id="dzt-2e-VM9"/>
|
||||||
|
</connections>
|
||||||
</collectionViewController>
|
</collectionViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="kiO-UO-esV" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="kiO-UO-esV" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
@@ -865,7 +868,7 @@ World</string>
|
|||||||
</namedColor>
|
</namedColor>
|
||||||
</resources>
|
</resources>
|
||||||
<inferredMetricsTieBreakers>
|
<inferredMetricsTieBreakers>
|
||||||
<segue reference="cnd-KK-o60"/>
|
<segue reference="dzt-2e-VM9"/>
|
||||||
</inferredMetricsTieBreakers>
|
</inferredMetricsTieBreakers>
|
||||||
<color key="tintColor" name="Red"/>
|
<color key="tintColor" name="Red"/>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ class MyAppsViewController: UICollectionViewController
|
|||||||
// Gestures
|
// Gestures
|
||||||
self.longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(MyAppsViewController.handleLongPressGesture(_:)))
|
self.longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(MyAppsViewController.handleLongPressGesture(_:)))
|
||||||
self.collectionView.addGestureRecognizer(self.longPressGestureRecognizer)
|
self.collectionView.addGestureRecognizer(self.longPressGestureRecognizer)
|
||||||
|
|
||||||
|
self.registerForPreviewing(with: self, sourceView: self.collectionView)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool)
|
override func viewWillAppear(_ animated: Bool)
|
||||||
@@ -110,14 +112,20 @@ class MyAppsViewController: UICollectionViewController
|
|||||||
|
|
||||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
|
||||||
{
|
{
|
||||||
guard segue.identifier == "showApp" else { return }
|
guard let identifier = segue.identifier else { return }
|
||||||
|
|
||||||
guard let cell = sender as? UICollectionViewCell, let indexPath = self.collectionView.indexPath(for: cell) else { return }
|
switch identifier
|
||||||
|
{
|
||||||
|
case "showApp", "showUpdate":
|
||||||
|
guard let cell = sender as? UICollectionViewCell, let indexPath = self.collectionView.indexPath(for: cell) else { return }
|
||||||
|
|
||||||
let installedApp = self.dataSource.item(at: indexPath)
|
let installedApp = self.dataSource.item(at: indexPath)
|
||||||
|
|
||||||
let appViewController = segue.destination as! AppViewController
|
let appViewController = segue.destination as! AppViewController
|
||||||
appViewController.app = installedApp.storeApp
|
appViewController.app = installedApp.storeApp
|
||||||
|
|
||||||
|
default: break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool
|
||||||
@@ -165,7 +173,8 @@ private extension MyAppsViewController
|
|||||||
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<InstalledApp, UIImage>(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext)
|
let dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<InstalledApp, UIImage>(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext)
|
||||||
dataSource.liveFetchLimit = maximumCollapsedUpdatesCount
|
dataSource.liveFetchLimit = maximumCollapsedUpdatesCount
|
||||||
dataSource.cellIdentifierHandler = { _ in "UpdateCell" }
|
dataSource.cellIdentifierHandler = { _ in "UpdateCell" }
|
||||||
dataSource.cellConfigurationHandler = { (cell, installedApp, indexPath) in
|
dataSource.cellConfigurationHandler = { [weak self] (cell, installedApp, indexPath) in
|
||||||
|
guard let self = self else { return }
|
||||||
guard let app = installedApp.storeApp else { return }
|
guard let app = installedApp.storeApp else { return }
|
||||||
|
|
||||||
let cell = cell as! UpdateCollectionViewCell
|
let cell = cell as! UpdateCollectionViewCell
|
||||||
@@ -689,6 +698,19 @@ extension MyAppsViewController
|
|||||||
return headerView
|
return headerView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
|
||||||
|
{
|
||||||
|
let section = Section.allCases[indexPath.section]
|
||||||
|
switch section
|
||||||
|
{
|
||||||
|
case .updates:
|
||||||
|
guard let cell = collectionView.cellForItem(at: indexPath) else { break }
|
||||||
|
self.performSegue(withIdentifier: "showUpdate", sender: cell)
|
||||||
|
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension MyAppsViewController: UICollectionViewDelegateFlowLayout
|
extension MyAppsViewController: UICollectionViewDelegateFlowLayout
|
||||||
@@ -860,3 +882,37 @@ extension MyAppsViewController: UIDocumentPickerDelegate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension MyAppsViewController: UIViewControllerPreviewingDelegate
|
||||||
|
{
|
||||||
|
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?
|
||||||
|
{
|
||||||
|
guard
|
||||||
|
let indexPath = self.collectionView.indexPathForItem(at: location),
|
||||||
|
let cell = self.collectionView.cellForItem(at: indexPath)
|
||||||
|
else { return nil }
|
||||||
|
|
||||||
|
let section = Section.allCases[indexPath.section]
|
||||||
|
switch section
|
||||||
|
{
|
||||||
|
case .updates:
|
||||||
|
previewingContext.sourceRect = cell.frame
|
||||||
|
|
||||||
|
let app = self.dataSource.item(at: indexPath)
|
||||||
|
guard let storeApp = app.storeApp else { return nil}
|
||||||
|
|
||||||
|
let appViewController = AppViewController.makeAppViewController(app: storeApp)
|
||||||
|
return appViewController
|
||||||
|
|
||||||
|
default: return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController)
|
||||||
|
{
|
||||||
|
let point = CGPoint(x: previewingContext.sourceRect.midX, y: previewingContext.sourceRect.midY)
|
||||||
|
guard let indexPath = self.collectionView.indexPathForItem(at: point), let cell = self.collectionView.cellForItem(at: indexPath) else { return }
|
||||||
|
|
||||||
|
self.performSegue(withIdentifier: "showUpdate", sender: cell)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,22 @@ extension UpdateCollectionViewCell
|
|||||||
}
|
}
|
||||||
animator.startAnimation()
|
animator.startAnimation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView?
|
||||||
|
{
|
||||||
|
let view = super.hitTest(point, with: event)
|
||||||
|
|
||||||
|
if view == self.versionDescriptionTextView
|
||||||
|
{
|
||||||
|
// Forward touches on the text view (but not on the nested "more" button)
|
||||||
|
// so cell selection works as expected.
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension UpdateCollectionViewCell
|
private extension UpdateCollectionViewCell
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="Version Notes" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="rNs-2O-k3V" customClass="CollapsingTextView" customModule="AltStore" customModuleProvider="target">
|
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="Version Notes" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rNs-2O-k3V" customClass="CollapsingTextView" customModule="AltStore" customModuleProvider="target">
|
||||||
<rect key="frame" x="75" y="-10" width="265" height="24.5"/>
|
<rect key="frame" x="75" y="-10" width="265" height="24.5"/>
|
||||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user