Skip to content

Commit 7589599

Browse files
committed
2 parents da12151 + f64819f commit 7589599

22 files changed

+229
-109
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Build Packages
6060
run: |
6161
make package
62-
cp packages/*.tipa .
62+
cp packages/*.tipa packages/*.deb .
6363
find .theos/obj -name "*.dSYM" -exec cp -r {} . \;
6464
6565
- name: Upload Packages
@@ -68,6 +68,7 @@ jobs:
6868
name: packages-${{ env.VERSION }}
6969
path: |
7070
*.tipa
71+
*.deb
7172
*.dSYM
7273
7374
- name: Release

CHANGELOG.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
- 修复 ZIP 归档中位于子目录的 dylib 文件无法正确导入的问题。
2-
- 新增 “所有应用” 分类。
3-
- 新增免责声明。
4-
- 新增中文名称 “巨魔注入器”。
5-
6-
------
7-
8-
- Fixed an issue where dylib files located in subdirectories in ZIP archives could not be imported correctly.
9-
- Added “All Applications” category.
10-
- Added disclaimer.
1+
- Inject `.bundle` additionally if `.deb` file contains both `.dylib` and `.bundle`

TrollFools.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
614C0C6C2D7D72D4007E9184 /* IndexableScroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 614C0C6B2D7D72C7007E9184 /* IndexableScroller.swift */; };
4848
6168001B2D364DD400DF485F /* StripedTextTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6168001A2D364DD400DF485F /* StripedTextTableViewController.m */; };
4949
6168001D2D3652B600DF485F /* LogsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6168001C2D3652B100DF485F /* LogsView.swift */; };
50+
61743CDA2D882CE80032696C /* PlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61743CD92D882CE40032696C /* PlaceholderView.swift */; };
5051
61946B262D2FD8AB009E0AC4 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 61946B252D2FD8AB009E0AC4 /* OrderedCollections */; };
5152
61C7D54A2D82D8E40064D626 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61C7D5462D82D5C60064D626 /* InfoPlist.strings */; };
5253
61C7D54C2D82DBAD0064D626 /* DisclaimerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C7D54B2D82DBAC0064D626 /* DisclaimerView.swift */; };
@@ -154,6 +155,7 @@
154155
616800192D364DD400DF485F /* StripedTextTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StripedTextTableViewController.h; sourceTree = "<group>"; };
155156
6168001A2D364DD400DF485F /* StripedTextTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StripedTextTableViewController.m; sourceTree = "<group>"; };
156157
6168001C2D3652B100DF485F /* LogsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsView.swift; sourceTree = "<group>"; };
158+
61743CD92D882CE40032696C /* PlaceholderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceholderView.swift; sourceTree = "<group>"; };
157159
61C7D5452D82D5C60064D626 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
158160
61C7D5472D82D5C80064D626 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
159161
61C7D5482D82D5C90064D626 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -288,6 +290,7 @@
288290
6168001C2D3652B100DF485F /* LogsView.swift */,
289291
6124A0772CD232D400C52253 /* OptionCell.swift */,
290292
CCB6A1182C4A58C7000D75B0 /* OptionView.swift */,
293+
61743CD92D882CE40032696C /* PlaceholderView.swift */,
291294
6124A07E2CD233BA00C52253 /* PlugInCell.swift */,
292295
CC19E4BA2C561D7300E0F1B5 /* SettingsView.swift */,
293296
CC1548D22C4A743200A4173E /* SuccessView.swift */,
@@ -654,6 +657,7 @@
654657
CC19E4BB2C561D7300E0F1B5 /* SettingsView.swift in Sources */,
655658
61EFA36F2D30338B00159442 /* InjectorV3+Bundle.swift in Sources */,
656659
61EFA3642D30267E00159442 /* InjectorV3.swift in Sources */,
660+
61743CDA2D882CE80032696C /* PlaceholderView.swift in Sources */,
657661
61C7D54C2D82DBAD0064D626 /* DisclaimerView.swift in Sources */,
658662
6124A07F2CD233BA00C52253 /* PlugInCell.swift in Sources */,
659663
61EFA37B2D31165700159442 /* InjectorV3+Backup.swift in Sources */,
@@ -1044,7 +1048,7 @@
10441048
repositoryURL = "https://github.com/siteline/swiftui-introspect.git";
10451049
requirement = {
10461050
kind = exactVersion;
1047-
version = 1.0.0;
1051+
version = 1.2.0;
10481052
};
10491053
};
10501054
CC0D662B2D7F11A2000EADED /* XCRemoteSwiftPackageReference "ArArchiveKit" */ = {

TrollFools.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TrollFools/AppListView.swift

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import SwiftUIIntrospect
1313
typealias Scope = AppListModel.Scope
1414

1515
struct AppListView: View {
16+
let isPad: Bool = UIDevice.current.userInterfaceIdiom == .pad
17+
1618
@StateObject var searchViewModel = AppListSearchModel()
1719
@EnvironmentObject var appList: AppListModel
1820

@@ -92,6 +94,47 @@ struct AppListView: View {
9294
}
9395

9496
var content: some View {
97+
styledNavigationView
98+
.animation(.easeOut, value: appList.activeScopeApps.keys)
99+
.sheet(item: $selectorOpenedURL) { urlWrapper in
100+
AppListView()
101+
.environmentObject(AppListModel(selectorURL: urlWrapper.url))
102+
}
103+
.onOpenURL { url in
104+
let ext = url.pathExtension.lowercased()
105+
guard url.isFileURL,
106+
(ext == "dylib" || ext == "deb" || ext == "zip")
107+
else {
108+
return
109+
}
110+
let urlIdent = URLIdentifiable(url: preprocessURL(url))
111+
if !isWarningHidden && ext == "deb" {
112+
temporaryOpenedURL = urlIdent
113+
isWarningPresented = true
114+
} else {
115+
selectorOpenedURL = urlIdent
116+
}
117+
}
118+
.onAppear {
119+
if Double.random(in: 0 ..< 1) < 0.1 {
120+
isAdvertisementHidden = false
121+
}
122+
}
123+
}
124+
125+
var styledNavigationView: some View {
126+
Group {
127+
if isPad {
128+
navigationView
129+
.navigationViewStyle(.automatic)
130+
} else {
131+
navigationView
132+
.navigationViewStyle(.stack)
133+
}
134+
}
135+
}
136+
137+
var navigationView: some View {
95138
NavigationView {
96139
ScrollViewReader { reader in
97140
ZStack {
@@ -109,31 +152,10 @@ struct AppListView: View {
109152
}
110153
}
111154
}
112-
}
113-
.navigationViewStyle(StackNavigationViewStyle())
114-
.animation(.easeOut, value: appList.activeScopeApps.keys)
115-
.sheet(item: $selectorOpenedURL) { urlWrapper in
116-
AppListView()
117-
.environmentObject(AppListModel(selectorURL: urlWrapper.url))
118-
}
119-
.onOpenURL { url in
120-
let ext = url.pathExtension.lowercased()
121-
guard url.isFileURL,
122-
ext == "dylib" || ext == "deb"
123-
else {
124-
return
125-
}
126-
let urlIdent = URLIdentifiable(url: preprocessURL(url))
127-
if !isWarningHidden && ext == "deb" {
128-
temporaryOpenedURL = urlIdent
129-
isWarningPresented = true
130-
} else {
131-
selectorOpenedURL = urlIdent
132-
}
133-
}
134-
.onAppear {
135-
if Double.random(in: 0 ..< 1) < 0.1 {
136-
isAdvertisementHidden = false
155+
156+
// Detail view shown when nothing has been selected
157+
if !appList.isSelectorMode {
158+
PlaceholderView()
137159
}
138160
}
139161
}
@@ -178,7 +200,7 @@ struct AppListView: View {
178200
.onReceive(searchViewModel.$searchScopeIndex) {
179201
appList.activeScope = Scope(rawValue: $0) ?? .all
180202
}
181-
.introspect(.viewController, on: .iOS(.v14, .v15, .v16, .v17)) { viewController in
203+
.introspect(.viewController, on: .iOS(.v14, .v15, .v16, .v17, .v18)) { viewController in
182204
if searchViewModel.searchController == nil {
183205
viewController.navigationItem.hidesSearchBarWhenScrolling = true
184206
viewController.navigationItem.searchController = {

TrollFools/CLI/CmdInject.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct CmdInject: ParsableCommand {
2828

2929
func run() throws {
3030
guard let app = LSApplicationProxy(forIdentifier: bundleIdentifier),
31+
let appID = app.applicationIdentifier(),
3132
let bundleURL = app.bundleURL()
3233
else {
3334
throw ArgumentParser.ValidationError("The specified application does not exist.")
@@ -39,6 +40,16 @@ struct CmdInject: ParsableCommand {
3940
}
4041
let pluginURLs = pluginPaths.compactMap { URL(fileURLWithPath: $0) }
4142
let injector = try InjectorV3(bundleURL, loggerType: .os)
43+
if injector.appID.isEmpty {
44+
injector.appID = appID
45+
}
46+
if injector.teamID.isEmpty {
47+
if let teamID = app.teamID() {
48+
injector.teamID = teamID
49+
} else {
50+
injector.teamID = "0000000000"
51+
}
52+
}
4253
injector.useWeakReference = weakReference
4354
injector.injectStrategy = fastInjection ? .fast : .lexicographic
4455
try injector.inject(pluginURLs)

TrollFools/EjectListView.swift

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,23 @@ struct EjectListView: View {
232232
}
233233

234234
private func deletePlugIns(at offsets: IndexSet) {
235+
var logFileURL: URL?
236+
235237
do {
236238
let plugInsToRemove = offsets.map { ejectList.filteredPlugIns[$0] }
237239
let plugInURLsToRemove = plugInsToRemove.map { $0.url }
238240

239241
let injector = try InjectorV3(ejectList.app.url)
242+
logFileURL = injector.latestLogFileURL
243+
244+
if injector.appID.isEmpty {
245+
injector.appID = ejectList.app.id
246+
}
247+
248+
if injector.teamID.isEmpty {
249+
injector.teamID = ejectList.app.teamID
250+
}
251+
240252
injector.useWeakReference = useWeakReference
241253
injector.preferMainExecutable = preferMainExecutable
242254
injector.injectStrategy = injectStrategy
@@ -248,33 +260,36 @@ struct EjectListView: View {
248260
} catch {
249261
DDLogError("\(error)", ddlog: InjectorV3.main.logger)
250262

251-
lastError = error
252-
isErrorOccurred = true
253-
}
254-
}
255-
256-
private func deletePlugIn(_ plugin: InjectedPlugIn) {
257-
do {
258-
let injector = try InjectorV3(ejectList.app.url)
259-
injector.useWeakReference = useWeakReference
260-
injector.preferMainExecutable = preferMainExecutable
261-
injector.injectStrategy = injectStrategy
263+
var userInfo: [String: Any] = [
264+
NSLocalizedDescriptionKey: error.localizedDescription,
265+
]
262266

263-
try injector.eject([plugin.url])
267+
if let logFileURL {
268+
userInfo[NSURLErrorKey] = logFileURL
269+
}
264270

265-
ejectList.app.reload()
266-
ejectList.reload()
267-
} catch {
268-
DDLogError("\(error)", ddlog: InjectorV3.main.logger)
271+
let nsErr = NSError(domain: gTrollFoolsErrorDomain, code: 0, userInfo: userInfo)
269272

270-
lastError = error
273+
lastError = nsErr
271274
isErrorOccurred = true
272275
}
273276
}
274277

275278
private func deleteAll() {
279+
var logFileURL: URL?
280+
276281
do {
277282
let injector = try InjectorV3(ejectList.app.url)
283+
logFileURL = injector.latestLogFileURL
284+
285+
if injector.appID.isEmpty {
286+
injector.appID = ejectList.app.id
287+
}
288+
289+
if injector.teamID.isEmpty {
290+
injector.teamID = ejectList.app.teamID
291+
}
292+
278293
injector.useWeakReference = useWeakReference
279294
injector.preferMainExecutable = preferMainExecutable
280295
injector.injectStrategy = injectStrategy
@@ -303,7 +318,17 @@ struct EjectListView: View {
303318
DispatchQueue.main.async {
304319
DDLogError("\(error)", ddlog: InjectorV3.main.logger)
305320

306-
lastError = error
321+
var userInfo: [String: Any] = [
322+
NSLocalizedDescriptionKey: error.localizedDescription,
323+
]
324+
325+
if let logFileURL {
326+
userInfo[NSURLErrorKey] = logFileURL
327+
}
328+
329+
let nsErr = NSError(domain: gTrollFoolsErrorDomain, code: 0, userInfo: userInfo)
330+
331+
lastError = nsErr
307332
isErrorOccurred = true
308333
}
309334
}

TrollFools/Info.plist

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
<string>com.apple.mach-o-binary</string>
1919
</array>
2020
</dict>
21+
<dict>
22+
<key>CFBundleTypeName</key>
23+
<string>ZIP Archive</string>
24+
<key>LSHandlerRank</key>
25+
<string>Default</string>
26+
<key>CFBundleTypeRole</key>
27+
<string>Viewer</string>
28+
<key>LSItemContentTypes</key>
29+
<array>
30+
<string>public.zip-archive</string>
31+
</array>
32+
</dict>
2133
<dict>
2234
<key>CFBundleTypeName</key>
2335
<string>Sileo Deb Package</string>
@@ -41,8 +53,6 @@
4153
</array>
4254
<key>UTTypeIdentifier</key>
4355
<string>org.debian.deb-archive</string>
44-
<key>UTTypeIconFiles</key>
45-
<array/>
4656
<key>UTTypeTagSpecification</key>
4757
<dict>
4858
<key>public.filename-extension</key>

TrollFools/InjectView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ struct InjectView: View {
140140
userInfo[NSURLErrorKey] = logFileURL
141141
}
142142

143-
return .failure(NSError(domain: gTrollFoolsErrorDomain, code: 0, userInfo: userInfo))
143+
let nsErr = NSError(domain: gTrollFoolsErrorDomain, code: 0, userInfo: userInfo)
144+
145+
return .failure(nsErr)
144146
}
145147
}
146148
}

0 commit comments

Comments
 (0)