Skip to content

Commit

Permalink
opening .passthm files externally
Browse files Browse the repository at this point in the history
  • Loading branch information
leminlimez committed Dec 27, 2022
1 parent 1a57ec6 commit a62a448
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 80 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified RootHelper/.theos/obj/debug/arm64/trolltoolsroothelper
Binary file not shown.
Binary file not shown.
Binary file modified RootHelper/.theos/obj/debug/trolltoolsroothelper
Binary file not shown.
Binary file not shown.
Binary file modified TrollTools/.DS_Store
Binary file not shown.
Binary file modified TrollTools/Assets.xcassets/.DS_Store
Binary file not shown.
Binary file modified TrollTools/Assets.xcassets/screens/.DS_Store
Binary file not shown.
8 changes: 6 additions & 2 deletions TrollTools/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>Passcode Theme File</string>
Expand All @@ -38,6 +39,7 @@
<key>public.filename-extension</key>
<array>
<string>passthm</string>
<string>PASSTHM</string>
</array>
</dict>
</dict>
Expand All @@ -47,7 +49,8 @@
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.directory</string>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>Passcode Theme File</string>
Expand All @@ -60,6 +63,7 @@
<key>public.filename-extension</key>
<array>
<string>passthm</string>
<string>PASSTHM</string>
</array>
</dict>
</dict>
Expand Down
13 changes: 13 additions & 0 deletions TrollTools/Other/TrollToolsApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ struct TrollToolsApp: App {
}
try? RootHelper.loadMCM()
}
.onOpenURL(perform: { url in
// for opening passthm files
if url.pathExtension.lowercased() == "passthm" {
let defaultKeySize = PasscodeKeyFaceManager.getDefaultFaceSize()
do {
// try appying the themes
try PasscodeKeyFaceManager.setFacesFromTheme(url, keySize: CGFloat(defaultKeySize), customX: CGFloat(150), customY: CGFloat(150))
// show the passcode screen
//PasscodeEditorView()
ToolsView().activateView(viewName: "PasscodeEditorView", isActive: true)
} catch { UIApplication.shared.alert(body: error.localizedDescription) }
}
})
}
}
}
Expand Down
Binary file modified TrollTools/Views/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions TrollTools/Views/Tools/PasscodeEditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct PasscodeEditorView: View {
// export key
Button(action: {
do {
var archiveURL: URL? = try PasscodeKeyFaceManager.exportFaceTheme()
let archiveURL: URL? = try PasscodeKeyFaceManager.exportFaceTheme()
// show share menu
let avc = UIActivityViewController(activityItems: [archiveURL!], applicationActivities: nil)
let view: UIView = UIApplication.shared.windows.first!.rootViewController!.view
Expand Down Expand Up @@ -174,7 +174,7 @@ struct PasscodeEditorView: View {

let customAction = UIAlertAction(title: "Custom", style: .default) { (action) in
// ask the user for a custom size
var sizeAlert = UIAlertController(title: "Enter Key Dimensions", message: "Min: "+String(sizeLimit[0])+", Max: "+String(sizeLimit[1]), preferredStyle: .alert)
let sizeAlert = UIAlertController(title: "Enter Key Dimensions", message: "Min: "+String(sizeLimit[0])+", Max: "+String(sizeLimit[1]), preferredStyle: .alert)
// bring up the text prompts
sizeAlert.addTextField { (textField) in
// text field for width
Expand Down Expand Up @@ -357,7 +357,7 @@ struct PasscodeKeyView: View {
ZStack {
Circle()
.fill(Color(UIColor(red: 1, green: 1, blue: 1, alpha: 0.12)))
.frame(width: 70, height: 70) // background circle
.frame(width: 78, height: 78) // background circle
Circle()
.fill(Color(UIColor(red: 1, green: 1, blue: 1, alpha: 0))) // hidden circle for image
if face == nil {
Expand Down
117 changes: 42 additions & 75 deletions TrollTools/Views/Tools/ToolsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ struct ToolsView: View {
var imageName: String
}

struct GeneralOption: Identifiable {
var key: String
var id = UUID()
var view: AnyView
var title: String
var imageName: String
var active: Bool = false
}


@State var springboardOptions: [SpringboardOption] = [
.init(value: false, key: "SBShowRSSI", title: "Numeric Wi-Fi Strength", imageName: "wifi"),
Expand All @@ -29,85 +38,31 @@ struct ToolsView: View {
.init(value: false, key: "SBControlCenterDemo", title: "CC AirPlay Radar", imageName: "wifi.circle"),
]

@State var generalOptions: [GeneralOption] = [
.init(key: "GesturesView", view: AnyView(GesturesView()), title: "iPhone X Gestures", imageName: "iphone"),
.init(key: "BadgeChangerView", view: AnyView(BadgeChangerView()), title: "Custom Badges", imageName: "app.badge"),
.init(key: "PasscodeEditorView", view: AnyView(PasscodeEditorView()), title: "Passcode faces", imageName: "ellipsis.rectangle"),
.init(key: "CarrierNameChangerView", view: AnyView(CarrierNameChangerView()), title: "Custom Carrier Name", imageName: "chart.bar"),
.init(key: "LockscreenRespringView", view: AnyView(LockscreenRespringView()), title: "Locking after Respring", imageName: "lock"),
.init(key: "CalculatorErrorView", view: AnyView(CalculatorErrorView()), title: "Calculator Error Message", imageName: "function"),
.init(key: "LSFootnoteChangerView", view: AnyView(LSFootnoteChangerView()), title: "Lock Screen Footnote", imageName: "platter.filled.bottom.and.arrow.down.iphone"),
]

var body: some View {
NavigationView {
List {
Section {
NavigationLink(destination: GesturesView()) {
HStack {
Image(systemName: "iphone")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("iPhone X Gestures")
.padding(.horizontal, 10)
}
}
NavigationLink(destination: BadgeChangerView()) {
HStack {
Image(systemName: "app.badge")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Custom Badges")
.padding(.horizontal, 8)
}
}
NavigationLink(destination: PasscodeEditorView()) {
HStack {
Image(systemName: "ellipsis.rectangle")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Passcode faces")
.padding(.horizontal, 8)
}
}
NavigationLink(destination: CarrierNameChangerView()) {
HStack {
Image(systemName: "chart.bar")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Custom Carrier Name")
.padding(.horizontal, 8)
}
}
NavigationLink(destination: LockscreenRespringView()) {
HStack {
Image(systemName: "lock")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Locking after Respring")
.padding(.horizontal, 8)
}
}
NavigationLink(destination: CalculatorErrorView()) {
HStack {
Image(systemName: "function")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Calculator Error Message")
.padding(.horizontal, 8)
}
}
NavigationLink(destination: LSFootnoteChangerView()) {
HStack {
Image(systemName: "platter.filled.bottom.and.arrow.down.iphone")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text("Lock Screen Footnote")
.padding(.horizontal, 8)
ForEach($generalOptions) { option in
NavigationLink(destination: option.view.wrappedValue, isActive: option.active) {
HStack {
Image(systemName: option.imageName.wrappedValue)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 24, height: 24)
.foregroundColor(.blue)
Text(option.title.wrappedValue)
.padding(.horizontal, 8)
}
}
}
} header: {
Expand Down Expand Up @@ -178,6 +133,18 @@ struct ToolsView: View {
// write to file
try RootHelper.writeStr(String(decoding: plistData, as: UTF8.self), to: url)
}

func activateView(viewName: String, isActive: Bool) {
for (i, option) in generalOptions.enumerated() {
if option.key == viewName {
var option = generalOptions[i]
option.active = isActive
generalOptions[i] = option
print("Activity: " + String(generalOptions[i].active) )
return
}
}
}
}

struct ToolsView_Previews: PreviewProvider {
Expand Down

0 comments on commit a62a448

Please sign in to comment.