mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-11 15:53:30 +01:00
Shows detailed source “About” page when adding 3rd-party sources
Allows users to preview sources before adding them to their AltStore.
This commit is contained in:
89
AltStore/Sources/SourceDetailsComponents.swift
Normal file
89
AltStore/Sources/SourceDetailsComponents.swift
Normal file
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// SourceDetailsComponents.swift
|
||||
// AltStore
|
||||
//
|
||||
// Created by Riley Testut on 3/16/23.
|
||||
// Copyright © 2023 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
import Roxas
|
||||
|
||||
class TitleCollectionReusableView: UICollectionReusableView
|
||||
{
|
||||
let label: UILabel
|
||||
|
||||
override init(frame: CGRect)
|
||||
{
|
||||
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .largeTitle).withSymbolicTraits(.traitBold)!
|
||||
let font = UIFont(descriptor: fontDescriptor, size: 0.0)
|
||||
|
||||
self.label = UILabel(frame: .zero)
|
||||
self.label.font = font
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.addSubview(self.label, pinningEdgesWith: .zero)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
class ButtonCollectionReusableView: UICollectionReusableView
|
||||
{
|
||||
let button: UIButton
|
||||
|
||||
override init(frame: CGRect)
|
||||
{
|
||||
self.button = UIButton(type: .system)
|
||||
self.button.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.addSubview(self.button, pinningEdgesWith: .zero)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
class TextViewCollectionViewCell: UICollectionViewCell
|
||||
{
|
||||
let textView = CollapsingTextView(frame: .zero)
|
||||
|
||||
override init(frame: CGRect)
|
||||
{
|
||||
super.init(frame: frame)
|
||||
|
||||
self.initialize()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder)
|
||||
{
|
||||
super.init(coder: coder)
|
||||
|
||||
self.initialize()
|
||||
}
|
||||
|
||||
private func initialize()
|
||||
{
|
||||
self.textView.font = UIFont.preferredFont(forTextStyle: .body)
|
||||
self.textView.isScrollEnabled = false
|
||||
self.textView.isEditable = false
|
||||
self.textView.isSelectable = true
|
||||
self.textView.dataDetectorTypes = [.link]
|
||||
self.contentView.addSubview(self.textView, pinningEdgesWith: .zero)
|
||||
}
|
||||
|
||||
override func layoutMarginsDidChange()
|
||||
{
|
||||
super.layoutMarginsDidChange()
|
||||
|
||||
self.textView.textContainerInset.left = self.contentView.layoutMargins.left
|
||||
self.textView.textContainerInset.right = self.contentView.layoutMargins.right
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user