Skip to content

Commit

Permalink
✨ - FEAT: Auto Install after signing
Browse files Browse the repository at this point in the history
  • Loading branch information
corentios committed Oct 3, 2024
1 parent 0061c73 commit b97b169
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Shared/Data/UserDefaults/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ enum Preferences {

@Storage(key: "Feather.fuckOffPpqcheckDetection", defaultValue: true)
static var isFuckingPPqcheckDetectionOff: Bool

@Storage(key: "Feather.autoInstallAfterSign", defaultValue: false)
static var autoInstallAfterSign: Bool

@Storage(key: "Feather.CertificateTitleAppIDtoTeamID", defaultValue: false)
static var certificateTitleAppIDtoTeamID: Bool
Expand Down
12 changes: 8 additions & 4 deletions iOS/Views/Apps/LibraryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ extension LibraryViewController {
popupVC = PopupViewController()
popupVC.modalPresentationStyle = .pageSheet

let button1 = PopupViewControllerButton(title: "Sign \((source!.value(forKey: "name") as? String ?? ""))", color: .tintColor.withAlphaComponent(0.9))
let button1 = PopupViewControllerButton(
title: Preferences.autoInstallAfterSign
? "Sign & Install \((source!.value(forKey: "name") as? String ?? ""))"
: "Install \((source!.value(forKey: "name") as? String ?? ""))",
color: .tintColor.withAlphaComponent(0.9))
button1.onTap = { [weak self] in
guard let self = self else { return }
self.popupVC.dismiss(animated: true)
self.startSigning(meow: source!)
self.startSigning(meow: source!, filePath: filePath?.path ?? "")
}

let button2 = PopupViewControllerButton(title: "Install \((source!.value(forKey: "name") as? String ?? ""))", color: .quaternarySystemFill, titleColor: .tintColor)
Expand Down Expand Up @@ -243,9 +247,9 @@ extension LibraryViewController {
tableView.deselectRow(at: indexPath, animated: true)
}

@objc func startSigning(meow: NSManagedObject) {
@objc func startSigning(meow: NSManagedObject, filePath: String) {
if FileManager.default.fileExists(atPath: CoreDataManager.shared.getFilesForDownloadedApps(for:(meow as! DownloadedApps)).path) {
let ap = AppSigningViewController(app: meow, appsViewController: self)
let ap = AppSigningViewController(app: meow, filePath: filePath, appsViewController: self)
let navigationController = UINavigationController(rootViewController: ap)
navigationController.modalPresentationStyle = .fullScreen
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
Expand Down
7 changes: 6 additions & 1 deletion iOS/Views/Apps/Signing/AppSigningViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AppSigningViewController: UITableViewController, UINavigationControllerDel
var removeInjectPaths: [String] = []

var app: NSManagedObject!
var filePath: String = ""
var name: String = "Unknown"
var bundleId: String = "unknown"
var version: String = "unknown"
Expand Down Expand Up @@ -55,9 +56,10 @@ class AppSigningViewController: UITableViewController, UINavigationControllerDel

var certs: Certificate?

init(app: NSManagedObject, appsViewController: LibraryViewController) {
init(app: NSManagedObject, filePath: String, appsViewController: LibraryViewController) {
self.appsViewController = appsViewController
self.app = app
self.filePath = filePath
super.init(style: .insetGrouped)

if let hasGotCert = CoreDataManager.shared.getCurrentCertificate() {
Expand Down Expand Up @@ -176,6 +178,9 @@ class AppSigningViewController: UITableViewController, UINavigationControllerDel
if success {
self.appsViewController.fetchSources()
self.appsViewController.tableView.reloadData()
if Preferences.autoInstallAfterSign {
self.appsViewController.startInstallProcess(meow: self.app, filePath: self.filePath)
}
}
self.dismiss(animated: true)
}
Expand Down
13 changes: 12 additions & 1 deletion iOS/Views/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SettingsViewController: UITableViewController {
["Donate"],
[String.localized("SETTINGS_VIEW_CONTROLLER_CELL_ABOUT", arguments: "Feather"), String.localized("SETTINGS_VIEW_CONTROLLER_CELL_SUBMIT_FEEDBACK"), String.localized("SETTINGS_VIEW_CONTROLLER_CELL_GITHUB")],
[String.localized("SETTINGS_VIEW_CONTROLLER_CELL_DISPLAY"), String.localized("SETTINGS_VIEW_CONTROLLER_CELL_APP_ICON")],
["Current Certificate", String.localized("SETTINGS_VIEW_CONTROLLER_CELL_ADD_CERTIFICATES")],
["Current Certificate", String.localized("SETTINGS_VIEW_CONTROLLER_CELL_ADD_CERTIFICATES"), "Auto Install"],
// ["Signing Configuration"],
["Fuck PPQCheck", "PPQCheckMitigationString", "PPQCheckMitigationExport"],
["Use Server", String.localized("SETTINGS_VIEW_CONTROLLER_CELL_USE_CUSTOM_SERVER")],
Expand Down Expand Up @@ -142,6 +142,13 @@ extension SettingsViewController {
cell.textLabel?.textColor = .secondaryLabel
cell.selectionStyle = .none
}
case "Auto Install":
let autoInstall = SwitchViewCell()
autoInstall.textLabel?.text = "Install after signing"
autoInstall.switchControl.addTarget(self, action: #selector(autoInstallAfterSignToggled(_:)), for: .valueChanged)
autoInstall.switchControl.isOn = Preferences.autoInstallAfterSign
autoInstall.selectionStyle = .none
return autoInstall
case "Fuck PPQCheck":
let fuckPPq = SwitchViewCell()
fuckPPq.textLabel?.text = String.localized("SETTINGS_VIEW_CONTROLLER_PPQ_ALERT_TITLE")
Expand Down Expand Up @@ -237,6 +244,10 @@ extension SettingsViewController {
@objc func fuckPpqcheckToggled(_ sender: UISwitch) {
Preferences.isFuckingPPqcheckDetectionOff = sender.isOn
}

@objc func autoInstallAfterSignToggled(_ sender: UISwitch) {
Preferences.autoInstallAfterSign = sender.isOn
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let itemTapped = tableData[indexPath.section][indexPath.row]
Expand Down

0 comments on commit b97b169

Please sign in to comment.