From 6be5d0fcd1c13b572fe94b7e4f9227b01d9dc1e9 Mon Sep 17 00:00:00 2001 From: ginsudev Date: Mon, 30 Jan 2023 20:11:44 +1100 Subject: [PATCH] Don't rename imported fonts. Respring improvements. --- WDBFontOverwrite.xcodeproj/project.pbxproj | 4 ++-- WDBFontOverwrite/FontMap.swift | 19 ++----------------- .../MainInterface/ActionButtons.swift | 10 +++++----- .../CustomFontsScene.ViewModel.swift | 2 +- .../WDBFontOverwrite-Bridging-Header.h | 1 + 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/WDBFontOverwrite.xcodeproj/project.pbxproj b/WDBFontOverwrite.xcodeproj/project.pbxproj index 1eb0c49..0df0a62 100644 --- a/WDBFontOverwrite.xcodeproj/project.pbxproj +++ b/WDBFontOverwrite.xcodeproj/project.pbxproj @@ -435,7 +435,7 @@ "$(inherited)", "$(PROJECT_DIR)/WDBFontOverwrite", ); - MARKETING_VERSION = 1.10.6; + MARKETING_VERSION = 1.10.7; PRODUCT_BUNDLE_IDENTIFIER = com.ginsu.WDBFontOverwrite; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -473,7 +473,7 @@ "$(inherited)", "$(PROJECT_DIR)/WDBFontOverwrite", ); - MARKETING_VERSION = 1.10.6; + MARKETING_VERSION = 1.10.7; PRODUCT_BUNDLE_IDENTIFIER = com.ginsu.WDBFontOverwrite; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/WDBFontOverwrite/FontMap.swift b/WDBFontOverwrite/FontMap.swift index 3da0307..e1173b9 100644 --- a/WDBFontOverwrite/FontMap.swift +++ b/WDBFontOverwrite/FontMap.swift @@ -16,7 +16,7 @@ struct FontMap { "/System/Library/Fonts/CoreAddition/AppleColorEmoji-160px.ttc", "/System/Library/Fonts/Core/AppleColorEmoji.ttc", ]), - localPath: "CustomAppleColorEmoji.woff2" + localPath: "CustomAppleColorEmoji.ttc" ) static func populateFontMap() async throws { @@ -30,13 +30,10 @@ struct FontMap { guard !font.contains("AppleColorEmoji") else { continue } - guard let validatedLocalPath = validateFont(name: font) else { - continue - } fontMap[key(forFont: font)] = CustomFont( name: font, targetPath: .single("\(fontDirPath)\(dir)/\(font)"), - localPath: "Custom\(validatedLocalPath)" + localPath: "Custom\(font)" ) } } @@ -51,16 +48,4 @@ struct FontMap { } return rejoinedString } - - private static func validateFont(name: String) -> String? { - var components = name.components(separatedBy: ".") - guard components.last != "woff2" else { - return components.joined(separator: ".") - } - guard components.last == "ttc" || components.last == "ttf" else { - return nil - } - components[components.count - 1] = "woff2" - return components.joined(separator: ".") - } } diff --git a/WDBFontOverwrite/MainInterface/ActionButtons.swift b/WDBFontOverwrite/MainInterface/ActionButtons.swift index bddd638..03946e9 100644 --- a/WDBFontOverwrite/MainInterface/ActionButtons.swift +++ b/WDBFontOverwrite/MainInterface/ActionButtons.swift @@ -40,11 +40,11 @@ struct ActionButtons: View { } private func respring() { - let sharedApplication = UIApplication.shared - let windows = sharedApplication.windows - if let window = windows.first { - while true { - window.snapshotView(afterScreenUpdates: false) + grant_full_disk_access { error in + if error != nil { + print("can't get disk access") + } else { + xpc_crasher(UnsafeMutablePointer(mutating: "com.apple.frontboard.systemappservices")) } } } diff --git a/WDBFontOverwrite/MainInterface/CustomFontsScene.ViewModel.swift b/WDBFontOverwrite/MainInterface/CustomFontsScene.ViewModel.swift index b81efbe..ccd6317 100644 --- a/WDBFontOverwrite/MainInterface/CustomFontsScene.ViewModel.swift +++ b/WDBFontOverwrite/MainInterface/CustomFontsScene.ViewModel.swift @@ -33,7 +33,7 @@ extension CustomFontsScene { @Published var importType: CustomFontType = .font var selectedCustomFontType: CustomFontType { - return customFontPickerSelection == 0 ? .font : .emoji + customFontPickerSelection == 0 ? .font : .emoji } func batchOverwriteFonts() async { diff --git a/WDBFontOverwrite/WDBFontOverwrite-Bridging-Header.h b/WDBFontOverwrite/WDBFontOverwrite-Bridging-Header.h index bd0c865..9ad9ead 100644 --- a/WDBFontOverwrite/WDBFontOverwrite-Bridging-Header.h +++ b/WDBFontOverwrite/WDBFontOverwrite-Bridging-Header.h @@ -1,3 +1,4 @@ #import "vm_unaligned_copy_switch_race.h" #import "_UIKeyboardCache.h" +#import "helpers.h" #import "grant_full_disk_access.h"