Skip to content

Commit

Permalink
Changed format used in app.iconImage(forFormat:) because of version d…
Browse files Browse the repository at this point in the history
…ifferences
  • Loading branch information
NSAntoine committed Apr 3, 2023
1 parent 05aacaf commit 2688116
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class ApplicationInfoTableHeaderView: UIView {
}

func setup() {
let iconImageView = UIImageView(image: app.iconImage(forFormat: 12))
let iconImageView = UIImageView(image: app.iconImage(forFormat: 10))
iconImageView.translatesAutoresizingMaskIntoConstraints = false
iconImageView.contentMode = .scaleAspectFit
addSubview(iconImageView)

let nameLabel = UILabel()
Expand Down Expand Up @@ -56,17 +57,19 @@ class ApplicationInfoTableHeaderView: UIView {
actionsButton.widthAnchor.constraint(equalToConstant: 70),

iconImageView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor, constant: 15),
iconImageView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor, constant: 10),
iconImageView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
iconImageView.widthAnchor.constraint(equalToConstant: iconImageView.image?.size.width ?? 0),
iconImageView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor),

nameLabel.centerYAnchor.constraint(equalTo: iconImageView.layoutMarginsGuide.topAnchor, constant: 6.5),
// nameLabel.centerYAnchor.constraint(equalTo: iconImageView.layoutMarginsGuide.topAnchor, constant: 6.5),
nameLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 15),
nameLabel.trailingAnchor.constraint(equalTo: actionsButton.leadingAnchor),
nameLabel.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),

bundleIDLabel.leadingAnchor.constraint(equalTo: nameLabel.leadingAnchor),
bundleIDLabel.trailingAnchor.constraint(equalTo: actionsButton.leadingAnchor),
bundleIDLabel.topAnchor.constraint(equalTo: nameLabel.bottomAnchor),
bundleIDLabel.bottomAnchor.constraint(equalTo: iconImageView.bottomAnchor)
])

}
Expand Down
29 changes: 19 additions & 10 deletions AppIndex/UI/ApplicationInfo/ApplicationInfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ApplicationInfoViewController: UIViewController {
tableView.backgroundColor = .systemGroupedBackground
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.dataSource = dataSource
dataSource.defaultRowAnimation = .fade
tableView.delegate = self
//tableView.register(UITableViewCell.self, forCellReuseIdentifier: "GeneralCell")
view.addSubview(tableView)
Expand Down Expand Up @@ -115,7 +116,10 @@ class ApplicationInfoViewController: UIViewController {
alert.addAction(action)
}
alert.addAction(backupAction)
alert.addAction(deleteAction)
if app.proxy.isDeletable {
alert.addAction(deleteAction)
}

alert.addAction(UIAlertAction(title: .localized("Cancel"), style: .cancel))
present(alert, animated: true)
}
Expand All @@ -126,10 +130,6 @@ class ApplicationInfoViewController: UIViewController {
app.exportAsIpa(senderViewController: self)
}

let deleteAction = UIAction(title: .localized("Delete"), attributes: .destructive) { [unowned self] _ in
deleteApp()
}

let backupAction = UIAction(title: .localized("Backup")) { [unowned self] _ in
backupApp()
}
Expand All @@ -140,13 +140,22 @@ class ApplicationInfoViewController: UIViewController {
}
}

tableHeaderView.actionsButton.showsMenuAsPrimaryAction = true
tableHeaderView.actionsButton.menu = UIMenu(children: [
var children = [
UIMenu(options: .displayInline, children: [exportAsIPAction]),
UIMenu(options: .displayInline, children: [backupAction]),
UIMenu(options: .displayInline, children: restoreBackupsActions),
UIMenu(options: .displayInline, children: [deleteAction]),
])
UIMenu(options: .displayInline, children: restoreBackupsActions)
]

if app.proxy.isDeletable {
let deleteAction = UIAction(title: .localized("Delete"), attributes: .destructive) { [unowned self] _ in
deleteApp()
}

children.append(UIMenu(options: .displayInline, children: [deleteAction]))
}

tableHeaderView.actionsButton.showsMenuAsPrimaryAction = true
tableHeaderView.actionsButton.menu = UIMenu(children: children)

} else {
tableHeaderView.actionsButton.addTarget(self, action: #selector(openRightBarMenuActionSheet), for: .touchUpInside)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ApplicationContextMenuPreview: UIViewController {
super.viewDidLoad()

view.backgroundColor = .systemGroupedBackground
let imageView = UIImageView(image: app.iconImage(forFormat: 4))
let imageView = UIImageView(image: app.iconImage(forFormat: 10))
imageView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(imageView)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ extension ApplicationListViewController: UICollectionViewDelegate {
}

let copyImageAction = UIAction(title: .localized("Icon")) { _ in
UIPasteboard.general.image = app.iconImage(forFormat: 12)
UIPasteboard.general.image = app.iconImage(forFormat: 10)
}

let copyMenu = UIMenu(title: .localized("Copy..."), children: [copyNameAction, copyBundleIDAction, copyImageAction])
Expand Down

0 comments on commit 2688116

Please sign in to comment.