Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
- Added localisation for the alert message that gets displayed when opening the app if SIP is enabled
- Added support for detection unsupported app store installers (the OS X Lion and OS X Mountain Lion ones)
- Added some info.plist stuff about apple events usage.
- Done some additional testing for the bug fixes introduced in previous commits.
  • Loading branch information
ITzTravelInTime committed Oct 2, 2021
1 parent 986cbee commit aab615a
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 10 deletions.
5 changes: 3 additions & 2 deletions TINU/ChooseSideViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class ChooseSideViewController: GenericViewController, ViewID {

private var count = 0


#if sudoStartup
private static var _already_prompted = false
private static let _prompt_sip = "SIPPrompt"
Expand Down Expand Up @@ -108,7 +107,9 @@ class ChooseSideViewController: GenericViewController, ViewID {
Alert.window = self.window

//todo: localize this
let alert = Alert(message: "TINU Needs to be opened using diagnostics mode in order to work!", description: "SIP (System Integrity Protection) is currently enabled, and it will prevent TINU from working (this is due to a problem introduced in Catalina).\n\nYou can avoid this by chosing to use the diagnostics mode with administrator privileges (because it avoids this issue by using the privileges provvided by the terminal) or by .").adding(button: .init(text: "Use diagnostics mode", keyEquivalent: "\r")).adding(button: .init(text: "Continue anyway")).send().isFirstButton()
//let alert = Alert(message: "TINU needs be re-opened using diagnostics mode!", description: "SIP (System Integrity Protection) is currently enabled, and it will prevent TINU from working (this is due to a problem introduced in Catalina).\n\nYou can avoid this by chosing to use the diagnostics mode with administrator privileges (because it avoids this issue by using the privileges provvided by the terminal).").adding(button: .init(text: "Use diagnostics mode", keyEquivalent: "\r")).adding(button: .init(text: "Continue anyway")).send().isFirstButton()

let alert = dialogGenericWithManagerBool(self, name: "SIPDialog")

if alert{

Expand Down
3 changes: 3 additions & 0 deletions TINU/ChoseAppViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class ChoseAppViewController: GenericViewController, ViewID {
case .badAlias:
msgboxWithManager(self, name: "invalidAliasDialog", parseList: replist)
return
case .unsupported:
msgboxWithManager(self, name: "invalidAppDialog", parseList: replist)
return
}

})
Expand Down
1 change: 0 additions & 1 deletion TINU/DownloadAppViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ fileprivate struct AppDownloadManager: CodableDefaults, Codable, Equatable{
static let defaultResourceFileExtension = "json"
}


public class DownloadAppViewController: ShadowViewController, ViewID {

public let id: String = "DownloadAppViewController"
Expand Down
10 changes: 8 additions & 2 deletions TINU/DriveView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,16 @@ class DriveView: ShadowView, ViewID {
if isBigger{
self.setToolTipAndWarn("appTooBig")
}else{
if self.current!.app!.status == .broken{
switch current!.app!.status{
case .broken:
self.setToolTipAndWarn("appDamaged")
}else{
break
case .unsupported:
self.setToolTipAndWarn("appUnsupported")
break
default:
self.setToolTipAndWarn("appError")
break
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions TINU/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppleEventsUsageDescription</key>
<string>TINU needs to peform apple scripts in order to work</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>TINU needs to perform privileged operations in order to successfully create bootable macOS installers</string>
<key>CFBundleDevelopmentRegion</key>
Expand Down
1 change: 1 addition & 0 deletions TINU/InstallerAppInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public struct InstallerAppInfo: UIRepresentable{
case tooBig
case tooLittle
case badAlias
case unsupported = 255
}

var status: Status
Expand Down
15 changes: 12 additions & 3 deletions TINU/InstallerAppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extension CreationProcess{
let needed = neededFiles
var check: Int = needed.count
var isCurrentExecutable = false
var hasDMG = false
for c in needed{
if c.isEmpty{
check-=1
Expand All @@ -75,6 +76,9 @@ extension CreationProcess{
for d in c{
if manager.fileExists(atPath: app.path + d){
check-=1
if URL(fileURLWithPath: app.path + d).pathExtension == "dmg"{
hasDMG = true
}
breaked.toggle()
break
}
Expand All @@ -89,12 +93,17 @@ extension CreationProcess{
break
}
}
break

if !isCurrentExecutable && hasDMG {
isCurrentExecutable.toggle()
}

//break
}
}

if isCurrentExecutable{
ret.status = .notInstaller
ret.status = hasDMG ? .unsupported : .notInstaller
return ret
}

Expand Down Expand Up @@ -251,7 +260,7 @@ extension CreationProcess{
}

switch capp.status {
case .usable, .broken, .tooBig, .tooLittle:
case .usable, .broken, .tooBig, .tooLittle, .unsupported:
log(" \(appURL.path) has been added to the apps list")
ret.append(capp)
break
Expand Down
10 changes: 9 additions & 1 deletion TINU/TextAssetsEn.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@
"unmutable" : {
"openEFIMounter" : "Use\nEFI Partition Mounter",
"openInstallation" : "Install macOS",
"openInstaller" : "Create a bootable\nmacOS installer"
"openInstaller" : "Create a bootable\nmacOS installer",
"SIPDialogTitle" : "TINU needs be re-opened using diagnostics mode!",
"SIPDialog" : "SIP (System Integrity Protection) is currently enabled, and it will prevent TINU from working (this is due to a problem introduced in Catalina).\n\nYou can avoid this by chosing to use the diagnostics mode with administrator privileges (because it avoids this issue by using the privileges provvided by the terminal).",
"SIPDialog1" : "Use diagnostics mode",
"SIPDialog1Key" : "\r",
"SIPDialog2" : "Continue anyway",
"SIPDialog2Key" : ""
}
},
"InfoViewController":{
Expand Down Expand Up @@ -343,6 +349,8 @@
"appDamagedToolTip" : "This macOS installer app is not usable bacause it's missing some internal elements, you need the full installer app from the App Store which weights more than 5 gb\n\nPath: ${path}",
"appErrorWarn" : "Error: ${name}",
"appErrorToolTip" : "This macOS installer app is not usable bacause there was an error while trying to calculate it's size\n\nPath: ${path}",
"appUnsupportedWarn" : "Unsupported: ${name}",
"appUnsupportedToolTip" : "This macOS installer app is not usable bacause it isn't supported by TINU\n\nPath: ${path}",
"driveNormalToolTip" : "${size}${mount}"
}
},
Expand Down
10 changes: 9 additions & 1 deletion TINU/TextAssetsIt.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@
"unmutable" : {
"openEFIMounter" : "Usa\nEFI Partition Mounter",
"openInstallation" : "Installa macOS",
"openInstaller" : "Crea un supporto di\ninstallazione di macOS"
"openInstaller" : "Crea un supporto di\ninstallazione di macOS",
"SIPDialogTitle" : "TINU deve essere riaperto usando la Modalità diagnostica",
"SIPDialog" : "La SIP (System Integrity Protection) è attivata, ed impedisce a TINU di funzionare come dovrebbe (questo succede a causa di alcune limitazioni introdotte in Catalina).\n\nPuoi evitare questo se scegli di usare la modalità diagnostica con privilegi di amministratore (perchè sfrutta i privilegi di accesso forniti dal terminale per evitare questo problema).",
"SIPDialog1" : "Usa la mod. diagnostica",
"SIPDialog1Key" : "\r",
"SIPDialog2" : "Continua lo stesso",
"SIPDialog2Key" : ""
}
},
"InfoViewController":{
Expand Down Expand Up @@ -344,6 +350,8 @@
"appDamagedToolTip" : "Quest'app di installazione di macOS non è utilizzabile perchè è danneggiata e non contiene alcuni elementi richiesti, ti serve l'app di installazione completa presa da App Store, e che pesa come minimo, più di 5 GB \n\nPercorso: ${path}",
"appErrorWarn" : "Errore: ${name}",
"appErrorToolTip" : "Non è possibile usare quest'app di installazione di macOS perchè si è verificato un errore durante la verifica della dimensione dell'app stessa.\n\nPercorso: ${path}",
"appUnsupportedWarn" : "Non supportata: ${name}",
"appUnsupportedToolTip" : "Non è possibile usare quest'app di installazione di macOS perchè non è supportata da TINU.\n\nPercorso: ${path}",
"driveNormalToolTip" : "${size}${mount}"
}
},
Expand Down

0 comments on commit aab615a

Please sign in to comment.