mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
54 lines
1.5 KiB
Swift
54 lines
1.5 KiB
Swift
|
|
//
|
||
|
|
// ErrorDetailsViewController.swift
|
||
|
|
// AltStore
|
||
|
|
//
|
||
|
|
// Created by Riley Testut on 10/5/22.
|
||
|
|
// Copyright © 2022 Riley Testut. All rights reserved.
|
||
|
|
//
|
||
|
|
|
||
|
|
import UIKit
|
||
|
|
|
||
|
|
import AltStoreCore
|
||
|
|
|
||
|
|
class ErrorDetailsViewController: UIViewController
|
||
|
|
{
|
||
|
|
var loggedError: LoggedError?
|
||
|
|
|
||
|
|
@IBOutlet private var textView: UITextView!
|
||
|
|
|
||
|
|
override func viewDidLoad()
|
||
|
|
{
|
||
|
|
super.viewDidLoad()
|
||
|
|
|
||
|
|
if let error = self.loggedError?.error
|
||
|
|
{
|
||
|
|
self.title = error.localizedErrorCode
|
||
|
|
|
||
|
|
let font = self.textView.font ?? UIFont.preferredFont(forTextStyle: .body)
|
||
|
|
let detailedDescription = error.formattedDetailedDescription(with: font)
|
||
|
|
self.textView.attributedText = detailedDescription
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
self.title = NSLocalizedString("Error Details", comment: "")
|
||
|
|
}
|
||
|
|
|
||
|
|
self.navigationController?.navigationBar.tintColor = .altPrimary
|
||
|
|
|
||
|
|
if #available(iOS 15, *), let sheetController = self.navigationController?.sheetPresentationController
|
||
|
|
{
|
||
|
|
sheetController.detents = [.medium(), .large()]
|
||
|
|
sheetController.selectedDetentIdentifier = .medium
|
||
|
|
sheetController.prefersGrabberVisible = true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
override func viewDidLayoutSubviews()
|
||
|
|
{
|
||
|
|
super.viewDidLayoutSubviews()
|
||
|
|
|
||
|
|
self.textView.textContainerInset.left = self.view.layoutMargins.left
|
||
|
|
self.textView.textContainerInset.right = self.view.layoutMargins.right
|
||
|
|
}
|
||
|
|
}
|